@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.
@@ -6229,10 +6229,10 @@ class PopoverComponent {
6229
6229
  }
6230
6230
  }
6231
6231
  PopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: PopoverComponent, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
6232
- 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"] }] });
6232
+ 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"] }] });
6233
6233
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: PopoverComponent, decorators: [{
6234
6234
  type: Component,
6235
- 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" }]
6235
+ 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" }]
6236
6236
  }], ctorParameters: function () { return [{ type: i0.Renderer2 }]; }, propDecorators: { content: [{
6237
6237
  type: Input
6238
6238
  }], visible: [{
@@ -6256,11 +6256,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
6256
6256
  }] } });
6257
6257
 
6258
6258
  class PopoverDirective {
6259
- constructor(document, renderer, hostElement, componentFactoryResolver, viewContainerRef, listenersService) {
6259
+ constructor(document, renderer, hostElement, viewContainerRef, listenersService) {
6260
6260
  this.document = document;
6261
6261
  this.renderer = renderer;
6262
6262
  this.hostElement = hostElement;
6263
- this.componentFactoryResolver = componentFactoryResolver;
6264
6263
  this.viewContainerRef = viewContainerRef;
6265
6264
  this.listenersService = listenersService;
6266
6265
  /**
@@ -6283,10 +6282,10 @@ class PopoverDirective {
6283
6282
  {
6284
6283
  name: 'offset',
6285
6284
  options: {
6286
- offset: [0, 8],
6287
- },
6288
- },
6289
- ],
6285
+ offset: [0, 8]
6286
+ }
6287
+ }
6288
+ ]
6290
6289
  };
6291
6290
  }
6292
6291
  /**
@@ -6309,20 +6308,19 @@ class PopoverDirective {
6309
6308
  get visible() {
6310
6309
  return this._visible;
6311
6310
  }
6311
+ get ariaDescribedBy() {
6312
+ return this.popoverId ? this.popoverId : null;
6313
+ }
6312
6314
  ngOnChanges(changes) {
6313
6315
  if (changes['visible']) {
6314
6316
  changes['visible'].currentValue ? this.addPopoverElement() : this.removePopoverElement();
6315
6317
  }
6316
6318
  }
6317
- get ariaDescribedBy() {
6318
- return this.popoverId ? this.popoverId : null;
6319
- }
6320
6319
  ngOnDestroy() {
6321
6320
  this.clearListeners();
6322
6321
  this.destroyPopoverElement();
6323
6322
  }
6324
6323
  ngOnInit() {
6325
- // this.createPopoverElement();
6326
6324
  this.setListeners();
6327
6325
  }
6328
6326
  setListeners() {
@@ -6356,60 +6354,64 @@ class PopoverDirective {
6356
6354
  }
6357
6355
  createPopoverElement() {
6358
6356
  if (!this.popoverRef) {
6359
- const popoverComponent = this.componentFactoryResolver.resolveComponentFactory(PopoverComponent);
6360
- this.popoverRef = popoverComponent.create(this.viewContainerRef.injector);
6357
+ this.popoverRef = this.viewContainerRef.createComponent(PopoverComponent);
6358
+ // this.viewContainerRef.detach();
6361
6359
  }
6362
6360
  }
6363
6361
  destroyPopoverElement() {
6364
- var _a, _b, _c;
6362
+ var _a, _b, _c, _d, _e;
6365
6363
  (_a = this.popover) === null || _a === void 0 ? void 0 : _a.remove();
6366
6364
  (_b = this.popoverRef) === null || _b === void 0 ? void 0 : _b.destroy();
6367
6365
  // @ts-ignore
6368
6366
  this.popoverRef = undefined;
6369
6367
  (_c = this.popperInstance) === null || _c === void 0 ? void 0 : _c.destroy();
6370
- this.viewContainerRef.detach();
6371
- this.viewContainerRef.clear();
6368
+ (_d = this.viewContainerRef) === null || _d === void 0 ? void 0 : _d.detach();
6369
+ (_e = this.viewContainerRef) === null || _e === void 0 ? void 0 : _e.clear();
6372
6370
  }
6373
6371
  addPopoverElement() {
6372
+ var _a;
6374
6373
  if (!this.popoverRef) {
6375
6374
  this.createPopoverElement();
6376
6375
  }
6377
6376
  this.popoverRef.instance.content = this.content;
6378
6377
  this.popover = this.popoverRef.location.nativeElement;
6378
+ this.renderer.addClass(this.popover, 'd-none');
6379
6379
  this.renderer.addClass(this.popover, 'fade');
6380
- // this.renderer.setStyle(this.popover, 'visibility', 'hidden')
6380
+ (_a = this.popperInstance) === null || _a === void 0 ? void 0 : _a.destroy();
6381
6381
  setTimeout(() => {
6382
6382
  this.popperInstance = createPopper(this.hostElement.nativeElement, this.popover, Object.assign({}, this.popperOptions));
6383
6383
  this.viewContainerRef.insert(this.popoverRef.hostView);
6384
+ this.renderer.appendChild(this.document.body, this.popover);
6385
+ if (!this.visible) {
6386
+ this.removePopoverElement();
6387
+ return;
6388
+ }
6384
6389
  setTimeout(() => {
6385
6390
  this.popoverId = this.getUID('popover');
6386
6391
  this.popoverRef.instance.id = this.popoverId;
6392
+ if (!this.visible) {
6393
+ this.removePopoverElement();
6394
+ return;
6395
+ }
6396
+ this.renderer.removeClass(this.popover, 'd-none');
6387
6397
  this.popoverRef.instance.visible = this.visible;
6388
- // this.renderer.removeStyle(this.popover, 'visibility');
6389
- this.renderer.appendChild(this.document.body, this.popover);
6390
6398
  this.popperInstance.forceUpdate();
6391
- // this.popoverRef.changeDetectorRef.detectChanges();
6392
6399
  }, 100);
6393
6400
  });
6394
6401
  }
6395
6402
  removePopoverElement() {
6403
+ this.popoverId = '';
6396
6404
  if (!this.popoverRef) {
6397
6405
  return;
6398
6406
  }
6399
6407
  this.popoverRef.instance.visible = this.visible;
6400
- // this.popoverRef.changeDetectorRef?.detectChanges();
6401
6408
  this.popoverRef.instance.id = undefined;
6402
6409
  setTimeout(() => {
6403
- var _a;
6404
6410
  this.viewContainerRef.detach();
6405
- // this.viewContainerRef.remove();
6406
- // this.renderer.removeChild(this.document.body, this.popover);
6407
- (_a = this.popperInstance) === null || _a === void 0 ? void 0 : _a.destroy();
6408
- this.popoverId = '';
6409
6411
  }, 300);
6410
6412
  }
6411
6413
  }
6412
- 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 });
6414
+ 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 });
6413
6415
  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 });
6414
6416
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: PopoverDirective, decorators: [{
6415
6417
  type: Directive,
@@ -6422,7 +6424,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
6422
6424
  return [{ type: undefined, decorators: [{
6423
6425
  type: Inject,
6424
6426
  args: [DOCUMENT]
6425
- }] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ComponentFactoryResolver }, { type: i0.ViewContainerRef }, { type: ListenersService }];
6427
+ }] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: ListenersService }];
6426
6428
  }, propDecorators: { content: [{
6427
6429
  type: Input,
6428
6430
  args: ['cPopover']
@@ -8859,11 +8861,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
8859
8861
  }] } });
8860
8862
 
8861
8863
  class TooltipDirective {
8862
- constructor(document, renderer, hostElement, componentFactoryResolver, viewContainerRef, listenersService) {
8864
+ constructor(document, renderer, hostElement, viewContainerRef, listenersService) {
8863
8865
  this.document = document;
8864
8866
  this.renderer = renderer;
8865
8867
  this.hostElement = hostElement;
8866
- this.componentFactoryResolver = componentFactoryResolver;
8867
8868
  this.viewContainerRef = viewContainerRef;
8868
8869
  this.listenersService = listenersService;
8869
8870
  /**
@@ -8886,10 +8887,10 @@ class TooltipDirective {
8886
8887
  {
8887
8888
  name: 'offset',
8888
8889
  options: {
8889
- offset: [0, 0],
8890
- },
8891
- },
8892
- ],
8890
+ offset: [0, 0]
8891
+ }
8892
+ }
8893
+ ]
8893
8894
  };
8894
8895
  }
8895
8896
  /**
@@ -8907,10 +8908,7 @@ class TooltipDirective {
8907
8908
  * Toggle the visibility of tooltip component.
8908
8909
  */
8909
8910
  set visible(value) {
8910
- var _a;
8911
8911
  this._visible = value;
8912
- value ? this.addTooltipElement() : this.removeTooltipElement();
8913
- (_a = this.tooltipRef) === null || _a === void 0 ? void 0 : _a.changeDetectorRef.markForCheck();
8914
8912
  }
8915
8913
  get visible() {
8916
8914
  return this._visible;
@@ -8928,7 +8926,6 @@ class TooltipDirective {
8928
8926
  this.destroyTooltipElement();
8929
8927
  }
8930
8928
  ngOnInit() {
8931
- // this.createTooltipElement();
8932
8929
  this.setListeners();
8933
8930
  }
8934
8931
  setListeners() {
@@ -8937,12 +8934,15 @@ class TooltipDirective {
8937
8934
  trigger: this.trigger,
8938
8935
  callbackToggle: () => {
8939
8936
  this.visible = !this.visible;
8937
+ this.visible ? this.addTooltipElement() : this.removeTooltipElement();
8940
8938
  },
8941
8939
  callbackOff: () => {
8942
8940
  this.visible = false;
8941
+ this.removeTooltipElement();
8943
8942
  },
8944
8943
  callbackOn: () => {
8945
8944
  this.visible = true;
8945
+ this.addTooltipElement();
8946
8946
  }
8947
8947
  };
8948
8948
  this.listenersService.setListeners(config);
@@ -8959,55 +8959,65 @@ class TooltipDirective {
8959
8959
  }
8960
8960
  createTooltipElement() {
8961
8961
  if (!this.tooltipRef) {
8962
- const tooltipComponent = this.componentFactoryResolver.resolveComponentFactory(TooltipComponent);
8963
- this.tooltipRef = this.viewContainerRef.createComponent(tooltipComponent);
8962
+ this.tooltipRef = this.viewContainerRef.createComponent(TooltipComponent);
8963
+ // this.viewContainerRef.detach();
8964
8964
  }
8965
8965
  }
8966
8966
  destroyTooltipElement() {
8967
- var _a, _b, _c;
8967
+ var _a, _b, _c, _d, _e;
8968
8968
  (_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.remove();
8969
8969
  (_b = this.tooltipRef) === null || _b === void 0 ? void 0 : _b.destroy();
8970
8970
  // @ts-ignore
8971
8971
  this.tooltipRef = undefined;
8972
8972
  (_c = this.popperInstance) === null || _c === void 0 ? void 0 : _c.destroy();
8973
- this.viewContainerRef.detach();
8974
- this.viewContainerRef.clear();
8973
+ (_d = this.viewContainerRef) === null || _d === void 0 ? void 0 : _d.detach();
8974
+ (_e = this.viewContainerRef) === null || _e === void 0 ? void 0 : _e.clear();
8975
8975
  }
8976
8976
  addTooltipElement() {
8977
+ var _a;
8977
8978
  if (!this.tooltipRef) {
8978
8979
  this.createTooltipElement();
8979
8980
  }
8980
8981
  this.tooltipRef.instance.content = this.content;
8981
8982
  this.tooltip = this.tooltipRef.location.nativeElement;
8983
+ this.renderer.addClass(this.tooltip, 'd-none');
8984
+ this.renderer.addClass(this.tooltip, 'fade');
8985
+ (_a = this.popperInstance) === null || _a === void 0 ? void 0 : _a.destroy();
8982
8986
  setTimeout(() => {
8983
8987
  this.popperInstance = createPopper(this.hostElement.nativeElement, this.tooltip, Object.assign({}, this.popperOptions));
8988
+ this.viewContainerRef.insert(this.tooltipRef.hostView);
8989
+ this.renderer.appendChild(this.document.body, this.tooltip);
8990
+ if (!this.visible) {
8991
+ this.removeTooltipElement();
8992
+ return;
8993
+ }
8984
8994
  setTimeout(() => {
8985
8995
  this.tooltipId = this.getUID('tooltip');
8986
8996
  this.tooltipRef.instance.id = this.tooltipId;
8997
+ if (!this.visible) {
8998
+ this.removeTooltipElement();
8999
+ return;
9000
+ }
9001
+ this.renderer.removeClass(this.tooltip, 'd-none');
8987
9002
  this.tooltipRef.instance.visible = this.visible;
8988
- this.renderer.appendChild(this.document.body, this.tooltip);
8989
9003
  this.popperInstance.forceUpdate();
8990
- this.tooltipRef.changeDetectorRef.markForCheck();
8991
- // this.tooltipRef.changeDetectorRef.detectChanges();
8992
9004
  }, 100);
8993
9005
  });
8994
9006
  }
8995
9007
  removeTooltipElement() {
9008
+ this.tooltipId = '';
8996
9009
  if (!this.tooltipRef) {
8997
9010
  return;
8998
9011
  }
8999
9012
  this.tooltipRef.instance.visible = this.visible;
9013
+ this.tooltipRef.instance.id = undefined;
9000
9014
  setTimeout(() => {
9001
9015
  var _a;
9002
- // this.tooltipRef.changeDetectorRef.detectChanges();
9003
- this.tooltipRef.instance.id = undefined;
9004
- this.renderer.removeChild(this.document.body, this.tooltip);
9005
- (_a = this.popperInstance) === null || _a === void 0 ? void 0 : _a.destroy();
9006
- this.tooltipId = '';
9016
+ (_a = this.viewContainerRef) === null || _a === void 0 ? void 0 : _a.detach();
9007
9017
  }, 300);
9008
9018
  }
9009
9019
  }
9010
- 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 });
9020
+ 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 });
9011
9021
  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 });
9012
9022
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: TooltipDirective, decorators: [{
9013
9023
  type: Directive,
@@ -9017,10 +9027,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
9017
9027
  providers: [ListenersService]
9018
9028
  }]
9019
9029
  }], ctorParameters: function () {
9020
- return [{ type: undefined, decorators: [{
9030
+ return [{ type: Document, decorators: [{
9021
9031
  type: Inject,
9022
9032
  args: [DOCUMENT]
9023
- }] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ComponentFactoryResolver }, { type: i0.ViewContainerRef }, { type: ListenersService }];
9033
+ }] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: ListenersService }];
9024
9034
  }, propDecorators: { content: [{
9025
9035
  type: Input,
9026
9036
  args: ['cTooltip']