@sumaris-net/ngx-components 0.25.20 → 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 +53 -34
- 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 +12 -5
- 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/table.class.js +4 -4
- 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/fesm2015/sumaris-net.ngx-components.js +52 -34
- 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 +9 -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 +4 -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
|
@@ -4018,8 +4018,8 @@
|
|
|
4018
4018
|
}, "");
|
|
4019
4019
|
};
|
|
4020
4020
|
FormErrorAdapter.prototype.translateControlPath = function (path, opts) {
|
|
4021
|
-
if (opts === null || opts === void 0 ? void 0 : opts.
|
|
4022
|
-
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);
|
|
4023
4023
|
}
|
|
4024
4024
|
var i18nKey = (opts && opts.i18nPrefix || '') + changeCaseToUnderscore(path).toUpperCase();
|
|
4025
4025
|
return this.translate.instant(i18nKey);
|
|
@@ -18908,20 +18908,22 @@
|
|
|
18908
18908
|
|
|
18909
18909
|
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
18910
18910
|
var AppForm = /** @class */ (function () {
|
|
18911
|
-
function AppForm(
|
|
18912
|
-
|
|
18913
|
-
this.
|
|
18914
|
-
this._subscription = new rxjs.Subscription();
|
|
18911
|
+
function AppForm(injector, form) {
|
|
18912
|
+
var _this = this;
|
|
18913
|
+
this.error = null;
|
|
18915
18914
|
this._enable = false;
|
|
18916
18915
|
this._loading = true;
|
|
18917
|
-
this.
|
|
18916
|
+
this.i18nFieldPrefix = null;
|
|
18917
|
+
this._subscription = new rxjs.Subscription();
|
|
18918
18918
|
this.debug = false;
|
|
18919
18919
|
this.onCancel = new i0.EventEmitter();
|
|
18920
18920
|
this.onSubmit = new i0.EventEmitter();
|
|
18921
18921
|
if (form)
|
|
18922
18922
|
this.setForm(form);
|
|
18923
|
-
this.
|
|
18924
|
-
|
|
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); }
|
|
18925
18927
|
});
|
|
18926
18928
|
this.autocompleteFields = this.autocompleteHelper.fields;
|
|
18927
18929
|
}
|
|
@@ -19021,6 +19023,9 @@
|
|
|
19021
19023
|
});
|
|
19022
19024
|
AppForm.prototype.ngOnInit = function () {
|
|
19023
19025
|
this._enable ? this.enable() : this.disable();
|
|
19026
|
+
this.errorTranslatorOptions = this.errorTranslatorOptions || {
|
|
19027
|
+
controlPathTranslator: this
|
|
19028
|
+
};
|
|
19024
19029
|
};
|
|
19025
19030
|
AppForm.prototype.ngOnDestroy = function () {
|
|
19026
19031
|
this._subscription.unsubscribe();
|
|
@@ -19130,7 +19135,18 @@
|
|
|
19130
19135
|
if (!opts || opts.emitEvent !== false)
|
|
19131
19136
|
this.markForCheck();
|
|
19132
19137
|
};
|
|
19138
|
+
AppForm.prototype.translateControlPath = function (path) {
|
|
19139
|
+
return this.getFieldName(path);
|
|
19140
|
+
};
|
|
19133
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
|
+
};
|
|
19134
19150
|
AppForm.prototype.registerSubscription = function (sub) {
|
|
19135
19151
|
return this._subscription.add(sub);
|
|
19136
19152
|
};
|
|
@@ -19147,13 +19163,13 @@
|
|
|
19147
19163
|
{ type: i0.Directive }
|
|
19148
19164
|
];
|
|
19149
19165
|
AppForm.ctorParameters = function () { return [
|
|
19150
|
-
{ type:
|
|
19151
|
-
{ type: i1.FormGroup }
|
|
19152
|
-
{ type: LocalSettingsService }
|
|
19166
|
+
{ type: i0.Injector },
|
|
19167
|
+
{ type: i1.FormGroup }
|
|
19153
19168
|
]; };
|
|
19154
19169
|
AppForm.propDecorators = {
|
|
19155
19170
|
debug: [{ type: i0.Input }],
|
|
19156
19171
|
tabindex: [{ type: i0.Input }],
|
|
19172
|
+
errorTranslatorOptions: [{ type: i0.Input }],
|
|
19157
19173
|
form: [{ type: i0.Input }],
|
|
19158
19174
|
onCancel: [{ type: i0.Output }],
|
|
19159
19175
|
onSubmit: [{ type: i0.Output }]
|
|
@@ -19161,12 +19177,12 @@
|
|
|
19161
19177
|
|
|
19162
19178
|
var AuthForm = /** @class */ (function (_super) {
|
|
19163
19179
|
__extends(AuthForm, _super);
|
|
19164
|
-
function AuthForm(
|
|
19165
|
-
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({
|
|
19166
19182
|
username: [null, i1.Validators.required],
|
|
19167
19183
|
password: [null, i1.Validators.required],
|
|
19168
19184
|
offline: [network.offline]
|
|
19169
|
-
})
|
|
19185
|
+
})) || this;
|
|
19170
19186
|
_this.configService = configService;
|
|
19171
19187
|
_this.modalCtrl = modalCtrl;
|
|
19172
19188
|
_this.network = network;
|
|
@@ -19270,8 +19286,8 @@
|
|
|
19270
19286
|
},] }
|
|
19271
19287
|
];
|
|
19272
19288
|
AuthForm.ctorParameters = function () { return [
|
|
19289
|
+
{ type: i0.Injector },
|
|
19273
19290
|
{ type: PlatformService },
|
|
19274
|
-
{ type: i1$3.DateAdapter },
|
|
19275
19291
|
{ type: i1.FormBuilder },
|
|
19276
19292
|
{ type: LocalSettingsService },
|
|
19277
19293
|
{ type: ConfigService },
|
|
@@ -19974,9 +19990,8 @@
|
|
|
19974
19990
|
|
|
19975
19991
|
var AccountPage = /** @class */ (function (_super) {
|
|
19976
19992
|
__extends(AccountPage, _super);
|
|
19977
|
-
function AccountPage(
|
|
19978
|
-
var _this = _super.call(this,
|
|
19979
|
-
_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;
|
|
19980
19995
|
_this.router = router;
|
|
19981
19996
|
_this.formBuilder = formBuilder;
|
|
19982
19997
|
_this.accountService = accountService;
|
|
@@ -20172,7 +20187,7 @@
|
|
|
20172
20187
|
},] }
|
|
20173
20188
|
];
|
|
20174
20189
|
AccountPage.ctorParameters = function () { return [
|
|
20175
|
-
{ type:
|
|
20190
|
+
{ type: i0.Injector },
|
|
20176
20191
|
{ type: i3.Router },
|
|
20177
20192
|
{ type: i1.FormBuilder },
|
|
20178
20193
|
{ type: AccountService },
|
|
@@ -20571,9 +20586,8 @@
|
|
|
20571
20586
|
|
|
20572
20587
|
var SettingsPage = /** @class */ (function (_super_1) {
|
|
20573
20588
|
__extends(SettingsPage, _super_1);
|
|
20574
|
-
function SettingsPage(
|
|
20575
|
-
var _this = _super_1.call(this,
|
|
20576
|
-
_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;
|
|
20577
20591
|
_this.platform = platform;
|
|
20578
20592
|
_this.router = router;
|
|
20579
20593
|
_this.validatorService = validatorService;
|
|
@@ -20927,7 +20941,7 @@
|
|
|
20927
20941
|
},] }
|
|
20928
20942
|
];
|
|
20929
20943
|
SettingsPage.ctorParameters = function () { return [
|
|
20930
|
-
{ type:
|
|
20944
|
+
{ type: i0.Injector },
|
|
20931
20945
|
{ type: PlatformService },
|
|
20932
20946
|
{ type: i3.Router },
|
|
20933
20947
|
{ type: LocalSettingsValidatorService },
|
|
@@ -20944,8 +20958,7 @@
|
|
|
20944
20958
|
var AppPropertiesForm = /** @class */ (function (_super) {
|
|
20945
20959
|
__extends(AppPropertiesForm, _super);
|
|
20946
20960
|
function AppPropertiesForm(injector, formBuilder, dateAdapter, settings, cd, formGroupDir) {
|
|
20947
|
-
var _this = _super.call(this,
|
|
20948
|
-
_this.injector = injector;
|
|
20961
|
+
var _this = _super.call(this, injector, null) || this;
|
|
20949
20962
|
_this.formBuilder = formBuilder;
|
|
20950
20963
|
_this.dateAdapter = dateAdapter;
|
|
20951
20964
|
_this.settings = settings;
|
|
@@ -21069,7 +21082,7 @@
|
|
|
21069
21082
|
var AppListForm = /** @class */ (function (_super) {
|
|
21070
21083
|
__extends(AppListForm, _super);
|
|
21071
21084
|
function AppListForm(injector, formBuilder, dateAdapter, settings, cd, formGroupDir) {
|
|
21072
|
-
var _this = _super.call(this,
|
|
21085
|
+
var _this = _super.call(this, injector, null) || this;
|
|
21073
21086
|
_this.injector = injector;
|
|
21074
21087
|
_this.formBuilder = formBuilder;
|
|
21075
21088
|
_this.dateAdapter = dateAdapter;
|
|
@@ -23714,7 +23727,7 @@
|
|
|
23714
23727
|
this.saveBeforeSort = toBoolean(this.saveBeforeSort, !this.readOnly); // force to false when readonly
|
|
23715
23728
|
this.saveBeforeFilter = toBoolean(this.saveBeforeFilter, !this.readOnly); // force to false when readonly
|
|
23716
23729
|
this.keepEditedRowOnSave = toBoolean(this.keepEditedRowOnSave, this.inlineEdition);
|
|
23717
|
-
this.
|
|
23730
|
+
this.errorTranslatorOptions = this.errorTranslatorOptions || { separator: ', ', controlPathTranslator: this }; // Can be override in subclasses constructors
|
|
23718
23731
|
// Check ask user confirmation is possible
|
|
23719
23732
|
if (this.confirmBeforeDelete && !this.alertCtrl)
|
|
23720
23733
|
throw Error('Missing \'alertCtrl\' or \'injector\' in component\'s constructor.');
|
|
@@ -24791,7 +24804,7 @@
|
|
|
24791
24804
|
return this._autocompleteConfigHolder.add(fieldName, options);
|
|
24792
24805
|
};
|
|
24793
24806
|
AppTable.prototype.getI18nColumnName = function (columnName) {
|
|
24794
|
-
return this.i18nColumnPrefix + changeCaseToUnderscore(columnName).toUpperCase();
|
|
24807
|
+
return (this.i18nColumnPrefix || '') + changeCaseToUnderscore(columnName).toUpperCase();
|
|
24795
24808
|
};
|
|
24796
24809
|
AppTable.prototype.generateTableId = function () {
|
|
24797
24810
|
return this.location.path(true).replace(/[?].*$/g, '').replace(/\/[\d]+/g, '_id') + '_' + this.constructor.name;
|
|
@@ -24910,7 +24923,7 @@
|
|
|
24910
24923
|
row = row || this.editedRow;
|
|
24911
24924
|
if (!row || !this.formErrorAdapter)
|
|
24912
24925
|
return undefined;
|
|
24913
|
-
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));
|
|
24914
24927
|
};
|
|
24915
24928
|
AppTable.prototype.setError = function (value, opts) {
|
|
24916
24929
|
if (this.errorSubject.value !== value) {
|
|
@@ -25755,6 +25768,7 @@
|
|
|
25755
25768
|
enableListenChanges: (injector.get(ENVIRONMENT).listenRemoteChanges === true), pathIdAttribute: 'id', autoLoad: true, autoUpdateRoute: true, i18nPrefix: ''
|
|
25756
25769
|
}, options);
|
|
25757
25770
|
_this.settings = injector.get(LocalSettingsService);
|
|
25771
|
+
_this.formErrorAdapter = injector.get(FormErrorAdapter);
|
|
25758
25772
|
_this.cd = injector.get(i0.ChangeDetectorRef);
|
|
25759
25773
|
_this.dateFormat = injector.get(DateFormatPipe);
|
|
25760
25774
|
_this.toastController = injector.get(i1$5.ToastController);
|
|
@@ -25856,7 +25870,6 @@
|
|
|
25856
25870
|
/**
|
|
25857
25871
|
* Load data from the snapshot route
|
|
25858
25872
|
*
|
|
25859
|
-
* @param route
|
|
25860
25873
|
* @protected
|
|
25861
25874
|
*/
|
|
25862
25875
|
AppEntityEditor.prototype.loadFromRoute = function () {
|
|
@@ -26093,7 +26106,13 @@
|
|
|
26093
26106
|
});
|
|
26094
26107
|
});
|
|
26095
26108
|
};
|
|
26096
|
-
|
|
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) {
|
|
26097
26116
|
return __awaiter(this, void 0, void 0, function () {
|
|
26098
26117
|
var data, updatedData, err_2;
|
|
26099
26118
|
return __generator(this, function (_b) {
|
|
@@ -26131,14 +26150,14 @@
|
|
|
26131
26150
|
case 3:
|
|
26132
26151
|
data = _b.sent();
|
|
26133
26152
|
this.disable();
|
|
26134
|
-
return [4 /*yield*/, this.dataService.save(data,
|
|
26153
|
+
return [4 /*yield*/, this.dataService.save(data, opts)];
|
|
26135
26154
|
case 4:
|
|
26136
26155
|
updatedData = _b.sent();
|
|
26137
26156
|
return [4 /*yield*/, this.onEntitySaved(updatedData)];
|
|
26138
26157
|
case 5:
|
|
26139
26158
|
_b.sent();
|
|
26140
26159
|
// Update the view (e.g metadata)
|
|
26141
|
-
return [4 /*yield*/, this.updateView(updatedData,
|
|
26160
|
+
return [4 /*yield*/, this.updateView(updatedData, opts)];
|
|
26142
26161
|
case 6:
|
|
26143
26162
|
// Update the view (e.g metadata)
|
|
26144
26163
|
_b.sent();
|