import Sortable from "sortablejs";
+import {Component} from "./component";
-class ShelfSort {
+export class ShelfSort extends Component {
setup() {
this.elem = this.$el;
initSortable() {
const scrollBoxes = this.elem.querySelectorAll('.scroll-box');
- for (let scrollBox of scrollBoxes) {
+ for (const scrollBox of scrollBoxes) {
new Sortable(scrollBox, {
group: 'shelf-books',
ghostClass: 'primary-background-light',
+ handle: '.handle',
animation: 150,
onSort: this.onChange.bind(this),
});
this.input.value = shelfBookElems.map(elem => elem.getAttribute('data-id')).join(',');
}
-}
-
-export default ShelfSort;
\ No newline at end of file
+}
\ No newline at end of file