/** * DO NOT EDIT THIS FILE. * See the following change record for more information, * https://www.drupal.org/node/2815083 * @preserve **/ (($, Drupal) => { Drupal.behaviors.claroTableDrag = { attach(context, settings) { const createItemWrapBoundaries = row => { const $row = $(row); const $firstCell = $row.find('td:first-of-type').eq(0).wrapInner(Drupal.theme('tableDragCellContentWrapper')).wrapInner($(Drupal.theme('tableDragCellItemsWrapper')).addClass('js-tabledrag-cell-content')); const $targetElem = $firstCell.find('.js-tabledrag-cell-content'); $targetElem.eq(0).find('> .tabledrag-cell-content__item > .js-tabledrag-handle, > .tabledrag-cell-content__item > .js-indentation').prependTo($targetElem); }; Object.keys(settings.tableDrag || {}).forEach(base => { once('claroTabledrag', $(context).find(`#${base}`).find('> tr.draggable, > tbody > tr.draggable')).forEach(createItemWrapBoundaries); }); } }; $.extend(Drupal.tableDrag.prototype.row.prototype, { markChanged() { const marker = $(Drupal.theme('tableDragChangedMarker')).addClass('js-tabledrag-changed-marker'); const cell = $(this.element).find('td:first-of-type'); if (cell.find('.js-tabledrag-changed-marker').length === 0) { cell.find('.js-tabledrag-handle').after(marker); } }, onIndent() { $(this.table).find('.tabledrag-cell > .js-indentation').each((index, indentToMove) => { const $indentToMove = $(indentToMove); const $cellContent = $indentToMove.siblings('.tabledrag-cell-content'); $indentToMove.prependTo($cellContent); }); } }); $.extend(Drupal.theme, { tableDragIndentation() { return '
'; }, tableDragChangedWarning() { return ` `; }, tableDragHandle: () => ``, tableDragToggle: () => `