@coreui/angular 4.2.2 → 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.
@@ -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
  /**
@@ -6309,8 +6308,8 @@ class PopoverDirective {
6309
6308
  }
6310
6309
  createPopoverElement() {
6311
6310
  if (!this.popoverRef) {
6312
- const popoverComponent = this.componentFactoryResolver.resolveComponentFactory(PopoverComponent);
6313
- this.popoverRef = popoverComponent.create(this.viewContainerRef.injector);
6311
+ this.popoverRef = this.viewContainerRef.createComponent(PopoverComponent);
6312
+ // this.viewContainerRef.detach();
6314
6313
  }
6315
6314
  }
6316
6315
  destroyPopoverElement() {
@@ -6319,8 +6318,8 @@ class PopoverDirective {
6319
6318
  // @ts-ignore
6320
6319
  this.popoverRef = undefined;
6321
6320
  this.popperInstance?.destroy();
6322
- this.viewContainerRef.detach();
6323
- this.viewContainerRef.clear();
6321
+ this.viewContainerRef?.detach();
6322
+ this.viewContainerRef?.clear();
6324
6323
  }
6325
6324
  addPopoverElement() {
6326
6325
  if (!this.popoverRef) {
@@ -6328,21 +6327,32 @@ class PopoverDirective {
6328
6327
  }
6329
6328
  this.popoverRef.instance.content = this.content;
6330
6329
  this.popover = this.popoverRef.location.nativeElement;
6330
+ this.renderer.addClass(this.popover, 'd-none');
6331
6331
  this.renderer.addClass(this.popover, 'fade');
6332
+ this.popperInstance?.destroy();
6332
6333
  setTimeout(() => {
6333
6334
  this.popperInstance = createPopper(this.hostElement.nativeElement, this.popover, { ...this.popperOptions });
6334
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
+ }
6335
6341
  setTimeout(() => {
6336
6342
  this.popoverId = this.getUID('popover');
6337
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');
6338
6349
  this.popoverRef.instance.visible = this.visible;
6339
- this.renderer.appendChild(this.document.body, this.popover);
6340
6350
  this.popperInstance.forceUpdate();
6341
- // this.popoverRef.changeDetectorRef.markForCheck();
6342
6351
  }, 100);
6343
6352
  });
6344
6353
  }
6345
6354
  removePopoverElement() {
6355
+ this.popoverId = '';
6346
6356
  if (!this.popoverRef) {
6347
6357
  return;
6348
6358
  }
@@ -6350,12 +6360,10 @@ class PopoverDirective {
6350
6360
  this.popoverRef.instance.id = undefined;
6351
6361
  setTimeout(() => {
6352
6362
  this.viewContainerRef.detach();
6353
- this.popperInstance?.destroy();
6354
- this.popoverId = '';
6355
6363
  }, 300);
6356
6364
  }
6357
6365
  }
6358
- 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 });
6359
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 });
6360
6368
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: PopoverDirective, decorators: [{
6361
6369
  type: Directive,
@@ -6367,7 +6375,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
6367
6375
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
6368
6376
  type: Inject,
6369
6377
  args: [DOCUMENT]
6370
- }] }, { 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: [{
6371
6379
  type: Input,
6372
6380
  args: ['cPopover']
6373
6381
  }], popperOptions: [{