@seniorsistemas/angular-components 16.7.5 → 16.8.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.
- package/bundles/seniorsistemas-angular-components.umd.js +83 -10
- package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
- package/bundles/seniorsistemas-angular-components.umd.min.js +2 -2
- package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
- package/components/dynamic-form/configurations/form-field.d.ts +2 -0
- package/components/tooltip/models/element-area.d.ts +6 -0
- package/components/tooltip/tooltip.directive.d.ts +12 -6
- package/components/utils/debouce.d.ts +4 -0
- package/components/utils/index.d.ts +3 -2
- package/esm2015/components/dynamic-form/components/grid/row/row.component.js +2 -1
- package/esm2015/components/dynamic-form/configurations/form-field.js +1 -1
- package/esm2015/components/tooltip/models/element-area.js +1 -0
- package/esm2015/components/tooltip/tooltip.directive.js +36 -10
- package/esm2015/components/utils/debouce.js +35 -0
- package/esm2015/components/utils/index.js +4 -3
- package/esm5/components/dynamic-form/components/grid/row/row.component.js +2 -2
- package/esm5/components/dynamic-form/configurations/form-field.js +1 -1
- package/esm5/components/tooltip/models/element-area.js +1 -0
- package/esm5/components/tooltip/tooltip.directive.js +37 -10
- package/esm5/components/utils/debouce.js +50 -0
- package/esm5/components/utils/index.js +4 -3
- package/fesm2015/seniorsistemas-angular-components.js +68 -11
- package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
- package/fesm5/seniorsistemas-angular-components.js +84 -12
- package/fesm5/seniorsistemas-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/seniorsistemas-angular-components.metadata.json +1 -1
|
@@ -3697,6 +3697,52 @@
|
|
|
3697
3697
|
return ExportUtils;
|
|
3698
3698
|
}());
|
|
3699
3699
|
|
|
3700
|
+
var DEFAULT_TIMER = 300;
|
|
3701
|
+
var DebounceUtils = /** @class */ (function () {
|
|
3702
|
+
function DebounceUtils() {
|
|
3703
|
+
}
|
|
3704
|
+
DebounceUtils.prototype.debounce = function (func, timeout) {
|
|
3705
|
+
var _this = this;
|
|
3706
|
+
if (timeout === void 0) { timeout = DEFAULT_TIMER; }
|
|
3707
|
+
var timer;
|
|
3708
|
+
return function () {
|
|
3709
|
+
var args = [];
|
|
3710
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3711
|
+
args[_i] = arguments[_i];
|
|
3712
|
+
}
|
|
3713
|
+
clearTimeout(timer);
|
|
3714
|
+
timer = setTimeout(function () {
|
|
3715
|
+
func.apply(_this, args);
|
|
3716
|
+
}, timeout);
|
|
3717
|
+
};
|
|
3718
|
+
};
|
|
3719
|
+
DebounceUtils.prototype.debounceLeading = function (func, timeout) {
|
|
3720
|
+
var _this = this;
|
|
3721
|
+
if (timeout === void 0) { timeout = DEFAULT_TIMER; }
|
|
3722
|
+
var timer;
|
|
3723
|
+
return function () {
|
|
3724
|
+
var args = [];
|
|
3725
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3726
|
+
args[_i] = arguments[_i];
|
|
3727
|
+
}
|
|
3728
|
+
if (!timer) {
|
|
3729
|
+
func.apply(_this, args);
|
|
3730
|
+
}
|
|
3731
|
+
clearTimeout(timer);
|
|
3732
|
+
timer = setTimeout(function () {
|
|
3733
|
+
timer = null;
|
|
3734
|
+
}, timeout);
|
|
3735
|
+
};
|
|
3736
|
+
};
|
|
3737
|
+
DebounceUtils.ɵprov = core.ɵɵdefineInjectable({ factory: function DebounceUtils_Factory() { return new DebounceUtils(); }, token: DebounceUtils, providedIn: "root" });
|
|
3738
|
+
DebounceUtils = __decorate([
|
|
3739
|
+
core.Injectable({
|
|
3740
|
+
providedIn: 'root',
|
|
3741
|
+
})
|
|
3742
|
+
], DebounceUtils);
|
|
3743
|
+
return DebounceUtils;
|
|
3744
|
+
}());
|
|
3745
|
+
|
|
3700
3746
|
/**
|
|
3701
3747
|
* Formats a JSON response to a JS object
|
|
3702
3748
|
* @param response The response to format
|
|
@@ -4283,11 +4329,13 @@
|
|
|
4283
4329
|
})(TooltipEvent || (TooltipEvent = {}));
|
|
4284
4330
|
|
|
4285
4331
|
var TooltipDirective = /** @class */ (function () {
|
|
4286
|
-
function TooltipDirective(elementRef, appRef, componentFactoryResolver, injector) {
|
|
4332
|
+
function TooltipDirective(elementRef, appRef, componentFactoryResolver, injector, debounceUtils) {
|
|
4333
|
+
var _this = this;
|
|
4287
4334
|
this.elementRef = elementRef;
|
|
4288
4335
|
this.appRef = appRef;
|
|
4289
4336
|
this.componentFactoryResolver = componentFactoryResolver;
|
|
4290
4337
|
this.injector = injector;
|
|
4338
|
+
this.debounceUtils = debounceUtils;
|
|
4291
4339
|
this.position = exports.TooltipPosition.Top;
|
|
4292
4340
|
this.showDelay = 500;
|
|
4293
4341
|
this.tooltipEvent = TooltipEvent.Hover;
|
|
@@ -4295,6 +4343,8 @@
|
|
|
4295
4343
|
this.visible = true;
|
|
4296
4344
|
this.mobileBehavior = MobileBehavior.Pressing;
|
|
4297
4345
|
this.componentRef = null;
|
|
4346
|
+
this.boundOnWindowMouseMoveFunction = this.onWindowMouseMove.bind(this);
|
|
4347
|
+
this.debounceCreateTooltipFunction = this.debounceUtils.debounceLeading(function () { return _this.createTootip(); });
|
|
4298
4348
|
}
|
|
4299
4349
|
TooltipDirective.prototype.ngOnInit = function () {
|
|
4300
4350
|
this.validatePosition();
|
|
@@ -4302,6 +4352,25 @@
|
|
|
4302
4352
|
TooltipDirective.prototype.ngOnDestroy = function () {
|
|
4303
4353
|
this.destroy();
|
|
4304
4354
|
};
|
|
4355
|
+
TooltipDirective.prototype.onWindowMouseMove = function (event) {
|
|
4356
|
+
if (!this.componentRef) {
|
|
4357
|
+
return;
|
|
4358
|
+
}
|
|
4359
|
+
var elementRect = this.elementRef.nativeElement.getBoundingClientRect();
|
|
4360
|
+
var toolTipRect = this.tooltipDivElement.getBoundingClientRect();
|
|
4361
|
+
var totalElementArea = {
|
|
4362
|
+
top: Math.min(elementRect.top, toolTipRect.top),
|
|
4363
|
+
right: Math.max(elementRect.right, toolTipRect.right),
|
|
4364
|
+
left: Math.min(elementRect.left, toolTipRect.left),
|
|
4365
|
+
bottom: Math.max(elementRect.bottom, toolTipRect.bottom)
|
|
4366
|
+
};
|
|
4367
|
+
if (this.isMousePositionOutsideOfElement(event.clientX, event.clientY, totalElementArea)) {
|
|
4368
|
+
this.destroy();
|
|
4369
|
+
}
|
|
4370
|
+
};
|
|
4371
|
+
TooltipDirective.prototype.isMousePositionOutsideOfElement = function (mouseX, mouseY, elementArea) {
|
|
4372
|
+
return mouseX < elementArea.left || mouseX >= elementArea.right || mouseY < elementArea.top || mouseY >= elementArea.bottom;
|
|
4373
|
+
};
|
|
4305
4374
|
// whenever the component with the tooltip is clicked I destroy the tooltip.
|
|
4306
4375
|
// whenever a key is pressed on the component with the tooltip I destroy the tooltip.
|
|
4307
4376
|
TooltipDirective.prototype.onClick = function () {
|
|
@@ -4329,12 +4398,12 @@
|
|
|
4329
4398
|
};
|
|
4330
4399
|
TooltipDirective.prototype.onMouseEnter = function () {
|
|
4331
4400
|
if (this.tooltipEvent === TooltipEvent.Hover) {
|
|
4332
|
-
this.
|
|
4401
|
+
this.debounceCreateTooltipFunction();
|
|
4333
4402
|
}
|
|
4334
4403
|
};
|
|
4335
4404
|
TooltipDirective.prototype.onMouseLeave = function () {
|
|
4336
4405
|
if (this.tooltipEvent === TooltipEvent.Hover) {
|
|
4337
|
-
this.
|
|
4406
|
+
this.destroy();
|
|
4338
4407
|
}
|
|
4339
4408
|
};
|
|
4340
4409
|
TooltipDirective.prototype.onTouchStart = function () {
|
|
@@ -4347,7 +4416,7 @@
|
|
|
4347
4416
|
if (this.tooltipEvent === TooltipEvent.Hover) {
|
|
4348
4417
|
if (this.mobileBehavior === MobileBehavior.Pressing) {
|
|
4349
4418
|
window.clearTimeout(this.touchTimeout);
|
|
4350
|
-
this.
|
|
4419
|
+
this.destroy();
|
|
4351
4420
|
}
|
|
4352
4421
|
}
|
|
4353
4422
|
};
|
|
@@ -4363,9 +4432,6 @@
|
|
|
4363
4432
|
throw new Error("Tooltip " + this.position + " position is unexpected");
|
|
4364
4433
|
}
|
|
4365
4434
|
};
|
|
4366
|
-
TooltipDirective.prototype.setHideTooltipTimeout = function () {
|
|
4367
|
-
this.destroy();
|
|
4368
|
-
};
|
|
4369
4435
|
TooltipDirective.prototype.createTootip = function () {
|
|
4370
4436
|
var _a;
|
|
4371
4437
|
if (this.componentRef === null && ((_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
@@ -4376,6 +4442,7 @@
|
|
|
4376
4442
|
document.body.appendChild(domElem);
|
|
4377
4443
|
this.setTooltipComponentProperties();
|
|
4378
4444
|
this.showTimeout = window.setTimeout(this.showTooltip.bind(this), this.showDelay);
|
|
4445
|
+
this.tooltipDivElement = domElem.querySelector('.tooltip');
|
|
4379
4446
|
if (this.displayTime) {
|
|
4380
4447
|
window.setTimeout(this.destroy.bind(this), this.displayTime);
|
|
4381
4448
|
}
|
|
@@ -4384,6 +4451,7 @@
|
|
|
4384
4451
|
TooltipDirective.prototype.showTooltip = function () {
|
|
4385
4452
|
if (this.componentRef !== null) {
|
|
4386
4453
|
this.componentRef.instance.visible = true;
|
|
4454
|
+
window.addEventListener('mousemove', this.boundOnWindowMouseMoveFunction);
|
|
4387
4455
|
}
|
|
4388
4456
|
};
|
|
4389
4457
|
TooltipDirective.prototype.setTooltipComponentProperties = function () {
|
|
@@ -4488,13 +4556,16 @@
|
|
|
4488
4556
|
this.appRef.detachView(this.componentRef.hostView);
|
|
4489
4557
|
this.componentRef.destroy();
|
|
4490
4558
|
this.componentRef = null;
|
|
4559
|
+
this.tooltipDivElement = null;
|
|
4491
4560
|
}
|
|
4561
|
+
window.removeEventListener('mousemove', this.boundOnWindowMouseMoveFunction);
|
|
4492
4562
|
};
|
|
4493
4563
|
TooltipDirective.ctorParameters = function () { return [
|
|
4494
4564
|
{ type: core.ElementRef },
|
|
4495
4565
|
{ type: core.ApplicationRef },
|
|
4496
4566
|
{ type: core.ComponentFactoryResolver },
|
|
4497
|
-
{ type: core.Injector }
|
|
4567
|
+
{ type: core.Injector },
|
|
4568
|
+
{ type: DebounceUtils }
|
|
4498
4569
|
]; };
|
|
4499
4570
|
__decorate([
|
|
4500
4571
|
core.Input("sTooltip")
|
|
@@ -4537,7 +4608,8 @@
|
|
|
4537
4608
|
core.HostListener("mouseenter")
|
|
4538
4609
|
], TooltipDirective.prototype, "onMouseEnter", null);
|
|
4539
4610
|
__decorate([
|
|
4540
|
-
core.HostListener("mouseleave")
|
|
4611
|
+
core.HostListener("mouseleave"),
|
|
4612
|
+
core.HostListener("wheel")
|
|
4541
4613
|
], TooltipDirective.prototype, "onMouseLeave", null);
|
|
4542
4614
|
__decorate([
|
|
4543
4615
|
core.HostListener("touchstart")
|
|
@@ -6597,7 +6669,7 @@
|
|
|
6597
6669
|
], RowComponent.prototype, "errorMessages", void 0);
|
|
6598
6670
|
RowComponent = __decorate([
|
|
6599
6671
|
core.Component({
|
|
6600
|
-
template: "\n <div class=\"ui-fluid\" [formGroup]=\"group\">\n <div class=\"ui-g\">\n <ng-container *ngFor=\"let field of config.fields\">\n <div [ngClass]=\"field.gridClass\" *ngIf=\"field.visible()\">\n <label\n [for]=\"field.name\"\n [ngClass]=\"{ 'required': field.required() }\"\n *sInfoSign=\"field.infoSign\"\n >\n {{ field.label }}\n </label>\n <ng-container *sDynamicForm=\"{ id: id, config: field, group: group}\"></ng-container>\n <s-control-errors [form]=\"group\" [control]=\"group.controls[field.name]\"\n [errorMessages]=\"getErrorMessages(field.errorMessages)\"></s-control-errors>\n </div>\n </ng-container>\n </div>\n "
|
|
6672
|
+
template: "\n <div class=\"ui-fluid\" [formGroup]=\"group\">\n <div class=\"ui-g\">\n <ng-container *ngFor=\"let field of config.fields\">\n <div [ngClass]=\"field.gridClass\" *ngIf=\"field.visible()\">\n <label\n [for]=\"field.name\"\n [ngClass]=\"{ 'required': field.required() }\"\n *sInfoSign=\"field.infoSign\"\n >\n {{ field.label }}\n </label>\n <ng-container *sDynamicForm=\"{ id: id, config: field, group: group}\"></ng-container>\n <s-control-errors [form]=\"group\" [control]=\"group.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 "
|
|
6601
6673
|
})
|
|
6602
6674
|
], RowComponent);
|
|
6603
6675
|
return RowComponent;
|
|
@@ -12126,6 +12198,7 @@
|
|
|
12126
12198
|
exports.DEFAULT_CALENDAR_LOCALE_OPTIONS = DEFAULT_CALENDAR_LOCALE_OPTIONS;
|
|
12127
12199
|
exports.DEFAULT_LOCALE_OPTIONS = DEFAULT_LOCALE_OPTIONS;
|
|
12128
12200
|
exports.DEFAULT_NUMBER_LOCALE_OPTIONS = DEFAULT_NUMBER_LOCALE_OPTIONS;
|
|
12201
|
+
exports.DebounceUtils = DebounceUtils;
|
|
12129
12202
|
exports.DoubleClickDirective = DoubleClickDirective;
|
|
12130
12203
|
exports.DynamicConfig = DynamicConfig;
|
|
12131
12204
|
exports.DynamicFormComponent = DynamicFormComponent;
|