@sumaris-net/ngx-components 0.25.17 → 0.26.0
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 +108 -68
- 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/doc/changelog.md +6 -0
- package/esm2015/src/app/core/account/account.js +5 -7
- package/esm2015/src/app/core/auth/form/form-auth.js +6 -7
- package/esm2015/src/app/core/form/entity-editor.class.js +16 -6
- package/esm2015/src/app/core/form/form.class.js +29 -12
- package/esm2015/src/app/core/form/list.form.js +2 -2
- package/esm2015/src/app/core/form/properties.form.js +2 -3
- package/esm2015/src/app/core/settings/settings.page.js +5 -7
- package/esm2015/src/app/core/table/entities-table-datasource.class.js +5 -7
- package/esm2015/src/app/core/table/table.class.js +25 -19
- package/esm2015/src/app/shared/pipes/form.pipes.js +1 -1
- package/esm2015/src/app/shared/validator/form-error-adapter.class.js +3 -3
- package/esm2015/src/app/shared/validator/validators.js +8 -9
- package/fesm2015/sumaris-net.ngx-components.js +88 -64
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/account/account.d.ts +2 -5
- package/src/app/core/auth/form/form-auth.d.ts +2 -4
- package/src/app/core/form/entity-editor.class.d.ts +10 -2
- package/src/app/core/form/form.class.d.ts +15 -12
- package/src/app/core/form/properties.form.d.ts +0 -1
- package/src/app/core/settings/settings.page.d.ts +2 -5
- package/src/app/core/table/table.class.d.ts +5 -7
- package/src/app/shared/pipes/form.pipes.d.ts +2 -2
- package/src/app/shared/validator/form-error-adapter.class.d.ts +6 -6
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -3128,23 +3128,22 @@
|
|
|
3128
3128
|
};
|
|
3129
3129
|
};
|
|
3130
3130
|
SharedFormGroupValidators.dateMaxDuration = function (startDateField, endDateField, maxDuration, durationUnit) {
|
|
3131
|
+
var maxDurationError = { dateMaxDuration: true };
|
|
3131
3132
|
return function (group) {
|
|
3132
|
-
var endField = group.get(endDateField);
|
|
3133
3133
|
var startDate = fromDateISOString(group.get(startDateField).value);
|
|
3134
|
+
var endField = group.get(endDateField);
|
|
3134
3135
|
var endDate = fromDateISOString(endField.value);
|
|
3135
3136
|
if (isNotNil(startDate) && isNotNil(endDate) && Math.abs(startDate.diff(endDate, durationUnit)) > maxDuration) {
|
|
3137
|
+
console.log('TODO error !');
|
|
3136
3138
|
// Update end field
|
|
3137
|
-
var endFieldErrors = endField.errors || {};
|
|
3138
|
-
endFieldErrors['dateMaxDuration'] = true;
|
|
3139
|
-
endField.setErrors(endFieldErrors);
|
|
3140
3139
|
endField.markAsTouched({ onlySelf: true });
|
|
3140
|
+
endField.markAsPending();
|
|
3141
|
+
endField.setErrors(Object.assign(Object.assign({}, endField.errors), maxDurationError));
|
|
3141
3142
|
// Return the error (should be apply to the parent form)
|
|
3142
|
-
return
|
|
3143
|
+
return maxDurationError;
|
|
3143
3144
|
}
|
|
3144
3145
|
// OK: remove the existing on the end field
|
|
3145
|
-
|
|
3146
|
-
SharedValidators.clearError(endField, 'dateMaxDuration');
|
|
3147
|
-
}
|
|
3146
|
+
SharedValidators.clearError(endField, 'dateMaxDuration');
|
|
3148
3147
|
return null;
|
|
3149
3148
|
};
|
|
3150
3149
|
};
|
|
@@ -4019,8 +4018,8 @@
|
|
|
4019
4018
|
}, "");
|
|
4020
4019
|
};
|
|
4021
4020
|
FormErrorAdapter.prototype.translateControlPath = function (path, opts) {
|
|
4022
|
-
if (opts === null || opts === void 0 ? void 0 : opts.
|
|
4023
|
-
return opts === null || opts === void 0 ? void 0 : opts.
|
|
4021
|
+
if (opts === null || opts === void 0 ? void 0 : opts.controlPathTranslator) {
|
|
4022
|
+
return opts === null || opts === void 0 ? void 0 : opts.controlPathTranslator.translateControlPath(path);
|
|
4024
4023
|
}
|
|
4025
4024
|
var i18nKey = (opts && opts.i18nPrefix || '') + changeCaseToUnderscore(path).toUpperCase();
|
|
4026
4025
|
return this.translate.instant(i18nKey);
|
|
@@ -18909,20 +18908,22 @@
|
|
|
18909
18908
|
|
|
18910
18909
|
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
18911
18910
|
var AppForm = /** @class */ (function () {
|
|
18912
|
-
function AppForm(
|
|
18913
|
-
|
|
18914
|
-
this.
|
|
18915
|
-
this._subscription = new rxjs.Subscription();
|
|
18911
|
+
function AppForm(injector, form) {
|
|
18912
|
+
var _this = this;
|
|
18913
|
+
this.error = null;
|
|
18916
18914
|
this._enable = false;
|
|
18917
18915
|
this._loading = true;
|
|
18918
|
-
this.
|
|
18916
|
+
this.i18nFieldPrefix = null;
|
|
18917
|
+
this._subscription = new rxjs.Subscription();
|
|
18919
18918
|
this.debug = false;
|
|
18920
18919
|
this.onCancel = new i0.EventEmitter();
|
|
18921
18920
|
this.onSubmit = new i0.EventEmitter();
|
|
18922
18921
|
if (form)
|
|
18923
18922
|
this.setForm(form);
|
|
18924
|
-
this.
|
|
18925
|
-
|
|
18923
|
+
this.settings = injector.get(LocalSettingsService);
|
|
18924
|
+
this.errorTranslator = injector.get(FormErrorAdapter);
|
|
18925
|
+
this.autocompleteHelper = new MatAutocompleteConfigHolder(this.settings && {
|
|
18926
|
+
getUserAttributes: function (a, b) { return _this.settings.getFieldDisplayAttributes(a, b); }
|
|
18926
18927
|
});
|
|
18927
18928
|
this.autocompleteFields = this.autocompleteHelper.fields;
|
|
18928
18929
|
}
|
|
@@ -19022,6 +19023,9 @@
|
|
|
19022
19023
|
});
|
|
19023
19024
|
AppForm.prototype.ngOnInit = function () {
|
|
19024
19025
|
this._enable ? this.enable() : this.disable();
|
|
19026
|
+
this.errorTranslatorOptions = this.errorTranslatorOptions || {
|
|
19027
|
+
controlPathTranslator: this
|
|
19028
|
+
};
|
|
19025
19029
|
};
|
|
19026
19030
|
AppForm.prototype.ngOnDestroy = function () {
|
|
19027
19031
|
this._subscription.unsubscribe();
|
|
@@ -19131,7 +19135,18 @@
|
|
|
19131
19135
|
if (!opts || opts.emitEvent !== false)
|
|
19132
19136
|
this.markForCheck();
|
|
19133
19137
|
};
|
|
19138
|
+
AppForm.prototype.translateControlPath = function (path) {
|
|
19139
|
+
return this.getFieldName(path);
|
|
19140
|
+
};
|
|
19134
19141
|
/* -- protected methods -- */
|
|
19142
|
+
AppForm.prototype.getFormError = function (form, opts) {
|
|
19143
|
+
if (!form || !this.errorTranslator)
|
|
19144
|
+
return undefined;
|
|
19145
|
+
return this.errorTranslator.translateErrors(this.form, Object.assign({ controlPathTranslator: this }, opts));
|
|
19146
|
+
};
|
|
19147
|
+
AppForm.prototype.getFieldName = function (path) {
|
|
19148
|
+
return (this.i18nFieldPrefix || '') + changeCaseToUnderscore(path).toUpperCase();
|
|
19149
|
+
};
|
|
19135
19150
|
AppForm.prototype.registerSubscription = function (sub) {
|
|
19136
19151
|
return this._subscription.add(sub);
|
|
19137
19152
|
};
|
|
@@ -19148,13 +19163,13 @@
|
|
|
19148
19163
|
{ type: i0.Directive }
|
|
19149
19164
|
];
|
|
19150
19165
|
AppForm.ctorParameters = function () { return [
|
|
19151
|
-
{ type:
|
|
19152
|
-
{ type: i1.FormGroup }
|
|
19153
|
-
{ type: LocalSettingsService }
|
|
19166
|
+
{ type: i0.Injector },
|
|
19167
|
+
{ type: i1.FormGroup }
|
|
19154
19168
|
]; };
|
|
19155
19169
|
AppForm.propDecorators = {
|
|
19156
19170
|
debug: [{ type: i0.Input }],
|
|
19157
19171
|
tabindex: [{ type: i0.Input }],
|
|
19172
|
+
errorTranslatorOptions: [{ type: i0.Input }],
|
|
19158
19173
|
form: [{ type: i0.Input }],
|
|
19159
19174
|
onCancel: [{ type: i0.Output }],
|
|
19160
19175
|
onSubmit: [{ type: i0.Output }]
|
|
@@ -19162,12 +19177,12 @@
|
|
|
19162
19177
|
|
|
19163
19178
|
var AuthForm = /** @class */ (function (_super) {
|
|
19164
19179
|
__extends(AuthForm, _super);
|
|
19165
|
-
function AuthForm(
|
|
19166
|
-
var _this = _super.call(this,
|
|
19180
|
+
function AuthForm(injector, platform, formBuilder, settings, configService, modalCtrl, network, cd, environment) {
|
|
19181
|
+
var _this = _super.call(this, injector, formBuilder.group({
|
|
19167
19182
|
username: [null, i1.Validators.required],
|
|
19168
19183
|
password: [null, i1.Validators.required],
|
|
19169
19184
|
offline: [network.offline]
|
|
19170
|
-
})
|
|
19185
|
+
})) || this;
|
|
19171
19186
|
_this.configService = configService;
|
|
19172
19187
|
_this.modalCtrl = modalCtrl;
|
|
19173
19188
|
_this.network = network;
|
|
@@ -19271,8 +19286,8 @@
|
|
|
19271
19286
|
},] }
|
|
19272
19287
|
];
|
|
19273
19288
|
AuthForm.ctorParameters = function () { return [
|
|
19289
|
+
{ type: i0.Injector },
|
|
19274
19290
|
{ type: PlatformService },
|
|
19275
|
-
{ type: i1$3.DateAdapter },
|
|
19276
19291
|
{ type: i1.FormBuilder },
|
|
19277
19292
|
{ type: LocalSettingsService },
|
|
19278
19293
|
{ type: ConfigService },
|
|
@@ -19975,9 +19990,8 @@
|
|
|
19975
19990
|
|
|
19976
19991
|
var AccountPage = /** @class */ (function (_super) {
|
|
19977
19992
|
__extends(AccountPage, _super);
|
|
19978
|
-
function AccountPage(
|
|
19979
|
-
var _this = _super.call(this,
|
|
19980
|
-
_this.dateAdapter = dateAdapter;
|
|
19993
|
+
function AccountPage(injector, router, formBuilder, accountService, validatorService, settingsValidatorService, translate, settings, cd, locales) {
|
|
19994
|
+
var _this = _super.call(this, injector, validatorService.getFormGroup(accountService.account)) || this;
|
|
19981
19995
|
_this.router = router;
|
|
19982
19996
|
_this.formBuilder = formBuilder;
|
|
19983
19997
|
_this.accountService = accountService;
|
|
@@ -20173,7 +20187,7 @@
|
|
|
20173
20187
|
},] }
|
|
20174
20188
|
];
|
|
20175
20189
|
AccountPage.ctorParameters = function () { return [
|
|
20176
|
-
{ type:
|
|
20190
|
+
{ type: i0.Injector },
|
|
20177
20191
|
{ type: i3.Router },
|
|
20178
20192
|
{ type: i1.FormBuilder },
|
|
20179
20193
|
{ type: AccountService },
|
|
@@ -20572,9 +20586,8 @@
|
|
|
20572
20586
|
|
|
20573
20587
|
var SettingsPage = /** @class */ (function (_super_1) {
|
|
20574
20588
|
__extends(SettingsPage, _super_1);
|
|
20575
|
-
function SettingsPage(
|
|
20576
|
-
var _this = _super_1.call(this,
|
|
20577
|
-
_this.dateAdapter = dateAdapter;
|
|
20589
|
+
function SettingsPage(injector, platform, router, validatorService, alertCtrl, translate, formBuilder, accountService, settings, cd, network, locales) {
|
|
20590
|
+
var _this = _super_1.call(this, injector, validatorService.getFormGroup()) || this;
|
|
20578
20591
|
_this.platform = platform;
|
|
20579
20592
|
_this.router = router;
|
|
20580
20593
|
_this.validatorService = validatorService;
|
|
@@ -20928,7 +20941,7 @@
|
|
|
20928
20941
|
},] }
|
|
20929
20942
|
];
|
|
20930
20943
|
SettingsPage.ctorParameters = function () { return [
|
|
20931
|
-
{ type:
|
|
20944
|
+
{ type: i0.Injector },
|
|
20932
20945
|
{ type: PlatformService },
|
|
20933
20946
|
{ type: i3.Router },
|
|
20934
20947
|
{ type: LocalSettingsValidatorService },
|
|
@@ -20945,8 +20958,7 @@
|
|
|
20945
20958
|
var AppPropertiesForm = /** @class */ (function (_super) {
|
|
20946
20959
|
__extends(AppPropertiesForm, _super);
|
|
20947
20960
|
function AppPropertiesForm(injector, formBuilder, dateAdapter, settings, cd, formGroupDir) {
|
|
20948
|
-
var _this = _super.call(this,
|
|
20949
|
-
_this.injector = injector;
|
|
20961
|
+
var _this = _super.call(this, injector, null) || this;
|
|
20950
20962
|
_this.formBuilder = formBuilder;
|
|
20951
20963
|
_this.dateAdapter = dateAdapter;
|
|
20952
20964
|
_this.settings = settings;
|
|
@@ -21070,7 +21082,7 @@
|
|
|
21070
21082
|
var AppListForm = /** @class */ (function (_super) {
|
|
21071
21083
|
__extends(AppListForm, _super);
|
|
21072
21084
|
function AppListForm(injector, formBuilder, dateAdapter, settings, cd, formGroupDir) {
|
|
21073
|
-
var _this = _super.call(this,
|
|
21085
|
+
var _this = _super.call(this, injector, null) || this;
|
|
21074
21086
|
_this.injector = injector;
|
|
21075
21087
|
_this.formBuilder = formBuilder;
|
|
21076
21088
|
_this.dateAdapter = dateAdapter;
|
|
@@ -23178,14 +23190,10 @@
|
|
|
23178
23190
|
this._stopWatching$.next();
|
|
23179
23191
|
};
|
|
23180
23192
|
EntitiesTableDataSource.prototype.waitIdle = function (debounceTimeMs) {
|
|
23181
|
-
return
|
|
23182
|
-
|
|
23183
|
-
|
|
23184
|
-
|
|
23185
|
-
.pipe(operators.debounceTime(debounceTimeMs || 100) // if not started yet, wait
|
|
23186
|
-
))];
|
|
23187
|
-
});
|
|
23188
|
-
});
|
|
23193
|
+
return firstFalsePromise(this.loadingSubject
|
|
23194
|
+
.asObservable()
|
|
23195
|
+
.pipe(operators.debounceTime(debounceTimeMs || 100) // if not started yet, wait
|
|
23196
|
+
));
|
|
23189
23197
|
};
|
|
23190
23198
|
EntitiesTableDataSource.prototype.confirmCreate = function (row) {
|
|
23191
23199
|
if (!_super_1.prototype.confirmCreate.call(this, row))
|
|
@@ -23719,7 +23727,7 @@
|
|
|
23719
23727
|
this.saveBeforeSort = toBoolean(this.saveBeforeSort, !this.readOnly); // force to false when readonly
|
|
23720
23728
|
this.saveBeforeFilter = toBoolean(this.saveBeforeFilter, !this.readOnly); // force to false when readonly
|
|
23721
23729
|
this.keepEditedRowOnSave = toBoolean(this.keepEditedRowOnSave, this.inlineEdition);
|
|
23722
|
-
this.
|
|
23730
|
+
this.errorTranslatorOptions = this.errorTranslatorOptions || { separator: ', ', controlPathTranslator: this }; // Can be override in subclasses constructors
|
|
23723
23731
|
// Check ask user confirmation is possible
|
|
23724
23732
|
if (this.confirmBeforeDelete && !this.alertCtrl)
|
|
23725
23733
|
throw Error('Missing \'alertCtrl\' or \'injector\' in component\'s constructor.');
|
|
@@ -23936,7 +23944,7 @@
|
|
|
23936
23944
|
if (previousRow && (previousRow.id === -1) && ((_a = previousRow.validator) === null || _a === void 0 ? void 0 : _a.invalid) && !((_b = previousRow.validator) === null || _b === void 0 ? void 0 : _b.dirty)) {
|
|
23937
23945
|
this.deleteNewRow(event, previousRow);
|
|
23938
23946
|
// Wait deletion is done, then edit previous row (by id, because of reloading)
|
|
23939
|
-
|
|
23947
|
+
this.waitIdle()
|
|
23940
23948
|
.then(function () { return _this.editRowById(event, row.id, { focusColumn: _this.lastUserColumn }); });
|
|
23941
23949
|
return true;
|
|
23942
23950
|
}
|
|
@@ -24282,34 +24290,54 @@
|
|
|
24282
24290
|
});
|
|
24283
24291
|
};
|
|
24284
24292
|
AppTable.prototype.selectRowById = function (id) {
|
|
24285
|
-
|
|
24286
|
-
|
|
24287
|
-
return
|
|
24288
|
-
|
|
24289
|
-
|
|
24290
|
-
|
|
24293
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
24294
|
+
var row;
|
|
24295
|
+
return __generator(this, function (_d) {
|
|
24296
|
+
switch (_d.label) {
|
|
24297
|
+
case 0:
|
|
24298
|
+
if (id === undefined)
|
|
24299
|
+
return [2 /*return*/, false];
|
|
24300
|
+
return [4 /*yield*/, this.waitIdle()];
|
|
24301
|
+
case 1:
|
|
24302
|
+
_d.sent();
|
|
24303
|
+
row = this.dataSource.getRow(id);
|
|
24304
|
+
return [2 /*return*/, this.clickRow(null, row)];
|
|
24305
|
+
}
|
|
24306
|
+
});
|
|
24307
|
+
});
|
|
24291
24308
|
};
|
|
24292
24309
|
/**
|
|
24293
24310
|
* Try to select row by data. Will use dataEquals() (that call EntityUtils.equals()) to find same row's data
|
|
24294
24311
|
* @param data
|
|
24295
24312
|
*/
|
|
24296
24313
|
AppTable.prototype.selectRowByData = function (data) {
|
|
24297
|
-
|
|
24298
|
-
|
|
24299
|
-
|
|
24300
|
-
|
|
24301
|
-
|
|
24302
|
-
|
|
24303
|
-
|
|
24314
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
24315
|
+
var row;
|
|
24316
|
+
var _this = this;
|
|
24317
|
+
return __generator(this, function (_d) {
|
|
24318
|
+
switch (_d.label) {
|
|
24319
|
+
case 0:
|
|
24320
|
+
if (data === undefined)
|
|
24321
|
+
return [2 /*return*/, Promise.resolve(false)];
|
|
24322
|
+
return [4 /*yield*/, this.waitIdle()];
|
|
24323
|
+
case 1:
|
|
24324
|
+
_d.sent();
|
|
24325
|
+
return [4 /*yield*/, this.dataSource.getRows()];
|
|
24326
|
+
case 2:
|
|
24327
|
+
row = ((_d.sent()) || [])
|
|
24328
|
+
.find(function (row) { return _this.equals(row.currentData, data); });
|
|
24329
|
+
return [2 /*return*/, row && this.clickRow(null, row)];
|
|
24330
|
+
}
|
|
24331
|
+
});
|
|
24332
|
+
});
|
|
24304
24333
|
};
|
|
24305
24334
|
AppTable.prototype.clickRow = function (event, row) {
|
|
24306
24335
|
var _this = this;
|
|
24307
|
-
var _a;
|
|
24308
24336
|
if (this.loading) {
|
|
24309
24337
|
// Wait while loading, and loop
|
|
24310
24338
|
if (this.debug)
|
|
24311
24339
|
console.debug("[table] Waiting before apply clickRow() (datasource is busy)...");
|
|
24312
|
-
|
|
24340
|
+
this.waitIdle().then(function () { return _this.clickRow(event, row); });
|
|
24313
24341
|
return false;
|
|
24314
24342
|
}
|
|
24315
24343
|
// DEBUG
|
|
@@ -24335,6 +24363,9 @@
|
|
|
24335
24363
|
AppTable.prototype.moveRow = function (id, direction) {
|
|
24336
24364
|
this.dataSource.move(id, direction);
|
|
24337
24365
|
};
|
|
24366
|
+
AppTable.prototype.waitIdle = function () {
|
|
24367
|
+
return firstFalsePromise(this.loadingSubject);
|
|
24368
|
+
};
|
|
24338
24369
|
AppTable.prototype.openSelectColumnsModal = function (event) {
|
|
24339
24370
|
return __awaiter(this, void 0, void 0, function () {
|
|
24340
24371
|
var columns, hasTopModal, modal, data, userColumns;
|
|
@@ -24386,7 +24417,7 @@
|
|
|
24386
24417
|
setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
24387
24418
|
return __generator(this, function (_d) {
|
|
24388
24419
|
switch (_d.label) {
|
|
24389
|
-
case 0: return [4 /*yield*/,
|
|
24420
|
+
case 0: return [4 /*yield*/, this.waitIdle()];
|
|
24390
24421
|
case 1:
|
|
24391
24422
|
_d.sent();
|
|
24392
24423
|
event.target.complete();
|
|
@@ -24773,7 +24804,7 @@
|
|
|
24773
24804
|
return this._autocompleteConfigHolder.add(fieldName, options);
|
|
24774
24805
|
};
|
|
24775
24806
|
AppTable.prototype.getI18nColumnName = function (columnName) {
|
|
24776
|
-
return this.i18nColumnPrefix + changeCaseToUnderscore(columnName).toUpperCase();
|
|
24807
|
+
return (this.i18nColumnPrefix || '') + changeCaseToUnderscore(columnName).toUpperCase();
|
|
24777
24808
|
};
|
|
24778
24809
|
AppTable.prototype.generateTableId = function () {
|
|
24779
24810
|
return this.location.path(true).replace(/[?].*$/g, '').replace(/\/[\d]+/g, '_id') + '_' + this.constructor.name;
|
|
@@ -24892,7 +24923,7 @@
|
|
|
24892
24923
|
row = row || this.editedRow;
|
|
24893
24924
|
if (!row || !this.formErrorAdapter)
|
|
24894
24925
|
return undefined;
|
|
24895
|
-
return this.formErrorAdapter.translateErrors(row.validator, Object.assign(Object.assign({}, this.
|
|
24926
|
+
return this.formErrorAdapter.translateErrors(row.validator, Object.assign(Object.assign({}, this.errorTranslatorOptions), opts));
|
|
24896
24927
|
};
|
|
24897
24928
|
AppTable.prototype.setError = function (value, opts) {
|
|
24898
24929
|
if (this.errorSubject.value !== value) {
|
|
@@ -25737,6 +25768,7 @@
|
|
|
25737
25768
|
enableListenChanges: (injector.get(ENVIRONMENT).listenRemoteChanges === true), pathIdAttribute: 'id', autoLoad: true, autoUpdateRoute: true, i18nPrefix: ''
|
|
25738
25769
|
}, options);
|
|
25739
25770
|
_this.settings = injector.get(LocalSettingsService);
|
|
25771
|
+
_this.formErrorAdapter = injector.get(FormErrorAdapter);
|
|
25740
25772
|
_this.cd = injector.get(i0.ChangeDetectorRef);
|
|
25741
25773
|
_this.dateFormat = injector.get(DateFormatPipe);
|
|
25742
25774
|
_this.toastController = injector.get(i1$5.ToastController);
|
|
@@ -25838,7 +25870,6 @@
|
|
|
25838
25870
|
/**
|
|
25839
25871
|
* Load data from the snapshot route
|
|
25840
25872
|
*
|
|
25841
|
-
* @param route
|
|
25842
25873
|
* @protected
|
|
25843
25874
|
*/
|
|
25844
25875
|
AppEntityEditor.prototype.loadFromRoute = function () {
|
|
@@ -25947,7 +25978,7 @@
|
|
|
25947
25978
|
idChanged = isNotNil(data.id)
|
|
25948
25979
|
&& this.previousDataId !== undefined // Ignore if first loading (=undefined)
|
|
25949
25980
|
&& this.previousDataId !== data.id;
|
|
25950
|
-
opts = Object.assign({ updateRoute: this._autoUpdateRoute && idChanged && !this.loading, openTabIndex: this._autoOpenNextTab && idChanged &&
|
|
25981
|
+
opts = Object.assign({ updateRoute: this._autoUpdateRoute && idChanged && !this.loading, openTabIndex: this._autoOpenNextTab && idChanged && this.computeNextTabIndex() }, opts);
|
|
25951
25982
|
this.data = data;
|
|
25952
25983
|
this.previousDataId = data.id || null;
|
|
25953
25984
|
promiseOrVoid = this.setValue(data);
|
|
@@ -26075,7 +26106,13 @@
|
|
|
26075
26106
|
});
|
|
26076
26107
|
});
|
|
26077
26108
|
};
|
|
26078
|
-
|
|
26109
|
+
/**
|
|
26110
|
+
* Save the editor, by calling the dataService.save().
|
|
26111
|
+
* Ensure that editor if valid. If not, display an error
|
|
26112
|
+
* @param event
|
|
26113
|
+
* @param opts
|
|
26114
|
+
*/
|
|
26115
|
+
AppEntityEditor.prototype.save = function (event, opts) {
|
|
26079
26116
|
return __awaiter(this, void 0, void 0, function () {
|
|
26080
26117
|
var data, updatedData, err_2;
|
|
26081
26118
|
return __generator(this, function (_b) {
|
|
@@ -26113,14 +26150,14 @@
|
|
|
26113
26150
|
case 3:
|
|
26114
26151
|
data = _b.sent();
|
|
26115
26152
|
this.disable();
|
|
26116
|
-
return [4 /*yield*/, this.dataService.save(data,
|
|
26153
|
+
return [4 /*yield*/, this.dataService.save(data, opts)];
|
|
26117
26154
|
case 4:
|
|
26118
26155
|
updatedData = _b.sent();
|
|
26119
26156
|
return [4 /*yield*/, this.onEntitySaved(updatedData)];
|
|
26120
26157
|
case 5:
|
|
26121
26158
|
_b.sent();
|
|
26122
26159
|
// Update the view (e.g metadata)
|
|
26123
|
-
return [4 /*yield*/, this.updateView(updatedData,
|
|
26160
|
+
return [4 /*yield*/, this.updateView(updatedData, opts)];
|
|
26124
26161
|
case 6:
|
|
26125
26162
|
// Update the view (e.g metadata)
|
|
26126
26163
|
_b.sent();
|
|
@@ -26290,6 +26327,9 @@
|
|
|
26290
26327
|
this.error = userMessage;
|
|
26291
26328
|
};
|
|
26292
26329
|
/* -- protected methods -- */
|
|
26330
|
+
AppEntityEditor.prototype.computeNextTabIndex = function () {
|
|
26331
|
+
return this.selectedTabIndex + 1 < this.tabCount ? this.selectedTabIndex + 1 : undefined;
|
|
26332
|
+
};
|
|
26293
26333
|
AppEntityEditor.prototype.unload = function () {
|
|
26294
26334
|
return __awaiter(this, void 0, void 0, function () {
|
|
26295
26335
|
return __generator(this, function (_b) {
|