@sumaris-net/ngx-components 1.6.14 → 1.6.18
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 +135 -38
- 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/shared/material/badge/badge-icon.directive.js +93 -20
- package/esm2015/src/app/shared/material/badge/badge-icon.test.js +9 -2
- package/esm2015/src/app/shared/material/latlong/material.latlong.js +20 -19
- package/fesm2015/sumaris-net.ngx-components.js +116 -38
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/shared/material/badge/badge-icon.directive.d.ts +20 -7
- package/src/app/shared/material/badge/badge-icon.test.d.ts +7 -0
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -4151,24 +4151,25 @@ class MatLatLongField {
|
|
|
4151
4151
|
this.pattern = 'DDMM';
|
|
4152
4152
|
this.mask = MASKS[this.type][this.pattern];
|
|
4153
4153
|
}
|
|
4154
|
-
if (this.maxDecimals) {
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
}
|
|
4154
|
+
if (isNil(this.maxDecimals)) {
|
|
4155
|
+
this.maxDecimals = DEFAULT_MAX_DECIMALS;
|
|
4156
|
+
}
|
|
4157
|
+
// Remove max decimals in the DDMMSS format
|
|
4158
|
+
else if (this.pattern === 'DD') {
|
|
4159
|
+
console.warn(`Invalid attribute 'maxDecimals' - Must be '0' when using the 'DDMMSS' pattern.`);
|
|
4160
|
+
this.maxDecimals = 7;
|
|
4161
|
+
}
|
|
4162
|
+
else if (this.pattern === 'DDMMSS') {
|
|
4163
|
+
console.warn(`Invalid attribute 'maxDecimals' - Must be '0' when using the 'DDMMSS' pattern.`);
|
|
4164
|
+
this.maxDecimals = 0;
|
|
4165
|
+
}
|
|
4166
|
+
else if (this.maxDecimals < 0) {
|
|
4167
|
+
console.error('Invalid attribute \'maxDecimals\'. Must a positive value.');
|
|
4168
|
+
this.maxDecimals = DEFAULT_MAX_DECIMALS;
|
|
4169
|
+
}
|
|
4170
|
+
else if (this.maxDecimals !== DEFAULT_MAX_DECIMALS) {
|
|
4171
|
+
console.warn(`Invalid attribute 'maxDecimals' - Expected value: ${DEFAULT_MAX_DECIMALS}. Other value not implemented.`);
|
|
4172
|
+
this.maxDecimals = DEFAULT_MAX_DECIMALS;
|
|
4172
4173
|
}
|
|
4173
4174
|
this.showSignControl = this.pattern !== 'DD';
|
|
4174
4175
|
this.formatFn = this.type === 'latitude' ? formatLatitude : formatLongitude;
|
|
@@ -7473,14 +7474,74 @@ MaterialChipsModule.decorators = [
|
|
|
7473
7474
|
class MatBadgeIconDirective {
|
|
7474
7475
|
constructor(el) {
|
|
7475
7476
|
this.el = el;
|
|
7477
|
+
this._subscription = null;
|
|
7478
|
+
this._$update = new Subject();
|
|
7479
|
+
}
|
|
7480
|
+
set size(value) {
|
|
7481
|
+
if (this._size !== value) {
|
|
7482
|
+
this._size = value;
|
|
7483
|
+
this.updateView();
|
|
7484
|
+
}
|
|
7485
|
+
}
|
|
7486
|
+
get size() {
|
|
7487
|
+
return this._size;
|
|
7488
|
+
}
|
|
7489
|
+
set color(value) {
|
|
7490
|
+
if (this._color !== value) {
|
|
7491
|
+
this._color = value;
|
|
7492
|
+
this.updateView();
|
|
7493
|
+
}
|
|
7494
|
+
}
|
|
7495
|
+
get color() {
|
|
7496
|
+
return this._color;
|
|
7497
|
+
}
|
|
7498
|
+
set fill(value) {
|
|
7499
|
+
if (this._fill !== value) {
|
|
7500
|
+
this._fill = value;
|
|
7501
|
+
this.updateView();
|
|
7502
|
+
}
|
|
7503
|
+
}
|
|
7504
|
+
get fill() {
|
|
7505
|
+
return this._fill;
|
|
7506
|
+
}
|
|
7507
|
+
set matIcon(icon) {
|
|
7508
|
+
if (this._matIcon !== icon) {
|
|
7509
|
+
this._matIcon = icon;
|
|
7510
|
+
this.updateView();
|
|
7511
|
+
}
|
|
7512
|
+
}
|
|
7513
|
+
set ionIcon(icon) {
|
|
7514
|
+
if (this._ionIcon !== icon) {
|
|
7515
|
+
this._ionIcon = icon;
|
|
7516
|
+
this.updateView();
|
|
7517
|
+
}
|
|
7476
7518
|
}
|
|
7477
7519
|
ngOnInit() {
|
|
7478
|
-
|
|
7479
|
-
this.
|
|
7480
|
-
|
|
7481
|
-
|
|
7520
|
+
// Default value
|
|
7521
|
+
this._size = this._size || 'medium';
|
|
7522
|
+
this._color = this._color || 'primary';
|
|
7523
|
+
if (this._color === 'warn')
|
|
7524
|
+
this._color = 'warning';
|
|
7525
|
+
this.updateView(true);
|
|
7526
|
+
this._subscription = this._$update
|
|
7527
|
+
.pipe(debounceTime(100))
|
|
7528
|
+
.subscribe(() => this.updateView(true));
|
|
7529
|
+
}
|
|
7530
|
+
ngOnDestroy() {
|
|
7531
|
+
var _a;
|
|
7532
|
+
(_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
7533
|
+
}
|
|
7534
|
+
updateView(immediate) {
|
|
7535
|
+
// Async by default
|
|
7536
|
+
if (!immediate) {
|
|
7537
|
+
this._$update.next();
|
|
7538
|
+
return;
|
|
7539
|
+
}
|
|
7540
|
+
const badge = this.el.nativeElement.querySelector('.mat-badge-content');
|
|
7541
|
+
if (!badge)
|
|
7542
|
+
return;
|
|
7482
7543
|
let fontSize;
|
|
7483
|
-
switch (this.
|
|
7544
|
+
switch (this._size) {
|
|
7484
7545
|
case 'large':
|
|
7485
7546
|
fontSize = '24px';
|
|
7486
7547
|
break;
|
|
@@ -7491,26 +7552,34 @@ class MatBadgeIconDirective {
|
|
|
7491
7552
|
fontSize = '16px';
|
|
7492
7553
|
break;
|
|
7493
7554
|
}
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7555
|
+
let html = '';
|
|
7556
|
+
if (this._matIcon) {
|
|
7557
|
+
html = `<i class="material-icons" style="font-size: ${fontSize};">${this._matIcon}</i>`;
|
|
7558
|
+
}
|
|
7559
|
+
else if (this._ionIcon) {
|
|
7560
|
+
html = `<ion-icon style="font-size: ${fontSize}; pointer-events: none;" name="${this._ionIcon}"></ion-icon>`;
|
|
7561
|
+
}
|
|
7562
|
+
if (this._html !== html) {
|
|
7563
|
+
this._html = html;
|
|
7564
|
+
badge.innerHTML = html;
|
|
7565
|
+
}
|
|
7566
|
+
// Update style
|
|
7498
7567
|
// fill: 'clear'
|
|
7499
|
-
if (this.
|
|
7500
|
-
badge.style.color = `var(--ion-color-${this.
|
|
7568
|
+
if (this._fill === 'clear') {
|
|
7569
|
+
badge.style.color = `var(--ion-color-${this._color})`;
|
|
7501
7570
|
badge.style.background = 'transparent';
|
|
7502
7571
|
}
|
|
7503
7572
|
// fill: 'solid' (default value)
|
|
7504
7573
|
else {
|
|
7505
|
-
badge.style.background = `var(--ion-color-${this.
|
|
7506
|
-
badge.style.color = `var(--ion-color-${this.
|
|
7507
|
-
}
|
|
7508
|
-
if (this.matIcon) {
|
|
7509
|
-
badge.innerHTML = `<i class="material-icons" style="font-size: ${fontSize};">${this.matIcon}</i>`;
|
|
7510
|
-
}
|
|
7511
|
-
else if (this.ionIcon) {
|
|
7512
|
-
badge.innerHTML = `<ion-icon style="font-size: ${fontSize}; pointer-events: none;" name="${this.ionIcon}"></ion-icon>`;
|
|
7574
|
+
badge.style.background = `var(--ion-color-${this._color})`;
|
|
7575
|
+
badge.style.color = `var(--ion-color-${this._color}-contrast)`;
|
|
7513
7576
|
}
|
|
7577
|
+
if (badge.style.display !== 'inline-block')
|
|
7578
|
+
badge.style.display = 'inline-block';
|
|
7579
|
+
if (badge.style.alignItems !== 'center')
|
|
7580
|
+
badge.style.alignItems = 'center';
|
|
7581
|
+
if (badge.style.justifyContent !== 'center')
|
|
7582
|
+
badge.style.justifyContent = 'center';
|
|
7514
7583
|
}
|
|
7515
7584
|
}
|
|
7516
7585
|
MatBadgeIconDirective.decorators = [
|
|
@@ -7527,6 +7596,9 @@ MatBadgeIconDirective.ctorParameters = () => [
|
|
|
7527
7596
|
{ type: ElementRef }
|
|
7528
7597
|
];
|
|
7529
7598
|
MatBadgeIconDirective.propDecorators = {
|
|
7599
|
+
size: [{ type: Input, args: ['matBadgeSize',] }],
|
|
7600
|
+
color: [{ type: Input, args: ['matBadgeColor',] }],
|
|
7601
|
+
fill: [{ type: Input, args: ['matBadgeFill',] }],
|
|
7530
7602
|
matIcon: [{ type: Input, args: ['matBadgeIcon',] }],
|
|
7531
7603
|
ionIcon: [{ type: Input, args: ['ionBadgeIcon',] }]
|
|
7532
7604
|
};
|
|
@@ -17061,11 +17133,17 @@ ChipsTestPage.ctorParameters = () => [
|
|
|
17061
17133
|
];
|
|
17062
17134
|
|
|
17063
17135
|
class MatBadgeIconTestPage {
|
|
17136
|
+
constructor() {
|
|
17137
|
+
this.$icon = new BehaviorSubject('alert');
|
|
17138
|
+
this.$size = new BehaviorSubject('small');
|
|
17139
|
+
this.$fill = new BehaviorSubject('solid');
|
|
17140
|
+
this.$color = new BehaviorSubject('danger');
|
|
17141
|
+
}
|
|
17064
17142
|
}
|
|
17065
17143
|
MatBadgeIconTestPage.decorators = [
|
|
17066
17144
|
{ type: Component, args: [{
|
|
17067
17145
|
selector: 'mat-badge-icon-test',
|
|
17068
|
-
template: "\n<ion-header>\n <ion-toolbar color=\"primary\">\n\n <ion-buttons slot=\"start\">\n <ion-back-button></ion-back-button>\n </ion-buttons>\n\n <ion-title>matBadgeIcon directive</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class=\"ion-padding\">\n\n <!-- small badge -->\n <p>\n <ion-text color=\"tertiary\">\n <span matBadge matIcon=\"check\"\n matBadgeSize=\"small\"\n matBadgeColor=\"accent\"\n matBadgeOverlap=\"false\">Small badge</span>\n </ion-text>\n </p>\n\n <!-- medium badge -->\n <p>\n <ion-text matBadge matBadgeIcon=\"check\"\n matBadgeSize=\"medium\"\n matBadgeColor=\"tertiary\"\n matBadgeOverlap=\"false\"\n >Medium badge</ion-text>\n </p>\n\n <!-- small badge -->\n <p>\n <ion-label matBadge matBadgeIcon=\"close\" matBadgeSize=\"large\"\n matBadgeOverlap=\"false\">Large badge</ion-label>\n </p>\n\n <!-- default size badge -->\n <p>\n <ion-label matBadge matBadgeIcon=\"check\" matBadgeColor=\"success\"\n matBadgeOverlap=\"false\">Badge (no size, no color)\n </ion-label>\n </p>\n\n <!-- ion icon -->\n <p>\n <ion-label matBadge\n ionBadgeIcon=\"checkmark\"\n matBadgeColor=\"success\"\n matBadgeOverlap=\"false\">Badge with ion-icon\n </ion-label>\n </p>\n\n <!-- ion icon clear -->\n <p>\n <ion-label matBadge\n ionBadgeIcon=\"checkmark-circle\"\n matBadgeColor=\"tertiary\"\n matBadgeFill=\"clear\"\n matBadgeOverlap=\"false\">Badge with clear icon\n </ion-label>\n </p>\n\n\n</ion-content>\n"
|
|
17146
|
+
template: "\n<ion-header>\n <ion-toolbar color=\"primary\">\n\n <ion-buttons slot=\"start\">\n <ion-back-button></ion-back-button>\n </ion-buttons>\n\n <ion-title>matBadgeIcon directive</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class=\"ion-padding\">\n\n <!-- small badge -->\n <p>\n <ion-text color=\"tertiary\">\n <span matBadge matIcon=\"check\"\n matBadgeSize=\"small\"\n matBadgeColor=\"accent\"\n matBadgeOverlap=\"false\">Small badge</span>\n </ion-text>\n </p>\n\n <!-- medium badge -->\n <p>\n <ion-text matBadge matBadgeIcon=\"check\"\n matBadgeSize=\"medium\"\n matBadgeColor=\"tertiary\"\n matBadgeOverlap=\"false\"\n >Medium badge</ion-text>\n </p>\n\n <!-- small badge -->\n <p>\n <ion-label matBadge matBadgeIcon=\"close\" matBadgeSize=\"large\"\n matBadgeOverlap=\"false\">Large badge</ion-label>\n </p>\n\n <!-- default size badge -->\n <p>\n <ion-label matBadge matBadgeIcon=\"check\" matBadgeColor=\"success\"\n matBadgeOverlap=\"false\">Badge (no size, no color)\n </ion-label>\n </p>\n\n <!-- ion icon -->\n <p>\n <ion-label matBadge\n ionBadgeIcon=\"checkmark\"\n matBadgeColor=\"success\"\n matBadgeOverlap=\"false\">Badge with ion-icon\n </ion-label>\n </p>\n\n <!-- ion icon clear -->\n <p>\n <ion-label matBadge\n ionBadgeIcon=\"checkmark-circle\"\n matBadgeColor=\"tertiary\"\n matBadgeFill=\"clear\"\n matBadgeOverlap=\"false\">Badge with clear icon\n </ion-label>\n </p>\n\n <ion-row class=\"ion-no-padding\">\n <ion-col>\n <mat-icon [style.color]=\"'var(--ion-color-secondary)'\"\n matBadge\n [ionBadgeIcon]=\"$icon|async\"\n [matBadgeColor]=\"$color|async\"\n [matBadgeFill]=\"$fill|async\"\n [matBadgeSize]=\"$size|async\"\n matBadgeOverlap=\"false\">\n <ion-icon slot=\"icon-only\"\n [color]=\"'secondary'\"\n name=\"navigate\"\n ></ion-icon>\n </mat-icon>\n </ion-col>\n\n <ion-col>\n <mat-form-field>\n <mat-select placeholder=\"matBadgeColor\"\n [value]=\"$color.value\"\n (selectionChange)=\"this.$color.next($event.value)\">\n <mat-option [value]=\"'primary'\">primary</mat-option>\n <mat-option [value]=\"'secondary'\">secondary</mat-option>\n <mat-option [value]=\"'tertiary'\">tertiary</mat-option>\n <mat-option [value]=\"'danger'\">danger</mat-option>\n </mat-select>\n </mat-form-field>\n </ion-col>\n\n <ion-col>\n <mat-form-field>\n <mat-select placeholder=\"ionBadgeIcon\"\n [value]=\"$icon.value\"\n (selectionChange)=\"this.$icon.next($event.value)\">\n <mat-option [value]=\"'checkmark-circle'\">checkmark-circle</mat-option>\n <mat-option [value]=\"'alert-circle'\">alert-circle</mat-option>\n <mat-option [value]=\"'alert'\">alert</mat-option>\n <mat-option [value]=\"'flag'\">flag</mat-option>\n </mat-select>\n </mat-form-field>\n </ion-col>\n\n <ion-col>\n <mat-form-field>\n <mat-select placeholder=\"matBadgeSize\"\n [value]=\"$size.value\"\n (selectionChange)=\"this.$size.next($event.value)\">\n <mat-option [value]=\"'large'\">large</mat-option>\n <mat-option [value]=\"'medium'\">medium</mat-option>\n <mat-option [value]=\"'small'\">small</mat-option>\n </mat-select>\n </mat-form-field>\n </ion-col>\n\n <ion-col>\n <mat-form-field>\n <mat-select placeholder=\"matBadgeFill\"\n [value]=\"$fill.value\"\n (selectionChange)=\"this.$fill.next($event.value)\">\n <mat-option [value]=\"'clear'\">clear</mat-option>\n <mat-option [value]=\"'solid'\">solid</mat-option>\n </mat-select>\n </mat-form-field>\n </ion-col>\n </ion-row>\n\n</ion-content>\n"
|
|
17069
17147
|
},] }
|
|
17070
17148
|
];
|
|
17071
17149
|
|