@microbiome-informatics/genome-properties-viewer 1.0.0-beta.1 → 1.0.0-beta.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.
package/src/modal.js CHANGED
@@ -6,19 +6,16 @@ class GPModal {
6
6
  /**
7
7
  * Appends the divs for the modal overlay and the popup.
8
8
  * Inside the popup creates a `div` element with a refence in `this.content`.
9
- * @param {HTMLElement} element - DOM element where the modal should be appended.
9
+ * The overlay is mounted on `document.body` so it stacks above page chrome.
10
10
  */
11
- constructor(element) {
11
+ constructor() {
12
12
  this.fixed = false;
13
- this.mask = d3
14
- .selectAll(element)
13
+ const host = d3.select("body");
14
+ this.mask = host
15
15
  .append("div")
16
16
  .attr("class", "gp-modal")
17
17
  .on("click", () => !this.fixed && this.setVisibility(false));
18
- this.popup = d3
19
- .selectAll(element)
20
- .append("div")
21
- .attr("class", "gp-modal-popup");
18
+ this.popup = host.append("div").attr("class", "gp-modal-popup");
22
19
  this.content = this.popup.append("div").attr("class", "gp-modal-content");
23
20
  }
24
21
 
@@ -51,6 +48,11 @@ class GPModal {
51
48
  getContentElement() {
52
49
  return this.content;
53
50
  }
51
+
52
+ destroy() {
53
+ this.mask.remove();
54
+ this.popup.remove();
55
+ }
54
56
  }
55
57
 
56
58
  export default GPModal;