wip(Dashboard): grid widgets
This commit is contained in:
1
assets/bootstrap.js
vendored
1
assets/bootstrap.js
vendored
@@ -10,6 +10,7 @@ import { startStimulusApp } from '@symfony/stimulus-bundle';
|
||||
import Popover from '@stimulus-components/popover';
|
||||
import Dialog from '@stimulus-components/dialog';
|
||||
import Dropdown from '@stimulus-components/dropdown';
|
||||
|
||||
import 'animate.css';
|
||||
|
||||
const app = startStimulusApp();
|
||||
|
||||
40
assets/controllers/dashboard_widgets_controller.js
Normal file
40
assets/controllers/dashboard_widgets_controller.js
Normal file
@@ -0,0 +1,40 @@
|
||||
import { Controller } from '@hotwired/stimulus';
|
||||
import {GridStack} from "../vendor/gridstack/gridstack.index.js";
|
||||
|
||||
/*
|
||||
* The following line makes this controller "lazy": it won't be downloaded until needed
|
||||
* See https://symfony.com/bundles/StimulusBundle/current/index.html#lazy-stimulus-controllers
|
||||
*/
|
||||
|
||||
/* stimulusFetch: 'lazy' */
|
||||
export default class extends Controller {
|
||||
grid;
|
||||
|
||||
initialize() {
|
||||
|
||||
}
|
||||
|
||||
connect() {
|
||||
this.grid = GridStack.init({
|
||||
column: 2,
|
||||
alwaysShowResizeHandle: true,
|
||||
margin: "2rem",
|
||||
resizable: {
|
||||
handles: 'e,se,s,sw,w'
|
||||
}
|
||||
});
|
||||
|
||||
this.grid.load();
|
||||
}
|
||||
|
||||
// Add custom controller actions here
|
||||
// fooBar() { this.fooTarget.classList.toggle(this.bazClass) }
|
||||
|
||||
disconnect() {
|
||||
// Called anytime its element is disconnected from the DOM
|
||||
// (on page change, when it's removed from or moved in the DOM, etc.)
|
||||
|
||||
// Here you should remove all event listeners added in "connect()"
|
||||
// this.fooTarget.removeEventListener('click', this._fooBar)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user