@coreui/angular-pro 4.0.0-alpha.1 → 4.0.0-alpha.2

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.
@@ -6279,19 +6279,20 @@
6279
6279
  this.backdropClick$ = this.backdropClick.asObservable();
6280
6280
  this.renderer = rendererFactory.createRenderer(null, null);
6281
6281
  }
6282
- BackdropService.prototype.setBackdrop = function () {
6282
+ BackdropService.prototype.setBackdrop = function (type) {
6283
6283
  var _this = this;
6284
- var backdrop = this.renderer.createElement('div');
6285
- this.renderer.addClass(backdrop, 'modal-backdrop');
6286
- this.renderer.addClass(backdrop, 'fade');
6287
- this.renderer.appendChild(this.document.body, backdrop);
6288
- this.unListen = this.renderer.listen(backdrop, 'click', function (e) {
6284
+ if (type === void 0) { type = 'modal'; }
6285
+ var backdropElement = this.renderer.createElement('div');
6286
+ this.renderer.addClass(backdropElement, type + "-backdrop");
6287
+ this.renderer.addClass(backdropElement, 'fade');
6288
+ this.renderer.appendChild(this.document.body, backdropElement);
6289
+ this.unListen = this.renderer.listen(backdropElement, 'click', function (e) {
6289
6290
  _this.onClickHandler();
6290
6291
  });
6291
6292
  setTimeout(function () {
6292
- _this.renderer.addClass(backdrop, 'show');
6293
+ _this.renderer.addClass(backdropElement, 'show');
6293
6294
  });
6294
- return backdrop;
6295
+ return backdropElement;
6295
6296
  };
6296
6297
  BackdropService.prototype.clearBackdrop = function (backdrop) {
6297
6298
  var _this = this;
@@ -6371,6 +6372,7 @@
6371
6372
  */
6372
6373
  this.visibleChange = new i0.EventEmitter();
6373
6374
  this._show = true;
6375
+ this.mouseDownTarget = null;
6374
6376
  }
6375
6377
  Object.defineProperty(ModalComponent.prototype, "scrollable", {
6376
6378
  get: function () {
@@ -6394,11 +6396,14 @@
6394
6396
  * Toggle the visibility of modal component.
6395
6397
  * @type boolean
6396
6398
  */
6397
- set: function (visible) {
6398
- this._visible = visible;
6399
- this.setBackdrop(this.backdrop !== false && visible);
6400
- this.setBodyStyles(visible);
6401
- this.visibleChange.emit(visible);
6399
+ set: function (value) {
6400
+ var newValue = coercion.coerceBooleanProperty(value);
6401
+ if (this._visible !== newValue) {
6402
+ this._visible = newValue;
6403
+ this.setBackdrop(this.backdrop !== false && newValue);
6404
+ this.setBodyStyles(newValue);
6405
+ this.visibleChange.emit(newValue);
6406
+ }
6402
6407
  },
6403
6408
  enumerable: false,
6404
6409
  configurable: true
@@ -6493,14 +6498,20 @@
6493
6498
  }
6494
6499
  }
6495
6500
  };
6501
+ ModalComponent.prototype.onMouseDownHandler = function ($event) {
6502
+ this.mouseDownTarget = $event.target;
6503
+ };
6496
6504
  ModalComponent.prototype.onClickHandler = function ($event) {
6505
+ $event.stopPropagation();
6506
+ if (this.mouseDownTarget !== $event.target) {
6507
+ this.mouseDownTarget = null;
6508
+ return;
6509
+ }
6497
6510
  if (this.backdrop === 'static') {
6498
6511
  this.setStaticBackdrop();
6512
+ return;
6499
6513
  }
6500
- else {
6501
- this.modalService.toggle({ show: false, modal: this });
6502
- }
6503
- $event.stopPropagation();
6514
+ this.modalService.toggle({ show: false, modal: this });
6504
6515
  };
6505
6516
  ModalComponent.prototype.ngOnInit = function () {
6506
6517
  this.stateToggleSubscribe();
@@ -6532,7 +6543,7 @@
6532
6543
  };
6533
6544
  ModalComponent.prototype.setBackdrop = function (setBackdrop) {
6534
6545
  if (setBackdrop) {
6535
- this.activeBackdrop = this.backdropService.setBackdrop();
6546
+ this.activeBackdrop = this.backdropService.setBackdrop('modal');
6536
6547
  }
6537
6548
  else {
6538
6549
  this.activeBackdrop = this.backdropService.clearBackdrop(this.activeBackdrop);
@@ -6567,7 +6578,7 @@
6567
6578
  return ModalComponent;
6568
6579
  }());
6569
6580
  ModalComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: ModalComponent, deps: [{ token: i2.DOCUMENT }, { token: i0__namespace.Renderer2 }, { token: i0__namespace.ElementRef }, { token: ModalService }, { token: BackdropService }], target: i0__namespace.ɵɵFactoryTarget.Component });
6570
- ModalComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: ModalComponent, selector: "c-modal", inputs: { alignment: "alignment", backdrop: "backdrop", fullscreen: "fullscreen", keyboard: "keyboard", id: "id", size: "size", transition: "transition", role: "role", ariaModal: "ariaModal", scrollable: "scrollable", visible: "visible" }, outputs: { visibleChange: "visibleChange" }, host: { listeners: { "@showHide.start": "animateStart($event)", "@showHide.done": "animateDone($event)", "document:keydown": "onKeyDownHandler($event)", "click": "onClickHandler($event)" }, properties: { "attr.role": "this.role", "attr.aria-modal": "this.ariaModal", "class": "this.hostClasses", "attr.aria-hidden": "this.ariaHidden", "attr.tabindex": "this.tabIndex", "@showHide": "this.animateTrigger" } }, viewQueries: [{ propertyName: "modalContent", first: true, predicate: ModalContentComponent, descendants: true, read: i0.ElementRef }], exportAs: ["cModal"], ngImport: i0__namespace, template: "<c-modal-dialog\r\n [alignment]=\"alignment\"\r\n [fullscreen]=\"fullscreen\"\r\n [scrollable]=\"scrollable\"\r\n [size]=\"size\">\r\n <c-modal-content>\r\n <div [cdkTrapFocus]=\"visible\" [cdkTrapFocusAutoCapture]=\"visible\" style=\"display: contents;\">\r\n <ng-content></ng-content>\r\n </div>\r\n </c-modal-content>\r\n</c-modal-dialog>\r\n", styles: [""], components: [{ type: ModalDialogComponent, selector: "c-modal-dialog", inputs: ["alignment", "fullscreen", "scrollable", "size"] }, { type: ModalContentComponent, selector: "c-modal-content" }], directives: [{ type: i1__namespace$2.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }], animations: [
6581
+ ModalComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: ModalComponent, selector: "c-modal", inputs: { alignment: "alignment", backdrop: "backdrop", fullscreen: "fullscreen", keyboard: "keyboard", id: "id", size: "size", transition: "transition", role: "role", ariaModal: "ariaModal", scrollable: "scrollable", visible: "visible" }, outputs: { visibleChange: "visibleChange" }, host: { listeners: { "@showHide.start": "animateStart($event)", "@showHide.done": "animateDone($event)", "document:keydown": "onKeyDownHandler($event)", "mousedown": "onMouseDownHandler($event)", "click": "onClickHandler($event)" }, properties: { "attr.role": "this.role", "attr.aria-modal": "this.ariaModal", "class": "this.hostClasses", "attr.aria-hidden": "this.ariaHidden", "attr.tabindex": "this.tabIndex", "@showHide": "this.animateTrigger" } }, viewQueries: [{ propertyName: "modalContent", first: true, predicate: ModalContentComponent, descendants: true, read: i0.ElementRef }], exportAs: ["cModal"], ngImport: i0__namespace, template: "<c-modal-dialog\r\n [alignment]=\"alignment\"\r\n [fullscreen]=\"fullscreen\"\r\n [scrollable]=\"scrollable\"\r\n [size]=\"size\">\r\n <c-modal-content>\r\n <div [cdkTrapFocus]=\"visible\" [cdkTrapFocusAutoCapture]=\"visible\" style=\"display: contents;\">\r\n <ng-content></ng-content>\r\n </div>\r\n </c-modal-content>\r\n</c-modal-dialog>\r\n", styles: [""], components: [{ type: ModalDialogComponent, selector: "c-modal-dialog", inputs: ["alignment", "fullscreen", "scrollable", "size"] }, { type: ModalContentComponent, selector: "c-modal-content" }], directives: [{ type: i1__namespace$2.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }], animations: [
6571
6582
  i1.trigger('showHide', [
6572
6583
  i1.state('visible', i1.style({
6573
6584
  display: 'block'
@@ -6656,6 +6667,9 @@
6656
6667
  }], onKeyDownHandler: [{
6657
6668
  type: i0.HostListener,
6658
6669
  args: ['document:keydown', ['$event']]
6670
+ }], onMouseDownHandler: [{
6671
+ type: i0.HostListener,
6672
+ args: ['mousedown', ['$event']]
6659
6673
  }], onClickHandler: [{
6660
6674
  type: i0.HostListener,
6661
6675
  args: ['click', ['$event']]
@@ -6909,7 +6923,7 @@
6909
6923
  };
6910
6924
  OffcanvasComponent.prototype.setBackdrop = function (setBackdrop) {
6911
6925
  if (setBackdrop) {
6912
- this.activeBackdrop = this.backdropService.setBackdrop();
6926
+ this.activeBackdrop = this.backdropService.setBackdrop('offcanvas');
6913
6927
  this.backdropClickSubscribe();
6914
6928
  }
6915
6929
  else {