VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /var/www/html/libs/absol-full/dist/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/libs/absol-full/dist/js/mdls__absol-acomp__js__treetable__TTBody.js
/*** module: node_modules/absol-acomp/js/treetable/TTBody.js ***/
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _TTRow = _interopRequireWildcard(require("./TTRow"));

var _ResizeSystem = _interopRequireDefault(require("absol/src/HTML5/ResizeSystem"));




/***
 *
 * @param {TTTable}table
 * @param {TTDBody} data
 * @constructor
 */
function TTBody(table, data) {
  this.table = table;
  this.data = data;
  this.elt = this.table.elt.$body;
  /***
   *
   * @type {TTRow[]}
   */

  this.rows = (this.data.rows || []).map(rowData => new _TTRow.default(this, rowData, null));
  this.clonedRows = null;
  this.renderRows();
}

TTBody.prototype.applyQueryResult = function (queryResult) {
  this.clearClonedRows();

  if (queryResult) {
    this.table.elt.addClass('as-searching');
    this.clonedRows = this.rows.filter(row => queryResult[row.id]).map((row, i) => new _TTRow.TTClonedRow(row, queryResult, i));
    this.clonedRows.sort((a, b) => {
      var sa = a.score[1];
      var sb = b.score[1];
      if (sa !== sb) return sb - sa;
      return a.idx - b.idx;
    });
    this.renderRows(this.clonedRows);
    this.table.elt.notifySizeChange();
  } else {
    this.table.elt.removeClass('as-searching');
    this.renderRows();
  }
};

TTBody.prototype.clearClonedRows = function () {
  if (this.clonedRows) this.clonedRows.forEach(row => row.detach());
  this.clonedRows = null;
};
/***
 *
 */


TTBody.prototype.renderRows = function (rows) {
  rows = rows || this.rows;
  this.elt.clearChild().addChild(rows.reduce((ac, row) => {
    row.getRowElements(ac);
    return ac;
  }, []));
};
/***
 *
 * @param data
 */


TTBody.prototype.rowOf = function (data) {
  if (data instanceof _TTRow.default) {
    data = data.data;
  }

  var result = null;
  var queue = this.rows.slice();
  var cr;

  while (queue.length > 0 && !result) {
    cr = queue.shift();

    if (cr.data === data || cr.data.id === data || data.id && cr.data.id === data.id) {
      result = cr;
    } else {
      queue.push.apply(queue, cr.subRows);
    }
  }

  return result;
};
/***
 *
 * @param {TTDRow} rowData
 */


TTBody.prototype.addRow = function (rowData) {
  var row = new _TTRow.default(this, rowData, null);
  this.data.rows.push(rowData);
  this.rows.push(row);
  var elements = row.getRowElements();
  elements.forEach(elt => this.elt.addChild(elt));

  _ResizeSystem.default.requestUpdateSignal();
};

var _default = TTBody;
exports.default = _default;

VaKeR 2022