@sumaris-net/ngx-components 0.27.0 → 0.27.4
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 +272 -177
- 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/esm2015/src/app/core/form/editor.class.js +172 -127
- package/esm2015/src/app/core/form/entity-editor.class.js +2 -1
- package/esm2015/src/app/core/form/form.class.js +16 -2
- package/esm2015/src/app/core/form/form.utils.js +14 -1
- package/esm2015/src/app/core/services/platform.service.js +2 -5
- package/esm2015/src/app/core/table/table.class.js +14 -2
- package/esm2015/src/app/shared/pipes/number-format.pipe.js +3 -3
- package/fesm2015/sumaris-net.ngx-components.js +212 -132
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +2 -2
- package/src/app/core/form/editor.class.d.ts +43 -26
- package/src/app/core/form/form.class.d.ts +12 -2
- package/src/app/core/form/form.utils.d.ts +16 -0
- package/src/app/core/table/table.class.d.ts +5 -0
- package/src/app/shared/pipes/number-format.pipe.d.ts +1 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -2280,11 +2280,11 @@
|
|
|
2280
2280
|
var NumberFormatPipe = /** @class */ (function () {
|
|
2281
2281
|
function NumberFormatPipe() {
|
|
2282
2282
|
}
|
|
2283
|
-
NumberFormatPipe.prototype.transform = function (val) {
|
|
2283
|
+
NumberFormatPipe.prototype.transform = function (val, numberFormatOptions) {
|
|
2284
2284
|
// Format the output to display any way you want here.
|
|
2285
2285
|
// For instance:
|
|
2286
2286
|
if (val !== undefined && val !== null) {
|
|
2287
|
-
return val.toLocaleString(
|
|
2287
|
+
return val.toLocaleString(undefined, numberFormatOptions);
|
|
2288
2288
|
}
|
|
2289
2289
|
else {
|
|
2290
2290
|
return '';
|
|
@@ -3376,6 +3376,13 @@
|
|
|
3376
3376
|
AppNullForm.prototype.markAsDirty = function (opts) { };
|
|
3377
3377
|
AppNullForm.prototype.markAsLoading = function (opts) { };
|
|
3378
3378
|
AppNullForm.prototype.markAsLoaded = function (opts) { };
|
|
3379
|
+
AppNullForm.prototype.markAsReady = function (opts) { };
|
|
3380
|
+
AppNullForm.prototype.waitIdle = function (opts) {
|
|
3381
|
+
return Promise.reject(false);
|
|
3382
|
+
};
|
|
3383
|
+
AppNullForm.prototype.ready = function () {
|
|
3384
|
+
return Promise.reject(true);
|
|
3385
|
+
};
|
|
3379
3386
|
return AppNullForm;
|
|
3380
3387
|
}());
|
|
3381
3388
|
var AppFormProvider = /** @class */ (function () {
|
|
@@ -3461,6 +3468,9 @@
|
|
|
3461
3468
|
enumerable: false,
|
|
3462
3469
|
configurable: true
|
|
3463
3470
|
});
|
|
3471
|
+
AppFormProvider.prototype.ready = function () {
|
|
3472
|
+
return this.delegate.ready();
|
|
3473
|
+
};
|
|
3464
3474
|
AppFormProvider.prototype.disable = function (opts) {
|
|
3465
3475
|
return this.delegate.disable(opts);
|
|
3466
3476
|
};
|
|
@@ -3488,6 +3498,9 @@
|
|
|
3488
3498
|
AppFormProvider.prototype.markAsLoaded = function (opts) {
|
|
3489
3499
|
return this.delegate.markAsLoaded(opts);
|
|
3490
3500
|
};
|
|
3501
|
+
AppFormProvider.prototype.markAsReady = function (opts) {
|
|
3502
|
+
return this.delegate.markAsReady(opts);
|
|
3503
|
+
};
|
|
3491
3504
|
return AppFormProvider;
|
|
3492
3505
|
}());
|
|
3493
3506
|
AppFormProvider.NULL_FORM = new AppNullForm();
|
|
@@ -16497,9 +16510,6 @@
|
|
|
16497
16510
|
_this._debug = !environment.production;
|
|
16498
16511
|
if (_this._debug)
|
|
16499
16512
|
console.debug('[platform] Creating service');
|
|
16500
|
-
_this.start()
|
|
16501
|
-
// Manage error
|
|
16502
|
-
.catch(function (err) { return _this.onStartupError(err); });
|
|
16503
16513
|
return _this;
|
|
16504
16514
|
}
|
|
16505
16515
|
Object.defineProperty(PlatformService.prototype, "mobile", {
|
|
@@ -16524,7 +16534,7 @@
|
|
|
16524
16534
|
};
|
|
16525
16535
|
Object.defineProperty(PlatformService.prototype, "canDownload", {
|
|
16526
16536
|
get: function () {
|
|
16527
|
-
return this.
|
|
16537
|
+
return isNotNil(this.downloader);
|
|
16528
16538
|
},
|
|
16529
16539
|
enumerable: false,
|
|
16530
16540
|
configurable: true
|
|
@@ -19023,6 +19033,7 @@
|
|
|
19023
19033
|
this.error = null;
|
|
19024
19034
|
this._enable = false;
|
|
19025
19035
|
this._loading = true;
|
|
19036
|
+
this._$ready = new rxjs.BehaviorSubject(true);
|
|
19026
19037
|
this.i18nFieldPrefix = null;
|
|
19027
19038
|
this._subscription = new rxjs.Subscription();
|
|
19028
19039
|
this.debug = false;
|
|
@@ -19233,6 +19244,18 @@
|
|
|
19233
19244
|
this.markForCheck();
|
|
19234
19245
|
}
|
|
19235
19246
|
};
|
|
19247
|
+
AppForm.prototype.markAsReady = function (opts) {
|
|
19248
|
+
if (!this._$ready.value) {
|
|
19249
|
+
this._$ready.next(true);
|
|
19250
|
+
}
|
|
19251
|
+
};
|
|
19252
|
+
/**
|
|
19253
|
+
* Wait form is ready
|
|
19254
|
+
* @param opts
|
|
19255
|
+
*/
|
|
19256
|
+
AppForm.prototype.ready = function (opts) {
|
|
19257
|
+
return firstTruePromise(this._$ready);
|
|
19258
|
+
};
|
|
19236
19259
|
/**
|
|
19237
19260
|
* Wait form is idle (not loading)
|
|
19238
19261
|
* @param opts
|
|
@@ -23497,6 +23520,7 @@
|
|
|
23497
23520
|
this.allowRowDetail = true;
|
|
23498
23521
|
this.excludesColumns = [];
|
|
23499
23522
|
this.totalRowCount = null;
|
|
23523
|
+
this.readySubject = new rxjs.BehaviorSubject(false);
|
|
23500
23524
|
this.loadingSubject = new rxjs.BehaviorSubject(true);
|
|
23501
23525
|
this.savingSubject = new rxjs.BehaviorSubject(false);
|
|
23502
23526
|
this.dirtySubject = new rxjs.BehaviorSubject(false);
|
|
@@ -23760,6 +23784,14 @@
|
|
|
23760
23784
|
(_a = row.validator) === null || _a === void 0 ? void 0 : _a.markAsDirty(opts);
|
|
23761
23785
|
this.markAsDirty(opts);
|
|
23762
23786
|
};
|
|
23787
|
+
AppTable.prototype.markAsReady = function (opts) {
|
|
23788
|
+
if (this.readySubject.value !== false) {
|
|
23789
|
+
this.readySubject.next(false);
|
|
23790
|
+
if (!opts || opts.emitEvent !== false) {
|
|
23791
|
+
this.markForCheck();
|
|
23792
|
+
}
|
|
23793
|
+
}
|
|
23794
|
+
};
|
|
23763
23795
|
Object.defineProperty(AppTable.prototype, "loading", {
|
|
23764
23796
|
get: function () {
|
|
23765
23797
|
return this.loadingSubject.value;
|
|
@@ -24474,6 +24506,9 @@
|
|
|
24474
24506
|
AppTable.prototype.moveRow = function (id, direction) {
|
|
24475
24507
|
this.dataSource.move(id, direction);
|
|
24476
24508
|
};
|
|
24509
|
+
AppTable.prototype.ready = function () {
|
|
24510
|
+
return firstTruePromise(this.readySubject);
|
|
24511
|
+
};
|
|
24477
24512
|
AppTable.prototype.waitIdle = function () {
|
|
24478
24513
|
return firstFalsePromise(this.loadingSubject);
|
|
24479
24514
|
};
|
|
@@ -25269,8 +25304,8 @@
|
|
|
25269
25304
|
return AppTabEditorOptions;
|
|
25270
25305
|
}());
|
|
25271
25306
|
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
25272
|
-
var
|
|
25273
|
-
function
|
|
25307
|
+
var AppEditor = /** @class */ (function () {
|
|
25308
|
+
function AppEditor(route, router, alertCtrl, translate) {
|
|
25274
25309
|
this.route = route;
|
|
25275
25310
|
this.router = router;
|
|
25276
25311
|
this.alertCtrl = alertCtrl;
|
|
@@ -25279,25 +25314,20 @@
|
|
|
25279
25314
|
this._enabled = false;
|
|
25280
25315
|
this._dirty = false;
|
|
25281
25316
|
this._loading = true;
|
|
25282
|
-
this.
|
|
25317
|
+
this._$ready = new rxjs.BehaviorSubject(false);
|
|
25283
25318
|
this.debug = false;
|
|
25284
25319
|
this.submitted = false;
|
|
25285
25320
|
this.toolbar = null;
|
|
25286
25321
|
this.formButtonsBar = null;
|
|
25287
|
-
this.selectedTabIndexChange = new i0.EventEmitter();
|
|
25288
|
-
options = Object.assign({ tabCount: 1, enableSwipe: true, tabGroupAnimationDuration: '200ms' }, options);
|
|
25289
|
-
this.tabCount = options.tabCount;
|
|
25290
|
-
this.enableSwipe = options.enableSwipe;
|
|
25291
|
-
this.tabGroupAnimationDuration = options.tabGroupAnimationDuration;
|
|
25292
25322
|
}
|
|
25293
|
-
Object.defineProperty(
|
|
25323
|
+
Object.defineProperty(AppEditor.prototype, "tables", {
|
|
25294
25324
|
get: function () {
|
|
25295
25325
|
return this._children && this._children.filter(function (c) { return c instanceof AppTable; });
|
|
25296
25326
|
},
|
|
25297
25327
|
enumerable: false,
|
|
25298
25328
|
configurable: true
|
|
25299
25329
|
});
|
|
25300
|
-
Object.defineProperty(
|
|
25330
|
+
Object.defineProperty(AppEditor.prototype, "dirty", {
|
|
25301
25331
|
get: function () {
|
|
25302
25332
|
var _a;
|
|
25303
25333
|
return this._dirty || (((_a = this._children) === null || _a === void 0 ? void 0 : _a.findIndex(function (c) { return c.enabled && c.dirty; })) !== -1) || false;
|
|
@@ -25305,7 +25335,7 @@
|
|
|
25305
25335
|
enumerable: false,
|
|
25306
25336
|
configurable: true
|
|
25307
25337
|
});
|
|
25308
|
-
Object.defineProperty(
|
|
25338
|
+
Object.defineProperty(AppEditor.prototype, "valid", {
|
|
25309
25339
|
/**
|
|
25310
25340
|
* Is valid (tables and forms)
|
|
25311
25341
|
*/
|
|
@@ -25316,7 +25346,7 @@
|
|
|
25316
25346
|
enumerable: false,
|
|
25317
25347
|
configurable: true
|
|
25318
25348
|
});
|
|
25319
|
-
Object.defineProperty(
|
|
25349
|
+
Object.defineProperty(AppEditor.prototype, "invalid", {
|
|
25320
25350
|
get: function () {
|
|
25321
25351
|
var _a;
|
|
25322
25352
|
return (((_a = this._children) === null || _a === void 0 ? void 0 : _a.findIndex(function (c) { return c.enabled && c.invalid; })) !== -1) || false;
|
|
@@ -25324,7 +25354,7 @@
|
|
|
25324
25354
|
enumerable: false,
|
|
25325
25355
|
configurable: true
|
|
25326
25356
|
});
|
|
25327
|
-
Object.defineProperty(
|
|
25357
|
+
Object.defineProperty(AppEditor.prototype, "pending", {
|
|
25328
25358
|
get: function () {
|
|
25329
25359
|
var _a;
|
|
25330
25360
|
return (((_a = this._children) === null || _a === void 0 ? void 0 : _a.findIndex(function (c) { return c.enabled && c.pending; })) !== -1) || false;
|
|
@@ -25332,7 +25362,7 @@
|
|
|
25332
25362
|
enumerable: false,
|
|
25333
25363
|
configurable: true
|
|
25334
25364
|
});
|
|
25335
|
-
Object.defineProperty(
|
|
25365
|
+
Object.defineProperty(AppEditor.prototype, "loading", {
|
|
25336
25366
|
get: function () {
|
|
25337
25367
|
var _a;
|
|
25338
25368
|
return this._loading || (((_a = this._children) === null || _a === void 0 ? void 0 : _a.findIndex(function (c) { return c.enabled && c.loading; })) !== -1) || false;
|
|
@@ -25340,76 +25370,47 @@
|
|
|
25340
25370
|
enumerable: false,
|
|
25341
25371
|
configurable: true
|
|
25342
25372
|
});
|
|
25343
|
-
Object.defineProperty(
|
|
25373
|
+
Object.defineProperty(AppEditor.prototype, "enabled", {
|
|
25344
25374
|
get: function () {
|
|
25345
25375
|
return this._enabled;
|
|
25346
25376
|
},
|
|
25347
25377
|
enumerable: false,
|
|
25348
25378
|
configurable: true
|
|
25349
25379
|
});
|
|
25350
|
-
Object.defineProperty(
|
|
25380
|
+
Object.defineProperty(AppEditor.prototype, "disabled", {
|
|
25351
25381
|
get: function () {
|
|
25352
25382
|
return !this._enabled;
|
|
25353
25383
|
},
|
|
25354
25384
|
enumerable: false,
|
|
25355
25385
|
configurable: true
|
|
25356
25386
|
});
|
|
25357
|
-
Object.defineProperty(
|
|
25387
|
+
Object.defineProperty(AppEditor.prototype, "children", {
|
|
25358
25388
|
get: function () {
|
|
25359
25389
|
return this._children;
|
|
25360
25390
|
},
|
|
25361
25391
|
enumerable: false,
|
|
25362
25392
|
configurable: true
|
|
25363
25393
|
});
|
|
25364
|
-
Object.defineProperty(
|
|
25394
|
+
Object.defineProperty(AppEditor.prototype, "empty", {
|
|
25365
25395
|
get: function () {
|
|
25366
25396
|
return this._enabled;
|
|
25367
25397
|
},
|
|
25368
25398
|
enumerable: false,
|
|
25369
25399
|
configurable: true
|
|
25370
25400
|
});
|
|
25371
|
-
|
|
25372
|
-
get: function () {
|
|
25373
|
-
return this._selectedTabIndex;
|
|
25374
|
-
},
|
|
25375
|
-
set: function (value) {
|
|
25376
|
-
this.setSelectedTabIndex(value);
|
|
25377
|
-
},
|
|
25378
|
-
enumerable: false,
|
|
25379
|
-
configurable: true
|
|
25380
|
-
});
|
|
25381
|
-
AppTabEditor.prototype.ngOnInit = function () {
|
|
25401
|
+
AppEditor.prototype.ngOnInit = function () {
|
|
25382
25402
|
var _this = this;
|
|
25383
|
-
this.queryTabIndexParamName = this.queryTabIndexParamName || 'tab';
|
|
25384
|
-
// Read the selected tab index, from path query params
|
|
25385
|
-
if (this.tabGroup) {
|
|
25386
|
-
this.registerSubscription(this.route.queryParams
|
|
25387
|
-
.subscribe(function (queryParams) {
|
|
25388
|
-
_this.queryParams = Object.assign({}, queryParams);
|
|
25389
|
-
// Parse tab param
|
|
25390
|
-
if (_this.tabCount > 1 && _this.queryTabIndexParamName) {
|
|
25391
|
-
var tabIndex = queryParams[_this.queryTabIndexParamName];
|
|
25392
|
-
_this.queryParams[_this.queryTabIndexParamName] = tabIndex && parseInt(tabIndex) || undefined;
|
|
25393
|
-
if (isNotNil(_this.queryParams[_this.queryTabIndexParamName])) {
|
|
25394
|
-
_this.selectedTabIndex = _this.queryParams[_this.queryTabIndexParamName];
|
|
25395
|
-
}
|
|
25396
|
-
}
|
|
25397
|
-
// Realign tab, after a delay because the tab can be disabled when component is created
|
|
25398
|
-
setTimeout(function () { return _this.tabGroup.realignInkBar(); }, 500);
|
|
25399
|
-
}));
|
|
25400
|
-
}
|
|
25401
25403
|
if (this.formButtonsBar) {
|
|
25402
25404
|
this.registerSubscription(this.formButtonsBar.onBack.subscribe(function (event) { return _this.goBack(event); }));
|
|
25403
25405
|
}
|
|
25404
25406
|
};
|
|
25405
|
-
|
|
25407
|
+
AppEditor.prototype.ngAfterViewInit = function () {
|
|
25406
25408
|
// Can be override by subclasses
|
|
25407
25409
|
};
|
|
25408
|
-
|
|
25410
|
+
AppEditor.prototype.ngOnDestroy = function () {
|
|
25409
25411
|
this._subscription.unsubscribe();
|
|
25410
|
-
this.selectedTabIndexChange.complete();
|
|
25411
25412
|
};
|
|
25412
|
-
|
|
25413
|
+
AppEditor.prototype.addChildForm = function (form) {
|
|
25413
25414
|
if (!form)
|
|
25414
25415
|
throw new Error('Trying to register an undefined child form');
|
|
25415
25416
|
this._children = this._children || [];
|
|
@@ -25421,26 +25422,26 @@
|
|
|
25421
25422
|
}
|
|
25422
25423
|
return this;
|
|
25423
25424
|
};
|
|
25424
|
-
|
|
25425
|
+
AppEditor.prototype.addChildForms = function (forms) {
|
|
25425
25426
|
var _this = this;
|
|
25426
25427
|
(forms || []).forEach(function (form) { return _this.addChildForm(form); });
|
|
25427
25428
|
return this;
|
|
25428
25429
|
};
|
|
25429
|
-
|
|
25430
|
+
AppEditor.prototype.disable = function (opts) {
|
|
25430
25431
|
var _a;
|
|
25431
25432
|
this._enabled = false;
|
|
25432
25433
|
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return c.disable(opts); });
|
|
25433
25434
|
if (!this.loading && (!opts || opts.emitEvent !== false))
|
|
25434
25435
|
this.markForCheck();
|
|
25435
25436
|
};
|
|
25436
|
-
|
|
25437
|
+
AppEditor.prototype.enable = function (opts) {
|
|
25437
25438
|
var _a;
|
|
25438
25439
|
this._enabled = true;
|
|
25439
25440
|
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return c.enable(opts); });
|
|
25440
25441
|
if (!this.loading && (!opts || opts.emitEvent !== false))
|
|
25441
25442
|
this.markForCheck();
|
|
25442
25443
|
};
|
|
25443
|
-
|
|
25444
|
+
AppEditor.prototype.markAsPristine = function (opts) {
|
|
25444
25445
|
var _a;
|
|
25445
25446
|
this.error = null;
|
|
25446
25447
|
this.submitted = false;
|
|
@@ -25449,7 +25450,7 @@
|
|
|
25449
25450
|
if (!this.loading && (!opts || opts.emitEvent !== false))
|
|
25450
25451
|
this.markForCheck();
|
|
25451
25452
|
};
|
|
25452
|
-
|
|
25453
|
+
AppEditor.prototype.markAsUntouched = function (opts) {
|
|
25453
25454
|
var _a;
|
|
25454
25455
|
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return c.markAsUntouched(); });
|
|
25455
25456
|
if (!this.loading && (!opts || opts.emitEvent !== false))
|
|
@@ -25459,99 +25460,49 @@
|
|
|
25459
25460
|
* @deprecated prefer to use markAllAsTouched()
|
|
25460
25461
|
* @param opts
|
|
25461
25462
|
*/
|
|
25462
|
-
|
|
25463
|
+
AppEditor.prototype.markAsTouched = function (opts) {
|
|
25463
25464
|
var _a;
|
|
25464
25465
|
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return c.markAsTouched(opts); });
|
|
25465
25466
|
if (!this.loading && (!opts || opts.emitEvent !== false))
|
|
25466
25467
|
this.markForCheck();
|
|
25467
25468
|
};
|
|
25468
|
-
|
|
25469
|
+
AppEditor.prototype.markAllAsTouched = function (opts) {
|
|
25469
25470
|
var _a;
|
|
25470
25471
|
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return c.markAllAsTouched(opts); });
|
|
25471
25472
|
if (!this.loading && (!opts || opts.emitEvent !== false))
|
|
25472
25473
|
this.markForCheck();
|
|
25473
25474
|
};
|
|
25474
|
-
|
|
25475
|
+
AppEditor.prototype.markAsDirty = function (opts) {
|
|
25475
25476
|
this._dirty = true;
|
|
25476
25477
|
if (!this.loading && (!opts || opts.emitEvent !== false))
|
|
25477
25478
|
this.markForCheck();
|
|
25478
25479
|
};
|
|
25479
|
-
|
|
25480
|
+
AppEditor.prototype.markAsLoading = function (opts) {
|
|
25480
25481
|
if (!this._loading) {
|
|
25481
25482
|
this._loading = true;
|
|
25482
25483
|
if (!opts || opts.emitEvent !== false)
|
|
25483
25484
|
this.markForCheck();
|
|
25484
25485
|
}
|
|
25485
25486
|
};
|
|
25486
|
-
|
|
25487
|
+
AppEditor.prototype.markAsLoaded = function (opts) {
|
|
25487
25488
|
if (this._loading) {
|
|
25488
25489
|
this._loading = false;
|
|
25489
25490
|
if (!opts || opts.emitEvent !== false)
|
|
25490
25491
|
this.markForCheck();
|
|
25491
25492
|
}
|
|
25492
25493
|
};
|
|
25493
|
-
|
|
25494
|
-
|
|
25495
|
-
|
|
25496
|
-
|
|
25497
|
-
if (!this.queryParams || +this.queryParams[queryTabIndexParamName] !== event.index) {
|
|
25498
|
-
this.queryParams = this.queryParams || {};
|
|
25499
|
-
this.queryParams[queryTabIndexParamName] = event.index;
|
|
25500
|
-
if (queryTabIndexParamName === 'tab' && isNotNil(this.queryParams['subtab'])) {
|
|
25501
|
-
delete this.queryParams.subtab; // clean subtab
|
|
25502
|
-
}
|
|
25503
|
-
this.router.navigate(['.'], {
|
|
25504
|
-
relativeTo: this.route,
|
|
25505
|
-
queryParams: this.queryParams,
|
|
25506
|
-
replaceUrl: true
|
|
25507
|
-
});
|
|
25508
|
-
return true;
|
|
25509
|
-
}
|
|
25510
|
-
return false;
|
|
25494
|
+
AppEditor.prototype.markAsReady = function (opts) {
|
|
25495
|
+
var _a;
|
|
25496
|
+
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return c.markAsReady(opts); });
|
|
25497
|
+
this._$ready.next(true);
|
|
25511
25498
|
};
|
|
25512
|
-
|
|
25513
|
-
|
|
25514
|
-
*/
|
|
25515
|
-
AppTabEditor.prototype.onSwipeTab = function (event) {
|
|
25516
|
-
var _this = this;
|
|
25517
|
-
// DEBUG
|
|
25518
|
-
// if (this.debug) console.debug("[tab-page] onSwipeTab()");
|
|
25519
|
-
// Skip, if not a valid swipe event
|
|
25520
|
-
if (!this.enableSwipe || !event
|
|
25521
|
-
|| event.defaultPrevented || (event.srcEvent && event.srcEvent.defaultPrevented)
|
|
25522
|
-
|| event.pointerType !== 'touch') {
|
|
25523
|
-
return false;
|
|
25524
|
-
}
|
|
25525
|
-
// DEBUG
|
|
25526
|
-
//if (this.debug)
|
|
25527
|
-
//console.debug("[tab-page] Detected swipe: " + event.type, event);
|
|
25528
|
-
var selectTabIndex = this.selectedTabIndex;
|
|
25529
|
-
switch (event.type) {
|
|
25530
|
-
// Open next tab
|
|
25531
|
-
case 'swipeleft':
|
|
25532
|
-
var isLast = selectTabIndex >= (this.tabCount - 1);
|
|
25533
|
-
selectTabIndex = isLast ? 0 : selectTabIndex + 1;
|
|
25534
|
-
break;
|
|
25535
|
-
// Open previous tab
|
|
25536
|
-
case 'swiperight':
|
|
25537
|
-
var isFirst = selectTabIndex <= 0;
|
|
25538
|
-
selectTabIndex = isFirst ? this.tabCount : selectTabIndex - 1;
|
|
25539
|
-
break;
|
|
25540
|
-
// Other case
|
|
25541
|
-
default:
|
|
25542
|
-
console.error('[tab-page] Unknown swipe action: ' + event.type);
|
|
25543
|
-
return false;
|
|
25544
|
-
}
|
|
25545
|
-
setTimeout(function () {
|
|
25546
|
-
_this.selectedTabIndex = selectTabIndex;
|
|
25547
|
-
_this.markForCheck();
|
|
25548
|
-
});
|
|
25549
|
-
return true;
|
|
25499
|
+
AppEditor.prototype.ready = function (opts) {
|
|
25500
|
+
return firstTruePromise(this._$ready);
|
|
25550
25501
|
};
|
|
25551
|
-
|
|
25552
|
-
|
|
25502
|
+
AppEditor.prototype.waitIdle = function (opts) {
|
|
25503
|
+
return AppFormUtils.waitIdle(this, opts);
|
|
25553
25504
|
};
|
|
25554
|
-
|
|
25505
|
+
AppEditor.prototype.cancel = function (event) {
|
|
25555
25506
|
return __awaiter(this, void 0, void 0, function () {
|
|
25556
25507
|
return __generator(this, function (_b) {
|
|
25557
25508
|
switch (_b.label) {
|
|
@@ -25577,12 +25528,11 @@
|
|
|
25577
25528
|
*
|
|
25578
25529
|
* @param opts
|
|
25579
25530
|
*/
|
|
25580
|
-
|
|
25531
|
+
AppEditor.prototype.unload = function (opts) {
|
|
25581
25532
|
return __awaiter(this, void 0, void 0, function () {
|
|
25582
25533
|
return __generator(this, function (_b) {
|
|
25583
25534
|
console.debug('[tab-page] Unloading data...');
|
|
25584
25535
|
this.markAsLoading();
|
|
25585
|
-
this.selectedTabIndex = 0;
|
|
25586
25536
|
this._children.forEach(function (f) {
|
|
25587
25537
|
if (f instanceof AppForm) {
|
|
25588
25538
|
f.reset(null, opts);
|
|
@@ -25595,7 +25545,7 @@
|
|
|
25595
25545
|
});
|
|
25596
25546
|
});
|
|
25597
25547
|
};
|
|
25598
|
-
|
|
25548
|
+
AppEditor.prototype.reloadWithConfirmation = function (confirm) {
|
|
25599
25549
|
return __awaiter(this, void 0, void 0, function () {
|
|
25600
25550
|
var needConfirm, translations, alert;
|
|
25601
25551
|
return __generator(this, function (_b) {
|
|
@@ -25643,7 +25593,7 @@
|
|
|
25643
25593
|
});
|
|
25644
25594
|
});
|
|
25645
25595
|
};
|
|
25646
|
-
|
|
25596
|
+
AppEditor.prototype.goBack = function (event) {
|
|
25647
25597
|
var _a;
|
|
25648
25598
|
return __awaiter(this, void 0, void 0, function () {
|
|
25649
25599
|
return __generator(this, function (_b) {
|
|
@@ -25659,32 +25609,15 @@
|
|
|
25659
25609
|
});
|
|
25660
25610
|
});
|
|
25661
25611
|
};
|
|
25662
|
-
|
|
25612
|
+
AppEditor.prototype.logFormErrors = function () {
|
|
25663
25613
|
var _this = this;
|
|
25664
|
-
|
|
25665
|
-
if (
|
|
25666
|
-
|
|
25667
|
-
}
|
|
25668
|
-
else if (value > this.tabCount - 1) {
|
|
25669
|
-
value = this.tabCount - 1;
|
|
25670
|
-
}
|
|
25671
|
-
this._selectedTabIndex = value;
|
|
25672
|
-
this.selectedTabIndexChange.next(value);
|
|
25673
|
-
if (this.tabGroup && (!opts || opts.realignInkBar !== false)) {
|
|
25674
|
-
this.tabGroup.selectedIndex = value;
|
|
25675
|
-
this.markForCheck();
|
|
25676
|
-
// Wait tab change in UI, before realign ink tab
|
|
25677
|
-
setTimeout(function () { return _this.tabGroup.realignInkBar(); }, 200);
|
|
25678
|
-
}
|
|
25679
|
-
else if (!opts || opts.emitEvent !== false) {
|
|
25680
|
-
this.markForCheck();
|
|
25681
|
-
}
|
|
25682
|
-
};
|
|
25683
|
-
AppTabEditor.prototype.waitIdle = function (opts) {
|
|
25684
|
-
return AppFormUtils.waitIdle(this, opts);
|
|
25614
|
+
var _a;
|
|
25615
|
+
if (this.debug)
|
|
25616
|
+
console.debug('[app-tab-editor] Page not valid. Checking where (forms, tables)...');
|
|
25617
|
+
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return _this.logChildrenFormErrors(c); });
|
|
25685
25618
|
};
|
|
25686
25619
|
/* -- protected methods -- */
|
|
25687
|
-
|
|
25620
|
+
AppEditor.prototype.scrollToTop = function (duration) {
|
|
25688
25621
|
return __awaiter(this, void 0, void 0, function () {
|
|
25689
25622
|
var scrollToTop_1;
|
|
25690
25623
|
return __generator(this, function (_b) {
|
|
@@ -25706,13 +25639,13 @@
|
|
|
25706
25639
|
});
|
|
25707
25640
|
});
|
|
25708
25641
|
};
|
|
25709
|
-
|
|
25642
|
+
AppEditor.prototype.registerSubscription = function (sub) {
|
|
25710
25643
|
this._subscription.add(sub);
|
|
25711
25644
|
};
|
|
25712
|
-
|
|
25645
|
+
AppEditor.prototype.unregisterSubscription = function (sub) {
|
|
25713
25646
|
this._subscription.remove(sub);
|
|
25714
25647
|
};
|
|
25715
|
-
|
|
25648
|
+
AppEditor.prototype.saveIfDirtyAndConfirm = function (event, opts) {
|
|
25716
25649
|
return __awaiter(this, void 0, void 0, function () {
|
|
25717
25650
|
var confirm, cancel, translations, alert;
|
|
25718
25651
|
return __generator(this, function (_b) {
|
|
@@ -25766,7 +25699,7 @@
|
|
|
25766
25699
|
});
|
|
25767
25700
|
});
|
|
25768
25701
|
};
|
|
25769
|
-
|
|
25702
|
+
AppEditor.prototype.showToast = function (opts) {
|
|
25770
25703
|
return __awaiter(this, void 0, void 0, function () {
|
|
25771
25704
|
return __generator(this, function (_b) {
|
|
25772
25705
|
switch (_b.label) {
|
|
@@ -25781,18 +25714,11 @@
|
|
|
25781
25714
|
});
|
|
25782
25715
|
});
|
|
25783
25716
|
};
|
|
25784
|
-
|
|
25785
|
-
var _this = this;
|
|
25786
|
-
var _a;
|
|
25787
|
-
if (this.debug)
|
|
25788
|
-
console.debug('[app-tab-editor] Page not valid. Checking where (forms, tables)...');
|
|
25789
|
-
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return _this.logChildrenFormErrors(c); });
|
|
25790
|
-
};
|
|
25791
|
-
AppTabEditor.prototype.logChildrenFormErrors = function (c, prefix, path) {
|
|
25717
|
+
AppEditor.prototype.logChildrenFormErrors = function (c, prefix, path) {
|
|
25792
25718
|
var _this = this;
|
|
25793
25719
|
prefix = prefix || '[app-tab-editor] ';
|
|
25794
25720
|
// If editor
|
|
25795
|
-
if (c instanceof
|
|
25721
|
+
if (c instanceof AppEditor) {
|
|
25796
25722
|
c.logFormErrors();
|
|
25797
25723
|
}
|
|
25798
25724
|
// Angular form control
|
|
@@ -25830,11 +25756,179 @@
|
|
|
25830
25756
|
console.warn(prefix + " Unknown children sub-form: ", c);
|
|
25831
25757
|
}
|
|
25832
25758
|
};
|
|
25833
|
-
|
|
25759
|
+
AppEditor.prototype.markForCheck = function () {
|
|
25834
25760
|
// Should be override by subclasses, if change detection is Push
|
|
25835
25761
|
};
|
|
25836
|
-
return
|
|
25762
|
+
return AppEditor;
|
|
25837
25763
|
}());
|
|
25764
|
+
AppEditor.decorators = [
|
|
25765
|
+
{ type: i0.Directive }
|
|
25766
|
+
];
|
|
25767
|
+
AppEditor.ctorParameters = function () { return [
|
|
25768
|
+
{ type: i3.ActivatedRoute },
|
|
25769
|
+
{ type: i3.Router },
|
|
25770
|
+
{ type: i1$5.AlertController },
|
|
25771
|
+
{ type: i1$2.TranslateService }
|
|
25772
|
+
]; };
|
|
25773
|
+
AppEditor.propDecorators = {
|
|
25774
|
+
toolbar: [{ type: i0.ViewChild, args: [ToolbarToken,] }],
|
|
25775
|
+
formButtonsBar: [{ type: i0.ViewChild, args: [FormButtonsBarToken, { static: true },] }],
|
|
25776
|
+
content: [{ type: i0.ViewChild, args: [i1$5.IonContent, { static: true },] }]
|
|
25777
|
+
};
|
|
25778
|
+
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
25779
|
+
var AppTabEditor = /** @class */ (function (_super_1) {
|
|
25780
|
+
__extends(AppTabEditor, _super_1);
|
|
25781
|
+
function AppTabEditor(route, router, alertCtrl, translate, options) {
|
|
25782
|
+
var _this = _super_1.call(this, route, router, alertCtrl, translate) || this;
|
|
25783
|
+
_this.route = route;
|
|
25784
|
+
_this.router = router;
|
|
25785
|
+
_this.alertCtrl = alertCtrl;
|
|
25786
|
+
_this.translate = translate;
|
|
25787
|
+
_this._selectedTabIndex = 0;
|
|
25788
|
+
_this.selectedTabIndexChange = new i0.EventEmitter();
|
|
25789
|
+
options = Object.assign({ tabCount: 1, enableSwipe: true, tabGroupAnimationDuration: '200ms' }, options);
|
|
25790
|
+
_this.tabCount = options.tabCount;
|
|
25791
|
+
_this.enableSwipe = options.enableSwipe;
|
|
25792
|
+
_this.tabGroupAnimationDuration = options.tabGroupAnimationDuration;
|
|
25793
|
+
return _this;
|
|
25794
|
+
}
|
|
25795
|
+
Object.defineProperty(AppTabEditor.prototype, "selectedTabIndex", {
|
|
25796
|
+
get: function () {
|
|
25797
|
+
return this._selectedTabIndex;
|
|
25798
|
+
},
|
|
25799
|
+
set: function (value) {
|
|
25800
|
+
this.setSelectedTabIndex(value);
|
|
25801
|
+
},
|
|
25802
|
+
enumerable: false,
|
|
25803
|
+
configurable: true
|
|
25804
|
+
});
|
|
25805
|
+
AppTabEditor.prototype.ngOnInit = function () {
|
|
25806
|
+
var _this = this;
|
|
25807
|
+
_super_1.prototype.ngOnInit.call(this);
|
|
25808
|
+
this.queryTabIndexParamName = this.queryTabIndexParamName || 'tab';
|
|
25809
|
+
// Read the selected tab index, from path query params
|
|
25810
|
+
if (this.tabGroup) {
|
|
25811
|
+
this.registerSubscription(this.route.queryParams
|
|
25812
|
+
.subscribe(function (queryParams) {
|
|
25813
|
+
_this.queryParams = Object.assign({}, queryParams);
|
|
25814
|
+
// Parse tab param
|
|
25815
|
+
if (_this.tabCount > 1 && _this.queryTabIndexParamName) {
|
|
25816
|
+
var tabIndex = queryParams[_this.queryTabIndexParamName];
|
|
25817
|
+
_this.queryParams[_this.queryTabIndexParamName] = tabIndex && parseInt(tabIndex) || undefined;
|
|
25818
|
+
if (isNotNil(_this.queryParams[_this.queryTabIndexParamName])) {
|
|
25819
|
+
_this.selectedTabIndex = _this.queryParams[_this.queryTabIndexParamName];
|
|
25820
|
+
}
|
|
25821
|
+
}
|
|
25822
|
+
// Realign tab, after a delay because the tab can be disabled when component is created
|
|
25823
|
+
setTimeout(function () { return _this.tabGroup.realignInkBar(); }, 500);
|
|
25824
|
+
}));
|
|
25825
|
+
}
|
|
25826
|
+
};
|
|
25827
|
+
AppTabEditor.prototype.ngOnDestroy = function () {
|
|
25828
|
+
_super_1.prototype.ngOnDestroy.call(this);
|
|
25829
|
+
this.selectedTabIndexChange.complete();
|
|
25830
|
+
};
|
|
25831
|
+
AppTabEditor.prototype.setSelectedTabIndex = function (value, opts) {
|
|
25832
|
+
var _this = this;
|
|
25833
|
+
// Fix value
|
|
25834
|
+
if (value < 0) {
|
|
25835
|
+
value = 0;
|
|
25836
|
+
}
|
|
25837
|
+
else if (value > this.tabCount - 1) {
|
|
25838
|
+
value = this.tabCount - 1;
|
|
25839
|
+
}
|
|
25840
|
+
this._selectedTabIndex = value;
|
|
25841
|
+
this.selectedTabIndexChange.next(value);
|
|
25842
|
+
if (this.tabGroup && (!opts || opts.realignInkBar !== false)) {
|
|
25843
|
+
this.tabGroup.selectedIndex = value;
|
|
25844
|
+
this.markForCheck();
|
|
25845
|
+
// Wait tab change in UI, before realign ink tab
|
|
25846
|
+
setTimeout(function () { return _this.tabGroup.realignInkBar(); }, 200);
|
|
25847
|
+
}
|
|
25848
|
+
else if (!opts || opts.emitEvent !== false) {
|
|
25849
|
+
this.markForCheck();
|
|
25850
|
+
}
|
|
25851
|
+
};
|
|
25852
|
+
AppTabEditor.prototype.onTabChange = function (event, queryTabIndexParamName) {
|
|
25853
|
+
queryTabIndexParamName = queryTabIndexParamName || this.queryTabIndexParamName;
|
|
25854
|
+
if (!queryTabIndexParamName)
|
|
25855
|
+
return true; // Skip if tab query param not set
|
|
25856
|
+
if (!this.queryParams || +this.queryParams[queryTabIndexParamName] !== event.index) {
|
|
25857
|
+
this.queryParams = this.queryParams || {};
|
|
25858
|
+
this.queryParams[queryTabIndexParamName] = event.index;
|
|
25859
|
+
if (queryTabIndexParamName === 'tab' && isNotNil(this.queryParams['subtab'])) {
|
|
25860
|
+
delete this.queryParams.subtab; // clean subtab
|
|
25861
|
+
}
|
|
25862
|
+
this.router.navigate(['.'], {
|
|
25863
|
+
relativeTo: this.route,
|
|
25864
|
+
queryParams: this.queryParams,
|
|
25865
|
+
replaceUrl: true
|
|
25866
|
+
});
|
|
25867
|
+
return true;
|
|
25868
|
+
}
|
|
25869
|
+
return false;
|
|
25870
|
+
};
|
|
25871
|
+
/**
|
|
25872
|
+
* Action triggered when user swipes
|
|
25873
|
+
*/
|
|
25874
|
+
AppTabEditor.prototype.onSwipeTab = function (event) {
|
|
25875
|
+
var _this = this;
|
|
25876
|
+
// DEBUG
|
|
25877
|
+
// if (this.debug) console.debug("[tab-page] onSwipeTab()");
|
|
25878
|
+
// Skip, if not a valid swipe event
|
|
25879
|
+
if (!this.enableSwipe || !event
|
|
25880
|
+
|| event.defaultPrevented || (event.srcEvent && event.srcEvent.defaultPrevented)
|
|
25881
|
+
|| event.pointerType !== 'touch') {
|
|
25882
|
+
return false;
|
|
25883
|
+
}
|
|
25884
|
+
// DEBUG
|
|
25885
|
+
//if (this.debug)
|
|
25886
|
+
//console.debug("[tab-page] Detected swipe: " + event.type, event);
|
|
25887
|
+
var selectTabIndex = this.selectedTabIndex;
|
|
25888
|
+
switch (event.type) {
|
|
25889
|
+
// Open next tab
|
|
25890
|
+
case 'swipeleft':
|
|
25891
|
+
var isLast = selectTabIndex >= (this.tabCount - 1);
|
|
25892
|
+
selectTabIndex = isLast ? 0 : selectTabIndex + 1;
|
|
25893
|
+
break;
|
|
25894
|
+
// Open previous tab
|
|
25895
|
+
case 'swiperight':
|
|
25896
|
+
var isFirst = selectTabIndex <= 0;
|
|
25897
|
+
selectTabIndex = isFirst ? this.tabCount : selectTabIndex - 1;
|
|
25898
|
+
break;
|
|
25899
|
+
// Other case
|
|
25900
|
+
default:
|
|
25901
|
+
console.error('[tab-page] Unknown swipe action: ' + event.type);
|
|
25902
|
+
return false;
|
|
25903
|
+
}
|
|
25904
|
+
setTimeout(function () {
|
|
25905
|
+
_this.selectedTabIndex = selectTabIndex;
|
|
25906
|
+
_this.markForCheck();
|
|
25907
|
+
});
|
|
25908
|
+
return true;
|
|
25909
|
+
};
|
|
25910
|
+
AppTabEditor.prototype.onSubTabChange = function (event) {
|
|
25911
|
+
this.onTabChange(event, 'subtab');
|
|
25912
|
+
};
|
|
25913
|
+
AppTabEditor.prototype.unload = function (opts) {
|
|
25914
|
+
var _super = Object.create(null, {
|
|
25915
|
+
unload: { get: function () { return _super_1.prototype.unload; } }
|
|
25916
|
+
});
|
|
25917
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
25918
|
+
return __generator(this, function (_b) {
|
|
25919
|
+
switch (_b.label) {
|
|
25920
|
+
case 0:
|
|
25921
|
+
this.selectedTabIndex = 0;
|
|
25922
|
+
return [4 /*yield*/, _super.unload.call(this, opts)];
|
|
25923
|
+
case 1:
|
|
25924
|
+
_b.sent();
|
|
25925
|
+
return [2 /*return*/];
|
|
25926
|
+
}
|
|
25927
|
+
});
|
|
25928
|
+
});
|
|
25929
|
+
};
|
|
25930
|
+
return AppTabEditor;
|
|
25931
|
+
}(AppEditor));
|
|
25838
25932
|
AppTabEditor.decorators = [
|
|
25839
25933
|
{ type: i0.Directive }
|
|
25840
25934
|
];
|
|
@@ -25847,12 +25941,9 @@
|
|
|
25847
25941
|
]; };
|
|
25848
25942
|
AppTabEditor.propDecorators = {
|
|
25849
25943
|
queryTabIndexParamName: [{ type: i0.Input }],
|
|
25850
|
-
tabGroup: [{ type: i0.ViewChild, args: ['tabGroup', { static: true },] }],
|
|
25851
|
-
toolbar: [{ type: i0.ViewChild, args: [ToolbarToken,] }],
|
|
25852
|
-
formButtonsBar: [{ type: i0.ViewChild, args: [FormButtonsBarToken, { static: true },] }],
|
|
25853
|
-
content: [{ type: i0.ViewChild, args: [i1$5.IonContent, { static: true },] }],
|
|
25854
25944
|
selectedTabIndex: [{ type: i0.Input }],
|
|
25855
|
-
selectedTabIndexChange: [{ type: i0.Output }]
|
|
25945
|
+
selectedTabIndexChange: [{ type: i0.Output }],
|
|
25946
|
+
tabGroup: [{ type: i0.ViewChild, args: ['tabGroup', { static: true },] }]
|
|
25856
25947
|
};
|
|
25857
25948
|
|
|
25858
25949
|
var AppEditorOptions = /** @class */ (function (_super) {
|
|
@@ -26092,13 +26183,16 @@
|
|
|
26092
26183
|
opts = Object.assign({ updateRoute: this._autoUpdateRoute && idChanged && !this.loading, openTabIndex: this._autoOpenNextTab && idChanged && isNil(this.previousDataId) && this.computeNextTabIndex() }, opts);
|
|
26093
26184
|
this.data = data;
|
|
26094
26185
|
this.previousDataId = data.id || null;
|
|
26095
|
-
|
|
26096
|
-
if (!promiseOrVoid) return [3 /*break*/, 2];
|
|
26097
|
-
return [4 /*yield*/, promiseOrVoid];
|
|
26186
|
+
return [4 /*yield*/, this.ready()];
|
|
26098
26187
|
case 1:
|
|
26099
26188
|
_b.sent();
|
|
26100
|
-
|
|
26189
|
+
promiseOrVoid = this.setValue(data);
|
|
26190
|
+
if (!promiseOrVoid) return [3 /*break*/, 3];
|
|
26191
|
+
return [4 /*yield*/, promiseOrVoid];
|
|
26101
26192
|
case 2:
|
|
26193
|
+
_b.sent();
|
|
26194
|
+
_b.label = 3;
|
|
26195
|
+
case 3:
|
|
26102
26196
|
if (!opts || opts.emitEvent !== false) {
|
|
26103
26197
|
this.markAsPristine();
|
|
26104
26198
|
this.markAsUntouched();
|
|
@@ -27821,6 +27915,7 @@
|
|
|
27821
27915
|
exports.AdminModule = AdminModule;
|
|
27822
27916
|
exports.AdminRoutingModule = AdminRoutingModule;
|
|
27823
27917
|
exports.Alerts = Alerts;
|
|
27918
|
+
exports.AppEditor = AppEditor;
|
|
27824
27919
|
exports.AppEditorOptions = AppEditorOptions;
|
|
27825
27920
|
exports.AppEntityEditor = AppEntityEditor;
|
|
27826
27921
|
exports.AppForm = AppForm;
|