- /**
- * Redraw the operator labels that are displayed next to each filter.
- */
- redrawOperatorLabels() {
- for (let i = 0; i < this.draggableRows.length; i++) {
- // Within the row, the operator labels are displayed inside the first
- // table cell (next to the filter name).
- const $draggableRow = $(this.draggableRows[i]);
- const $firstCell = $draggableRow.find('td').eq(0);
- if ($firstCell.length) {
- // The value of the operator label ("And" or "Or") is taken from the
- // first operator dropdown we encounter, going backwards from the
- // current row. This dropdown is the one associated with the current
- // row's filter group.
- const operatorValue = $draggableRow.prevAll('.views-group-title').find('option:selected').html();
- const operatorLabel = `<span class="views-operator-label">${operatorValue}</span>`;
- // If the next visible row after this one is a draggable filter row,
- // display the operator label next to the current row. (Checking for
- // visibility is necessary here since the "Remove" links hide the
- // removed row but don't actually remove it from the document).
- const $nextRow = $draggableRow.nextAll(':visible').eq(0);
- const $existingOperatorLabel = $firstCell.find('.views-operator-label');
- if ($nextRow.hasClass('draggable')) {
- // If an operator label was already there, replace it with the new
- // one.
- if ($existingOperatorLabel.length) {
- $existingOperatorLabel.replaceWith(operatorLabel);
+ /**
+ * Redraw the operator labels that are displayed next to each filter.
+ */
+ redrawOperatorLabels() {
+ for (let i = 0; i < this.draggableRows.length; i++) {
+ // Within the row, the operator labels are displayed inside the first
+ // table cell (next to the filter name).
+ const $draggableRow = $(this.draggableRows[i]);
+ const $firstCell = $draggableRow.find('td').eq(0);
+ if ($firstCell.length) {
+ // The value of the operator label ("And" or "Or") is taken from the
+ // first operator dropdown we encounter, going backwards from the
+ // current row. This dropdown is the one associated with the current
+ // row's filter group.
+ const operatorValue = $draggableRow
+ .prevAll('.views-group-title')
+ .find('option:selected')
+ .html();
+ const operatorLabel = `<span class="views-operator-label">${operatorValue}</span>`;
+ // If the next visible row after this one is a draggable filter row,
+ // display the operator label next to the current row. (Checking for
+ // visibility is necessary here since the "Remove" links hide the
+ // removed row but don't actually remove it from the document).
+ const $nextRow = $draggableRow.nextAll(':visible').eq(0);
+ const $existingOperatorLabel = $firstCell.find(
+ '.views-operator-label',
+ );
+ if ($nextRow.hasClass('draggable')) {
+ // If an operator label was already there, replace it with the new
+ // one.
+ if ($existingOperatorLabel.length) {
+ $existingOperatorLabel.replaceWith(operatorLabel);
+ }
+ // Otherwise, append the operator label to the end of the table
+ // cell.
+ else {
+ $firstCell.append(operatorLabel);
+ }