@seniorsistemas/angular-components 16.2.1 → 16.2.2

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.
Files changed (24) hide show
  1. package/bundles/seniorsistemas-angular-components.umd.js +53 -10
  2. package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
  3. package/bundles/seniorsistemas-angular-components.umd.min.js +1 -1
  4. package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
  5. package/components/dynamic-form/configurations/fields/field.d.ts +3 -0
  6. package/components/tooltip/models/index.d.ts +2 -0
  7. package/components/tooltip/models/tooltip-event.d.ts +4 -0
  8. package/components/tooltip/tooltip.directive.d.ts +5 -2
  9. package/esm2015/components/dynamic-form/configurations/fields/field.js +2 -1
  10. package/esm2015/components/dynamic-form/dynamic-field.component.js +2 -1
  11. package/esm2015/components/tooltip/models/index.js +3 -1
  12. package/esm2015/components/tooltip/models/tooltip-event.js +6 -0
  13. package/esm2015/components/tooltip/tooltip.directive.js +47 -12
  14. package/esm5/components/dynamic-form/configurations/fields/field.js +2 -1
  15. package/esm5/components/dynamic-form/dynamic-field.component.js +2 -2
  16. package/esm5/components/tooltip/models/index.js +3 -1
  17. package/esm5/components/tooltip/models/tooltip-event.js +6 -0
  18. package/esm5/components/tooltip/tooltip.directive.js +47 -12
  19. package/fesm2015/seniorsistemas-angular-components.js +53 -9
  20. package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
  21. package/fesm5/seniorsistemas-angular-components.js +53 -10
  22. package/fesm5/seniorsistemas-angular-components.js.map +1 -1
  23. package/package.json +1 -1
  24. package/seniorsistemas-angular-components.metadata.json +1 -1
@@ -1238,6 +1238,7 @@
1238
1238
  this.type = config.type;
1239
1239
  this.size = new FieldSize(config.size || {});
1240
1240
  this.errorMessages = config.errorMessages;
1241
+ this.bottomTemplate = config.bottomTemplate;
1241
1242
  this.gridClass = Object.keys(this.size).map(function (key) { return "ui-" + key + "-" + _this.size[key]; });
1242
1243
  this.defaultValue = config.defaultValue;
1243
1244
  this.representedBy = config.representedBy;
@@ -3281,6 +3282,12 @@
3281
3282
  MobileBehavior["Tap"] = "tap";
3282
3283
  })(MobileBehavior || (MobileBehavior = {}));
3283
3284
 
3285
+ var TooltipEvent;
3286
+ (function (TooltipEvent) {
3287
+ TooltipEvent["Focus"] = "focus";
3288
+ TooltipEvent["Hover"] = "hover";
3289
+ })(TooltipEvent || (TooltipEvent = {}));
3290
+
3284
3291
  var TooltipDirective = /** @class */ (function () {
3285
3292
  function TooltipDirective(elementRef, appRef, componentFactoryResolver, injector) {
3286
3293
  this.elementRef = elementRef;
@@ -3289,7 +3296,9 @@
3289
3296
  this.injector = injector;
3290
3297
  this.position = exports.TooltipPosition.Top;
3291
3298
  this.showDelay = 500;
3299
+ this.tooltipEvent = TooltipEvent.Hover;
3292
3300
  this.escape = false;
3301
+ this.visible = true;
3293
3302
  this.mobileBehavior = MobileBehavior.Pressing;
3294
3303
  this.componentRef = null;
3295
3304
  }
@@ -3302,28 +3311,50 @@
3302
3311
  // whenever the component with the tooltip is clicked I destroy the tooltip.
3303
3312
  // whenever a key is pressed on the component with the tooltip I destroy the tooltip.
3304
3313
  TooltipDirective.prototype.onClick = function () {
3305
- if (!navigator.userAgent.match(/Android/i) && !navigator.userAgent.match(/iPhone/i)) {
3314
+ if (this.tooltipEvent === TooltipEvent.Hover &&
3315
+ !navigator.userAgent.match(/Android/i) &&
3316
+ !navigator.userAgent.match(/iPhone/i)) {
3306
3317
  this.destroy();
3307
3318
  }
3308
3319
  };
3309
3320
  // whenever you touch outside the component with the tooltip I destroy the tooltip.
3310
3321
  TooltipDirective.prototype.onDocumentTouchStart = function () {
3311
- this.destroy();
3322
+ if (this.tooltipEvent === TooltipEvent.Hover) {
3323
+ this.destroy();
3324
+ }
3325
+ };
3326
+ TooltipDirective.prototype.onFocus = function () {
3327
+ if (this.tooltipEvent === TooltipEvent.Focus) {
3328
+ this.createTootip();
3329
+ }
3330
+ };
3331
+ TooltipDirective.prototype.onBlur = function () {
3332
+ if (this.tooltipEvent === TooltipEvent.Focus) {
3333
+ this.destroy();
3334
+ }
3312
3335
  };
3313
3336
  TooltipDirective.prototype.onMouseEnter = function () {
3314
- this.createTootip();
3337
+ if (this.tooltipEvent === TooltipEvent.Hover) {
3338
+ this.createTootip();
3339
+ }
3315
3340
  };
3316
3341
  TooltipDirective.prototype.onMouseLeave = function () {
3317
- this.setHideTooltipTimeout();
3342
+ if (this.tooltipEvent === TooltipEvent.Hover) {
3343
+ this.setHideTooltipTimeout();
3344
+ }
3318
3345
  };
3319
3346
  TooltipDirective.prototype.onTouchStart = function () {
3320
- window.clearTimeout(this.touchTimeout);
3321
- this.touchTimeout = window.setTimeout(this.createTootip.bind(this), this.mobileBehavior === MobileBehavior.Pressing ? this.showDelay : 0);
3347
+ if (this.tooltipEvent === TooltipEvent.Hover) {
3348
+ window.clearTimeout(this.touchTimeout);
3349
+ this.touchTimeout = window.setTimeout(this.createTootip.bind(this), this.mobileBehavior === MobileBehavior.Pressing ? this.showDelay : 0);
3350
+ }
3322
3351
  };
3323
3352
  TooltipDirective.prototype.onTouchEnd = function () {
3324
- if (this.mobileBehavior === MobileBehavior.Pressing) {
3325
- window.clearTimeout(this.touchTimeout);
3326
- this.setHideTooltipTimeout();
3353
+ if (this.tooltipEvent === TooltipEvent.Hover) {
3354
+ if (this.mobileBehavior === MobileBehavior.Pressing) {
3355
+ window.clearTimeout(this.touchTimeout);
3356
+ this.setHideTooltipTimeout();
3357
+ }
3327
3358
  }
3328
3359
  };
3329
3360
  TooltipDirective.prototype.validatePosition = function () {
@@ -3483,9 +3514,15 @@
3483
3514
  __decorate([
3484
3515
  core.Input()
3485
3516
  ], TooltipDirective.prototype, "displayTime", void 0);
3517
+ __decorate([
3518
+ core.Input()
3519
+ ], TooltipDirective.prototype, "tooltipEvent", void 0);
3486
3520
  __decorate([
3487
3521
  core.Input()
3488
3522
  ], TooltipDirective.prototype, "escape", void 0);
3523
+ __decorate([
3524
+ core.Input()
3525
+ ], TooltipDirective.prototype, "visible", void 0);
3489
3526
  __decorate([
3490
3527
  core.Input()
3491
3528
  ], TooltipDirective.prototype, "mobileBehavior", void 0);
@@ -3496,6 +3533,12 @@
3496
3533
  __decorate([
3497
3534
  core.HostListener("document:touchstart")
3498
3535
  ], TooltipDirective.prototype, "onDocumentTouchStart", null);
3536
+ __decorate([
3537
+ core.HostListener("focus")
3538
+ ], TooltipDirective.prototype, "onFocus", null);
3539
+ __decorate([
3540
+ core.HostListener("blur")
3541
+ ], TooltipDirective.prototype, "onBlur", null);
3499
3542
  __decorate([
3500
3543
  core.HostListener("mouseenter")
3501
3544
  ], TooltipDirective.prototype, "onMouseEnter", null);
@@ -5627,7 +5670,7 @@
5627
5670
  DynamicFieldComponent = __decorate([
5628
5671
  core.Component({
5629
5672
  selector: "s-dynamic-field",
5630
- template: "\n <div class=\"ui-fluid\" [formGroup]=\"form\">\n <div class=\"ui-g\">\n <ng-container *ngFor=\"let field of fields\">\n <div [ngClass]=\"field.gridClass\" *ngIf=\"field.visible()\">\n <span *ngIf=\"field.label\"><label [for]=\"field.name\"\n [ngClass]=\"{ 'required': field.required() }\" *sInfoSign=\"field.infoSign\">{{ field.label }}</label></span>\n <ng-container *sDynamicForm=\"{ id: id, config: field, group: form}\"></ng-container>\n <s-control-errors [form]=\"form\" [control]=\"form.controls[field.name]\"\n [errorMessages]=\"getErrorMessages(field.errorMessages)\"></s-control-errors>\n </div>\n </ng-container>\n </div>\n </div>\n "
5673
+ template: "\n <div class=\"ui-fluid\" [formGroup]=\"form\">\n <div class=\"ui-g\">\n <ng-container *ngFor=\"let field of fields\">\n <div [ngClass]=\"field.gridClass\" *ngIf=\"field.visible()\">\n <span *ngIf=\"field.label\"><label [for]=\"field.name\"\n [ngClass]=\"{ 'required': field.required() }\" *sInfoSign=\"field.infoSign\">{{ field.label }}</label></span>\n <ng-container *sDynamicForm=\"{ id: id, config: field, group: form}\"></ng-container>\n <s-control-errors [form]=\"form\" [control]=\"form.controls[field.name]\"\n [errorMessages]=\"getErrorMessages(field.errorMessages)\"></s-control-errors>\n <ng-template *ngIf=\"field?.bottomTemplate\" [ngTemplateOutlet]=\"field.bottomTemplate\"></ng-template>\n </div>\n </ng-container>\n </div>\n </div>\n "
5631
5674
  })
5632
5675
  ], DynamicFieldComponent);
5633
5676
  return DynamicFieldComponent;