@sumaris-net/ngx-components 0.27.13 → 0.27.17
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 -16
- 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/core.module.js +5 -2
- package/esm2015/src/app/core/icon/icon.component.js +29 -0
- package/esm2015/src/app/core/menu/menu.model.js +1 -1
- package/esm2015/src/app/shared/colors.utils.js +2 -0
- package/esm2015/src/app/shared/services/translate-context.service.js +4 -4
- package/esm2015/src/app/shared/types.js +1 -1
- package/esm2015/src/app/shared/validator/validators.js +25 -14
- package/esm2015/sumaris-net.ngx-components.js +2 -1
- package/fesm2015/sumaris-net.ngx-components.js +58 -17
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/icon/icon.component.d.ts +9 -0
- package/src/app/core/menu/menu.model.d.ts +0 -2
- package/src/app/shared/colors.utils.d.ts +3 -0
- package/src/app/shared/types.d.ts +1 -0
- package/src/app/shared/validator/validators.d.ts +2 -0
- package/src/assets/i18n/fr.json +2 -2
- package/sumaris-net.ngx-components.d.ts +1 -0
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -2805,7 +2805,7 @@
|
|
|
2805
2805
|
// Compute a contextual i18n key, using the context as suffix
|
|
2806
2806
|
var contextKey = this.contextualKey(key, context);
|
|
2807
2807
|
// Return the contextual translation, or default of not exists
|
|
2808
|
-
return this.translate.get(contextKey)
|
|
2808
|
+
return this.translate.get(contextKey, interpolateParams)
|
|
2809
2809
|
.pipe(operators.mergeMap(function (translation) { return (translation !== contextKey) ? rxjs.of(translation) : _this.translate.get(key); }));
|
|
2810
2810
|
};
|
|
2811
2811
|
TranslateContextService.prototype.instant = function (key, context, interpolateParams) {
|
|
@@ -2815,8 +2815,8 @@
|
|
|
2815
2815
|
// Compute a contextual i18n key, using the context as suffix
|
|
2816
2816
|
var contextualKey = this.contextualKey(key, context);
|
|
2817
2817
|
// Return the contextual translation, or default of not exists
|
|
2818
|
-
var translation = this.translate.instant(contextualKey);
|
|
2819
|
-
return (translation !== contextualKey) ? translation : this.translate.instant(key);
|
|
2818
|
+
var translation = this.translate.instant(contextualKey, interpolateParams);
|
|
2819
|
+
return (translation !== contextualKey) ? translation : this.translate.instant(key, interpolateParams);
|
|
2820
2820
|
};
|
|
2821
2821
|
/**
|
|
2822
2822
|
* Compute a contextual i18n key, using the context as suffix
|
|
@@ -2926,6 +2926,18 @@
|
|
|
2926
2926
|
var SharedValidators = /** @class */ (function () {
|
|
2927
2927
|
function SharedValidators() {
|
|
2928
2928
|
}
|
|
2929
|
+
SharedValidators.getDoubleRegexp = function (maxDecimals) {
|
|
2930
|
+
if (isNil(maxDecimals))
|
|
2931
|
+
return this._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS.NO_LIMIT;
|
|
2932
|
+
if (maxDecimals < 0)
|
|
2933
|
+
throw new Error("Invalid maxDecimals value: " + maxDecimals);
|
|
2934
|
+
var regexp = this._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS[maxDecimals];
|
|
2935
|
+
if (regexp)
|
|
2936
|
+
return regexp;
|
|
2937
|
+
// New regexp: add it to cache
|
|
2938
|
+
this._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS[maxDecimals] = new RegExp("^[-]?[0-9]+([.,][0-9]{1," + maxDecimals + "})?$");
|
|
2939
|
+
return this._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS[maxDecimals];
|
|
2940
|
+
};
|
|
2929
2941
|
SharedValidators.validDate = function (control) {
|
|
2930
2942
|
var value = control.value;
|
|
2931
2943
|
var date = !value || moment$4.isMoment(value) ? value : moment$4(control.value, DATE_ISO_PATTERN);
|
|
@@ -2985,24 +2997,15 @@
|
|
|
2985
2997
|
return null;
|
|
2986
2998
|
};
|
|
2987
2999
|
SharedValidators.double = function (opts) {
|
|
2988
|
-
var
|
|
2989
|
-
if (opts && isNotNil(opts.maxDecimals)) {
|
|
2990
|
-
if (opts.maxDecimals < 0)
|
|
2991
|
-
throw new Error("Invalid maxDecimals value: " + opts.maxDecimals);
|
|
2992
|
-
regexpStr = opts.maxDecimals > 1 ? "^[-]?[0-9]+([.,][0-9]{1," + opts.maxDecimals + "})?$" : '^[-]?[0-9]+([.,][0-9])?$';
|
|
2993
|
-
}
|
|
2994
|
-
else {
|
|
2995
|
-
regexpStr = '^[-]?[0-9]+([.,][0-9]*)?$';
|
|
2996
|
-
}
|
|
2997
|
-
var regexp = new RegExp(regexpStr);
|
|
3000
|
+
var regexp = this.getDoubleRegexp(opts === null || opts === void 0 ? void 0 : opts.maxDecimals);
|
|
2998
3001
|
return function (control) {
|
|
2999
3002
|
var value = control.value;
|
|
3000
3003
|
if (Number.isNaN(value)) {
|
|
3001
3004
|
//console.log("WARN: Getting a NaN value !");
|
|
3002
|
-
|
|
3005
|
+
return null;
|
|
3003
3006
|
}
|
|
3004
3007
|
if (isNotNil(value) && value !== '' && !regexp.test(value)) {
|
|
3005
|
-
return { maxDecimals:
|
|
3008
|
+
return { maxDecimals: { maxDecimals: opts === null || opts === void 0 ? void 0 : opts.maxDecimals } };
|
|
3006
3009
|
}
|
|
3007
3010
|
return null;
|
|
3008
3011
|
};
|
|
@@ -3095,6 +3098,14 @@
|
|
|
3095
3098
|
};
|
|
3096
3099
|
return SharedValidators;
|
|
3097
3100
|
}());
|
|
3101
|
+
SharedValidators._REGEXP_CACHE = {
|
|
3102
|
+
DOUBLE_BY_MAX_DECIMALS: {
|
|
3103
|
+
NO_LIMIT: /^[-]?[0-9]+([.,][0-9]*)?$/,
|
|
3104
|
+
1: /^[-]?[0-9]+([.,][0-9])?$/,
|
|
3105
|
+
2: /^[-]?[0-9]+([.,][0-9]{1,2})?$/,
|
|
3106
|
+
3: /^[-]?[0-9]+([.,][0-9]{1,2})?$/,
|
|
3107
|
+
}
|
|
3108
|
+
};
|
|
3098
3109
|
SharedValidators.I18N_ERROR_KEYS = {
|
|
3099
3110
|
required: 'ERROR.FIELD_REQUIRED',
|
|
3100
3111
|
min: 'ERROR.FIELD_MIN',
|
|
@@ -22477,6 +22488,39 @@
|
|
|
22477
22488
|
forward: [{ type: i0.Output }]
|
|
22478
22489
|
};
|
|
22479
22490
|
|
|
22491
|
+
var AppIconComponent = /** @class */ (function () {
|
|
22492
|
+
function AppIconComponent() {
|
|
22493
|
+
this.icon = null;
|
|
22494
|
+
this.matIcon = null;
|
|
22495
|
+
this.matSvgIcon = null;
|
|
22496
|
+
this.color = null;
|
|
22497
|
+
}
|
|
22498
|
+
Object.defineProperty(AppIconComponent.prototype, "ref", {
|
|
22499
|
+
set: function (value) {
|
|
22500
|
+
this.icon = value.icon;
|
|
22501
|
+
this.matIcon = value.matIcon;
|
|
22502
|
+
this.matSvgIcon = value.matSvgIcon;
|
|
22503
|
+
},
|
|
22504
|
+
enumerable: false,
|
|
22505
|
+
configurable: true
|
|
22506
|
+
});
|
|
22507
|
+
;
|
|
22508
|
+
return AppIconComponent;
|
|
22509
|
+
}());
|
|
22510
|
+
AppIconComponent.decorators = [
|
|
22511
|
+
{ type: i0.Component, args: [{
|
|
22512
|
+
selector: 'app-icon',
|
|
22513
|
+
template: "<ion-icon *ngIf=\"icon; else matIcon\" slot=\"icon-only\"\n [color]=\"color\"\n [name]=\"icon\"\n></ion-icon>\n<ng-template #matIcon>\n <mat-icon [svgIcon]=\"matSvgIcon\"\n [style.color]=\"'var(--ion-color-'+color+')'\"\n >{{matIcon}}\n </mat-icon>\n</ng-template>\n\n"
|
|
22514
|
+
},] }
|
|
22515
|
+
];
|
|
22516
|
+
AppIconComponent.propDecorators = {
|
|
22517
|
+
icon: [{ type: i0.Input }],
|
|
22518
|
+
matIcon: [{ type: i0.Input }],
|
|
22519
|
+
matSvgIcon: [{ type: i0.Input }],
|
|
22520
|
+
color: [{ type: i0.Input }],
|
|
22521
|
+
ref: [{ type: i0.Input }]
|
|
22522
|
+
};
|
|
22523
|
+
|
|
22480
22524
|
var CoreModule = /** @class */ (function () {
|
|
22481
22525
|
function CoreModule() {
|
|
22482
22526
|
}
|
|
@@ -22529,7 +22573,8 @@
|
|
|
22529
22573
|
EntityMetadataComponent,
|
|
22530
22574
|
FormButtonsBarComponent,
|
|
22531
22575
|
AppPropertiesForm,
|
|
22532
|
-
AppListForm
|
|
22576
|
+
AppListForm,
|
|
22577
|
+
AppIconComponent
|
|
22533
22578
|
],
|
|
22534
22579
|
exports: [
|
|
22535
22580
|
SharedModule,
|
|
@@ -22555,6 +22600,7 @@
|
|
|
22555
22600
|
AppListForm,
|
|
22556
22601
|
AppInstallUpgradeCard,
|
|
22557
22602
|
DepartmentToStringPipe,
|
|
22603
|
+
AppIconComponent
|
|
22558
22604
|
]
|
|
22559
22605
|
},] }
|
|
22560
22606
|
];
|
|
@@ -28334,6 +28380,7 @@
|
|
|
28334
28380
|
exports["ɵi"] = RegisterModal;
|
|
28335
28381
|
exports["ɵj"] = UserSettingsValidatorService;
|
|
28336
28382
|
exports["ɵk"] = LocalSettingsValidatorService;
|
|
28383
|
+
exports["ɵl"] = AppIconComponent;
|
|
28337
28384
|
|
|
28338
28385
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
28339
28386
|
|