@coreui/angular-pro 4.2.0-next.8 → 4.2.0-next.9

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.
@@ -5940,23 +5940,37 @@ class DateRangePickerComponent {
5940
5940
  this.subscribeDateChange(false);
5941
5941
  }
5942
5942
  ngAfterViewInit() {
5943
- // setTimeout(() => {
5944
- this.contentTemplates.forEach((child) => {
5945
- this.templates[child.id] = child.templateRef;
5943
+ setTimeout(() => {
5944
+ this.contentTemplates.forEach((child) => {
5945
+ this.templates[child.id] = child.templateRef;
5946
+ });
5946
5947
  });
5947
- // });
5948
5948
  }
5949
5949
  ngOnChanges(changes) {
5950
5950
  if (changes['date']) {
5951
5951
  // for date-picker component
5952
- this.startDateValue = changes['date']?.currentValue?.toLocaleDateString(this.locale) ?? '';
5952
+ const date = this.convertValueToDate(changes['date']?.currentValue) ?? null;
5953
+ this.handleStartDateChange(date);
5954
+ this.calendarDate = date ?? undefined;
5953
5955
  }
5954
5956
  if (changes['startDate']) {
5955
- this.startDateValue = changes['startDate']?.currentValue?.toLocaleDateString(this.locale) ?? '';
5957
+ const date = this.convertValueToDate(changes['startDate']?.currentValue) ?? null;
5958
+ this.handleStartDateChange(date);
5959
+ this.calendarDate = date ?? undefined;
5956
5960
  }
5957
5961
  if (changes['endDate']) {
5958
- this.endDateValue = changes['endDate']?.currentValue?.toLocaleDateString(this.locale) ?? '';
5962
+ const date = this.convertValueToDate(changes['endDate']?.currentValue) ?? null;
5963
+ this.handleEndDateChange(date);
5964
+ }
5965
+ }
5966
+ convertValueToDate(value) {
5967
+ if (!value) {
5968
+ return null;
5969
+ }
5970
+ if (typeof value === 'string') {
5971
+ return getLocalDateFromString(value, this.locale, this.timepicker);
5959
5972
  }
5973
+ return new Date(value) ?? null;
5960
5974
  }
5961
5975
  getCustomRangeKey(customRange) {
5962
5976
  return customRange[0];
@@ -10606,10 +10620,10 @@ class PopoverComponent {
10606
10620
  }
10607
10621
  }
10608
10622
  PopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: PopoverComponent, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
10609
- PopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: PopoverComponent, selector: "c-popover", inputs: { content: "content", visible: "visible", id: "id", role: "role" }, host: { properties: { "attr.id": "this.id", "attr.role": "this.role", "class": "this.hostClasses" } }, viewQueries: [{ propertyName: "viewContainerRef", first: true, predicate: ["popoverTemplate"], descendants: true, read: ViewContainerRef }], usesOnChanges: true, ngImport: i0, template: "<ng-container>\r\n <div [ngClass]=\"{'popover-arrow': !!content}\" data-popper-arrow ></div>\r\n <ng-container #popoverTemplate></ng-container>\r\n</ng-container>\r\n", dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
10623
+ PopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: PopoverComponent, selector: "c-popover", inputs: { content: "content", visible: "visible", id: "id", role: "role" }, host: { properties: { "attr.id": "this.id", "attr.role": "this.role", "class": "this.hostClasses" } }, viewQueries: [{ propertyName: "viewContainerRef", first: true, predicate: ["popoverTemplate"], descendants: true, read: ViewContainerRef }], usesOnChanges: true, ngImport: i0, template: "<ng-container>\n <div [ngClass]=\"{'popover-arrow': !!content}\" data-popper-arrow></div>\n <ng-container #popoverTemplate></ng-container>\n</ng-container>\n", dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
10610
10624
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: PopoverComponent, decorators: [{
10611
10625
  type: Component,
10612
- args: [{ selector: 'c-popover', template: "<ng-container>\r\n <div [ngClass]=\"{'popover-arrow': !!content}\" data-popper-arrow ></div>\r\n <ng-container #popoverTemplate></ng-container>\r\n</ng-container>\r\n" }]
10626
+ args: [{ selector: 'c-popover', template: "<ng-container>\n <div [ngClass]=\"{'popover-arrow': !!content}\" data-popper-arrow></div>\n <ng-container #popoverTemplate></ng-container>\n</ng-container>\n" }]
10613
10627
  }], ctorParameters: function () { return [{ type: i0.Renderer2 }]; }, propDecorators: { content: [{
10614
10628
  type: Input
10615
10629
  }], visible: [{
@@ -10633,11 +10647,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
10633
10647
  }] } });
10634
10648
 
10635
10649
  class PopoverDirective {
10636
- constructor(document, renderer, hostElement, componentFactoryResolver, viewContainerRef, listenersService) {
10650
+ constructor(document, renderer, hostElement, viewContainerRef, listenersService) {
10637
10651
  this.document = document;
10638
10652
  this.renderer = renderer;
10639
10653
  this.hostElement = hostElement;
10640
- this.componentFactoryResolver = componentFactoryResolver;
10641
10654
  this.viewContainerRef = viewContainerRef;
10642
10655
  this.listenersService = listenersService;
10643
10656
  /**
@@ -10660,10 +10673,10 @@ class PopoverDirective {
10660
10673
  {
10661
10674
  name: 'offset',
10662
10675
  options: {
10663
- offset: [0, 8],
10664
- },
10665
- },
10666
- ],
10676
+ offset: [0, 8]
10677
+ }
10678
+ }
10679
+ ]
10667
10680
  };
10668
10681
  }
10669
10682
  /**
@@ -10686,20 +10699,19 @@ class PopoverDirective {
10686
10699
  get visible() {
10687
10700
  return this._visible;
10688
10701
  }
10702
+ get ariaDescribedBy() {
10703
+ return this.popoverId ? this.popoverId : null;
10704
+ }
10689
10705
  ngOnChanges(changes) {
10690
10706
  if (changes['visible']) {
10691
10707
  changes['visible'].currentValue ? this.addPopoverElement() : this.removePopoverElement();
10692
10708
  }
10693
10709
  }
10694
- get ariaDescribedBy() {
10695
- return this.popoverId ? this.popoverId : null;
10696
- }
10697
10710
  ngOnDestroy() {
10698
10711
  this.clearListeners();
10699
10712
  this.destroyPopoverElement();
10700
10713
  }
10701
10714
  ngOnInit() {
10702
- // this.createPopoverElement();
10703
10715
  this.setListeners();
10704
10716
  }
10705
10717
  setListeners() {
@@ -10733,8 +10745,8 @@ class PopoverDirective {
10733
10745
  }
10734
10746
  createPopoverElement() {
10735
10747
  if (!this.popoverRef) {
10736
- const popoverComponent = this.componentFactoryResolver.resolveComponentFactory(PopoverComponent);
10737
- this.popoverRef = popoverComponent.create(this.viewContainerRef.injector);
10748
+ this.popoverRef = this.viewContainerRef.createComponent(PopoverComponent);
10749
+ // this.viewContainerRef.detach();
10738
10750
  }
10739
10751
  }
10740
10752
  destroyPopoverElement() {
@@ -10743,8 +10755,8 @@ class PopoverDirective {
10743
10755
  // @ts-ignore
10744
10756
  this.popoverRef = undefined;
10745
10757
  this.popperInstance?.destroy();
10746
- this.viewContainerRef.detach();
10747
- this.viewContainerRef.clear();
10758
+ this.viewContainerRef?.detach();
10759
+ this.viewContainerRef?.clear();
10748
10760
  }
10749
10761
  addPopoverElement() {
10750
10762
  if (!this.popoverRef) {
@@ -10752,39 +10764,43 @@ class PopoverDirective {
10752
10764
  }
10753
10765
  this.popoverRef.instance.content = this.content;
10754
10766
  this.popover = this.popoverRef.location.nativeElement;
10767
+ this.renderer.addClass(this.popover, 'd-none');
10755
10768
  this.renderer.addClass(this.popover, 'fade');
10756
- // this.renderer.setStyle(this.popover, 'visibility', 'hidden')
10769
+ this.popperInstance?.destroy();
10757
10770
  setTimeout(() => {
10758
10771
  this.popperInstance = createPopper(this.hostElement.nativeElement, this.popover, { ...this.popperOptions });
10759
10772
  this.viewContainerRef.insert(this.popoverRef.hostView);
10773
+ this.renderer.appendChild(this.document.body, this.popover);
10774
+ if (!this.visible) {
10775
+ this.removePopoverElement();
10776
+ return;
10777
+ }
10760
10778
  setTimeout(() => {
10761
10779
  this.popoverId = this.getUID('popover');
10762
10780
  this.popoverRef.instance.id = this.popoverId;
10781
+ if (!this.visible) {
10782
+ this.removePopoverElement();
10783
+ return;
10784
+ }
10785
+ this.renderer.removeClass(this.popover, 'd-none');
10763
10786
  this.popoverRef.instance.visible = this.visible;
10764
- // this.renderer.removeStyle(this.popover, 'visibility');
10765
- this.renderer.appendChild(this.document.body, this.popover);
10766
10787
  this.popperInstance.forceUpdate();
10767
- // this.popoverRef.changeDetectorRef.detectChanges();
10768
10788
  }, 100);
10769
10789
  });
10770
10790
  }
10771
10791
  removePopoverElement() {
10792
+ this.popoverId = '';
10772
10793
  if (!this.popoverRef) {
10773
10794
  return;
10774
10795
  }
10775
10796
  this.popoverRef.instance.visible = this.visible;
10776
- // this.popoverRef.changeDetectorRef?.detectChanges();
10777
10797
  this.popoverRef.instance.id = undefined;
10778
10798
  setTimeout(() => {
10779
10799
  this.viewContainerRef.detach();
10780
- // this.viewContainerRef.remove();
10781
- // this.renderer.removeChild(this.document.body, this.popover);
10782
- this.popperInstance?.destroy();
10783
- this.popoverId = '';
10784
10800
  }, 300);
10785
10801
  }
10786
10802
  }
10787
- PopoverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: PopoverDirective, deps: [{ token: DOCUMENT }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ComponentFactoryResolver }, { token: i0.ViewContainerRef }, { token: ListenersService }], target: i0.ɵɵFactoryTarget.Directive });
10803
+ PopoverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: PopoverDirective, deps: [{ token: DOCUMENT }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: ListenersService }], target: i0.ɵɵFactoryTarget.Directive });
10788
10804
  PopoverDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: PopoverDirective, selector: "[cPopover]", inputs: { content: ["cPopover", "content"], popperOptions: ["cPopoverOptions", "popperOptions"], placement: ["cPopoverPlacement", "placement"], trigger: ["cPopoverTrigger", "trigger"], visible: ["cPopoverVisible", "visible"] }, host: { properties: { "attr.aria-describedby": "this.ariaDescribedBy" } }, providers: [ListenersService], exportAs: ["cPopover"], usesOnChanges: true, ngImport: i0 });
10789
10805
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: PopoverDirective, decorators: [{
10790
10806
  type: Directive,
@@ -10796,7 +10812,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
10796
10812
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
10797
10813
  type: Inject,
10798
10814
  args: [DOCUMENT]
10799
- }] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ComponentFactoryResolver }, { type: i0.ViewContainerRef }, { type: ListenersService }]; }, propDecorators: { content: [{
10815
+ }] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: ListenersService }]; }, propDecorators: { content: [{
10800
10816
  type: Input,
10801
10817
  args: ['cPopover']
10802
10818
  }], popperOptions: [{
@@ -14371,11 +14387,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
14371
14387
  }] } });
14372
14388
 
14373
14389
  class TooltipDirective {
14374
- constructor(document, renderer, hostElement, componentFactoryResolver, viewContainerRef, listenersService) {
14390
+ constructor(document, renderer, hostElement, viewContainerRef, listenersService) {
14375
14391
  this.document = document;
14376
14392
  this.renderer = renderer;
14377
14393
  this.hostElement = hostElement;
14378
- this.componentFactoryResolver = componentFactoryResolver;
14379
14394
  this.viewContainerRef = viewContainerRef;
14380
14395
  this.listenersService = listenersService;
14381
14396
  /**
@@ -14398,10 +14413,10 @@ class TooltipDirective {
14398
14413
  {
14399
14414
  name: 'offset',
14400
14415
  options: {
14401
- offset: [0, 0],
14402
- },
14403
- },
14404
- ],
14416
+ offset: [0, 0]
14417
+ }
14418
+ }
14419
+ ]
14405
14420
  };
14406
14421
  }
14407
14422
  /**
@@ -14420,8 +14435,6 @@ class TooltipDirective {
14420
14435
  */
14421
14436
  set visible(value) {
14422
14437
  this._visible = value;
14423
- value ? this.addTooltipElement() : this.removeTooltipElement();
14424
- this.tooltipRef?.changeDetectorRef.markForCheck();
14425
14438
  }
14426
14439
  get visible() {
14427
14440
  return this._visible;
@@ -14439,7 +14452,6 @@ class TooltipDirective {
14439
14452
  this.destroyTooltipElement();
14440
14453
  }
14441
14454
  ngOnInit() {
14442
- // this.createTooltipElement();
14443
14455
  this.setListeners();
14444
14456
  }
14445
14457
  setListeners() {
@@ -14448,12 +14460,15 @@ class TooltipDirective {
14448
14460
  trigger: this.trigger,
14449
14461
  callbackToggle: () => {
14450
14462
  this.visible = !this.visible;
14463
+ this.visible ? this.addTooltipElement() : this.removeTooltipElement();
14451
14464
  },
14452
14465
  callbackOff: () => {
14453
14466
  this.visible = false;
14467
+ this.removeTooltipElement();
14454
14468
  },
14455
14469
  callbackOn: () => {
14456
14470
  this.visible = true;
14471
+ this.addTooltipElement();
14457
14472
  }
14458
14473
  };
14459
14474
  this.listenersService.setListeners(config);
@@ -14470,8 +14485,8 @@ class TooltipDirective {
14470
14485
  }
14471
14486
  createTooltipElement() {
14472
14487
  if (!this.tooltipRef) {
14473
- const tooltipComponent = this.componentFactoryResolver.resolveComponentFactory(TooltipComponent);
14474
- this.tooltipRef = this.viewContainerRef.createComponent(tooltipComponent);
14488
+ this.tooltipRef = this.viewContainerRef.createComponent(TooltipComponent);
14489
+ // this.viewContainerRef.detach();
14475
14490
  }
14476
14491
  }
14477
14492
  destroyTooltipElement() {
@@ -14480,8 +14495,8 @@ class TooltipDirective {
14480
14495
  // @ts-ignore
14481
14496
  this.tooltipRef = undefined;
14482
14497
  this.popperInstance?.destroy();
14483
- this.viewContainerRef.detach();
14484
- this.viewContainerRef.clear();
14498
+ this.viewContainerRef?.detach();
14499
+ this.viewContainerRef?.clear();
14485
14500
  }
14486
14501
  addTooltipElement() {
14487
14502
  if (!this.tooltipRef) {
@@ -14489,34 +14504,43 @@ class TooltipDirective {
14489
14504
  }
14490
14505
  this.tooltipRef.instance.content = this.content;
14491
14506
  this.tooltip = this.tooltipRef.location.nativeElement;
14507
+ this.renderer.addClass(this.tooltip, 'd-none');
14508
+ this.renderer.addClass(this.tooltip, 'fade');
14509
+ this.popperInstance?.destroy();
14492
14510
  setTimeout(() => {
14493
14511
  this.popperInstance = createPopper(this.hostElement.nativeElement, this.tooltip, { ...this.popperOptions });
14512
+ this.viewContainerRef.insert(this.tooltipRef.hostView);
14513
+ this.renderer.appendChild(this.document.body, this.tooltip);
14514
+ if (!this.visible) {
14515
+ this.removeTooltipElement();
14516
+ return;
14517
+ }
14494
14518
  setTimeout(() => {
14495
14519
  this.tooltipId = this.getUID('tooltip');
14496
14520
  this.tooltipRef.instance.id = this.tooltipId;
14521
+ if (!this.visible) {
14522
+ this.removeTooltipElement();
14523
+ return;
14524
+ }
14525
+ this.renderer.removeClass(this.tooltip, 'd-none');
14497
14526
  this.tooltipRef.instance.visible = this.visible;
14498
- this.renderer.appendChild(this.document.body, this.tooltip);
14499
14527
  this.popperInstance.forceUpdate();
14500
- this.tooltipRef.changeDetectorRef.markForCheck();
14501
- // this.tooltipRef.changeDetectorRef.detectChanges();
14502
14528
  }, 100);
14503
14529
  });
14504
14530
  }
14505
14531
  removeTooltipElement() {
14532
+ this.tooltipId = '';
14506
14533
  if (!this.tooltipRef) {
14507
14534
  return;
14508
14535
  }
14509
14536
  this.tooltipRef.instance.visible = this.visible;
14537
+ this.tooltipRef.instance.id = undefined;
14510
14538
  setTimeout(() => {
14511
- // this.tooltipRef.changeDetectorRef.detectChanges();
14512
- this.tooltipRef.instance.id = undefined;
14513
- this.renderer.removeChild(this.document.body, this.tooltip);
14514
- this.popperInstance?.destroy();
14515
- this.tooltipId = '';
14539
+ this.viewContainerRef?.detach();
14516
14540
  }, 300);
14517
14541
  }
14518
14542
  }
14519
- TooltipDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: TooltipDirective, deps: [{ token: DOCUMENT }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ComponentFactoryResolver }, { token: i0.ViewContainerRef }, { token: ListenersService }], target: i0.ɵɵFactoryTarget.Directive });
14543
+ TooltipDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: TooltipDirective, deps: [{ token: DOCUMENT }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: ListenersService }], target: i0.ɵɵFactoryTarget.Directive });
14520
14544
  TooltipDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: TooltipDirective, selector: "[cTooltip]", inputs: { content: ["cTooltip", "content"], popperOptions: ["cTooltipOptions", "popperOptions"], placement: ["cTooltipPlacement", "placement"], trigger: ["cTooltipTrigger", "trigger"], visible: ["cTooltipVisible", "visible"] }, host: { properties: { "attr.aria-describedby": "this.ariaDescribedBy" } }, providers: [ListenersService], exportAs: ["cTooltip"], usesOnChanges: true, ngImport: i0 });
14521
14545
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: TooltipDirective, decorators: [{
14522
14546
  type: Directive,
@@ -14525,10 +14549,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
14525
14549
  exportAs: 'cTooltip',
14526
14550
  providers: [ListenersService]
14527
14551
  }]
14528
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
14552
+ }], ctorParameters: function () { return [{ type: Document, decorators: [{
14529
14553
  type: Inject,
14530
14554
  args: [DOCUMENT]
14531
- }] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ComponentFactoryResolver }, { type: i0.ViewContainerRef }, { type: ListenersService }]; }, propDecorators: { content: [{
14555
+ }] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: ListenersService }]; }, propDecorators: { content: [{
14532
14556
  type: Input,
14533
14557
  args: ['cTooltip']
14534
14558
  }], popperOptions: [{