mirror of
https://github.com/we-promise/sure.git
synced 2026-04-09 07:14:47 +00:00
feat: implement expandable view for cashflow sankey chart (#739)
* 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>
This commit is contained in:
23
app/javascript/controllers/cashflow_expand_controller.js
Normal file
23
app/javascript/controllers/cashflow_expand_controller.js
Normal file
@@ -0,0 +1,23 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user