@sumaris-net/ngx-components 1.6.15 → 1.7.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.
@@ -4566,6 +4566,42 @@
4566
4566
  { type: ngx.Keyboard, decorators: [{ type: i0.Optional }] }
4567
4567
  ]; };
4568
4568
 
4569
+ var NgVarDirective = /** @class */ (function () {
4570
+ function NgVarDirective(templateRef, vcRef) {
4571
+ this.templateRef = templateRef;
4572
+ this.vcRef = vcRef;
4573
+ this.context = {
4574
+ $implicit: null,
4575
+ ngVar: null,
4576
+ };
4577
+ this.hasView = false;
4578
+ }
4579
+ Object.defineProperty(NgVarDirective.prototype, "ngVar", {
4580
+ set: function (context) {
4581
+ this.context.$implicit = this.context.ngVar = context;
4582
+ if (!this.hasView) {
4583
+ this.vcRef.createEmbeddedView(this.templateRef, this.context);
4584
+ this.hasView = true;
4585
+ }
4586
+ },
4587
+ enumerable: false,
4588
+ configurable: true
4589
+ });
4590
+ return NgVarDirective;
4591
+ }());
4592
+ NgVarDirective.decorators = [
4593
+ { type: i0.Directive, args: [{
4594
+ selector: '[ngVar]',
4595
+ },] }
4596
+ ];
4597
+ NgVarDirective.ctorParameters = function () { return [
4598
+ { type: i0.TemplateRef },
4599
+ { type: i0.ViewContainerRef }
4600
+ ]; };
4601
+ NgVarDirective.propDecorators = {
4602
+ ngVar: [{ type: i0.Input }]
4603
+ };
4604
+
4569
4605
  var SharedDirectivesModule = /** @class */ (function () {
4570
4606
  function SharedDirectivesModule() {
4571
4607
  }
@@ -4578,10 +4614,12 @@
4578
4614
  i1$5.IonicModule
4579
4615
  ],
4580
4616
  declarations: [
4581
- AutofocusDirective
4617
+ AutofocusDirective,
4618
+ NgVarDirective
4582
4619
  ],
4583
4620
  exports: [
4584
- AutofocusDirective
4621
+ AutofocusDirective,
4622
+ NgVarDirective
4585
4623
  ]
4586
4624
  },] }
4587
4625
  ];
@@ -4720,24 +4758,25 @@
4720
4758
  this.pattern = 'DDMM';
4721
4759
  this.mask = MASKS[this.type][this.pattern];
4722
4760
  }
4723
- if (this.maxDecimals) {
4724
- if (this.maxDecimals < 0) {
4725
- console.error('Invalid attribute \'maxDecimals\'. Must a positive value.');
4726
- this.maxDecimals = DEFAULT_MAX_DECIMALS;
4727
- }
4728
- // Remove max decimals in the DDMMSS format
4729
- else if (this.pattern === 'DD') {
4730
- console.warn("Invalid attribute 'maxDecimals' - Must be '0' when using the 'DDMMSS' pattern.");
4731
- this.maxDecimals = 7;
4732
- }
4733
- else if (this.pattern === 'DDMMSS') {
4734
- console.warn("Invalid attribute 'maxDecimals' - Must be '0' when using the 'DDMMSS' pattern.");
4735
- this.maxDecimals = 0;
4736
- }
4737
- else if (this.maxDecimals !== DEFAULT_MAX_DECIMALS) {
4738
- console.warn("Invalid attribute 'maxDecimals' - Expected value: " + DEFAULT_MAX_DECIMALS + ". Other value not implemented.");
4739
- this.maxDecimals = DEFAULT_MAX_DECIMALS;
4740
- }
4761
+ if (isNil(this.maxDecimals)) {
4762
+ this.maxDecimals = DEFAULT_MAX_DECIMALS;
4763
+ }
4764
+ // Remove max decimals in the DDMMSS format
4765
+ else if (this.pattern === 'DD') {
4766
+ console.warn("Invalid attribute 'maxDecimals' - Must be '0' when using the 'DDMMSS' pattern.");
4767
+ this.maxDecimals = 7;
4768
+ }
4769
+ else if (this.pattern === 'DDMMSS') {
4770
+ console.warn("Invalid attribute 'maxDecimals' - Must be '0' when using the 'DDMMSS' pattern.");
4771
+ this.maxDecimals = 0;
4772
+ }
4773
+ else if (this.maxDecimals < 0) {
4774
+ console.error('Invalid attribute \'maxDecimals\'. Must a positive value.');
4775
+ this.maxDecimals = DEFAULT_MAX_DECIMALS;
4776
+ }
4777
+ else if (this.maxDecimals !== DEFAULT_MAX_DECIMALS) {
4778
+ console.warn("Invalid attribute 'maxDecimals' - Expected value: " + DEFAULT_MAX_DECIMALS + ". Other value not implemented.");
4779
+ this.maxDecimals = DEFAULT_MAX_DECIMALS;
4741
4780
  }
4742
4781
  this.showSignControl = this.pattern !== 'DD';
4743
4782
  this.formatFn = this.type === 'latitude' ? formatLatitude : formatLongitude;
@@ -8369,7 +8408,48 @@
8369
8408
  var MatBadgeIconDirective = /** @class */ (function () {
8370
8409
  function MatBadgeIconDirective(el) {
8371
8410
  this.el = el;
8411
+ this._subscription = null;
8412
+ this._$update = new rxjs.Subject();
8372
8413
  }
8414
+ Object.defineProperty(MatBadgeIconDirective.prototype, "size", {
8415
+ get: function () {
8416
+ return this._size;
8417
+ },
8418
+ set: function (value) {
8419
+ if (this._size !== value) {
8420
+ this._size = value;
8421
+ this.updateView();
8422
+ }
8423
+ },
8424
+ enumerable: false,
8425
+ configurable: true
8426
+ });
8427
+ Object.defineProperty(MatBadgeIconDirective.prototype, "color", {
8428
+ get: function () {
8429
+ return this._color;
8430
+ },
8431
+ set: function (value) {
8432
+ if (this._color !== value) {
8433
+ this._color = value;
8434
+ this.updateView();
8435
+ }
8436
+ },
8437
+ enumerable: false,
8438
+ configurable: true
8439
+ });
8440
+ Object.defineProperty(MatBadgeIconDirective.prototype, "fill", {
8441
+ get: function () {
8442
+ return this._fill;
8443
+ },
8444
+ set: function (value) {
8445
+ if (this._fill !== value) {
8446
+ this._fill = value;
8447
+ this.updateView();
8448
+ }
8449
+ },
8450
+ enumerable: false,
8451
+ configurable: true
8452
+ });
8373
8453
  Object.defineProperty(MatBadgeIconDirective.prototype, "matIcon", {
8374
8454
  set: function (icon) {
8375
8455
  if (this._matIcon !== icon) {
@@ -8391,18 +8471,32 @@
8391
8471
  configurable: true
8392
8472
  });
8393
8473
  MatBadgeIconDirective.prototype.ngOnInit = function () {
8394
- this.updateView();
8474
+ var _this = this;
8475
+ // Default value
8476
+ this._size = this._size || 'medium';
8477
+ this._color = this._color || 'primary';
8478
+ if (this._color === 'warn')
8479
+ this._color = 'warning';
8480
+ this.updateView(true);
8481
+ this._subscription = this._$update
8482
+ .pipe(operators.debounceTime(100))
8483
+ .subscribe(function () { return _this.updateView(true); });
8484
+ };
8485
+ MatBadgeIconDirective.prototype.ngOnDestroy = function () {
8486
+ var _a;
8487
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
8395
8488
  };
8396
- MatBadgeIconDirective.prototype.updateView = function () {
8397
- this.size = this.size || 'medium';
8398
- this.color = this.color || 'primary';
8399
- if (this.color === 'warn')
8400
- this.color = 'warning';
8489
+ MatBadgeIconDirective.prototype.updateView = function (immediate) {
8490
+ // Async by default
8491
+ if (!immediate) {
8492
+ this._$update.next();
8493
+ return;
8494
+ }
8401
8495
  var badge = this.el.nativeElement.querySelector('.mat-badge-content');
8402
8496
  if (!badge)
8403
8497
  return;
8404
8498
  var fontSize;
8405
- switch (this.size) {
8499
+ switch (this._size) {
8406
8500
  case 'large':
8407
8501
  fontSize = '24px';
8408
8502
  break;
@@ -8413,25 +8507,34 @@
8413
8507
  fontSize = '16px';
8414
8508
  break;
8415
8509
  }
8416
- badge.style.display = 'flex';
8417
- badge.style.alignItems = 'center';
8418
- badge.style.justifyContent = 'center';
8510
+ var html = '';
8511
+ if (this._matIcon) {
8512
+ html = "<i class=\"material-icons\" style=\"font-size: " + fontSize + ";\">" + this._matIcon + "</i>";
8513
+ }
8514
+ else if (this._ionIcon) {
8515
+ html = "<ion-icon style=\"font-size: " + fontSize + "; pointer-events: none;\" name=\"" + this._ionIcon + "\"></ion-icon>";
8516
+ }
8517
+ if (this._html !== html) {
8518
+ this._html = html;
8519
+ badge.innerHTML = html;
8520
+ }
8521
+ // Update style
8419
8522
  // fill: 'clear'
8420
- if (this.fill === 'clear') {
8421
- badge.style.color = "var(--ion-color-" + this.color + ")";
8523
+ if (this._fill === 'clear') {
8524
+ badge.style.color = "var(--ion-color-" + this._color + ")";
8422
8525
  badge.style.background = 'transparent';
8423
8526
  }
8424
8527
  // fill: 'solid' (default value)
8425
8528
  else {
8426
- badge.style.background = "var(--ion-color-" + this.color + ")";
8427
- badge.style.color = "var(--ion-color-" + this.color + "-contrast)";
8428
- }
8429
- if (this._matIcon) {
8430
- badge.innerHTML = "<i class=\"material-icons\" style=\"font-size: " + fontSize + ";\">" + this._matIcon + "</i>";
8431
- }
8432
- else if (this._ionIcon) {
8433
- badge.innerHTML = "<ion-icon style=\"font-size: " + fontSize + "; pointer-events: none;\" name=\"" + this._ionIcon + "\"></ion-icon>";
8529
+ badge.style.background = "var(--ion-color-" + this._color + ")";
8530
+ badge.style.color = "var(--ion-color-" + this._color + "-contrast)";
8434
8531
  }
8532
+ if (badge.style.display !== 'inline-block')
8533
+ badge.style.display = 'inline-block';
8534
+ if (badge.style.alignItems !== 'center')
8535
+ badge.style.alignItems = 'center';
8536
+ if (badge.style.justifyContent !== 'center')
8537
+ badge.style.justifyContent = 'center';
8435
8538
  };
8436
8539
  return MatBadgeIconDirective;
8437
8540
  }());
@@ -8449,6 +8552,9 @@
8449
8552
  { type: i0.ElementRef }
8450
8553
  ]; };
8451
8554
  MatBadgeIconDirective.propDecorators = {
8555
+ size: [{ type: i0.Input, args: ['matBadgeSize',] }],
8556
+ color: [{ type: i0.Input, args: ['matBadgeColor',] }],
8557
+ fill: [{ type: i0.Input, args: ['matBadgeFill',] }],
8452
8558
  matIcon: [{ type: i0.Input, args: ['matBadgeIcon',] }],
8453
8559
  ionIcon: [{ type: i0.Input, args: ['ionBadgeIcon',] }]
8454
8560
  };
@@ -19599,18 +19705,17 @@
19599
19705
 
19600
19706
  var MatBadgeIconTestPage = /** @class */ (function () {
19601
19707
  function MatBadgeIconTestPage() {
19602
- this.$dynamicIcon = new rxjs.BehaviorSubject('alert');
19708
+ this.$icon = new rxjs.BehaviorSubject('alert');
19709
+ this.$size = new rxjs.BehaviorSubject('small');
19710
+ this.$fill = new rxjs.BehaviorSubject('solid');
19711
+ this.$color = new rxjs.BehaviorSubject('danger');
19603
19712
  }
19604
- MatBadgeIconTestPage.prototype.changeIcon = function (event) {
19605
- console.info(event);
19606
- this.$dynamicIcon.next(event.value);
19607
- };
19608
19713
  return MatBadgeIconTestPage;
19609
19714
  }());
19610
19715
  MatBadgeIconTestPage.decorators = [
19611
19716
  { type: i0.Component, args: [{
19612
19717
  selector: 'mat-badge-icon-test',
19613
- 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 <ion-label matBadge\n [ionBadgeIcon]=\"$dynamicIcon|async\"\n matBadgeColor=\"tertiary\"\n matBadgeFill=\"clear\"\n matBadgeOverlap=\"false\">Badge with dynamic icon\n </ion-label>\n </ion-col>\n\n <ion-col>\n <mat-form-field>\n <mat-select\n placeholder=\"Select icon\" (selectionChange)=\"changeIcon($event)\"\n [value]=\"$dynamicIcon.value\">\n <mat-option [value]=\"'checkmark-circle'\">checkmark-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\n </ion-col>\n </ion-row>\n\n</ion-content>\n"
19718
+ 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"
19614
19719
  },] }
19615
19720
  ];
19616
19721
 
@@ -29138,6 +29243,7 @@
29138
29243
  exports.ModalToolbarComponent = ModalToolbarComponent;
29139
29244
  exports.NetworkService = NetworkService;
29140
29245
  exports.NgInitDirective = NgInitDirective;
29246
+ exports.NgVarDirective = NgVarDirective;
29141
29247
  exports.NotEmptyArrayPipe = NotEmptyArrayPipe;
29142
29248
  exports.NumberFormatPipe = NumberFormatPipe;
29143
29249
  exports.NumpadDirective = NumpadDirective;