@coreui/angular 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.
@@ -6065,19 +6065,20 @@
6065
6065
  this.backdropClick$ = this.backdropClick.asObservable();
6066
6066
  this.renderer = rendererFactory.createRenderer(null, null);
6067
6067
  }
6068
- BackdropService.prototype.setBackdrop = function () {
6068
+ BackdropService.prototype.setBackdrop = function (type) {
6069
6069
  var _this = this;
6070
- var backdrop = this.renderer.createElement('div');
6071
- this.renderer.addClass(backdrop, 'modal-backdrop');
6072
- this.renderer.addClass(backdrop, 'fade');
6073
- this.renderer.appendChild(this.document.body, backdrop);
6074
- this.unListen = this.renderer.listen(backdrop, 'click', function (e) {
6070
+ if (type === void 0) { type = 'modal'; }
6071
+ var backdropElement = this.renderer.createElement('div');
6072
+ this.renderer.addClass(backdropElement, type + "-backdrop");
6073
+ this.renderer.addClass(backdropElement, 'fade');
6074
+ this.renderer.appendChild(this.document.body, backdropElement);
6075
+ this.unListen = this.renderer.listen(backdropElement, 'click', function (e) {
6075
6076
  _this.onClickHandler();
6076
6077
  });
6077
6078
  setTimeout(function () {
6078
- _this.renderer.addClass(backdrop, 'show');
6079
+ _this.renderer.addClass(backdropElement, 'show');
6079
6080
  });
6080
- return backdrop;
6081
+ return backdropElement;
6081
6082
  };
6082
6083
  BackdropService.prototype.clearBackdrop = function (backdrop) {
6083
6084
  var _this = this;
@@ -6157,6 +6158,7 @@
6157
6158
  */
6158
6159
  this.visibleChange = new i0.EventEmitter();
6159
6160
  this._show = true;
6161
+ this.mouseDownTarget = null;
6160
6162
  }
6161
6163
  Object.defineProperty(ModalComponent.prototype, "scrollable", {
6162
6164
  get: function () {
@@ -6180,11 +6182,14 @@
6180
6182
  * Toggle the visibility of modal component.
6181
6183
  * @type boolean
6182
6184
  */
6183
- set: function (visible) {
6184
- this._visible = visible;
6185
- this.setBackdrop(this.backdrop !== false && visible);
6186
- this.setBodyStyles(visible);
6187
- this.visibleChange.emit(visible);
6185
+ set: function (value) {
6186
+ var newValue = coercion.coerceBooleanProperty(value);
6187
+ if (this._visible !== newValue) {
6188
+ this._visible = newValue;
6189
+ this.setBackdrop(this.backdrop !== false && newValue);
6190
+ this.setBodyStyles(newValue);
6191
+ this.visibleChange.emit(newValue);
6192
+ }
6188
6193
  },
6189
6194
  enumerable: false,
6190
6195
  configurable: true
@@ -6279,14 +6284,20 @@
6279
6284
  }
6280
6285
  }
6281
6286
  };
6287
+ ModalComponent.prototype.onMouseDownHandler = function ($event) {
6288
+ this.mouseDownTarget = $event.target;
6289
+ };
6282
6290
  ModalComponent.prototype.onClickHandler = function ($event) {
6291
+ $event.stopPropagation();
6292
+ if (this.mouseDownTarget !== $event.target) {
6293
+ this.mouseDownTarget = null;
6294
+ return;
6295
+ }
6283
6296
  if (this.backdrop === 'static') {
6284
6297
  this.setStaticBackdrop();
6298
+ return;
6285
6299
  }
6286
- else {
6287
- this.modalService.toggle({ show: false, modal: this });
6288
- }
6289
- $event.stopPropagation();
6300
+ this.modalService.toggle({ show: false, modal: this });
6290
6301
  };
6291
6302
  ModalComponent.prototype.ngOnInit = function () {
6292
6303
  this.stateToggleSubscribe();
@@ -6318,7 +6329,7 @@
6318
6329
  };
6319
6330
  ModalComponent.prototype.setBackdrop = function (setBackdrop) {
6320
6331
  if (setBackdrop) {
6321
- this.activeBackdrop = this.backdropService.setBackdrop();
6332
+ this.activeBackdrop = this.backdropService.setBackdrop('modal');
6322
6333
  }
6323
6334
  else {
6324
6335
  this.activeBackdrop = this.backdropService.clearBackdrop(this.activeBackdrop);
@@ -6353,7 +6364,7 @@
6353
6364
  return ModalComponent;
6354
6365
  }());
6355
6366
  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 });
6356
- 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\n [alignment]=\"alignment\"\n [fullscreen]=\"fullscreen\"\n [scrollable]=\"scrollable\"\n [size]=\"size\">\n <c-modal-content>\n <div [cdkTrapFocus]=\"visible\" [cdkTrapFocusAutoCapture]=\"visible\" style=\"display: contents;\">\n <ng-content></ng-content>\n </div>\n </c-modal-content>\n</c-modal-dialog>\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: [
6367
+ 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\n [alignment]=\"alignment\"\n [fullscreen]=\"fullscreen\"\n [scrollable]=\"scrollable\"\n [size]=\"size\">\n <c-modal-content>\n <div [cdkTrapFocus]=\"visible\" [cdkTrapFocusAutoCapture]=\"visible\" style=\"display: contents;\">\n <ng-content></ng-content>\n </div>\n </c-modal-content>\n</c-modal-dialog>\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: [
6357
6368
  i1.trigger('showHide', [
6358
6369
  i1.state('visible', i1.style({
6359
6370
  display: 'block'
@@ -6442,6 +6453,9 @@
6442
6453
  }], onKeyDownHandler: [{
6443
6454
  type: i0.HostListener,
6444
6455
  args: ['document:keydown', ['$event']]
6456
+ }], onMouseDownHandler: [{
6457
+ type: i0.HostListener,
6458
+ args: ['mousedown', ['$event']]
6445
6459
  }], onClickHandler: [{
6446
6460
  type: i0.HostListener,
6447
6461
  args: ['click', ['$event']]
@@ -6695,7 +6709,7 @@
6695
6709
  };
6696
6710
  OffcanvasComponent.prototype.setBackdrop = function (setBackdrop) {
6697
6711
  if (setBackdrop) {
6698
- this.activeBackdrop = this.backdropService.setBackdrop();
6712
+ this.activeBackdrop = this.backdropService.setBackdrop('offcanvas');
6699
6713
  this.backdropClickSubscribe();
6700
6714
  }
6701
6715
  else {