mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 22:34:47 +00:00
* feat: implement expandable view for cashflow sankey chart * refactor: migrate cashflow dialog sizing to tailwind utilities * refactor: declarative draggable restore on cashflow dialog close * refactor: localized title and use Tailwind utilities * refactor: update dialog interaction especially on mobile * refactor: add global expand text to localization * fix: restore draggable immediately after dialog close * Whitespace noise --------- Signed-off-by: Juan José Mata <juanjo.mata@gmail.com> Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
24 lines
666 B
JavaScript
24 lines
666 B
JavaScript
import { Controller } from "@hotwired/stimulus";
|
|
|
|
export default class extends Controller {
|
|
open() {
|
|
const dialog = this.element.querySelector("dialog");
|
|
if (!dialog) return;
|
|
|
|
if (typeof this.originalDraggable === "undefined") {
|
|
this.originalDraggable = this.element.getAttribute("draggable");
|
|
}
|
|
this.element.setAttribute("draggable", "false");
|
|
|
|
dialog.showModal();
|
|
}
|
|
|
|
restore() {
|
|
if (this.originalDraggable === undefined) return;
|
|
this.originalDraggable
|
|
? this.element.setAttribute("draggable", this.originalDraggable)
|
|
: this.element.removeAttribute("draggable");
|
|
this.originalDraggable = undefined;
|
|
}
|
|
}
|