@dev-tcloud/tcloud-ui 0.1.6 → 0.1.8

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.
@@ -4370,10 +4370,22 @@ class TCloudUiTooltipDirective {
4370
4370
  constructor(el, renderer) {
4371
4371
  this.el = el;
4372
4372
  this.renderer = renderer;
4373
+ this.remove = false;
4373
4374
  this.info_text = '';
4374
4375
  this._direction = 'top';
4375
4376
  }
4376
4377
  onMouseOver(event) {
4378
+ let hoverInCallback = () => {
4379
+ this.remove = false;
4380
+ };
4381
+ let hoverOutCallback = () => {
4382
+ this.remove = true;
4383
+ const customDiv = document.querySelector('.tc-directive-tooltip');
4384
+ if (customDiv) {
4385
+ customDiv.remove();
4386
+ }
4387
+ };
4388
+ hoverOutCallback;
4377
4389
  const scrollTop = window.scrollY || window.pageYOffset;
4378
4390
  const tooltip = this.renderer.createElement('div');
4379
4391
  const rect = this.el.nativeElement?.getBoundingClientRect();
@@ -4396,20 +4408,37 @@ class TCloudUiTooltipDirective {
4396
4408
  this.renderer.addClass(tooltip, `tc-directive-tooltip-${direction}`);
4397
4409
  const id = this.generateID();
4398
4410
  this.renderer.setAttribute(tooltip, 'id', id);
4399
- const textNode = this.renderer.createText(`${this.info_text}`);
4400
- this.renderer.appendChild(tooltip, textNode);
4401
- this.renderer.appendChild(document.body, tooltip);
4402
- this.start_tooltip(id, height, width, el_position_x, el_position_y, direction);
4411
+ const textNode = this.info_text;
4412
+ if (textNode !== undefined && textNode !== null && textNode !== '') {
4413
+ tooltip.innerHTML = textNode;
4414
+ this.renderer.appendChild(document.body, tooltip);
4415
+ this.start_tooltip(id, height, width, el_position_x, el_position_y, direction);
4416
+ if (tooltip) {
4417
+ tooltip.addEventListener('mouseenter', hoverInCallback);
4418
+ tooltip.addEventListener('mouseleave', hoverOutCallback);
4419
+ }
4420
+ }
4403
4421
  }
4404
4422
  onMouseOut(event) {
4405
- const customDiv = document.querySelector('.tc-directive-tooltip');
4423
+ this.remove = true;
4424
+ this.remove_tooltip(document.querySelector('.tc-directive-tooltip'));
4425
+ }
4426
+ remove_tooltip(customDiv) {
4406
4427
  if (customDiv) {
4407
- customDiv.remove();
4428
+ setTimeout(() => {
4429
+ if (this.remove) {
4430
+ customDiv.remove();
4431
+ }
4432
+ }, 30);
4408
4433
  }
4409
4434
  }
4410
4435
  set TCtooltip(tooltip) {
4411
4436
  if (tooltip) {
4412
- this.info_text = tooltip;
4437
+ if (typeof tooltip === 'object') {
4438
+ }
4439
+ else {
4440
+ this.info_text = tooltip;
4441
+ }
4413
4442
  }
4414
4443
  }
4415
4444
  set TCdirection(direction) {
@@ -4477,14 +4506,65 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
4477
4506
  type: Input
4478
4507
  }] } });
4479
4508
 
4509
+ class TCloudUiElCopyDirective {
4510
+ constructor(el, renderer) {
4511
+ this.el = el;
4512
+ this.renderer = renderer;
4513
+ this._isCopy = false;
4514
+ }
4515
+ ngOnInit() {
4516
+ console.log('el', this.el.nativeElement);
4517
+ this.setItemFuncCopy();
4518
+ }
4519
+ setItemFuncCopy() {
4520
+ const btn_copy = this.renderer.createElement('i');
4521
+ var copyText = () => {
4522
+ const elementWithCopyAttribute = document.querySelector(`[data-el-copy="${id}"]`);
4523
+ const copyText = elementWithCopyAttribute?.textContent;
4524
+ navigator.clipboard.writeText(copyText);
4525
+ this.renderer.removeClass(btn_copy, 'fa-copy');
4526
+ this.renderer.addClass(btn_copy, 'fa-check');
4527
+ setTimeout(() => {
4528
+ this.renderer.removeClass(btn_copy, 'fa-check');
4529
+ this.renderer.addClass(btn_copy, 'fa-copy');
4530
+ }, 3000);
4531
+ };
4532
+ const id = this.generateID();
4533
+ this.renderer.setAttribute(this.el.nativeElement, 'data-el-copy', `${id}`);
4534
+ this.renderer.setStyle(btn_copy, 'cursor', 'pointer');
4535
+ this.renderer.setStyle(btn_copy, 'margin-left', '3px');
4536
+ this.renderer.addClass(btn_copy, 'fas');
4537
+ this.renderer.addClass(btn_copy, 'fa-copy');
4538
+ this.renderer.addClass(btn_copy, 'tcloud-ui-el-copy');
4539
+ this.renderer.setAttribute(btn_copy, 'id', id);
4540
+ this.renderer.setAttribute(btn_copy, 'title', 'Copy');
4541
+ this.renderer.listen(btn_copy, 'click', () => { copyText(); });
4542
+ this.renderer.appendChild(this.el.nativeElement, btn_copy);
4543
+ }
4544
+ generateID(target) {
4545
+ const ref = (target) ? `-${target}` : '';
4546
+ return `tc-el-copy-${Math.floor(Math.random() * Math.floor(Math.random() * Date.now()))}${ref}`;
4547
+ }
4548
+ }
4549
+ TCloudUiElCopyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TCloudUiElCopyDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
4550
+ TCloudUiElCopyDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: TCloudUiElCopyDirective, selector: "[TCCopy]", ngImport: i0 });
4551
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TCloudUiElCopyDirective, decorators: [{
4552
+ type: Directive,
4553
+ args: [{
4554
+ selector: '[TCCopy]'
4555
+ }]
4556
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; } });
4557
+
4480
4558
  class TCloudUiDirectiveModule {
4481
4559
  }
4482
4560
  TCloudUiDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TCloudUiDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4483
4561
  TCloudUiDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: TCloudUiDirectiveModule, declarations: [TCloudUiTooltipDirective,
4484
4562
  TCloudUiAlignDirective,
4485
- TCloudUiHoverParentDirective], exports: [TCloudUiTooltipDirective,
4563
+ TCloudUiHoverParentDirective,
4564
+ TCloudUiElCopyDirective], exports: [TCloudUiTooltipDirective,
4486
4565
  TCloudUiAlignDirective,
4487
- TCloudUiHoverParentDirective] });
4566
+ TCloudUiHoverParentDirective,
4567
+ TCloudUiElCopyDirective] });
4488
4568
  TCloudUiDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TCloudUiDirectiveModule });
4489
4569
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TCloudUiDirectiveModule, decorators: [{
4490
4570
  type: NgModule,
@@ -4492,12 +4572,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
4492
4572
  declarations: [
4493
4573
  TCloudUiTooltipDirective,
4494
4574
  TCloudUiAlignDirective,
4495
- TCloudUiHoverParentDirective
4575
+ TCloudUiHoverParentDirective,
4576
+ TCloudUiElCopyDirective
4496
4577
  ],
4497
4578
  exports: [
4498
4579
  TCloudUiTooltipDirective,
4499
4580
  TCloudUiAlignDirective,
4500
- TCloudUiHoverParentDirective
4581
+ TCloudUiHoverParentDirective,
4582
+ TCloudUiElCopyDirective
4501
4583
  ],
4502
4584
  }]
4503
4585
  }] });
@@ -5331,5 +5413,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
5331
5413
  * Generated bundle index. Do not edit.
5332
5414
  */
5333
5415
 
5334
- export { BytesPipe, CNPJPipe, CPFPipe, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR, DateBRPipe, MonthNamePipe, RespectivePipe, StatusInfoPipe, TCCondition, TCFiltersType, TCloudUiAccordionBodyComponent, TCloudUiAccordionComponent, TCloudUiAccordionModule, TCloudUiAccordionTitleComponent, TCloudUiAlignDirective, TCloudUiChoiceIssuesComponent, TCloudUiChoiceIssuesModule, TCloudUiDataListComponent, TCloudUiDataListModule, TCloudUiDataListOptionComponent, TCloudUiDatepickerComponent, TCloudUiDatepickerModule, TCloudUiDatepickerTimeComponent, TCloudUiDatepickerTimeModule, TCloudUiDirectiveModule, TCloudUiFiltersComponent, TCloudUiFiltersModule, TCloudUiHoverParentDirective, TCloudUiInputPasswordComponent, TCloudUiInputPasswordModule, TCloudUiInputSearchComponent, TCloudUiInputSearchModule, TCloudUiLineStepCircleComponent, TCloudUiLineStepCircleModule, TCloudUiLinhaLogoComponent, TCloudUiLinhaLogoModule, TCloudUiLoadingTransitionsService, TCloudUiModalBodyComponent, TCloudUiModalComponent, TCloudUiModalFooterComponent, TCloudUiModalHeaderComponent, TCloudUiModalModule, TCloudUiModule, TCloudUiMultiInputComponent, TCloudUiMultiInputModule, TCloudUiMultiSelectComponent, TCloudUiMultiSelectModule, TCloudUiMultiplesValuesComponent, TCloudUiMultiplesValuesModule, TCloudUiNotFoundComponent, TCloudUiNotFoundModule, TCloudUiNumberStepComponent, TCloudUiNumberStepModule, TCloudUiPipesModule, TCloudUiRangeDateComponent, TCloudUiScrollBoxComponent, TCloudUiScrollBoxModule, TCloudUiSearchInObjectService, TCloudUiTabContentComponent, TCloudUiTabHeadComponent, TCloudUiTabMenuComponent, TCloudUiTabMenuModule, TCloudUiTabSubtitleComponent, TCloudUiTabTitleComponent, TCloudUiTableComponent, TCloudUiTableModule, TCloudUiTooltipDirective, TCloudUiWelcomeComponent, TCloudUiWelcomeModule, ToTextPipe };
5416
+ export { BytesPipe, CNPJPipe, CPFPipe, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR, DateBRPipe, MonthNamePipe, RespectivePipe, StatusInfoPipe, TCCondition, TCFiltersType, TCloudUiAccordionBodyComponent, TCloudUiAccordionComponent, TCloudUiAccordionModule, TCloudUiAccordionTitleComponent, TCloudUiAlignDirective, TCloudUiChoiceIssuesComponent, TCloudUiChoiceIssuesModule, TCloudUiDataListComponent, TCloudUiDataListModule, TCloudUiDataListOptionComponent, TCloudUiDatepickerComponent, TCloudUiDatepickerModule, TCloudUiDatepickerTimeComponent, TCloudUiDatepickerTimeModule, TCloudUiDirectiveModule, TCloudUiElCopyDirective, TCloudUiFiltersComponent, TCloudUiFiltersModule, TCloudUiHoverParentDirective, TCloudUiInputPasswordComponent, TCloudUiInputPasswordModule, TCloudUiInputSearchComponent, TCloudUiInputSearchModule, TCloudUiLineStepCircleComponent, TCloudUiLineStepCircleModule, TCloudUiLinhaLogoComponent, TCloudUiLinhaLogoModule, TCloudUiLoadingTransitionsService, TCloudUiModalBodyComponent, TCloudUiModalComponent, TCloudUiModalFooterComponent, TCloudUiModalHeaderComponent, TCloudUiModalModule, TCloudUiModule, TCloudUiMultiInputComponent, TCloudUiMultiInputModule, TCloudUiMultiSelectComponent, TCloudUiMultiSelectModule, TCloudUiMultiplesValuesComponent, TCloudUiMultiplesValuesModule, TCloudUiNotFoundComponent, TCloudUiNotFoundModule, TCloudUiNumberStepComponent, TCloudUiNumberStepModule, TCloudUiPipesModule, TCloudUiRangeDateComponent, TCloudUiScrollBoxComponent, TCloudUiScrollBoxModule, TCloudUiSearchInObjectService, TCloudUiTabContentComponent, TCloudUiTabHeadComponent, TCloudUiTabMenuComponent, TCloudUiTabMenuModule, TCloudUiTabSubtitleComponent, TCloudUiTabTitleComponent, TCloudUiTableComponent, TCloudUiTableModule, TCloudUiTooltipDirective, TCloudUiWelcomeComponent, TCloudUiWelcomeModule, ToTextPipe };
5335
5417
  //# sourceMappingURL=dev-tcloud-tcloud-ui.mjs.map