nw-style-guide 13.0.1 → 13.0.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.
@@ -10,6 +10,7 @@ export declare class DropdownDirective implements OnInit, OnChanges, OnDestroy {
10
10
  autoClose: boolean | "inside" | "outside";
11
11
  elementsToIgnore: HTMLElement[];
12
12
  selectorsToIgnore: string[];
13
+ disabled: boolean;
13
14
  opened: EventEmitter<null>;
14
15
  closed: EventEmitter<null>;
15
16
  isOpen: boolean;
@@ -26,5 +27,5 @@ export declare class DropdownDirective implements OnInit, OnChanges, OnDestroy {
26
27
  onEscape(event: KeyboardEvent): void;
27
28
  ngOnDestroy(): void;
28
29
  static ɵfac: i0.ɵɵFactoryDeclaration<DropdownDirective, never>;
29
- static ɵdir: i0.ɵɵDirectiveDeclaration<DropdownDirective, "[nwDropdown]", ["nw-dropdown"], { "autoClose": "autoClose"; "elementsToIgnore": "elementsToIgnore"; "selectorsToIgnore": "selectorsToIgnore"; }, { "opened": "opened"; "closed": "closed"; }, never, never, false, never>;
30
+ static ɵdir: i0.ɵɵDirectiveDeclaration<DropdownDirective, "[nwDropdown]", ["nw-dropdown"], { "autoClose": "autoClose"; "elementsToIgnore": "elementsToIgnore"; "selectorsToIgnore": "selectorsToIgnore"; "disabled": "disabled"; }, { "opened": "opened"; "closed": "closed"; }, never, never, false, never>;
30
31
  }
@@ -1,5 +1,6 @@
1
1
  import { Directive, Input, HostBinding, Output, EventEmitter } from '@angular/core';
2
2
  import { DropdownService } from "./dropdown.service";
3
+ import { filter } from 'rxjs/operators';
3
4
  import * as i0 from "@angular/core";
4
5
  import * as i1 from "./dropdown.service";
5
6
  export class DropdownDirective {
@@ -12,6 +13,7 @@ export class DropdownDirective {
12
13
  this.autoClose = true;
13
14
  this.elementsToIgnore = [];
14
15
  this.selectorsToIgnore = [];
16
+ this.disabled = false;
15
17
  this.opened = new EventEmitter();
16
18
  this.closed = new EventEmitter();
17
19
  }
@@ -42,7 +44,17 @@ export class DropdownDirective {
42
44
  this._service.close();
43
45
  }
44
46
  _subscribeToToggle() {
45
- this._toggleSubscription = this._service.toggle$.subscribe(isOpen => {
47
+ this._toggleSubscription = this._service.toggle$
48
+ /**
49
+ * If the dropdown is disabled, only allow close events through
50
+ */
51
+ .pipe(filter(isOpen => {
52
+ if (this.disabled) {
53
+ return !isOpen;
54
+ }
55
+ return true;
56
+ }))
57
+ .subscribe(isOpen => {
46
58
  this.isOpen = isOpen;
47
59
  if (this.isOpen) {
48
60
  this.opened.emit();
@@ -89,9 +101,9 @@ export class DropdownDirective {
89
101
  }
90
102
  }
91
103
  DropdownDirective.ɵfac = function DropdownDirective_Factory(t) { return new (t || DropdownDirective)(i0.ɵɵdirectiveInject(i1.DropdownService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.NgZone), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
92
- DropdownDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: DropdownDirective, selectors: [["", "nwDropdown", ""]], hostVars: 2, hostBindings: function DropdownDirective_HostBindings(rf, ctx) { if (rf & 2) {
93
- i0.ɵɵclassProp("open", ctx.isOpen);
94
- } }, inputs: { autoClose: "autoClose", elementsToIgnore: "elementsToIgnore", selectorsToIgnore: "selectorsToIgnore" }, outputs: { opened: "opened", closed: "closed" }, exportAs: ["nw-dropdown"], features: [i0.ɵɵProvidersFeature([DropdownService]), i0.ɵɵNgOnChangesFeature] });
104
+ DropdownDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: DropdownDirective, selectors: [["", "nwDropdown", ""]], hostVars: 4, hostBindings: function DropdownDirective_HostBindings(rf, ctx) { if (rf & 2) {
105
+ i0.ɵɵclassProp("disabled", ctx.disabled)("open", ctx.isOpen);
106
+ } }, inputs: { autoClose: "autoClose", elementsToIgnore: "elementsToIgnore", selectorsToIgnore: "selectorsToIgnore", disabled: "disabled" }, outputs: { opened: "opened", closed: "closed" }, exportAs: ["nw-dropdown"], features: [i0.ɵɵProvidersFeature([DropdownService]), i0.ɵɵNgOnChangesFeature] });
95
107
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DropdownDirective, [{
96
108
  type: Directive,
97
109
  args: [{
@@ -105,6 +117,11 @@ DropdownDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: DropdownD
105
117
  type: Input
106
118
  }], selectorsToIgnore: [{
107
119
  type: Input
120
+ }], disabled: [{
121
+ type: HostBinding,
122
+ args: ['class.disabled']
123
+ }, {
124
+ type: Input
108
125
  }], opened: [{
109
126
  type: Output
110
127
  }], closed: [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nw-style-guide",
3
- "version": "13.0.1",
3
+ "version": "13.0.3",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "email": "garethdn@gmail.com",