@progressive-development/pd-dialog 0.6.7 → 0.6.9

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.
@@ -9,7 +9,10 @@ import { LitElement, CSSResultGroup } from 'lit';
9
9
  * @event popup-close - Wird ausgelöst, wenn das Popup geschlossen wurde
10
10
  */
11
11
  export declare class PdPopup extends LitElement {
12
+ closeByEscape: boolean;
12
13
  static styles: CSSResultGroup;
14
+ connectedCallback(): void;
15
+ disconnectedCallback(): void;
13
16
  /**
14
17
  * Öffnet das Popup programmatisch
15
18
  */
@@ -21,5 +24,6 @@ export declare class PdPopup extends LitElement {
21
24
  protected render(): import('lit-html').TemplateResult<1>;
22
25
  private _activatePopup;
23
26
  private _closePopup;
27
+ private _handleKeyDown;
24
28
  }
25
29
  //# sourceMappingURL=pd-popup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pd-popup.d.ts","sourceRoot":"","sources":["../src/pd-popup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAM5D,OAAO,0CAA0C,CAAC;AAElD;;;;;;;;GAQG;AACH,qBACa,OAAQ,SAAQ,UAAU;IACrC,OAAgB,MAAM,EAAE,cAAc,CA+CpC;IAEF;;OAEG;IACI,SAAS,IAAI,IAAI;IAIxB;;OAEG;IACI,SAAS,IAAI,IAAI;IAIxB,SAAS,CAAC,MAAM;IAqBhB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,WAAW;CAWpB"}
1
+ {"version":3,"file":"pd-popup.d.ts","sourceRoot":"","sources":["../src/pd-popup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAM5D,OAAO,0CAA0C,CAAC;AAElD;;;;;;;;GAQG;AACH,qBACa,OAAQ,SAAQ,UAAU;IAErC,aAAa,EAAE,OAAO,CAAS;IAE/B,OAAgB,MAAM,EAAE,cAAc,CA+CpC;IAEO,iBAAiB;IAOjB,oBAAoB;IAO7B;;OAEG;IACI,SAAS,IAAI,IAAI;IAIxB;;OAEG;IACI,SAAS,IAAI,IAAI;IAIxB,SAAS,CAAC,MAAM;IAqBhB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,cAAc,CAEpB;CACH"}
package/dist/pd-popup.js CHANGED
@@ -1,17 +1,38 @@
1
1
  import { css, LitElement, html } from "lit";
2
- import { customElement } from "lit/decorators.js";
2
+ import { property, customElement } from "lit/decorators.js";
3
3
  import { pdIcons } from "@progressive-development/pd-icon";
4
4
  import { PdColorStyles } from "@progressive-development/pd-shared-styles";
5
5
  import "@progressive-development/pd-icon/pd-icon";
6
+ var __defProp = Object.defineProperty;
6
7
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
8
  var __decorateClass = (decorators, target, key, kind) => {
8
9
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
9
10
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
10
11
  if (decorator = decorators[i])
11
- result = decorator(result) || result;
12
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
13
+ if (kind && result) __defProp(target, key, result);
12
14
  return result;
13
15
  };
14
16
  let PdPopup = class extends LitElement {
17
+ constructor() {
18
+ super(...arguments);
19
+ this.closeByEscape = false;
20
+ this._handleKeyDown = (e) => {
21
+ if (e.key === "Escape") this._closePopup();
22
+ };
23
+ }
24
+ connectedCallback() {
25
+ super.connectedCallback();
26
+ if (this.closeByEscape) {
27
+ document.addEventListener("keydown", this._handleKeyDown);
28
+ }
29
+ }
30
+ disconnectedCallback() {
31
+ super.disconnectedCallback();
32
+ if (this.closeByEscape) {
33
+ document.removeEventListener("keydown", this._handleKeyDown);
34
+ }
35
+ }
15
36
  /**
16
37
  * Öffnet das Popup programmatisch
17
38
  */
@@ -109,6 +130,9 @@ PdPopup.styles = [
109
130
  }
110
131
  `
111
132
  ];
133
+ __decorateClass([
134
+ property({ type: Boolean })
135
+ ], PdPopup.prototype, "closeByEscape", 2);
112
136
  PdPopup = __decorateClass([
113
137
  customElement("pd-popup")
114
138
  ], PdPopup);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progressive-development/pd-dialog",
3
- "version": "0.6.7",
3
+ "version": "0.6.9",
4
4
  "description": "Progressive Development dialog components.",
5
5
  "author": "PD Progressive Development",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@lit/localize": "^0.12.2",
44
- "@progressive-development/pd-forms": "^0.7.1",
44
+ "@progressive-development/pd-forms": "^0.7.2",
45
45
  "@progressive-development/pd-icon": "^0.7.4",
46
46
  "@progressive-development/pd-price": "^0.6.3",
47
47
  "@progressive-development/pd-shared-styles": "^0.2.5",