@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
@@ -1065,6 +1065,7 @@ var Field = /** @class */ (function () {
1065
1065
  this.type = config.type;
1066
1066
  this.size = new FieldSize(config.size || {});
1067
1067
  this.errorMessages = config.errorMessages;
1068
+ this.bottomTemplate = config.bottomTemplate;
1068
1069
  this.gridClass = Object.keys(this.size).map(function (key) { return "ui-" + key + "-" + _this.size[key]; });
1069
1070
  this.defaultValue = config.defaultValue;
1070
1071
  this.representedBy = config.representedBy;
@@ -3108,6 +3109,12 @@ var MobileBehavior;
3108
3109
  MobileBehavior["Tap"] = "tap";
3109
3110
  })(MobileBehavior || (MobileBehavior = {}));
3110
3111
 
3112
+ var TooltipEvent;
3113
+ (function (TooltipEvent) {
3114
+ TooltipEvent["Focus"] = "focus";
3115
+ TooltipEvent["Hover"] = "hover";
3116
+ })(TooltipEvent || (TooltipEvent = {}));
3117
+
3111
3118
  var TooltipDirective = /** @class */ (function () {
3112
3119
  function TooltipDirective(elementRef, appRef, componentFactoryResolver, injector) {
3113
3120
  this.elementRef = elementRef;
@@ -3116,7 +3123,9 @@ var TooltipDirective = /** @class */ (function () {
3116
3123
  this.injector = injector;
3117
3124
  this.position = TooltipPosition.Top;
3118
3125
  this.showDelay = 500;
3126
+ this.tooltipEvent = TooltipEvent.Hover;
3119
3127
  this.escape = false;
3128
+ this.visible = true;
3120
3129
  this.mobileBehavior = MobileBehavior.Pressing;
3121
3130
  this.componentRef = null;
3122
3131
  }
@@ -3129,28 +3138,50 @@ var TooltipDirective = /** @class */ (function () {
3129
3138
  // whenever the component with the tooltip is clicked I destroy the tooltip.
3130
3139
  // whenever a key is pressed on the component with the tooltip I destroy the tooltip.
3131
3140
  TooltipDirective.prototype.onClick = function () {
3132
- if (!navigator.userAgent.match(/Android/i) && !navigator.userAgent.match(/iPhone/i)) {
3141
+ if (this.tooltipEvent === TooltipEvent.Hover &&
3142
+ !navigator.userAgent.match(/Android/i) &&
3143
+ !navigator.userAgent.match(/iPhone/i)) {
3133
3144
  this.destroy();
3134
3145
  }
3135
3146
  };
3136
3147
  // whenever you touch outside the component with the tooltip I destroy the tooltip.
3137
3148
  TooltipDirective.prototype.onDocumentTouchStart = function () {
3138
- this.destroy();
3149
+ if (this.tooltipEvent === TooltipEvent.Hover) {
3150
+ this.destroy();
3151
+ }
3152
+ };
3153
+ TooltipDirective.prototype.onFocus = function () {
3154
+ if (this.tooltipEvent === TooltipEvent.Focus) {
3155
+ this.createTootip();
3156
+ }
3157
+ };
3158
+ TooltipDirective.prototype.onBlur = function () {
3159
+ if (this.tooltipEvent === TooltipEvent.Focus) {
3160
+ this.destroy();
3161
+ }
3139
3162
  };
3140
3163
  TooltipDirective.prototype.onMouseEnter = function () {
3141
- this.createTootip();
3164
+ if (this.tooltipEvent === TooltipEvent.Hover) {
3165
+ this.createTootip();
3166
+ }
3142
3167
  };
3143
3168
  TooltipDirective.prototype.onMouseLeave = function () {
3144
- this.setHideTooltipTimeout();
3169
+ if (this.tooltipEvent === TooltipEvent.Hover) {
3170
+ this.setHideTooltipTimeout();
3171
+ }
3145
3172
  };
3146
3173
  TooltipDirective.prototype.onTouchStart = function () {
3147
- window.clearTimeout(this.touchTimeout);
3148
- this.touchTimeout = window.setTimeout(this.createTootip.bind(this), this.mobileBehavior === MobileBehavior.Pressing ? this.showDelay : 0);
3174
+ if (this.tooltipEvent === TooltipEvent.Hover) {
3175
+ window.clearTimeout(this.touchTimeout);
3176
+ this.touchTimeout = window.setTimeout(this.createTootip.bind(this), this.mobileBehavior === MobileBehavior.Pressing ? this.showDelay : 0);
3177
+ }
3149
3178
  };
3150
3179
  TooltipDirective.prototype.onTouchEnd = function () {
3151
- if (this.mobileBehavior === MobileBehavior.Pressing) {
3152
- window.clearTimeout(this.touchTimeout);
3153
- this.setHideTooltipTimeout();
3180
+ if (this.tooltipEvent === TooltipEvent.Hover) {
3181
+ if (this.mobileBehavior === MobileBehavior.Pressing) {
3182
+ window.clearTimeout(this.touchTimeout);
3183
+ this.setHideTooltipTimeout();
3184
+ }
3154
3185
  }
3155
3186
  };
3156
3187
  TooltipDirective.prototype.validatePosition = function () {
@@ -3310,9 +3341,15 @@ var TooltipDirective = /** @class */ (function () {
3310
3341
  __decorate([
3311
3342
  Input()
3312
3343
  ], TooltipDirective.prototype, "displayTime", void 0);
3344
+ __decorate([
3345
+ Input()
3346
+ ], TooltipDirective.prototype, "tooltipEvent", void 0);
3313
3347
  __decorate([
3314
3348
  Input()
3315
3349
  ], TooltipDirective.prototype, "escape", void 0);
3350
+ __decorate([
3351
+ Input()
3352
+ ], TooltipDirective.prototype, "visible", void 0);
3316
3353
  __decorate([
3317
3354
  Input()
3318
3355
  ], TooltipDirective.prototype, "mobileBehavior", void 0);
@@ -3323,6 +3360,12 @@ var TooltipDirective = /** @class */ (function () {
3323
3360
  __decorate([
3324
3361
  HostListener("document:touchstart")
3325
3362
  ], TooltipDirective.prototype, "onDocumentTouchStart", null);
3363
+ __decorate([
3364
+ HostListener("focus")
3365
+ ], TooltipDirective.prototype, "onFocus", null);
3366
+ __decorate([
3367
+ HostListener("blur")
3368
+ ], TooltipDirective.prototype, "onBlur", null);
3326
3369
  __decorate([
3327
3370
  HostListener("mouseenter")
3328
3371
  ], TooltipDirective.prototype, "onMouseEnter", null);
@@ -5454,7 +5497,7 @@ var DynamicFieldComponent = /** @class */ (function () {
5454
5497
  DynamicFieldComponent = __decorate([
5455
5498
  Component({
5456
5499
  selector: "s-dynamic-field",
5457
- 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 "
5500
+ 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 "
5458
5501
  })
5459
5502
  ], DynamicFieldComponent);
5460
5503
  return DynamicFieldComponent;