SORTABLE TABLE PLUGIN DEFINITION ================================
552081
function Plugin(options) {
    return this.each(function () {
      var $navigation;
      var $this = $(this);
      var data = $this.data('bui.sortableTable');

      if (!data) {
        $navigation = options && 'navigation' in options && options.navigation ?
            $(options.navigation) : false;
        data = new SortableTable($this, $navigation);
        $this.data('bui.sortableTable', data);
      }

      data.sort(options['sorted-th'], options['sort-direction']);
    });
  }
1203531
function isLayoutTable(element) {
        if (element.childElementCount == 0) {
            return true;
        }

        if (element.hasAttribute('role') && element.getAttribute('role') != 'presentation') {
            return false;
        }

        if (element.getAttribute('role') == 'presentation') {
            var tableChildren = element.querySelectorAll('*')

            // layout tables should only contain TR and TD elements
            for (var i = 0; i < tableChildren.length; i++) {
                if (tableChildren[i].tagName != 'TR' && tableChildren[i].tagName != 'TD') {
                    return false;
                }
            }

            return true;
        }

        return false;
    }
1199928
function Plugin( element ) {
        this.element = element;
        this.jqElement = $(element);
        this.isScaleActive = false;

        this._defaults = defaults;
        this._name = pluginName;
    }
939929
function Plugin(option) {
			return this.each(function () {
				var $this = $(this);
				var data = $this.data("bs.popover");
				var options = typeof option == "object" && option;

				if (!data && /destroy|hide/.test(option)) return;
				if (!data) $this.data("bs.popover", (data = new Popover(this, options)));
				if (typeof option == "string") data[option]();
			});
		}
987746
public function applySort()
    {
        if ($this->sortable === false) {
            return;
        }

        $sortBy = $this->getSortBy();

        if ($sortBy && $this->paginator) {
            $this->paginator->addReloadArgs([$this->name.'_sort' => $sortBy]);
        }

        $desc = false;
        if ($sortBy && $sortBy[0] == '-') {
            $desc = true;
            $sortBy = substr($sortBy, 1);
        }

        $this->table->sortable = true;

        if (
            $sortBy
            && isset($this->table->columns[$sortBy])
            && $this->model->hasElement($sortBy) instanceof \atk4\data\Field
        ) {
            $this->model->setOrder($sortBy, $desc);
            $this->table->sort_by = $sortBy;
            $this->table->sort_order = $desc ? 'descending' : 'ascending';
        }

        $this->table->on(
            'click',
            'thead>tr>th',
            new jsReload($this->container, [$this->name.'_sort' => (new jQuery())->data('column')])
        );
    }
1228027
function(options) {
        var tbody = $('<tbody></tbody>'),
            column = options.column,
            columnCount = column.length,
            data = options.data,
            rowCount = data.length;

        for (var i = 0; i < rowCount; i++) {
            var tr = $('<tr></tr>'),
                item = data[i],
                index = i + 1;

            for (var j = 0; j < columnCount; j++) {
                var col = column[j];

                if (typeof col.visible !== 'undefined' && !col.visible) {
                    continue;
                }

                if (!$.isArray(col.content)) {
                    col.content = [col.content];
                }

                var td = $('<td></td>').attr({
                    align: col.align,
                    width: col.width,
                    class: col.customClass
                });
                if (col.editable && col.content.length === 1) {
                    td.attr('editable', '');
                }
                if (this.rowSpan > 1 && col.content.length === 1) {
                    td.attr('rowspan', this.rowSpan);
                }

                var content = col.content[0].apply(this, [item, index, col.field]).toString();
                td.html((col.escapeContent === false) ? content : escapeHTML(content)).appendTo(tr);

                if (options.flexible) {
                    td.removeAttr('width');
                }
            }

            tbody.append(tr);

            if (this.rowSpan > 1) {
                for (var m = 1; m < this.rowSpan; m++) {
                    var _tr = $('<tr></tr>');
                    for (var n = 0; n < columnCount; n++) {
                        var _col = column[n];

                        if (!$.isArray(_col.content)) {
                            _col.content = [_col.content];
                        }

                        if ((typeof _col.visible !== 'undefined' && !_col.visible) || _col.content.length === 1) {
                            continue;
                        }

                        var _td = $('<td></td>').attr({
                            align: _col.align,
                            class: _col.customClass
                        });
                        var _content = _col.content[m].apply(this, [item, index, _col.field]).toString();
                        _td.html((_col.escapeContent === false) ? _content : escapeHTML(_content)).appendTo(_tr);

                        if (options.flexible) {
                            _td.removeAttr('width');
                        }
                    }
                    tbody.append(_tr);
                }
            }
        }

        return tbody.prop('outerHTML');
    }
1154492
function(oTable, iColumnIndex) {
			if (!oTable ||
				iColumnIndex == null || iColumnIndex < 0) {
				return;
			}

			var oColumns = oTable.getColumns();
			if (iColumnIndex >= oColumns.length) {
				return;
			}

			var oColumn = oColumns[iColumnIndex];
			oColumn._closeMenu();
		}
435179
function (module) {
        "use strict";
    
        var plugins = {};
    
        var order;
        Object.defineProperty(this, 'order', {
            'get': function () {
                return order;
            },
            'set': function (value) {
                order = value;
            }
        });
    
        this.register = function (ID, plugin, group) {
    
            if (!group) group = 'default';
            if (!plugins[group]) plugins[group] = {};
    
            plugins[group][ID] = plugin;
    
        };
    
        this.get = function (group) {
    
            if (!group) group = 'default';
            var group = plugins[group];
    
            var ordered = [];
            for (var i in order) {
    
                var name = order[i];
                if (group[name]) ordered.push(group[name]);
    
            }
    
            // set all the plugins not in the ordered list
            for (var name in group) {
    
                if (!order || order.indexOf(name) === -1) ordered.push(group[name]);
    
            }
    
            return ordered;
    
        };
    
    }
1291324
function(){
			var plugin = $(this.element).data("ui-" + this.options.pluginName) || $(this.element).data(this.options.pluginName),
				opts = this.options,
				actualOpts = plugin.options,
				availOptList = opts.optionList,
				$opts = $(this.options.optionTarget).empty(),
				$ul = $("<ul>").appendTo($opts),
				$li = null;
			$.each(availOptList, function(i, o){
				if( typeof o.value === "boolean"){
					$li = $("<li>").append(
						$("<input>", {
							id: o.name,
							name: o.name,
							type: "checkbox",
							checked: !!actualOpts[o.name]  //o.value
						})
					).append(
						$("<label>", {"for": o.name, text: " " + o.hint})
					);
				}else if( typeof o.value === "number" || typeof o.value === "string"){
					$li = $("<li>").append(
							$("<label>", {"for": o.name, text: " " + o.name})
						).append(
							$("<input>", {
								id: o.name,
								name: o.name,
								type: "text",
								value: actualOpts[o.name] //o.value
							})
						);
				}else if( $.isArray(o.value) ){
					$li = $("<li>")
						.append(
							$("<label>", {"for": o.name, text: " " + o.name})
						).append(
							$("<select>", {
								id: o.name,
								name: o.name,
								size: 1
							})
						);
					var $sel = $li.find("select");
					$.each(o.value, function(){
						$sel.append($("<option>", {
							value: this.value,
							text: this.name,
							selected: (actualOpts[o.name] == this.value)  //this.selected
						}));
					});
				}
				$ul.append($li);
			});
		}
68737
function Plugin(option) {
			return this.each(function () {
				var $this = $(this);
				var data = $this.data("bs.carousel");
				var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == "object" && option);
				var action = typeof option == "string" ? option : options.slide;

				if (!data) $this.data("bs.carousel", (data = new Carousel(this, options)));
				if (typeof option == "number") data.to(option);
				else if (action) data[action]();
				else if (options.interval) data.pause().cycle();
			});
		}
543807
function getSortedColumns(tableStructure, sortColumn, compareFunction) {
  // With help from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
  var mappedArray = sortColumn.julianDatesOrValues.map(function(value, i) {
    return { index: i, value: value };
  });
  if (!defined(compareFunction)) {
    if (sortColumn.type === VarType.TIME) {
      compareFunction = function(a, b) {
        if (defined(a) && defined(b)) {
          return JulianDate.compare(a, b);
        }
        return defined(a) ? -1 : defined(b) ? 1 : 0; // so that undefined > defined, ie. all undefined dates go to the end.
      };
    } else {
      compareFunction = function(a, b) {
        return +(a > b) || +(a === b) - 1;
      };
    }
  }
  mappedArray.sort(function(a, b) {
    return compareFunction(a.value, b.value);
  });
  return tableStructure.columns.map(column => {
    var sortedValues = mappedArray.map(element => column.values[element.index]);
    return new TableColumn(column.name, sortedValues, column.getFullOptions());
  });
}
43811
function isSortableColumn(index$$1) {
      var sortable = this.columns[index$$1].sortable;
      var isSortable = typeof sortable === 'boolean' ? sortable : this.sortable;
      return isSortable;
    }
985181
function Plugin(element, options) {
    this.element = element;

    this.options = $.extend(true, {}, defaults, options);
    this.options.share = options.share; //simple solution to allow order of buttons

    this._defaults = defaults;
    this._name = pluginName;

    this.init();
  }
174709
function () {
/*Line 30 - 'AtomSortableColumn.js' */                if (!this._value)
/*Line 31 - 'AtomSortableColumn.js' */                    return;
/*Line 32 - 'AtomSortableColumn.js' */                if (this._value.indexOf(this._sortField) == -1) {
/*Line 33 - 'AtomSortableColumn.js' */                    AtomBinder.setValue(this, "direction", "");
/*Line 34 - 'AtomSortableColumn.js' */                    return;
/*Line 35 - 'AtomSortableColumn.js' */                }

/*Line 37 - 'AtomSortableColumn.js' */                if (this._value.lastIndexOf("desc") != this._value.length - 4) {
/*Line 38 - 'AtomSortableColumn.js' */                    AtomBinder.setValue(this, "direction", "asc");
/*Line 39 - 'AtomSortableColumn.js' */                } else {
/*Line 40 - 'AtomSortableColumn.js' */                    AtomBinder.setValue(this, "direction", "desc");
/*Line 41 - 'AtomSortableColumn.js' */                }
/*Line 42 - 'AtomSortableColumn.js' */            }
572050
function onSortableClick( event ) {
  if ( this.ui.sortButton ) {
    this.ui.sortButton.classList.remove( this.sortClass );
  }
  if ( this.ui.sortButton === event.target ) {
    this.sortDirection = ~this.sortDirection;
  } else {
    this.ui.sortButton = event.target;
    this.sortColumnIndex = this.getColumnIndex();
    this.sortDirection = DIRECTIONS.UP;
  }
  // The active sort class is changing when the sort direction changes.
  this.ui.sortButton.classList.add( this.sortClass );
  this.updateTable();

  return this;
}
1115826
def sortable_column(attribute, default_direction = nil, options = nil)
      if options.nil? && (options = Hash.try_convert(default_direction))
        default_direction = nil
      end
      default_direction ||= 'desc'
      options ||= {}
      name = options[:name] || attribute.humanize
      selected = @table_sort_info[:attribute].to_s == attribute
      if selected
        direction = @table_sort_info[:direction]
        new_direction = direction.to_s == 'desc' ? 'asc' : 'desc'
        classes = "selected #{direction}"
      else
        classes = ''
        new_direction = default_direction
      end
      link_to(name, url_for(sort: "#{attribute}.#{new_direction}"), class: classes)
    end
755286
public static function bootSortable()
    {
        static::addGlobalScope('position', function (Builder $builder) {
            $builder->orderBy(static::getSortableField());
        });

        static::saving(
            function ($model) {
                /* @var Model $model */
                $sortableField = static::getSortableField();
                $query = static::applySortableGroup(static::on(), $model);

                // only automatically calculate next position with max+1 when a position has not been set already
                if ($model->$sortableField === null) {
                    $model->setAttribute($sortableField, $query->max($sortableField) + 1);
                }
            }
        );

        static::deleting(
            function ($model) {
                $model->next()->decrement(static::getSortableField());
            }
        );
    }