@coreui/angular 4.2.0 → 4.2.3

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.
@@ -6183,10 +6183,10 @@ class PopoverComponent {
6183
6183
  }
6184
6184
  }
6185
6185
  PopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: PopoverComponent, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
6186
- 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"] }] });
6186
+ 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"] }] });
6187
6187
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: PopoverComponent, decorators: [{
6188
6188
  type: Component,
6189
- 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" }]
6189
+ 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" }]
6190
6190
  }], ctorParameters: function () { return [{ type: i0.Renderer2 }]; }, propDecorators: { content: [{
6191
6191
  type: Input
6192
6192
  }], visible: [{
@@ -6210,11 +6210,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
6210
6210
  }] } });
6211
6211
 
6212
6212
  class PopoverDirective {
6213
- constructor(document, renderer, hostElement, componentFactoryResolver, viewContainerRef, listenersService) {
6213
+ constructor(document, renderer, hostElement, viewContainerRef, listenersService) {
6214
6214
  this.document = document;
6215
6215
  this.renderer = renderer;
6216
6216
  this.hostElement = hostElement;
6217
- this.componentFactoryResolver = componentFactoryResolver;
6218
6217
  this.viewContainerRef = viewContainerRef;
6219
6218
  this.listenersService = listenersService;
6220
6219
  /**
@@ -6237,10 +6236,10 @@ class PopoverDirective {
6237
6236
  {
6238
6237
  name: 'offset',
6239
6238
  options: {
6240
- offset: [0, 8],
6241
- },
6242
- },
6243
- ],
6239
+ offset: [0, 8]
6240
+ }
6241
+ }
6242
+ ]
6244
6243
  };
6245
6244
  }
6246
6245
  /**
@@ -6263,20 +6262,19 @@ class PopoverDirective {
6263
6262
  get visible() {
6264
6263
  return this._visible;
6265
6264
  }
6265
+ get ariaDescribedBy() {
6266
+ return this.popoverId ? this.popoverId : null;
6267
+ }
6266
6268
  ngOnChanges(changes) {
6267
6269
  if (changes['visible']) {
6268
6270
  changes['visible'].currentValue ? this.addPopoverElement() : this.removePopoverElement();
6269
6271
  }
6270
6272
  }
6271
- get ariaDescribedBy() {
6272
- return this.popoverId ? this.popoverId : null;
6273
- }
6274
6273
  ngOnDestroy() {
6275
6274
  this.clearListeners();
6276
6275
  this.destroyPopoverElement();
6277
6276
  }
6278
6277
  ngOnInit() {
6279
- // this.createPopoverElement();
6280
6278
  this.setListeners();
6281
6279
  }
6282
6280
  setListeners() {
@@ -6310,8 +6308,8 @@ class PopoverDirective {
6310
6308
  }
6311
6309
  createPopoverElement() {
6312
6310
  if (!this.popoverRef) {
6313
- const popoverComponent = this.componentFactoryResolver.resolveComponentFactory(PopoverComponent);
6314
- this.popoverRef = popoverComponent.create(this.viewContainerRef.injector);
6311
+ this.popoverRef = this.viewContainerRef.createComponent(PopoverComponent);
6312
+ // this.viewContainerRef.detach();
6315
6313
  }
6316
6314
  }
6317
6315
  destroyPopoverElement() {
@@ -6320,8 +6318,8 @@ class PopoverDirective {
6320
6318
  // @ts-ignore
6321
6319
  this.popoverRef = undefined;
6322
6320
  this.popperInstance?.destroy();
6323
- this.viewContainerRef.detach();
6324
- this.viewContainerRef.clear();
6321
+ this.viewContainerRef?.detach();
6322
+ this.viewContainerRef?.clear();
6325
6323
  }
6326
6324
  addPopoverElement() {
6327
6325
  if (!this.popoverRef) {
@@ -6329,39 +6327,43 @@ class PopoverDirective {
6329
6327
  }
6330
6328
  this.popoverRef.instance.content = this.content;
6331
6329
  this.popover = this.popoverRef.location.nativeElement;
6330
+ this.renderer.addClass(this.popover, 'd-none');
6332
6331
  this.renderer.addClass(this.popover, 'fade');
6333
- // this.renderer.setStyle(this.popover, 'visibility', 'hidden')
6332
+ this.popperInstance?.destroy();
6334
6333
  setTimeout(() => {
6335
6334
  this.popperInstance = createPopper(this.hostElement.nativeElement, this.popover, { ...this.popperOptions });
6336
6335
  this.viewContainerRef.insert(this.popoverRef.hostView);
6336
+ this.renderer.appendChild(this.document.body, this.popover);
6337
+ if (!this.visible) {
6338
+ this.removePopoverElement();
6339
+ return;
6340
+ }
6337
6341
  setTimeout(() => {
6338
6342
  this.popoverId = this.getUID('popover');
6339
6343
  this.popoverRef.instance.id = this.popoverId;
6344
+ if (!this.visible) {
6345
+ this.removePopoverElement();
6346
+ return;
6347
+ }
6348
+ this.renderer.removeClass(this.popover, 'd-none');
6340
6349
  this.popoverRef.instance.visible = this.visible;
6341
- // this.renderer.removeStyle(this.popover, 'visibility');
6342
- this.renderer.appendChild(this.document.body, this.popover);
6343
6350
  this.popperInstance.forceUpdate();
6344
- // this.popoverRef.changeDetectorRef.detectChanges();
6345
6351
  }, 100);
6346
6352
  });
6347
6353
  }
6348
6354
  removePopoverElement() {
6355
+ this.popoverId = '';
6349
6356
  if (!this.popoverRef) {
6350
6357
  return;
6351
6358
  }
6352
6359
  this.popoverRef.instance.visible = this.visible;
6353
- // this.popoverRef.changeDetectorRef?.detectChanges();
6354
6360
  this.popoverRef.instance.id = undefined;
6355
6361
  setTimeout(() => {
6356
6362
  this.viewContainerRef.detach();
6357
- // this.viewContainerRef.remove();
6358
- // this.renderer.removeChild(this.document.body, this.popover);
6359
- this.popperInstance?.destroy();
6360
- this.popoverId = '';
6361
6363
  }, 300);
6362
6364
  }
6363
6365
  }
6364
- 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 });
6366
+ 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 });
6365
6367
  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 });
6366
6368
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: PopoverDirective, decorators: [{
6367
6369
  type: Directive,
@@ -6373,7 +6375,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
6373
6375
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
6374
6376
  type: Inject,
6375
6377
  args: [DOCUMENT]
6376
- }] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ComponentFactoryResolver }, { type: i0.ViewContainerRef }, { type: ListenersService }]; }, propDecorators: { content: [{
6378
+ }] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: ListenersService }]; }, propDecorators: { content: [{
6377
6379
  type: Input,
6378
6380
  args: ['cPopover']
6379
6381
  }], popperOptions: [{
@@ -8786,11 +8788,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
8786
8788
  }] } });
8787
8789
 
8788
8790
  class TooltipDirective {
8789
- constructor(document, renderer, hostElement, componentFactoryResolver, viewContainerRef, listenersService) {
8791
+ constructor(document, renderer, hostElement, viewContainerRef, listenersService) {
8790
8792
  this.document = document;
8791
8793
  this.renderer = renderer;
8792
8794
  this.hostElement = hostElement;
8793
- this.componentFactoryResolver = componentFactoryResolver;
8794
8795
  this.viewContainerRef = viewContainerRef;
8795
8796
  this.listenersService = listenersService;
8796
8797
  /**
@@ -8813,10 +8814,10 @@ class TooltipDirective {
8813
8814
  {
8814
8815
  name: 'offset',
8815
8816
  options: {
8816
- offset: [0, 0],
8817
- },
8818
- },
8819
- ],
8817
+ offset: [0, 0]
8818
+ }
8819
+ }
8820
+ ]
8820
8821
  };
8821
8822
  }
8822
8823
  /**
@@ -8835,8 +8836,6 @@ class TooltipDirective {
8835
8836
  */
8836
8837
  set visible(value) {
8837
8838
  this._visible = value;
8838
- value ? this.addTooltipElement() : this.removeTooltipElement();
8839
- this.tooltipRef?.changeDetectorRef.markForCheck();
8840
8839
  }
8841
8840
  get visible() {
8842
8841
  return this._visible;
@@ -8854,7 +8853,6 @@ class TooltipDirective {
8854
8853
  this.destroyTooltipElement();
8855
8854
  }
8856
8855
  ngOnInit() {
8857
- // this.createTooltipElement();
8858
8856
  this.setListeners();
8859
8857
  }
8860
8858
  setListeners() {
@@ -8863,12 +8861,15 @@ class TooltipDirective {
8863
8861
  trigger: this.trigger,
8864
8862
  callbackToggle: () => {
8865
8863
  this.visible = !this.visible;
8864
+ this.visible ? this.addTooltipElement() : this.removeTooltipElement();
8866
8865
  },
8867
8866
  callbackOff: () => {
8868
8867
  this.visible = false;
8868
+ this.removeTooltipElement();
8869
8869
  },
8870
8870
  callbackOn: () => {
8871
8871
  this.visible = true;
8872
+ this.addTooltipElement();
8872
8873
  }
8873
8874
  };
8874
8875
  this.listenersService.setListeners(config);
@@ -8885,8 +8886,8 @@ class TooltipDirective {
8885
8886
  }
8886
8887
  createTooltipElement() {
8887
8888
  if (!this.tooltipRef) {
8888
- const tooltipComponent = this.componentFactoryResolver.resolveComponentFactory(TooltipComponent);
8889
- this.tooltipRef = this.viewContainerRef.createComponent(tooltipComponent);
8889
+ this.tooltipRef = this.viewContainerRef.createComponent(TooltipComponent);
8890
+ // this.viewContainerRef.detach();
8890
8891
  }
8891
8892
  }
8892
8893
  destroyTooltipElement() {
@@ -8895,8 +8896,8 @@ class TooltipDirective {
8895
8896
  // @ts-ignore
8896
8897
  this.tooltipRef = undefined;
8897
8898
  this.popperInstance?.destroy();
8898
- this.viewContainerRef.detach();
8899
- this.viewContainerRef.clear();
8899
+ this.viewContainerRef?.detach();
8900
+ this.viewContainerRef?.clear();
8900
8901
  }
8901
8902
  addTooltipElement() {
8902
8903
  if (!this.tooltipRef) {
@@ -8904,34 +8905,43 @@ class TooltipDirective {
8904
8905
  }
8905
8906
  this.tooltipRef.instance.content = this.content;
8906
8907
  this.tooltip = this.tooltipRef.location.nativeElement;
8908
+ this.renderer.addClass(this.tooltip, 'd-none');
8909
+ this.renderer.addClass(this.tooltip, 'fade');
8910
+ this.popperInstance?.destroy();
8907
8911
  setTimeout(() => {
8908
8912
  this.popperInstance = createPopper(this.hostElement.nativeElement, this.tooltip, { ...this.popperOptions });
8913
+ this.viewContainerRef.insert(this.tooltipRef.hostView);
8914
+ this.renderer.appendChild(this.document.body, this.tooltip);
8915
+ if (!this.visible) {
8916
+ this.removeTooltipElement();
8917
+ return;
8918
+ }
8909
8919
  setTimeout(() => {
8910
8920
  this.tooltipId = this.getUID('tooltip');
8911
8921
  this.tooltipRef.instance.id = this.tooltipId;
8922
+ if (!this.visible) {
8923
+ this.removeTooltipElement();
8924
+ return;
8925
+ }
8926
+ this.renderer.removeClass(this.tooltip, 'd-none');
8912
8927
  this.tooltipRef.instance.visible = this.visible;
8913
- this.renderer.appendChild(this.document.body, this.tooltip);
8914
8928
  this.popperInstance.forceUpdate();
8915
- this.tooltipRef.changeDetectorRef.markForCheck();
8916
- // this.tooltipRef.changeDetectorRef.detectChanges();
8917
8929
  }, 100);
8918
8930
  });
8919
8931
  }
8920
8932
  removeTooltipElement() {
8933
+ this.tooltipId = '';
8921
8934
  if (!this.tooltipRef) {
8922
8935
  return;
8923
8936
  }
8924
8937
  this.tooltipRef.instance.visible = this.visible;
8938
+ this.tooltipRef.instance.id = undefined;
8925
8939
  setTimeout(() => {
8926
- // this.tooltipRef.changeDetectorRef.detectChanges();
8927
- this.tooltipRef.instance.id = undefined;
8928
- this.renderer.removeChild(this.document.body, this.tooltip);
8929
- this.popperInstance?.destroy();
8930
- this.tooltipId = '';
8940
+ this.viewContainerRef?.detach();
8931
8941
  }, 300);
8932
8942
  }
8933
8943
  }
8934
- 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 });
8944
+ 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 });
8935
8945
  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 });
8936
8946
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: TooltipDirective, decorators: [{
8937
8947
  type: Directive,
@@ -8940,10 +8950,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
8940
8950
  exportAs: 'cTooltip',
8941
8951
  providers: [ListenersService]
8942
8952
  }]
8943
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
8953
+ }], ctorParameters: function () { return [{ type: Document, decorators: [{
8944
8954
  type: Inject,
8945
8955
  args: [DOCUMENT]
8946
- }] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ComponentFactoryResolver }, { type: i0.ViewContainerRef }, { type: ListenersService }]; }, propDecorators: { content: [{
8956
+ }] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: ListenersService }]; }, propDecorators: { content: [{
8947
8957
  type: Input,
8948
8958
  args: ['cTooltip']
8949
8959
  }], popperOptions: [{