@sumaris-net/ngx-components 1.0.8 → 1.0.9
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 +63 -31
- 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/services/account.service.js +2 -2
- package/esm2015/src/app/core/services/local-settings.service.js +5 -3
- package/esm2015/src/app/shared/pipes/form.pipes.js +56 -5
- package/esm2015/src/app/shared/pipes/translate-context.pipe.js +7 -28
- package/fesm2015/sumaris-net.ngx-components.js +62 -31
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/shared/pipes/form.pipes.d.ts +14 -3
- package/src/app/shared/pipes/translate-context.pipe.d.ts +2 -7
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -2945,39 +2945,19 @@
|
|
|
2945
2945
|
]; };
|
|
2946
2946
|
|
|
2947
2947
|
var TranslateContextPipe = /** @class */ (function () {
|
|
2948
|
-
function TranslateContextPipe(translate
|
|
2948
|
+
function TranslateContextPipe(translate) {
|
|
2949
2949
|
this.translate = translate;
|
|
2950
|
-
this._ref = _ref;
|
|
2951
|
-
this.value = '';
|
|
2952
|
-
this.lastKey = null;
|
|
2953
|
-
this.lastSuffix = null;
|
|
2954
|
-
this.lastParams = [];
|
|
2955
2950
|
}
|
|
2956
2951
|
TranslateContextPipe.prototype.transform = function (query) {
|
|
2957
2952
|
var params = [];
|
|
2958
2953
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
2959
2954
|
params[_i - 1] = arguments[_i];
|
|
2960
2955
|
}
|
|
2961
|
-
if (!query || !query.length)
|
|
2956
|
+
if (!query || !query.length)
|
|
2962
2957
|
return query;
|
|
2963
|
-
}
|
|
2964
2958
|
var suffix = params && params.length ? params[0] : '';
|
|
2965
2959
|
params = suffix && params.slice(1);
|
|
2966
|
-
|
|
2967
|
-
if (equalsOrNil(query, this.lastKey)
|
|
2968
|
-
&& equals(suffix, this.lastSuffix)
|
|
2969
|
-
&& equals(params, this.lastParams)) {
|
|
2970
|
-
return this.value;
|
|
2971
|
-
}
|
|
2972
|
-
// store the query, in case it changes
|
|
2973
|
-
this.lastKey = query;
|
|
2974
|
-
// store the params, in case they change
|
|
2975
|
-
this.lastParams = params;
|
|
2976
|
-
// store the params, in case they change
|
|
2977
|
-
this.lastSuffix = suffix;
|
|
2978
|
-
// set the value
|
|
2979
|
-
this.value = this.translate.instant(query, suffix, params);
|
|
2980
|
-
return this.value;
|
|
2960
|
+
return this.translate.instant(query, suffix, params);
|
|
2981
2961
|
};
|
|
2982
2962
|
return TranslateContextPipe;
|
|
2983
2963
|
}());
|
|
@@ -2988,8 +2968,7 @@
|
|
|
2988
2968
|
},] }
|
|
2989
2969
|
];
|
|
2990
2970
|
TranslateContextPipe.ctorParameters = function () { return [
|
|
2991
|
-
{ type: TranslateContextService }
|
|
2992
|
-
{ type: i0.ChangeDetectorRef }
|
|
2971
|
+
{ type: TranslateContextService }
|
|
2993
2972
|
]; };
|
|
2994
2973
|
var TranslatablePipe = /** @class */ (function () {
|
|
2995
2974
|
function TranslatablePipe() {
|
|
@@ -4216,21 +4195,72 @@
|
|
|
4216
4195
|
]; };
|
|
4217
4196
|
|
|
4218
4197
|
var FormErrorTranslatePipe = /** @class */ (function () {
|
|
4219
|
-
function FormErrorTranslatePipe(adapter) {
|
|
4198
|
+
function FormErrorTranslatePipe(adapter, _ref) {
|
|
4220
4199
|
this.adapter = adapter;
|
|
4200
|
+
this._ref = _ref;
|
|
4201
|
+
this.value = '';
|
|
4202
|
+
this._lastForm = null;
|
|
4203
|
+
this._lastOptions = null;
|
|
4221
4204
|
}
|
|
4222
4205
|
FormErrorTranslatePipe.prototype.transform = function (form, opts) {
|
|
4223
|
-
|
|
4206
|
+
var _this = this;
|
|
4207
|
+
if (!form) {
|
|
4208
|
+
this._dispose();
|
|
4209
|
+
return '';
|
|
4210
|
+
}
|
|
4211
|
+
// if we ask another time for the same form and opts, return the last value
|
|
4212
|
+
if (form === this._lastForm && equals(opts, this._lastOptions)) {
|
|
4213
|
+
return this.value;
|
|
4214
|
+
}
|
|
4215
|
+
// store the query, in case it changes
|
|
4216
|
+
this._lastForm = form;
|
|
4217
|
+
// store the params, in case they change
|
|
4218
|
+
this._lastOptions = opts;
|
|
4219
|
+
// set the value
|
|
4220
|
+
this._updateValue(form, opts);
|
|
4221
|
+
// if there is a subscription to onLangChange, clean it
|
|
4222
|
+
this._dispose();
|
|
4223
|
+
// subscribe to onTranslationChange event, in case the translations change
|
|
4224
|
+
if (!this._onFormStatusChange) {
|
|
4225
|
+
this._onFormStatusChange = form.statusChanges.subscribe(function (status) {
|
|
4226
|
+
_this._updateValue(form, opts, status);
|
|
4227
|
+
});
|
|
4228
|
+
}
|
|
4229
|
+
return this.value;
|
|
4230
|
+
};
|
|
4231
|
+
FormErrorTranslatePipe.prototype.ngOnDestroy = function () {
|
|
4232
|
+
this._dispose();
|
|
4233
|
+
};
|
|
4234
|
+
FormErrorTranslatePipe.prototype._updateValue = function (form, opts, status) {
|
|
4235
|
+
if (status === 'INVALID' || form.invalid) {
|
|
4236
|
+
this.value = this.adapter.translateErrors(form, opts);
|
|
4237
|
+
this._ref.markForCheck();
|
|
4238
|
+
}
|
|
4239
|
+
else if (isNotNilOrBlank(this.value)) {
|
|
4240
|
+
this.value = '';
|
|
4241
|
+
this._ref.markForCheck();
|
|
4242
|
+
}
|
|
4243
|
+
};
|
|
4244
|
+
/**
|
|
4245
|
+
* Clean any existing subscription to change events
|
|
4246
|
+
*/
|
|
4247
|
+
FormErrorTranslatePipe.prototype._dispose = function () {
|
|
4248
|
+
if (typeof this._onFormStatusChange !== 'undefined') {
|
|
4249
|
+
this._onFormStatusChange.unsubscribe();
|
|
4250
|
+
this._onFormStatusChange = undefined;
|
|
4251
|
+
}
|
|
4224
4252
|
};
|
|
4225
4253
|
return FormErrorTranslatePipe;
|
|
4226
4254
|
}());
|
|
4227
4255
|
FormErrorTranslatePipe.decorators = [
|
|
4228
4256
|
{ type: i0.Pipe, args: [{
|
|
4229
4257
|
name: 'translateFormError',
|
|
4258
|
+
pure: false
|
|
4230
4259
|
},] }
|
|
4231
4260
|
];
|
|
4232
4261
|
FormErrorTranslatePipe.ctorParameters = function () { return [
|
|
4233
|
-
{ type: FormErrorTranslator }
|
|
4262
|
+
{ type: FormErrorTranslator },
|
|
4263
|
+
{ type: i0.ChangeDetectorRef }
|
|
4234
4264
|
]; };
|
|
4235
4265
|
|
|
4236
4266
|
var SharedPipesModule = /** @class */ (function () {
|
|
@@ -10843,7 +10873,7 @@
|
|
|
10843
10873
|
case 2:
|
|
10844
10874
|
data = Object.assign(Object.assign({}, this._data), settings);
|
|
10845
10875
|
if (equals(data, this._data))
|
|
10846
|
-
return [2 /*return*/]; //
|
|
10876
|
+
return [2 /*return*/]; // Skip if no changes
|
|
10847
10877
|
this._data = data;
|
|
10848
10878
|
if (!(opts && opts.persistImmediate)) return [3 /*break*/, 4];
|
|
10849
10879
|
return [4 /*yield*/, this.persistLocally(true)];
|
|
@@ -10924,9 +10954,11 @@
|
|
|
10924
10954
|
if (!feature)
|
|
10925
10955
|
return; // Not found
|
|
10926
10956
|
if (typeof feature === 'string') {
|
|
10957
|
+
var lastSyncDate = feature.substring(featurePrefix.length);
|
|
10958
|
+
console.debug("[" + featureName + "] Last synchronization date: " + lastSyncDate);
|
|
10927
10959
|
return {
|
|
10928
10960
|
name: featureName,
|
|
10929
|
-
lastSyncDate:
|
|
10961
|
+
lastSyncDate: lastSyncDate
|
|
10930
10962
|
};
|
|
10931
10963
|
}
|
|
10932
10964
|
return feature;
|
|
@@ -15576,7 +15608,7 @@
|
|
|
15576
15608
|
}
|
|
15577
15609
|
});
|
|
15578
15610
|
// Add log when closing WS
|
|
15579
|
-
subscription.add(function () { return console.debug('[account] [WS] Stop listening
|
|
15611
|
+
subscription.add(function () { return console.debug('[account] [WS] Stop listening changes'); });
|
|
15580
15612
|
return subscription;
|
|
15581
15613
|
};
|
|
15582
15614
|
Object.defineProperty(AccountService.prototype, "additionalFields", {
|