Files
odoo_source/addons/web/static/lib
Romeo Fragomeli 5f454f0ccb [IMP] web,web_editor,website_slide: sortable service for frontend usage
This commit removes the module sortable from jQueryUI and adds instead a
sortable service to use the sortable code already used by the backend.

The service can be called using `this.call("sortable", ...)` and the
sortable listeners are added when the `enable` function is called.
This function (`enable()`) returns an object that contains the `cleanup`
function (`cleanup()`).

```javascript
// start / setup
const sortable = this.call(
    "sortable",
    "create",
    {
        ref: { el: document.querySelector(".list") },
        elements: ".items",
        handle: ".drag-icon",
    },
);

// on attach callback / on mounted
const sortableInstance = sortable.enable();

// on destroy / on willUnmount
sortableInstance.cleanup();
```

Also, it adds some new property to the useSortable:
* clone: the placeholder is a clone of the drag element
* placeholderClasses: classes added to the placeholder element
* applyChangeOnDrop: on drop the change is applied to the DOM
* followingElementClasses: classes added to the element following mouse

task-3439226

closes odoo/odoo#137527

Related: odoo/enterprise#48371
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-10-10 01:59:35 +00:00
..
…