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__FrameView.js
/*** module: node_modules/absol-acomp/js/FrameView.js ***/
"use strict";

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

require("../css/frameview.css");

var _ACore = _interopRequireDefault(require("../ACore"));

var _utils = require("./utils");


var _ = _ACore.default._;
var $ = _ACore.default.$;
/***
 * @extends AElement
 * @constructor
 */

function FrameView() {
  this.$containers = []; //adapt

  (0, _utils.forwardEvent)(this, 'inactiveframe', 'deactiveframe');
  (0, _utils.forwardMethod)(this, 'notifyDeactiveFrame', 'notifyInactiveFrame');
}

FrameView.tag = 'frameview';

FrameView.render = function () {
  return _({
    class: 'absol-frame-view',
    extendEvent: ['activeframe', 'inactiveframe']
  });
};

FrameView.prototype.addChild = function (elt) {
  if (elt.hasClass && elt.hasClass('absol-frame')) {
    elt.selfRemove();

    var containerElt = _({
      class: 'absol-frame-view-frame-container',
      child: elt,
      props: {
        __elt__: elt
      }
    });

    this.$containers.push(containerElt);
    this.appendChild(containerElt);
    elt.notifyAttached(this);
  } else {
    throw new Error('Children must be a frame');
  }
};

FrameView.prototype.addLast = function (elt) {
  this.addChild(elt);
  this.activeFrame(elt);
};

FrameView.prototype.removeLast = function () {
  if (this.$containers.length > 0) {
    this.removeChild(this.$containers[this.$containers.length - 1].__elt__);
  }

  if (this.$containers.length > 0) {
    this.activeFrame(this.$containers[this.$containers.length - 1].__elt__);
  }
};

FrameView.prototype.getLength = function () {
  return this.$containers.length;
};

FrameView.prototype.getAllChild = function () {
  return this.$containers.map(function (ctn) {
    return ctn.__elt__;
  });
};

FrameView.prototype.getLast = function () {
  if (this.$containers.length > 0) {
    return this.$containers[this.$containers.length - 1].__elt__;
  }

  return null;
};

FrameView.prototype.addChildBefore = function (elt, at) {
  if (elt.hasClass && elt.hasClass('absol-frame')) {
    elt.selfRemove();
    var index = this.childIndexOf(at);

    if (index < 0) {
      throw new Error('Second param is not a child');
    }

    var index = this.childIndexOf(at);
    var atCtnElt = this.$containers[index];

    var containerElt = _({
      class: 'absol-frame-view-frame-container',
      child: elt,
      props: {
        __elt__: elt
      }
    });

    this.$containers.splice(index, 0, containerElt);
    this.super(containerElt, atCtnElt);
    elt.notifyAttached(this);
  } else {
    throw new Error('Children must be a frame');
  }
};

FrameView.prototype.addChildAfter = function (elt, at) {
  if (elt.hasClass && elt.hasClass('absol-frame')) {
    elt.selfRemove();
    var index = this.childIndexOf(at);

    if (index < 0) {
      throw new Error('Second param is not a child');
    }

    var index = this.childIndexOf(at);
    var atCtnElt = this.$containers[index];

    var containerElt = _({
      class: 'absol-frame-view-frame-container',
      child: elt,
      props: {
        __elt__: elt
      }
    });

    this.$containers.splice(index + 1, 0, containerElt);
    this.super(containerElt, atCtnElt);
    elt.notifyAttached(this);
  } else {
    throw new Error('Children must be a frame');
  }
};

FrameView.prototype.removeChild = function (elt) {
  var ctnEltIndex = this.childIndexOf(elt);

  if (ctnEltIndex >= 0) {
    var ctnElt = this.$containers[ctnEltIndex];
    this.$containers.splice(ctnEltIndex, 1);
    this.super(ctnElt);
  } else {
    throw new Error('Removed element is not a child!');
  }
};

FrameView.prototype.childIndexOf = function (elt) {
  for (var i = 0; i < this.$containers.length; ++i) {
    if (this.$containers[i].__elt__ == elt) return i;
  }

  return -1;
};

FrameView.prototype.findChildBefore = function (elt) {
  var eltIndex = this.childIndexOf(elt);
  if (eltIndex < 0) return -1;
  return this.$containers[eltIndex - 1];
};

FrameView.prototype.findChildAfter = function (elt) {
  var eltIndex = this.childIndexOf(elt);
  if (eltIndex < 0) return -1;
  return this.$containers[eltIndex + 1];
};

FrameView.prototype.clearChild = function () {
  while (this.$containers.length > 0) {
    this.removeChild(this.$containers[0].__elt__);
  }

  return this;
};

FrameView.prototype.findChildById = function (id) {
  var elt;

  for (var i = 0; i < this.$containers.length; ++i) {
    elt = this.$containers[i].__elt__;
    if (elt.getAttribute('id') == id) return elt;
  }

  return undefined;
};

FrameView.prototype.getAllChild = function () {
  return this.$containers.map(function (ctnElt) {
    return ctnElt.__elt__;
  });
};

FrameView.prototype.activeFrame = function (frameElt) {
  var ctnElt, elt;

  for (var i = 0; i < this.$containers.length; ++i) {
    ctnElt = this.$containers[i];
    elt = ctnElt.__elt__;

    if (frameElt === elt) {
      if (!ctnElt.hasClass('absol-active')) {
        ctnElt.addClass('absol-active');
        this.notifyActiveFrame(elt);
      } // else do nothing

    } else {
      if (ctnElt.hasClass('absol-active')) {
        ctnElt.removeClass('absol-active');
        this.notifyInactiveFrame(elt);
      } // else do nonthing

    }
  }

  return this;
};

FrameView.prototype.notifyActiveFrame = function (frameElt, originEvent) {
  frameElt.emit('active', {
    target: frameElt,
    type: 'active',
    originEvent: originEvent
  });
  this.emit('activeframe', {
    type: 'activeframe',
    target: this,
    frameElt: frameElt,
    originEvent: originEvent
  }, this);
};

FrameView.prototype.notifyInactiveFrame = function (frameElt, originEvent) {
  this.emit('inactiveframe', {
    type: 'inactiveframe',
    target: this,
    frameElt: frameElt,
    originEvent: originEvent
  }, this);
};

FrameView.prototype.activeFrameById = function (id) {
  var frameElt = this.findChildById(id);
  if (frameElt) this.activeFrame(frameElt);
  return this;
};

_ACore.default.install(FrameView);

var _default = FrameView;
exports.default = _default;

VaKeR 2022