ember-sortable
Version:
Sortable UI primitives for Ember.
36 lines (33 loc) • 1.16 kB
JavaScript
import { a as _defineProperty } from '../_rollupPluginBabelHelpers-a7bede49.js';
import Modifier from 'ember-modifier';
/**
* Modifier to to mark the handle of an item. If this is not supplied the item will be the handle
*
* @module drag-drop/draggable-group
* @example*
* <ol {{sortable-group onChange=this.update a11yAnnouncementConfig=this.myA11yConfig}}>
* {{#each model.items as |item|}}
* <li {{sortable-item model=item}}>
* {{item.name}}
* <span class="handle" {{sortable-handle}}>↕</span>
* </li>
* {{/each}}
* </ol>
*/
class SortableHandleModifier extends Modifier {
constructor(...args) {
super(...args);
_defineProperty(this, "didSetup", false);
}
modify(element) {
if (!this.didSetup) {
// take the model and look up the registered element, the tell that element you are the handle
element.dataset['sortableHandle'] = 'true';
element.setAttribute('tabIndex', '0');
element.setAttribute('role', 'button');
this.didSetup = true;
}
}
}
export { SortableHandleModifier as default };
//# sourceMappingURL=sortable-handle.js.map