@sumaris-net/ngx-components 1.9.9 → 1.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/sumaris-net.ngx-components.umd.js +143 -67
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/doc/changelog.md +4 -0
- package/esm2015/public_api.js +2 -2
- package/esm2015/src/app/core/form/editor.class.js +2 -2
- package/esm2015/src/app/core/form/entity-editor.class.js +17 -15
- package/esm2015/src/app/core/home/home.js +2 -2
- package/esm2015/src/app/core/install/install-upgrade-card.component.js +2 -2
- package/esm2015/src/app/core/services/account.service.js +22 -25
- package/esm2015/src/app/core/services/base-entity-service.class.js +3 -3
- package/esm2015/src/app/core/services/config.service.js +2 -2
- package/esm2015/src/app/core/services/network.service.js +5 -5
- package/esm2015/src/app/core/services/platform.service.js +3 -4
- package/esm2015/src/app/core/services/testing/referential-filter.model.js +23 -0
- package/esm2015/src/app/core/services/testing/referential.validator.js +44 -0
- package/esm2015/src/app/core/table/table.class.js +32 -20
- package/esm2015/src/app/shared/shared.testing.module.js +9 -3
- package/esm2015/src/app/shared/toast/toast.testing.js +39 -0
- package/esm2015/src/app/shared/toast/toast.testing.module.js +33 -0
- package/esm2015/src/app/shared/toast/toasts.js +119 -0
- package/esm2015/src/app/social/services/user-event.service.js +2 -2
- package/esm2015/sumaris-net.ngx-components.js +9 -7
- package/fesm2015/sumaris-net.ngx-components.js +140 -63
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +1 -1
- package/src/app/core/form/editor.class.d.ts +1 -1
- package/src/app/core/form/entity-editor.class.d.ts +9 -5
- package/src/app/core/home/home.d.ts +1 -1
- package/src/app/core/services/account.service.d.ts +4 -3
- package/src/app/core/services/config.service.d.ts +1 -1
- package/src/app/core/services/network.service.d.ts +1 -1
- package/src/app/core/services/platform.service.d.ts +1 -1
- package/src/app/core/services/testing/referential-filter.model.d.ts +9 -0
- package/src/app/core/services/testing/referential.validator.d.ts +19 -0
- package/src/app/core/table/table.class.d.ts +1 -1
- package/src/app/shared/shared.testing.module.d.ts +2 -0
- package/src/app/shared/toast/toast.testing.d.ts +14 -0
- package/src/app/shared/toast/toast.testing.module.d.ts +2 -0
- package/src/app/shared/{toasts.d.ts → toast/toasts.d.ts} +0 -0
- package/src/app/social/services/user-event.service.d.ts +1 -1
- package/sumaris-net.ngx-components.d.ts +8 -6
- package/sumaris-net.ngx-components.metadata.json +1 -1
- package/esm2015/src/app/shared/toasts.js +0 -119
|
@@ -10842,7 +10842,7 @@ class NetworkService extends StartableService {
|
|
|
10842
10842
|
this.onNetworkStatusChanges.next(currentConnectionType);
|
|
10843
10843
|
// Offline mode: alert the user
|
|
10844
10844
|
if (currentConnectionType === 'none' && (!opts || opts.showToast !== false)) {
|
|
10845
|
-
this.showToast({ message: 'NETWORK.INFO.OFFLINE_HELP' });
|
|
10845
|
+
this.showToast({ message: 'NETWORK.INFO.OFFLINE_HELP', type: 'warning' });
|
|
10846
10846
|
}
|
|
10847
10847
|
}
|
|
10848
10848
|
}
|
|
@@ -11042,11 +11042,11 @@ class NetworkService extends StartableService {
|
|
|
11042
11042
|
// Force offline mode
|
|
11043
11043
|
this._forceOffline = true;
|
|
11044
11044
|
// Alert the user
|
|
11045
|
-
this.showToast({ message: 'NETWORK.INFO.OFFLINE_HELP' });
|
|
11045
|
+
this.showToast({ message: 'NETWORK.INFO.OFFLINE_HELP', type: 'warning' });
|
|
11046
11046
|
}
|
|
11047
11047
|
else {
|
|
11048
11048
|
// Alert the user
|
|
11049
|
-
this.showToast({ message: 'NETWORK.INFO.OFFLINE' });
|
|
11049
|
+
this.showToast({ message: 'NETWORK.INFO.OFFLINE', type: 'warning' });
|
|
11050
11050
|
}
|
|
11051
11051
|
// Stop the network service
|
|
11052
11052
|
this.stop();
|
|
@@ -13612,7 +13612,8 @@ class AccountService extends BaseGraphqlService {
|
|
|
13612
13612
|
};
|
|
13613
13613
|
this._$additionalFields = new BehaviorSubject([]);
|
|
13614
13614
|
this._tokenType$ = new BehaviorSubject(undefined);
|
|
13615
|
-
this._enableListenChanges = (!environment.account || environment.account.enableListenChanges !== false);
|
|
13615
|
+
this._enableListenChanges = (!environment.account || environment.account.enableListenChanges !== false); // True by default
|
|
13616
|
+
this._listenIntervalInSeconds = toNumber(environment.account && environment.account.listenIntervalInSeconds, 0); // no timer by default
|
|
13616
13617
|
this._debug = !environment.production;
|
|
13617
13618
|
if (this._debug)
|
|
13618
13619
|
console.debug('[account-service] Creating service');
|
|
@@ -13802,7 +13803,7 @@ class AccountService extends BaseGraphqlService {
|
|
|
13802
13803
|
this.onChange.next(this._data);
|
|
13803
13804
|
// Listen remote changes
|
|
13804
13805
|
if (this._enableListenChanges)
|
|
13805
|
-
this.
|
|
13806
|
+
this.startListenRemoteChanges();
|
|
13806
13807
|
return this._data;
|
|
13807
13808
|
}
|
|
13808
13809
|
catch (error) {
|
|
@@ -13927,7 +13928,7 @@ class AccountService extends BaseGraphqlService {
|
|
|
13927
13928
|
this.onLogin.next(this._data);
|
|
13928
13929
|
this.onChange.next(this._data);
|
|
13929
13930
|
if (this._enableListenChanges)
|
|
13930
|
-
this.
|
|
13931
|
+
this.startListenRemoteChanges();
|
|
13931
13932
|
return this._data;
|
|
13932
13933
|
});
|
|
13933
13934
|
}
|
|
@@ -14027,7 +14028,6 @@ class AccountService extends BaseGraphqlService {
|
|
|
14027
14028
|
if (hadAuthBasic)
|
|
14028
14029
|
this.onAuthBasicChange.next(undefined);
|
|
14029
14030
|
this.onChange.next(undefined);
|
|
14030
|
-
this.stopListenChanges();
|
|
14031
14031
|
});
|
|
14032
14032
|
}
|
|
14033
14033
|
/**
|
|
@@ -14147,7 +14147,7 @@ class AccountService extends BaseGraphqlService {
|
|
|
14147
14147
|
listenChanges(opts) {
|
|
14148
14148
|
if (this._enableListenChanges)
|
|
14149
14149
|
return new Subscription(); // Already started: skip
|
|
14150
|
-
return this.
|
|
14150
|
+
return this.startListenRemoteChanges(opts);
|
|
14151
14151
|
}
|
|
14152
14152
|
get additionalFields() {
|
|
14153
14153
|
return this._$additionalFields.getValue();
|
|
@@ -14169,7 +14169,7 @@ class AccountService extends BaseGraphqlService {
|
|
|
14169
14169
|
}
|
|
14170
14170
|
/* -- protected method -- */
|
|
14171
14171
|
resetData() {
|
|
14172
|
-
this.
|
|
14172
|
+
this.stopListenRemoteChanges();
|
|
14173
14173
|
this._cache.loaded = false;
|
|
14174
14174
|
this._cache.keypair = null;
|
|
14175
14175
|
this._cache.authToken = null;
|
|
@@ -14298,7 +14298,7 @@ class AccountService extends BaseGraphqlService {
|
|
|
14298
14298
|
this.onLogin.next(this._data);
|
|
14299
14299
|
this.onChange.next(this._data);
|
|
14300
14300
|
if (this._enableListenChanges)
|
|
14301
|
-
this.
|
|
14301
|
+
this.startListenRemoteChanges();
|
|
14302
14302
|
if (this._debug)
|
|
14303
14303
|
console.debug(`[account] Account restoration [OK] {pubkey: ${pubkey.substr(0, 8)}}, {profile: ${this._cache.mainProfile}}`);
|
|
14304
14304
|
return account;
|
|
@@ -14498,12 +14498,12 @@ class AccountService extends BaseGraphqlService {
|
|
|
14498
14498
|
return yield this.authenticateAndGetToken(newToken, (counter || 1) + 1 /* increment */);
|
|
14499
14499
|
});
|
|
14500
14500
|
}
|
|
14501
|
-
|
|
14501
|
+
startListenRemoteChanges(opts) {
|
|
14502
14502
|
if (this._listenChangesSubscription)
|
|
14503
|
-
this.
|
|
14503
|
+
this.stopListenRemoteChanges(); // Stop previous subscription
|
|
14504
14504
|
if (this.network.offline)
|
|
14505
14505
|
return new Subscription(); // Offline: skip
|
|
14506
|
-
|
|
14506
|
+
this._listenChangesSubscription = this.watchChanges(opts)
|
|
14507
14507
|
.subscribe({
|
|
14508
14508
|
next: (data) => {
|
|
14509
14509
|
console.debug(`[account] Remote update detected at ${data.updateDate}`);
|
|
@@ -14523,20 +14523,17 @@ class AccountService extends BaseGraphqlService {
|
|
|
14523
14523
|
}
|
|
14524
14524
|
}
|
|
14525
14525
|
});
|
|
14526
|
-
|
|
14527
|
-
|
|
14528
|
-
this._listenChangesSubscription = subscription;
|
|
14529
|
-
// Make sure to use the stop function, when unsubscribe
|
|
14530
|
-
return new Subscription(() => this.stopListenChanges());
|
|
14531
|
-
}
|
|
14532
|
-
stopListenChanges() {
|
|
14533
|
-
if (this._listenChangesSubscription) {
|
|
14534
|
-
this._listenChangesSubscription.unsubscribe();
|
|
14526
|
+
this._listenChangesSubscription.add(() => {
|
|
14527
|
+
console.debug(`[account] Stop watching remote changes`);
|
|
14535
14528
|
this._listenChangesSubscription = null;
|
|
14536
|
-
}
|
|
14529
|
+
});
|
|
14530
|
+
return this._listenChangesSubscription;
|
|
14537
14531
|
}
|
|
14538
|
-
|
|
14532
|
+
stopListenRemoteChanges() {
|
|
14539
14533
|
var _a;
|
|
14534
|
+
(_a = this._listenChangesSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
14535
|
+
}
|
|
14536
|
+
watchChanges(opts) {
|
|
14540
14537
|
if (!this.started) {
|
|
14541
14538
|
// Wait service ready, then loop
|
|
14542
14539
|
return from(this.ready())
|
|
@@ -14547,7 +14544,7 @@ class AccountService extends BaseGraphqlService {
|
|
|
14547
14544
|
if (this.network.offline)
|
|
14548
14545
|
throw new Error('Cannot watch account changes: network is offline.');
|
|
14549
14546
|
const variables = {
|
|
14550
|
-
interval:
|
|
14547
|
+
interval: toNumber(opts && opts.intervalInSeconds, this._listenIntervalInSeconds)
|
|
14551
14548
|
};
|
|
14552
14549
|
console.debug(`[account] Watching remote changes, every ${variables.interval}s`);
|
|
14553
14550
|
return this.graphql.subscribe({
|
|
@@ -15473,8 +15470,7 @@ class PlatformService extends StartableService {
|
|
|
15473
15470
|
else {
|
|
15474
15471
|
const now = Date.now();
|
|
15475
15472
|
console.info(`[platform] Starting storage migration...`);
|
|
15476
|
-
const toast = yield this.showToast({ message: 'INFO.DATA_MIGRATION_STARTED',
|
|
15477
|
-
duration: 30000 });
|
|
15473
|
+
const toast = yield this.showToast({ message: 'INFO.DATA_MIGRATION_STARTED', type: 'info', duration: 30000 });
|
|
15478
15474
|
try {
|
|
15479
15475
|
yield StorageUtils.copy(oldForage, storage, { keys, deleteAfterCopy: false });
|
|
15480
15476
|
const duration = Date.now() - now;
|
|
@@ -17288,7 +17284,7 @@ MatBadgeIconTestPage.decorators = [
|
|
|
17288
17284
|
},] }
|
|
17289
17285
|
];
|
|
17290
17286
|
|
|
17291
|
-
const routes$
|
|
17287
|
+
const routes$2 = [
|
|
17292
17288
|
{
|
|
17293
17289
|
path: '',
|
|
17294
17290
|
pathMatch: 'full',
|
|
@@ -17340,7 +17336,7 @@ MaterialTestingModule.decorators = [
|
|
|
17340
17336
|
ReactiveFormsModule,
|
|
17341
17337
|
SharedMaterialModule,
|
|
17342
17338
|
TranslateModule.forChild(),
|
|
17343
|
-
RouterModule.forChild(routes$
|
|
17339
|
+
RouterModule.forChild(routes$2)
|
|
17344
17340
|
],
|
|
17345
17341
|
declarations: [
|
|
17346
17342
|
MaterialTestingPage,
|
|
@@ -17366,6 +17362,71 @@ MaterialTestingModule.decorators = [
|
|
|
17366
17362
|
},] }
|
|
17367
17363
|
];
|
|
17368
17364
|
|
|
17365
|
+
class ToastTestingPage {
|
|
17366
|
+
constructor(toastController, translate) {
|
|
17367
|
+
this.toastController = toastController;
|
|
17368
|
+
this.translate = translate;
|
|
17369
|
+
this.defaultOptions = {
|
|
17370
|
+
showCloseButton: false
|
|
17371
|
+
};
|
|
17372
|
+
}
|
|
17373
|
+
showToast(opts) {
|
|
17374
|
+
return Toasts.show(this.toastController, this.translate, Object.assign(Object.assign(Object.assign({}, this.defaultOptions), { message: 'This is a message' }), opts));
|
|
17375
|
+
}
|
|
17376
|
+
showInfo(opts) {
|
|
17377
|
+
return this.showToast(Object.assign({ type: 'info', message: 'This is a info text !' }, opts));
|
|
17378
|
+
}
|
|
17379
|
+
showWarning(opts) {
|
|
17380
|
+
return this.showToast(Object.assign({ type: 'warning', message: 'This is a warning text !' }, opts));
|
|
17381
|
+
}
|
|
17382
|
+
showError(opts) {
|
|
17383
|
+
return this.showToast(Object.assign({ type: 'error', message: 'This is a error text !' }, opts));
|
|
17384
|
+
}
|
|
17385
|
+
toggleCloseButton() {
|
|
17386
|
+
this.defaultOptions.showCloseButton = !this.defaultOptions.showCloseButton;
|
|
17387
|
+
}
|
|
17388
|
+
}
|
|
17389
|
+
ToastTestingPage.decorators = [
|
|
17390
|
+
{ type: Component, args: [{
|
|
17391
|
+
selector: 'toast-testing',
|
|
17392
|
+
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"
|
|
17393
|
+
},] }
|
|
17394
|
+
];
|
|
17395
|
+
ToastTestingPage.ctorParameters = () => [
|
|
17396
|
+
{ type: ToastController },
|
|
17397
|
+
{ type: TranslateService }
|
|
17398
|
+
];
|
|
17399
|
+
|
|
17400
|
+
const routes$1 = [
|
|
17401
|
+
{
|
|
17402
|
+
path: 'toast',
|
|
17403
|
+
pathMatch: 'full',
|
|
17404
|
+
component: ToastTestingPage
|
|
17405
|
+
}
|
|
17406
|
+
];
|
|
17407
|
+
class ToastTestingModule {
|
|
17408
|
+
}
|
|
17409
|
+
ToastTestingModule.decorators = [
|
|
17410
|
+
{ type: NgModule, args: [{
|
|
17411
|
+
imports: [
|
|
17412
|
+
CommonModule,
|
|
17413
|
+
IonicModule,
|
|
17414
|
+
TranslateModule.forChild(),
|
|
17415
|
+
RouterModule.forChild(routes$1)
|
|
17416
|
+
],
|
|
17417
|
+
declarations: [
|
|
17418
|
+
ToastTestingPage
|
|
17419
|
+
],
|
|
17420
|
+
exports: [
|
|
17421
|
+
RouterModule,
|
|
17422
|
+
ToastTestingPage
|
|
17423
|
+
]
|
|
17424
|
+
},] }
|
|
17425
|
+
];
|
|
17426
|
+
|
|
17427
|
+
const SHARED_TESTING_PAGES = [
|
|
17428
|
+
{ label: 'Toast', page: '/testing/shared/toast' }
|
|
17429
|
+
];
|
|
17369
17430
|
class SharedTestingModule {
|
|
17370
17431
|
}
|
|
17371
17432
|
SharedTestingModule.decorators = [
|
|
@@ -17373,10 +17434,12 @@ SharedTestingModule.decorators = [
|
|
|
17373
17434
|
imports: [
|
|
17374
17435
|
CommonModule,
|
|
17375
17436
|
TranslateModule.forChild(),
|
|
17376
|
-
MaterialTestingModule
|
|
17437
|
+
MaterialTestingModule,
|
|
17438
|
+
ToastTestingModule
|
|
17377
17439
|
],
|
|
17378
17440
|
exports: [
|
|
17379
|
-
MaterialTestingModule
|
|
17441
|
+
MaterialTestingModule,
|
|
17442
|
+
ToastTestingModule
|
|
17380
17443
|
]
|
|
17381
17444
|
},] }
|
|
17382
17445
|
];
|
|
@@ -20941,7 +21004,7 @@ class BaseEntityService extends BaseGraphqlService {
|
|
|
20941
21004
|
throw Error('Not implemented!');
|
|
20942
21005
|
const variables = opts && opts.variables || {
|
|
20943
21006
|
id,
|
|
20944
|
-
interval: opts && opts.interval
|
|
21007
|
+
interval: toNumber(opts && opts.interval, 0) // no timer by default
|
|
20945
21008
|
};
|
|
20946
21009
|
if (this._debug)
|
|
20947
21010
|
console.debug(this._logPrefix + `[WS] Listening for changes on ${this._logTypeName} {${id}}...`);
|
|
@@ -22142,6 +22205,7 @@ class AppTable {
|
|
|
22142
22205
|
const canDelete = yield this.canDeleteRows(rows, opts);
|
|
22143
22206
|
if (!canDelete)
|
|
22144
22207
|
return 0; // Cannot delete
|
|
22208
|
+
// If data need to be saved first
|
|
22145
22209
|
if (this.saveBeforeDelete) {
|
|
22146
22210
|
// Cancel invalid rows (because of save() will fail, if invalid rows exists)
|
|
22147
22211
|
rows = rows.reduce((res, row) => {
|
|
@@ -22152,30 +22216,40 @@ class AppTable {
|
|
|
22152
22216
|
if (deleted) {
|
|
22153
22217
|
this.visibleRowCount--;
|
|
22154
22218
|
this.totalRowCount--;
|
|
22219
|
+
// Forget is was the edited row
|
|
22220
|
+
if (row === this.editedRow) {
|
|
22221
|
+
this.editedRow = undefined;
|
|
22222
|
+
}
|
|
22155
22223
|
return res;
|
|
22156
22224
|
}
|
|
22157
22225
|
}
|
|
22158
22226
|
return res.concat(row);
|
|
22159
22227
|
}, []);
|
|
22160
|
-
if
|
|
22161
|
-
|
|
22162
|
-
|
|
22163
|
-
|
|
22164
|
-
|
|
22165
|
-
|
|
22166
|
-
|
|
22228
|
+
// Apply save, only if there is still some rows to delete
|
|
22229
|
+
// WARN: If no more rows (e.g. because all has been cancelled) then continue anyway to clear editedRow and selection (issue IMAGINE-669)
|
|
22230
|
+
if (isNotEmptyArray(rows)) {
|
|
22231
|
+
// Save data (e.g. when using memory service)
|
|
22232
|
+
const saved = yield this.saveBeforeAction('delete');
|
|
22233
|
+
if (!saved) {
|
|
22234
|
+
// Stop if save cancelled or save failed
|
|
22235
|
+
return;
|
|
22236
|
+
}
|
|
22167
22237
|
}
|
|
22168
22238
|
}
|
|
22169
|
-
if (this.debug)
|
|
22170
|
-
console.debug('[table] Delete selection...');
|
|
22171
|
-
const rowsToDelete = rows.slice()
|
|
22172
|
-
// Reverse row order
|
|
22173
|
-
// This is a workaround, need because row.delete() has async execution
|
|
22174
|
-
// and index cache is updated with a delay)
|
|
22175
|
-
.sort((a, b) => a.id > b.id ? -1 : 1);
|
|
22176
22239
|
try {
|
|
22177
|
-
const deleteCount =
|
|
22178
|
-
|
|
22240
|
+
const deleteCount = rows.length;
|
|
22241
|
+
// Apply deletion on datasource
|
|
22242
|
+
// If no more rows to delete, continue anyway to clear editedRow and selection (issue IMAGINE-669)
|
|
22243
|
+
if (deleteCount) {
|
|
22244
|
+
if (this.debug)
|
|
22245
|
+
console.debug('[table] Delete selected rows...');
|
|
22246
|
+
// Reverse row order (on a copy)
|
|
22247
|
+
// This is a workaround, need because row.delete() has async execution
|
|
22248
|
+
// and index cache is updated with a delay
|
|
22249
|
+
rows = rows.slice()
|
|
22250
|
+
.sort((a, b) => a.id > b.id ? -1 : 1);
|
|
22251
|
+
yield this._dataSource.deleteAll(rows);
|
|
22252
|
+
}
|
|
22179
22253
|
// DO not update manually, because watchALl().subscribe() will update this count
|
|
22180
22254
|
//this.totalRowCount -= deleteCount;
|
|
22181
22255
|
//this.visibleRowCount -= deleteCount;
|
|
@@ -22183,7 +22257,8 @@ class AppTable {
|
|
|
22183
22257
|
this.editedRow = undefined;
|
|
22184
22258
|
this.markAsDirty({ emitEvent: false /*markForCheck() is called just after*/ });
|
|
22185
22259
|
this.markForCheck();
|
|
22186
|
-
|
|
22260
|
+
if (deleteCount)
|
|
22261
|
+
this.onAfterDeletedRows.next(rows);
|
|
22187
22262
|
return deleteCount;
|
|
22188
22263
|
}
|
|
22189
22264
|
catch (err) {
|
|
@@ -23503,22 +23578,23 @@ class AppEditorOptions extends AppTabEditorOptions {
|
|
|
23503
23578
|
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
23504
23579
|
class AppEntityEditor extends AppTabEditor {
|
|
23505
23580
|
constructor(injector, dataType, dataService, options) {
|
|
23506
|
-
var _a;
|
|
23507
23581
|
super(injector.get(ActivatedRoute), injector.get(Router), injector.get(AlertController), injector.get(TranslateService), options);
|
|
23508
23582
|
this.dataType = dataType;
|
|
23509
23583
|
this.dataService = dataService;
|
|
23510
23584
|
this.saving = false;
|
|
23511
23585
|
this.$title = new Subject();
|
|
23512
23586
|
this.onUpdateView = new EventEmitter();
|
|
23587
|
+
this.environement = injector.get(ENVIRONMENT);
|
|
23513
23588
|
options = Object.assign({
|
|
23514
23589
|
// Default options
|
|
23515
|
-
enableListenChanges:
|
|
23590
|
+
enableListenChanges: !this.environement.entityEditor || this.environement.entityEditor.enableListenChanges !== false, listenIntervalInSeconds: toNumber(this.environement.entityEditor && this.environement.entityEditor.listenIntervalInSeconds, 0), pathIdAttribute: 'id', autoLoad: true, autoUpdateRoute: true, i18nPrefix: '' }, options);
|
|
23516
23591
|
this.settings = injector.get(LocalSettingsService);
|
|
23517
23592
|
this.errorTranslator = injector.get(FormErrorTranslator);
|
|
23518
23593
|
this.cd = injector.get(ChangeDetectorRef);
|
|
23519
23594
|
this.dateFormat = injector.get(DateFormatPipe);
|
|
23520
23595
|
this.toastController = injector.get(ToastController);
|
|
23521
23596
|
this._enableListenChanges = options.enableListenChanges;
|
|
23597
|
+
this._listenIntervalInSeconds = options.listenIntervalInSeconds;
|
|
23522
23598
|
this._pathIdAttribute = options.pathIdAttribute;
|
|
23523
23599
|
this._autoLoad = options.autoLoad;
|
|
23524
23600
|
this._autoLoadDelay = options.autoLoadDelay;
|
|
@@ -23586,7 +23662,7 @@ class AppEntityEditor extends AppTabEditor {
|
|
|
23586
23662
|
}
|
|
23587
23663
|
ngOnDestroy() {
|
|
23588
23664
|
super.ngOnDestroy();
|
|
23589
|
-
this.
|
|
23665
|
+
this._listenChangesSubscription = null; // already unsubscribe in the super function
|
|
23590
23666
|
this.$title.complete();
|
|
23591
23667
|
this.$title.unsubscribe();
|
|
23592
23668
|
this.onUpdateView.complete();
|
|
@@ -23665,32 +23741,33 @@ class AppEntityEditor extends AppTabEditor {
|
|
|
23665
23741
|
}
|
|
23666
23742
|
startListenRemoteChanges() {
|
|
23667
23743
|
// Skip if disable, or already listening
|
|
23668
|
-
if (this.
|
|
23744
|
+
if (this._listenChangesSubscription || !this._enableListenChanges || this.isNewData)
|
|
23669
23745
|
return;
|
|
23670
23746
|
// Listen for changes on server
|
|
23671
|
-
this.
|
|
23747
|
+
this._listenChangesSubscription = this.dataService.listenChanges(this.data.id, { interval: this._listenIntervalInSeconds })
|
|
23672
23748
|
.pipe(filter(isNotNil))
|
|
23673
23749
|
.subscribe((data) => {
|
|
23674
23750
|
if (data.updateDate && data.updateDate.isAfter(this.data.updateDate)) {
|
|
23675
23751
|
if (!this.dirty) {
|
|
23676
23752
|
if (this.debug)
|
|
23677
|
-
console.debug(`[data-editor] Changes detected on server, at {${data.updateDate}}
|
|
23753
|
+
console.debug(`[data-editor] Changes detected on server, at {${data.updateDate}}: reloading page...`);
|
|
23678
23754
|
this.updateView(data);
|
|
23679
23755
|
}
|
|
23680
23756
|
else {
|
|
23681
23757
|
if (this.debug)
|
|
23682
23758
|
console.debug(`[data-editor] Changes detected on server, at {${data.updateDate}}, but page is dirty: skip reloading.`);
|
|
23759
|
+
// TODO: alter user (with a toast ?)
|
|
23683
23760
|
}
|
|
23684
23761
|
}
|
|
23685
23762
|
});
|
|
23686
|
-
this.
|
|
23687
|
-
this.registerSubscription(this.
|
|
23763
|
+
this._listenChangesSubscription.add(() => this._listenChangesSubscription = null);
|
|
23764
|
+
this.registerSubscription(this._listenChangesSubscription);
|
|
23688
23765
|
}
|
|
23689
23766
|
stopListenRemoteChanges() {
|
|
23690
|
-
if (this.
|
|
23691
|
-
this.unregisterSubscription(this.
|
|
23692
|
-
this.
|
|
23693
|
-
this.
|
|
23767
|
+
if (this._listenChangesSubscription) {
|
|
23768
|
+
this.unregisterSubscription(this._listenChangesSubscription);
|
|
23769
|
+
this._listenChangesSubscription.unsubscribe();
|
|
23770
|
+
this._listenChangesSubscription = null;
|
|
23694
23771
|
}
|
|
23695
23772
|
}
|
|
23696
23773
|
updateView(data, opts) {
|
|
@@ -23835,7 +23912,7 @@ class AppEntityEditor extends AppTabEditor {
|
|
|
23835
23912
|
// Update the view (e.g metadata)
|
|
23836
23913
|
yield this.updateView(updatedData, opts);
|
|
23837
23914
|
// Subscribe to remote changes
|
|
23838
|
-
if (!this.
|
|
23915
|
+
if (!this._listenChangesSubscription)
|
|
23839
23916
|
this.startListenRemoteChanges();
|
|
23840
23917
|
this.submitted = false;
|
|
23841
23918
|
return true;
|
|
@@ -25227,5 +25304,5 @@ const ErrorCodes = {
|
|
|
25227
25304
|
* Generated bundle index. Do not edit.
|
|
25228
25305
|
*/
|
|
25229
25306
|
|
|
25230
|
-
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_TESTING_PAGES, AboutModal, Account, AccountPage, AccountService, AccountToStringPipe, ActionsColumnComponent, AdminModule, AdminRoutingModule, Alerts, AnimationState, AppEditor, AppEditorOptions, AppEntityEditor, AppForm, AppFormField, AppFormProvider, AppFormUtils, AppGestureConfig, AppGraphQLModule, AppHelpModal, AppInMemoryTable, AppInstallUpgradeCard, AppListForm, AppLoadingSpinner, AppMenuModule, AppNullForm, AppPropertiesForm, AppTabEditor, AppTabEditorOptions, AppTable, AppTableDataSourceOptions, AppTableUtils, AppValidatorService, AppendToInputDirective, ArrayFilterPipe, ArrayFirstPipe, ArrayIncludesPipe, ArrayLengthPipe, ArrayPluckPipe, AudioProvider, AuthForm, AuthGuardService, AuthModal, AutocompleteTestPage, AutofocusDirective, Base58, BaseEntityService, BaseGraphqlService, BaseGraphqlServiceOptions, BaseReferential, Beans, CORE_CONFIG_OPTIONS, CellValueChangeListener, ChipsTestPage, Color, ColorScale, ComponentDirtyGuard, ConfigService, Configuration, CoreModule, CryptoService, DATE_ISO_PATTERN, DATE_UNIX_MS_TIMESTAMP, DATE_UNIX_TIMESTAMP, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_PLACEHOLDER_CHAR, DEFAULT_REQUIRED_COLUMNS, DateDiffDurationPipe, DateFormatPipe, DateFromNowPipe, DateTimeTestPage, DateUtils, Department, DepartmentToStringPipe, DurationPipe, ENTITIES_STORAGE_KEY_PREFIX, ENVIRONMENT, EmptyArrayPipe, EntitiesService, EntitiesStorage, EntitiesTableDataSource, Entity, EntityClass, EntityClasses, EntityFilter, EntityFilterUtils, EntityMetadataComponent, EntityStore, EntityUtils, Environment, ErrorCodes, EvenPipe, FileService, FileSizePipe, FormArrayHelper, FormButtonsBarComponent, FormButtonsBarToken, FormErrorTranslatePipe, FormErrorTranslator, FormFieldValuesHolder, Fragments, GraphqlService, HAMMER_PRESS_TIME, HAMMER_TAP_TIME, HighlightPipe, HomePage, Hotkeys, HotkeysDialogComponent, InMemoryEntitiesService, IsLoginAccountPipe, IsNilOrBlankPipe, IsNotNilOrBlankPipe, IsNotOnFieldModePipe, IsOnFieldModePipe, 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, MapGetPipe, MapKeysPipe, MapValuesPipe, MatAutocompleteConfigHolder, MatAutocompleteField, MatBooleanField, MatChipsField, MatDate, MatDateShort, MatDateTime, MatDuration, MatLatLongField, MatNumpadComponent, MatNumpadContainerComponent, MatNumpadContent, MatPaginatorI18n, MatStepperI18n, MatSwipeField, MaterialChipsModule, MaterialTestingModule, MaterialTestingPage, MathAbsPipe, MenuComponent, MenuItems, MenuService, ModalToolbarComponent, NetworkService, NgInitDirective, NgVarDirective, NotEmptyArrayPipe, NumberFormatPipe, NumpadDirective, OddPipe, PRIORITIZED_AUTHORITIES, PUBKEY_REGEXP, Peer, Person, PersonFilter, PersonFragments, PersonService, PersonToStringPipe, PersonUtils, PersonValidatorService, PlatformService, ProgressBarService, ProgressInterceptor, PropertyGetPipe, RESERVED_END_COLUMNS, RESERVED_START_COLUMNS, Referential, ReferentialRef, ReferentialUtils, RegisterConfirmPage, SETTINGS_DISPLAY_COLUMNS, SETTINGS_FILTER, SETTINGS_PAGE_SIZE, SETTINGS_SORTED_COLUMN, SETTINGS_STORAGE_KEY, SETTINGS_TRANSIENT_PROPERTIES, SPACE_PLACEHOLDER_CHAR, SelectPeerModal, SettingsPage, SharedDirectivesModule, SharedFormArrayValidators, SharedFormGroupValidators, SharedHotkeysModule, SharedMatAutocompleteModule, SharedMatBooleanModule, SharedMatDateTimeModule, SharedMatDurationModule, SharedMatLatLongModule, SharedMatNumpadModule, SharedMatSwipeModule, SharedMaterialModule, SharedModule, SharedPipesModule, SharedRoutingModule, SharedTestingModule, SharedValidators, SocialModule, Software, StartableService, StatusById, StatusIds, StatusList, StrLengthPipe, SwipeTestPage, TableSelectColumnsComponent, ToStringPipe, Toasts, ToolbarComponent, ToolbarToken, TranslatablePipe, TranslateContextPipe, TranslateContextService, UserEvent, UserEventFilter, UserEventService, UserEventTypes, UserEventsTable, UserSettings, UsersPage, accountToString, adaptValueToControl, addValueInArray, arrayDistinct, arrayGroupBy, arraySize, asInputElement, canHaveFocus, capitalizeFirstLetter, chainPromises, changeCaseToUnderscore, clearValueInArray, copyEntity2Form, createPromiseEvent, createPromiseEventEmitter, departmentToString, departmentsToString, disableControls, emitPromiseEvent, entityToString, equals, equalsOrNil, 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, isControlHasInput, isCordova, isDesktop, isEmptyArray, isIOS, isInputElement, isInstanceOf, isInt, isMobile, isNil, isNilOrBlank, isNilOrNaN, isNotEmptyArray, isNotNil, isNotNilOrBlank, isNotNilOrNaN, isNotNilString, isNumber, isNumberRange, isTouchUi, isWindow, joinProperties, joinPropertiesPath, logFormErrors, markAllAsTouched, markAsUntouched, markControlAsTouched, markFormGroupAsTouched, matchMedia, matchUpperCase, mergeLoadResult, mixHex, 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, uncapitalizeFirstLetter, updateValueAndValidity, waitFor, waitForTrue, waitIdle, waitWhilePending, ɵ0$b as ɵ0, CustomReuseStrategy as ɵa, MatNumpadDomService as ɵb, SharedMatBadgeIconModule as ɵc, MatBadgeIconDirective as ɵd, isFocusableElement as ɵe, MatBadgeIconTestPage as ɵf,
|
|
25307
|
+
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_TESTING_PAGES, AboutModal, Account, AccountPage, AccountService, AccountToStringPipe, ActionsColumnComponent, AdminModule, AdminRoutingModule, Alerts, AnimationState, AppEditor, AppEditorOptions, AppEntityEditor, AppForm, AppFormField, AppFormProvider, AppFormUtils, AppGestureConfig, AppGraphQLModule, AppHelpModal, AppInMemoryTable, AppInstallUpgradeCard, AppListForm, AppLoadingSpinner, AppMenuModule, AppNullForm, AppPropertiesForm, AppTabEditor, AppTabEditorOptions, AppTable, AppTableDataSourceOptions, AppTableUtils, AppValidatorService, AppendToInputDirective, ArrayFilterPipe, ArrayFirstPipe, ArrayIncludesPipe, ArrayLengthPipe, ArrayPluckPipe, AudioProvider, AuthForm, AuthGuardService, AuthModal, AutocompleteTestPage, AutofocusDirective, Base58, BaseEntityService, BaseGraphqlService, BaseGraphqlServiceOptions, BaseReferential, Beans, CORE_CONFIG_OPTIONS, CellValueChangeListener, ChipsTestPage, Color, ColorScale, ComponentDirtyGuard, ConfigService, Configuration, CoreModule, CryptoService, DATE_ISO_PATTERN, DATE_UNIX_MS_TIMESTAMP, DATE_UNIX_TIMESTAMP, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_PLACEHOLDER_CHAR, DEFAULT_REQUIRED_COLUMNS, DateDiffDurationPipe, DateFormatPipe, DateFromNowPipe, DateTimeTestPage, DateUtils, Department, DepartmentToStringPipe, DurationPipe, ENTITIES_STORAGE_KEY_PREFIX, ENVIRONMENT, EmptyArrayPipe, EntitiesService, EntitiesStorage, EntitiesTableDataSource, Entity, EntityClass, EntityClasses, EntityFilter, EntityFilterUtils, EntityMetadataComponent, EntityStore, EntityUtils, Environment, ErrorCodes, EvenPipe, FileService, FileSizePipe, FormArrayHelper, FormButtonsBarComponent, FormButtonsBarToken, FormErrorTranslatePipe, FormErrorTranslator, FormFieldValuesHolder, Fragments, GraphqlService, HAMMER_PRESS_TIME, HAMMER_TAP_TIME, HighlightPipe, HomePage, Hotkeys, HotkeysDialogComponent, InMemoryEntitiesService, IsLoginAccountPipe, IsNilOrBlankPipe, IsNotNilOrBlankPipe, IsNotOnFieldModePipe, IsOnFieldModePipe, 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, MapGetPipe, MapKeysPipe, MapValuesPipe, MatAutocompleteConfigHolder, MatAutocompleteField, MatBooleanField, MatChipsField, MatDate, MatDateShort, MatDateTime, MatDuration, MatLatLongField, MatNumpadComponent, MatNumpadContainerComponent, MatNumpadContent, MatPaginatorI18n, MatStepperI18n, MatSwipeField, MaterialChipsModule, MaterialTestingModule, MaterialTestingPage, MathAbsPipe, MenuComponent, MenuItems, MenuService, ModalToolbarComponent, NetworkService, NgInitDirective, NgVarDirective, NotEmptyArrayPipe, NumberFormatPipe, NumpadDirective, OddPipe, PRIORITIZED_AUTHORITIES, PUBKEY_REGEXP, Peer, Person, PersonFilter, PersonFragments, PersonService, PersonToStringPipe, PersonUtils, PersonValidatorService, PlatformService, ProgressBarService, ProgressInterceptor, PropertyGetPipe, RESERVED_END_COLUMNS, RESERVED_START_COLUMNS, Referential, ReferentialRef, ReferentialUtils, RegisterConfirmPage, SETTINGS_DISPLAY_COLUMNS, SETTINGS_FILTER, SETTINGS_PAGE_SIZE, SETTINGS_SORTED_COLUMN, SETTINGS_STORAGE_KEY, SETTINGS_TRANSIENT_PROPERTIES, SHARED_TESTING_PAGES, SPACE_PLACEHOLDER_CHAR, SelectPeerModal, SettingsPage, SharedDirectivesModule, SharedFormArrayValidators, SharedFormGroupValidators, SharedHotkeysModule, SharedMatAutocompleteModule, SharedMatBooleanModule, SharedMatDateTimeModule, SharedMatDurationModule, SharedMatLatLongModule, SharedMatNumpadModule, SharedMatSwipeModule, SharedMaterialModule, SharedModule, SharedPipesModule, SharedRoutingModule, SharedTestingModule, SharedValidators, SocialModule, Software, StartableService, StatusById, StatusIds, StatusList, StrLengthPipe, SwipeTestPage, TableSelectColumnsComponent, ToStringPipe, Toasts, ToolbarComponent, ToolbarToken, TranslatablePipe, TranslateContextPipe, TranslateContextService, UserEvent, UserEventFilter, UserEventService, UserEventTypes, UserEventsTable, UserSettings, UsersPage, accountToString, adaptValueToControl, addValueInArray, arrayDistinct, arrayGroupBy, arraySize, asInputElement, canHaveFocus, capitalizeFirstLetter, chainPromises, changeCaseToUnderscore, clearValueInArray, copyEntity2Form, createPromiseEvent, createPromiseEventEmitter, departmentToString, departmentsToString, disableControls, emitPromiseEvent, entityToString, equals, equalsOrNil, 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, isControlHasInput, isCordova, isDesktop, isEmptyArray, isIOS, isInputElement, isInstanceOf, isInt, isMobile, isNil, isNilOrBlank, isNilOrNaN, isNotEmptyArray, isNotNil, isNotNilOrBlank, isNotNilOrNaN, isNotNilString, isNumber, isNumberRange, isTouchUi, isWindow, joinProperties, joinPropertiesPath, logFormErrors, markAllAsTouched, markAsUntouched, markControlAsTouched, markFormGroupAsTouched, matchMedia, matchUpperCase, mergeLoadResult, mixHex, 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, uncapitalizeFirstLetter, updateValueAndValidity, waitFor, waitForTrue, waitIdle, waitWhilePending, ɵ0$b as ɵ0, CustomReuseStrategy as ɵa, MatNumpadDomService as ɵb, SharedMatBadgeIconModule as ɵc, MatBadgeIconDirective as ɵd, isFocusableElement as ɵe, MatBadgeIconTestPage as ɵf, ToastTestingModule as ɵg, ToastTestingPage as ɵh, RegisterForm as ɵi, AccountValidatorService as ɵj, RegisterModal as ɵk, UserSettingsValidatorService as ɵl, LocalSettingsValidatorService as ɵm, AppIconComponent as ɵn };
|
|
25231
25308
|
//# sourceMappingURL=sumaris-net.ngx-components.js.map
|