@sumaris-net/ngx-components 1.10.4 → 1.10.7
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 +90 -89
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/esm2015/src/app/core/core.module.js +3 -5
- package/esm2015/src/app/core/form/entity-editor.class.js +3 -2
- package/esm2015/src/app/core/services/model/entity.model.js +5 -1
- package/esm2015/src/app/core/table/table.class.js +1 -5
- package/fesm2015/sumaris-net.ngx-components.js +8 -8
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/core.module.d.ts +1 -2
- package/src/app/core/services/model/entity.model.d.ts +1 -0
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -10416,6 +10416,10 @@
|
|
|
10416
10416
|
function EntityUtils() {
|
|
10417
10417
|
}
|
|
10418
10418
|
// Check that the object has a NOT nil attribute (ID by default)
|
|
10419
|
+
EntityUtils.isEntity = function (obj) {
|
|
10420
|
+
return isNotNil(obj.__typename) && (typeof obj.fromObject === 'function') && (typeof obj.asObject === 'function');
|
|
10421
|
+
};
|
|
10422
|
+
// Check that the object has a NOT nil attribute (ID by default)
|
|
10419
10423
|
EntityUtils.isNotEmpty = function (obj, checkedAttribute) {
|
|
10420
10424
|
return !!obj && obj[checkedAttribute] !== null && obj[checkedAttribute] !== undefined;
|
|
10421
10425
|
};
|
|
@@ -23626,13 +23630,12 @@
|
|
|
23626
23630
|
var CoreModule = /** @class */ (function () {
|
|
23627
23631
|
function CoreModule() {
|
|
23628
23632
|
}
|
|
23629
|
-
CoreModule.forRoot = function (
|
|
23633
|
+
CoreModule.forRoot = function () {
|
|
23630
23634
|
console.info('[core] Creating module (root)');
|
|
23631
23635
|
return {
|
|
23632
23636
|
ngModule: CoreModule,
|
|
23633
23637
|
providers: [
|
|
23634
|
-
PlatformService
|
|
23635
|
-
{ provide: ENVIRONMENT, useValue: environment }
|
|
23638
|
+
PlatformService
|
|
23636
23639
|
]
|
|
23637
23640
|
};
|
|
23638
23641
|
};
|
|
@@ -25658,10 +25661,6 @@
|
|
|
25658
25661
|
if (deleted) {
|
|
25659
25662
|
_this.visibleRowCount--;
|
|
25660
25663
|
_this.totalRowCount--;
|
|
25661
|
-
// Forget is was the edited row
|
|
25662
|
-
if (row === _this.editedRow) {
|
|
25663
|
-
_this.editedRow = undefined;
|
|
25664
|
-
}
|
|
25665
25664
|
return res;
|
|
25666
25665
|
}
|
|
25667
25666
|
}
|
|
@@ -27299,7 +27298,9 @@
|
|
|
27299
27298
|
var AppEntityEditor = /** @class */ (function (_super) {
|
|
27300
27299
|
__extends(AppEntityEditor, _super);
|
|
27301
27300
|
function AppEntityEditor(injector, dataType, dataService, options) {
|
|
27302
|
-
var _this =
|
|
27301
|
+
var _this = this;
|
|
27302
|
+
var _a, _b;
|
|
27303
|
+
_this = _super.call(this, injector.get(i3.ActivatedRoute), injector.get(i3.Router), injector.get(i1$5.AlertController), injector.get(i1$2.TranslateService), options) || this;
|
|
27303
27304
|
_this.dataType = dataType;
|
|
27304
27305
|
_this.dataService = dataService;
|
|
27305
27306
|
_this.saving = false;
|
|
@@ -27308,7 +27309,7 @@
|
|
|
27308
27309
|
_this.environement = injector.get(ENVIRONMENT);
|
|
27309
27310
|
options = Object.assign({
|
|
27310
27311
|
// Default options
|
|
27311
|
-
enableListenChanges:
|
|
27312
|
+
enableListenChanges: ((_a = _this.environement.entityEditor) === null || _a === void 0 ? void 0 : _a.enableListenChanges) || false, listenIntervalInSeconds: toNumber((_b = _this.environement.entityEditor) === null || _b === void 0 ? void 0 : _b.listenIntervalInSeconds, 0), pathIdAttribute: 'id', autoLoad: true, autoUpdateRoute: true, i18nPrefix: ''
|
|
27312
27313
|
}, options);
|
|
27313
27314
|
_this.settings = injector.get(LocalSettingsService);
|
|
27314
27315
|
_this.errorTranslator = injector.get(FormErrorTranslator);
|
|
@@ -27443,27 +27444,27 @@
|
|
|
27443
27444
|
AppEntityEditor.prototype.load = function (id, opts) {
|
|
27444
27445
|
return __awaiter(this, void 0, void 0, function () {
|
|
27445
27446
|
var data, err_1, data, err_2;
|
|
27446
|
-
return __generator(this, function (
|
|
27447
|
-
switch (
|
|
27447
|
+
return __generator(this, function (_c) {
|
|
27448
|
+
switch (_c.label) {
|
|
27448
27449
|
case 0:
|
|
27449
27450
|
if (!this.dataService)
|
|
27450
27451
|
throw new Error('Cannot load data: missing \'dataService\'!');
|
|
27451
27452
|
this.resetError();
|
|
27452
27453
|
if (!isNil(id)) return [3 /*break*/, 7];
|
|
27453
|
-
|
|
27454
|
+
_c.label = 1;
|
|
27454
27455
|
case 1:
|
|
27455
|
-
|
|
27456
|
+
_c.trys.push([1, 4, 5, 6]);
|
|
27456
27457
|
data = new this.dataType();
|
|
27457
27458
|
this._usageMode = this.computeUsageMode(data);
|
|
27458
27459
|
return [4 /*yield*/, this.onNewEntity(data, opts)];
|
|
27459
27460
|
case 2:
|
|
27460
|
-
|
|
27461
|
+
_c.sent();
|
|
27461
27462
|
return [4 /*yield*/, this.updateView(data, Object.assign({ openTabIndex: 0 }, opts))];
|
|
27462
27463
|
case 3:
|
|
27463
|
-
|
|
27464
|
+
_c.sent();
|
|
27464
27465
|
return [3 /*break*/, 6];
|
|
27465
27466
|
case 4:
|
|
27466
|
-
err_1 =
|
|
27467
|
+
err_1 = _c.sent();
|
|
27467
27468
|
this.setError(err_1, { emitEvent: false });
|
|
27468
27469
|
this.selectedTabIndex = 0;
|
|
27469
27470
|
return [3 /*break*/, 6];
|
|
@@ -27472,23 +27473,23 @@
|
|
|
27472
27473
|
return [7 /*endfinally*/];
|
|
27473
27474
|
case 6: return [3 /*break*/, 13];
|
|
27474
27475
|
case 7:
|
|
27475
|
-
|
|
27476
|
+
_c.trys.push([7, 11, 12, 13]);
|
|
27476
27477
|
return [4 /*yield*/, this.dataService.load(id, opts)];
|
|
27477
27478
|
case 8:
|
|
27478
|
-
data =
|
|
27479
|
+
data = _c.sent();
|
|
27479
27480
|
if (!data)
|
|
27480
27481
|
throw { code: ErrorCodes$2.DATA_NOT_FOUND_ERROR, message: 'ERROR.DATA_NO_FOUND' };
|
|
27481
27482
|
this._usageMode = this.computeUsageMode(data);
|
|
27482
27483
|
return [4 /*yield*/, this.onEntityLoaded(data, opts)];
|
|
27483
27484
|
case 9:
|
|
27484
|
-
|
|
27485
|
+
_c.sent();
|
|
27485
27486
|
return [4 /*yield*/, this.updateView(data, opts)];
|
|
27486
27487
|
case 10:
|
|
27487
|
-
|
|
27488
|
+
_c.sent();
|
|
27488
27489
|
this.startListenRemoteChanges();
|
|
27489
27490
|
return [3 /*break*/, 13];
|
|
27490
27491
|
case 11:
|
|
27491
|
-
err_2 =
|
|
27492
|
+
err_2 = _c.sent();
|
|
27492
27493
|
this.setError(err_2);
|
|
27493
27494
|
this.selectedTabIndex = 0;
|
|
27494
27495
|
return [3 /*break*/, 13];
|
|
@@ -27536,8 +27537,8 @@
|
|
|
27536
27537
|
return __awaiter(this, void 0, void 0, function () {
|
|
27537
27538
|
var idChanged, promiseOrVoid;
|
|
27538
27539
|
var _this = this;
|
|
27539
|
-
return __generator(this, function (
|
|
27540
|
-
switch (
|
|
27540
|
+
return __generator(this, function (_c) {
|
|
27541
|
+
switch (_c.label) {
|
|
27541
27542
|
case 0:
|
|
27542
27543
|
idChanged = isNotNil(data.id)
|
|
27543
27544
|
&& this.previousDataId !== undefined // Ignore if first loading (=undefined)
|
|
@@ -27547,13 +27548,13 @@
|
|
|
27547
27548
|
this.previousDataId = data.id || null;
|
|
27548
27549
|
return [4 /*yield*/, this.ready()];
|
|
27549
27550
|
case 1:
|
|
27550
|
-
|
|
27551
|
+
_c.sent();
|
|
27551
27552
|
promiseOrVoid = this.setValue(data);
|
|
27552
27553
|
if (!promiseOrVoid) return [3 /*break*/, 3];
|
|
27553
27554
|
return [4 /*yield*/, promiseOrVoid];
|
|
27554
27555
|
case 2:
|
|
27555
|
-
|
|
27556
|
-
|
|
27556
|
+
_c.sent();
|
|
27557
|
+
_c.label = 3;
|
|
27557
27558
|
case 3:
|
|
27558
27559
|
if (!opts || opts.emitEvent !== false) {
|
|
27559
27560
|
this.markAsPristine();
|
|
@@ -27597,8 +27598,8 @@
|
|
|
27597
27598
|
AppEntityEditor.prototype.updateTabAndRoute = function (data, opts) {
|
|
27598
27599
|
return __awaiter(this, void 0, void 0, function () {
|
|
27599
27600
|
var forcedQueryParams;
|
|
27600
|
-
return __generator(this, function (
|
|
27601
|
-
switch (
|
|
27601
|
+
return __generator(this, function (_c) {
|
|
27602
|
+
switch (_c.label) {
|
|
27602
27603
|
case 0:
|
|
27603
27604
|
this.queryParams = this.queryParams || {};
|
|
27604
27605
|
// Open the next tab
|
|
@@ -27613,18 +27614,18 @@
|
|
|
27613
27614
|
queryParams: Object.assign(Object.assign({}, this.queryParams), forcedQueryParams)
|
|
27614
27615
|
})];
|
|
27615
27616
|
case 1:
|
|
27616
|
-
|
|
27617
|
+
_c.sent();
|
|
27617
27618
|
return [3 /*break*/, 4];
|
|
27618
27619
|
case 2: return [4 /*yield*/, this.router.navigate(['..', 'new'], {
|
|
27619
27620
|
relativeTo: this.route,
|
|
27620
27621
|
queryParams: Object.assign(Object.assign({}, this.queryParams), forcedQueryParams)
|
|
27621
27622
|
})];
|
|
27622
27623
|
case 3:
|
|
27623
|
-
|
|
27624
|
-
|
|
27624
|
+
_c.sent();
|
|
27625
|
+
_c.label = 4;
|
|
27625
27626
|
case 4: return [4 /*yield*/, this.updateRoute(data, this.queryParams)];
|
|
27626
27627
|
case 5:
|
|
27627
|
-
|
|
27628
|
+
_c.sent();
|
|
27628
27629
|
return [2 /*return*/];
|
|
27629
27630
|
}
|
|
27630
27631
|
});
|
|
@@ -27642,16 +27643,16 @@
|
|
|
27642
27643
|
AppEntityEditor.prototype.saveAndClose = function (event, options) {
|
|
27643
27644
|
return __awaiter(this, void 0, void 0, function () {
|
|
27644
27645
|
var saved;
|
|
27645
|
-
return __generator(this, function (
|
|
27646
|
-
switch (
|
|
27646
|
+
return __generator(this, function (_c) {
|
|
27647
|
+
switch (_c.label) {
|
|
27647
27648
|
case 0: return [4 /*yield*/, this.save(event)];
|
|
27648
27649
|
case 1:
|
|
27649
|
-
saved =
|
|
27650
|
+
saved = _c.sent();
|
|
27650
27651
|
if (!saved) return [3 /*break*/, 3];
|
|
27651
27652
|
return [4 /*yield*/, this.close(event)];
|
|
27652
27653
|
case 2:
|
|
27653
|
-
|
|
27654
|
-
|
|
27654
|
+
_c.sent();
|
|
27655
|
+
_c.label = 3;
|
|
27655
27656
|
case 3: return [2 /*return*/, saved];
|
|
27656
27657
|
}
|
|
27657
27658
|
});
|
|
@@ -27659,7 +27660,7 @@
|
|
|
27659
27660
|
};
|
|
27660
27661
|
AppEntityEditor.prototype.close = function (event) {
|
|
27661
27662
|
return __awaiter(this, void 0, void 0, function () {
|
|
27662
|
-
return __generator(this, function (
|
|
27663
|
+
return __generator(this, function (_c) {
|
|
27663
27664
|
if (event) {
|
|
27664
27665
|
if (event.defaultPrevented)
|
|
27665
27666
|
return [2 /*return*/];
|
|
@@ -27679,8 +27680,8 @@
|
|
|
27679
27680
|
AppEntityEditor.prototype.save = function (event, opts) {
|
|
27680
27681
|
return __awaiter(this, void 0, void 0, function () {
|
|
27681
27682
|
var data, updatedData, err_3;
|
|
27682
|
-
return __generator(this, function (
|
|
27683
|
-
switch (
|
|
27683
|
+
return __generator(this, function (_c) {
|
|
27684
|
+
switch (_c.label) {
|
|
27684
27685
|
case 0:
|
|
27685
27686
|
if (this.loading || this.saving) {
|
|
27686
27687
|
console.debug('[data-editor] Skip save: editor is busy (loading or saving)');
|
|
@@ -27694,7 +27695,7 @@
|
|
|
27694
27695
|
return [4 /*yield*/, this.waitWhilePending()];
|
|
27695
27696
|
case 1:
|
|
27696
27697
|
// Wait end of async validation
|
|
27697
|
-
|
|
27698
|
+
_c.sent();
|
|
27698
27699
|
// If invalid
|
|
27699
27700
|
if (this.invalid) {
|
|
27700
27701
|
this.markAllAsTouched();
|
|
@@ -27707,31 +27708,31 @@
|
|
|
27707
27708
|
this.resetError();
|
|
27708
27709
|
if (this.debug)
|
|
27709
27710
|
console.debug('[data-editor] Saving data...');
|
|
27710
|
-
|
|
27711
|
+
_c.label = 2;
|
|
27711
27712
|
case 2:
|
|
27712
|
-
|
|
27713
|
+
_c.trys.push([2, 7, 8, 9]);
|
|
27713
27714
|
return [4 /*yield*/, this.getValue()];
|
|
27714
27715
|
case 3:
|
|
27715
|
-
data =
|
|
27716
|
+
data = _c.sent();
|
|
27716
27717
|
this.disable();
|
|
27717
27718
|
return [4 /*yield*/, this.dataService.save(data, opts)];
|
|
27718
27719
|
case 4:
|
|
27719
|
-
updatedData =
|
|
27720
|
+
updatedData = _c.sent();
|
|
27720
27721
|
return [4 /*yield*/, this.onEntitySaved(updatedData)];
|
|
27721
27722
|
case 5:
|
|
27722
|
-
|
|
27723
|
+
_c.sent();
|
|
27723
27724
|
// Update the view (e.g metadata)
|
|
27724
27725
|
return [4 /*yield*/, this.updateView(updatedData, opts)];
|
|
27725
27726
|
case 6:
|
|
27726
27727
|
// Update the view (e.g metadata)
|
|
27727
|
-
|
|
27728
|
+
_c.sent();
|
|
27728
27729
|
// Subscribe to remote changes
|
|
27729
27730
|
if (!this._listenChangesSubscription)
|
|
27730
27731
|
this.startListenRemoteChanges();
|
|
27731
27732
|
this.submitted = false;
|
|
27732
27733
|
return [2 /*return*/, true];
|
|
27733
27734
|
case 7:
|
|
27734
|
-
err_3 =
|
|
27735
|
+
err_3 = _c.sent();
|
|
27735
27736
|
this.submitted = true;
|
|
27736
27737
|
this.setError(err_3);
|
|
27737
27738
|
this.selectedTabIndex = 0;
|
|
@@ -27760,29 +27761,29 @@
|
|
|
27760
27761
|
AppEntityEditor.prototype.saveAndGetDataIfValid = function () {
|
|
27761
27762
|
return __awaiter(this, void 0, void 0, function () {
|
|
27762
27763
|
var saved;
|
|
27763
|
-
return __generator(this, function (
|
|
27764
|
-
switch (
|
|
27764
|
+
return __generator(this, function (_c) {
|
|
27765
|
+
switch (_c.label) {
|
|
27765
27766
|
case 0:
|
|
27766
27767
|
if (!!this.valid) return [3 /*break*/, 2];
|
|
27767
27768
|
// Make sure validation is finished
|
|
27768
27769
|
return [4 /*yield*/, AppFormUtils.waitWhilePending(this)];
|
|
27769
27770
|
case 1:
|
|
27770
27771
|
// Make sure validation is finished
|
|
27771
|
-
|
|
27772
|
+
_c.sent();
|
|
27772
27773
|
// If invalid: Open the first tab in error
|
|
27773
27774
|
if (this.invalid) {
|
|
27774
27775
|
this.openFirstInvalidTab();
|
|
27775
27776
|
return [2 /*return*/, undefined];
|
|
27776
27777
|
}
|
|
27777
|
-
|
|
27778
|
+
_c.label = 2;
|
|
27778
27779
|
case 2:
|
|
27779
27780
|
if (!this.dirty) return [3 /*break*/, 4];
|
|
27780
27781
|
return [4 /*yield*/, this.save(new Event('save'))];
|
|
27781
27782
|
case 3:
|
|
27782
|
-
saved =
|
|
27783
|
+
saved = _c.sent();
|
|
27783
27784
|
if (!saved)
|
|
27784
27785
|
return [2 /*return*/, undefined];
|
|
27785
|
-
|
|
27786
|
+
_c.label = 4;
|
|
27786
27787
|
case 4:
|
|
27787
27788
|
// Valid and saved data
|
|
27788
27789
|
return [2 /*return*/, this.data];
|
|
@@ -27794,40 +27795,40 @@
|
|
|
27794
27795
|
return __awaiter(this, void 0, void 0, function () {
|
|
27795
27796
|
var confirmation, data, isNew, err_4;
|
|
27796
27797
|
var _this = this;
|
|
27797
|
-
return __generator(this, function (
|
|
27798
|
-
switch (
|
|
27798
|
+
return __generator(this, function (_c) {
|
|
27799
|
+
switch (_c.label) {
|
|
27799
27800
|
case 0:
|
|
27800
27801
|
if (this.loading || this.saving)
|
|
27801
27802
|
return [2 /*return*/, false];
|
|
27802
27803
|
return [4 /*yield*/, Alerts.askDeleteConfirmation(this.alertCtrl, this.translate)];
|
|
27803
27804
|
case 1:
|
|
27804
|
-
confirmation =
|
|
27805
|
+
confirmation = _c.sent();
|
|
27805
27806
|
if (!confirmation)
|
|
27806
27807
|
return [2 /*return*/];
|
|
27807
27808
|
console.debug('[data-editor] Asking to delete...');
|
|
27808
27809
|
this.markAsSaving();
|
|
27809
27810
|
this.resetError();
|
|
27810
|
-
|
|
27811
|
+
_c.label = 2;
|
|
27811
27812
|
case 2:
|
|
27812
|
-
|
|
27813
|
+
_c.trys.push([2, 7, , 8]);
|
|
27813
27814
|
return [4 /*yield*/, this.getValue()];
|
|
27814
27815
|
case 3:
|
|
27815
|
-
data =
|
|
27816
|
+
data = _c.sent();
|
|
27816
27817
|
isNew = this.isNewData;
|
|
27817
27818
|
this.disable();
|
|
27818
27819
|
if (!!isNew) return [3 /*break*/, 5];
|
|
27819
27820
|
return [4 /*yield*/, this.dataService.delete(data)];
|
|
27820
27821
|
case 4:
|
|
27821
|
-
|
|
27822
|
-
|
|
27822
|
+
_c.sent();
|
|
27823
|
+
_c.label = 5;
|
|
27823
27824
|
case 5: return [4 /*yield*/, this.onEntityDeleted(data)];
|
|
27824
27825
|
case 6:
|
|
27825
|
-
|
|
27826
|
+
_c.sent();
|
|
27826
27827
|
// Remove page history
|
|
27827
27828
|
this.removePageHistory();
|
|
27828
27829
|
return [3 /*break*/, 8];
|
|
27829
27830
|
case 7:
|
|
27830
|
-
err_4 =
|
|
27831
|
+
err_4 = _c.sent();
|
|
27831
27832
|
this.submitted = true;
|
|
27832
27833
|
this.setError(err_4);
|
|
27833
27834
|
this.selectedTabIndex = 0;
|
|
@@ -27839,7 +27840,7 @@
|
|
|
27839
27840
|
return [4 /*yield*/, setTimeout(function () { return _this.goBack(); }, 500)];
|
|
27840
27841
|
case 9:
|
|
27841
27842
|
// Wait, then go back (wait is need in order to update back href is need)
|
|
27842
|
-
|
|
27843
|
+
_c.sent();
|
|
27843
27844
|
return [2 /*return*/, true];
|
|
27844
27845
|
}
|
|
27845
27846
|
});
|
|
@@ -27847,13 +27848,13 @@
|
|
|
27847
27848
|
};
|
|
27848
27849
|
AppEntityEditor.prototype.reload = function () {
|
|
27849
27850
|
return __awaiter(this, void 0, void 0, function () {
|
|
27850
|
-
return __generator(this, function (
|
|
27851
|
-
switch (
|
|
27851
|
+
return __generator(this, function (_c) {
|
|
27852
|
+
switch (_c.label) {
|
|
27852
27853
|
case 0:
|
|
27853
27854
|
this.markAsLoading();
|
|
27854
27855
|
return [4 /*yield*/, this.load(this.data && this.data.id)];
|
|
27855
27856
|
case 1:
|
|
27856
|
-
|
|
27857
|
+
_c.sent();
|
|
27857
27858
|
return [2 /*return*/];
|
|
27858
27859
|
}
|
|
27859
27860
|
});
|
|
@@ -27862,7 +27863,7 @@
|
|
|
27862
27863
|
AppEntityEditor.prototype.goBack = function (event) {
|
|
27863
27864
|
var _a;
|
|
27864
27865
|
return __awaiter(this, void 0, void 0, function () {
|
|
27865
|
-
return __generator(this, function (
|
|
27866
|
+
return __generator(this, function (_c) {
|
|
27866
27867
|
// Go back
|
|
27867
27868
|
if ((_a = this.toolbar) === null || _a === void 0 ? void 0 : _a.canGoBack) {
|
|
27868
27869
|
return [2 /*return*/, this.toolbar.goBack()];
|
|
@@ -27923,7 +27924,7 @@
|
|
|
27923
27924
|
};
|
|
27924
27925
|
AppEntityEditor.prototype.unload = function () {
|
|
27925
27926
|
return __awaiter(this, void 0, void 0, function () {
|
|
27926
|
-
return __generator(this, function (
|
|
27927
|
+
return __generator(this, function (_c) {
|
|
27927
27928
|
this.stopListenRemoteChanges();
|
|
27928
27929
|
this.form.reset();
|
|
27929
27930
|
this.registerForms();
|
|
@@ -27936,35 +27937,35 @@
|
|
|
27936
27937
|
};
|
|
27937
27938
|
AppEntityEditor.prototype.onBeforeEntityLoad = function () {
|
|
27938
27939
|
return __awaiter(this, void 0, void 0, function () {
|
|
27939
|
-
return __generator(this, function (
|
|
27940
|
+
return __generator(this, function (_c) {
|
|
27940
27941
|
return [2 /*return*/];
|
|
27941
27942
|
});
|
|
27942
27943
|
});
|
|
27943
27944
|
};
|
|
27944
27945
|
AppEntityEditor.prototype.onNewEntity = function (data, options) {
|
|
27945
27946
|
return __awaiter(this, void 0, void 0, function () {
|
|
27946
|
-
return __generator(this, function (
|
|
27947
|
+
return __generator(this, function (_c) {
|
|
27947
27948
|
return [2 /*return*/];
|
|
27948
27949
|
});
|
|
27949
27950
|
});
|
|
27950
27951
|
};
|
|
27951
27952
|
AppEntityEditor.prototype.onEntityLoaded = function (data, options) {
|
|
27952
27953
|
return __awaiter(this, void 0, void 0, function () {
|
|
27953
|
-
return __generator(this, function (
|
|
27954
|
+
return __generator(this, function (_c) {
|
|
27954
27955
|
return [2 /*return*/];
|
|
27955
27956
|
});
|
|
27956
27957
|
});
|
|
27957
27958
|
};
|
|
27958
27959
|
AppEntityEditor.prototype.onEntitySaved = function (data) {
|
|
27959
27960
|
return __awaiter(this, void 0, void 0, function () {
|
|
27960
|
-
return __generator(this, function (
|
|
27961
|
+
return __generator(this, function (_c) {
|
|
27961
27962
|
return [2 /*return*/];
|
|
27962
27963
|
});
|
|
27963
27964
|
});
|
|
27964
27965
|
};
|
|
27965
27966
|
AppEntityEditor.prototype.onEntityDeleted = function (data) {
|
|
27966
27967
|
return __awaiter(this, void 0, void 0, function () {
|
|
27967
|
-
return __generator(this, function (
|
|
27968
|
+
return __generator(this, function (_c) {
|
|
27968
27969
|
return [2 /*return*/];
|
|
27969
27970
|
});
|
|
27970
27971
|
});
|
|
@@ -27978,11 +27979,11 @@
|
|
|
27978
27979
|
AppEntityEditor.prototype.getValue = function () {
|
|
27979
27980
|
return __awaiter(this, void 0, void 0, function () {
|
|
27980
27981
|
var json, res;
|
|
27981
|
-
return __generator(this, function (
|
|
27982
|
-
switch (
|
|
27982
|
+
return __generator(this, function (_c) {
|
|
27983
|
+
switch (_c.label) {
|
|
27983
27984
|
case 0: return [4 /*yield*/, this.getJsonValueToSave()];
|
|
27984
27985
|
case 1:
|
|
27985
|
-
json =
|
|
27986
|
+
json = _c.sent();
|
|
27986
27987
|
res = new this.dataType();
|
|
27987
27988
|
res.fromObject(json);
|
|
27988
27989
|
return [2 /*return*/, res];
|
|
@@ -28001,18 +28002,18 @@
|
|
|
28001
28002
|
AppEntityEditor.prototype.updateTitle = function (data) {
|
|
28002
28003
|
return __awaiter(this, void 0, void 0, function () {
|
|
28003
28004
|
var title, page;
|
|
28004
|
-
return __generator(this, function (
|
|
28005
|
-
switch (
|
|
28005
|
+
return __generator(this, function (_c) {
|
|
28006
|
+
switch (_c.label) {
|
|
28006
28007
|
case 0:
|
|
28007
28008
|
data = data || this.data;
|
|
28008
28009
|
return [4 /*yield*/, this.computeTitle(data)];
|
|
28009
28010
|
case 1:
|
|
28010
|
-
title =
|
|
28011
|
+
title = _c.sent();
|
|
28011
28012
|
this.$title.next(title);
|
|
28012
28013
|
if (!!this.isNewData) return [3 /*break*/, 3];
|
|
28013
28014
|
return [4 /*yield*/, this.computePageHistory(title)];
|
|
28014
28015
|
case 2:
|
|
28015
|
-
page =
|
|
28016
|
+
page = _c.sent();
|
|
28016
28017
|
return [2 /*return*/, this.addToPageHistory(page)];
|
|
28017
28018
|
case 3: return [2 /*return*/];
|
|
28018
28019
|
}
|
|
@@ -28021,7 +28022,7 @@
|
|
|
28021
28022
|
};
|
|
28022
28023
|
AppEntityEditor.prototype.addToPageHistory = function (page, opts) {
|
|
28023
28024
|
return __awaiter(this, void 0, void 0, function () {
|
|
28024
|
-
return __generator(this, function (
|
|
28025
|
+
return __generator(this, function (_c) {
|
|
28025
28026
|
if (!page)
|
|
28026
28027
|
return [2 /*return*/]; // Skip
|
|
28027
28028
|
return [2 /*return*/, this.settings.addToPageHistory(page, Object.assign({ removePathQueryParams: true, removeTitleSmallTag: true, emitEvent: false }, opts))];
|
|
@@ -28030,7 +28031,7 @@
|
|
|
28030
28031
|
};
|
|
28031
28032
|
AppEntityEditor.prototype.computePageHistory = function (title) {
|
|
28032
28033
|
return __awaiter(this, void 0, void 0, function () {
|
|
28033
|
-
return __generator(this, function (
|
|
28034
|
+
return __generator(this, function (_c) {
|
|
28034
28035
|
return [2 /*return*/, {
|
|
28035
28036
|
title: title,
|
|
28036
28037
|
path: this.router.url
|
|
@@ -28040,7 +28041,7 @@
|
|
|
28040
28041
|
};
|
|
28041
28042
|
AppEntityEditor.prototype.removePageHistory = function (opts) {
|
|
28042
28043
|
return __awaiter(this, void 0, void 0, function () {
|
|
28043
|
-
return __generator(this, function (
|
|
28044
|
+
return __generator(this, function (_c) {
|
|
28044
28045
|
return [2 /*return*/, this.settings.removePageHistory(this.router.url, opts)];
|
|
28045
28046
|
});
|
|
28046
28047
|
});
|
|
@@ -28074,8 +28075,8 @@
|
|
|
28074
28075
|
AppEntityEditor.prototype.updateRoute = function (data, queryParams) {
|
|
28075
28076
|
return __awaiter(this, void 0, void 0, function () {
|
|
28076
28077
|
var path, commands;
|
|
28077
|
-
return __generator(this, function (
|
|
28078
|
-
switch (
|
|
28078
|
+
return __generator(this, function (_c) {
|
|
28079
|
+
switch (_c.label) {
|
|
28079
28080
|
case 0:
|
|
28080
28081
|
path = this.computePageUrl(isNotNil(data.id) ? data.id : 'new');
|
|
28081
28082
|
commands = (path && typeof path === 'string') ? path.split('/') : path;
|
|
@@ -28084,10 +28085,10 @@
|
|
|
28084
28085
|
replaceUrl: true,
|
|
28085
28086
|
queryParams: this.queryParams
|
|
28086
28087
|
})];
|
|
28087
|
-
case 1: return [2 /*return*/,
|
|
28088
|
+
case 1: return [2 /*return*/, _c.sent()];
|
|
28088
28089
|
case 2:
|
|
28089
28090
|
console.warn('Skip page route update. Invalid page path: ', path);
|
|
28090
|
-
|
|
28091
|
+
_c.label = 3;
|
|
28091
28092
|
case 3: return [2 /*return*/];
|
|
28092
28093
|
}
|
|
28093
28094
|
});
|