HEX
Server: Apache
System: Linux p3plzcpnl506847.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: slfopp7cb1df (5698090)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/slfopp7cb1df/public_html/sitepacket.com/src/client/src/UI/menu/item.js
import * as icons from 'Client/UI/icons'

export default class Item {
  element = document.createElement('div')
  options = undefined
  depth = 0
  visible = true
  isGroup = false
  iconElement = document.createElement('div')

  constructor({ options, isGroup, depth, imageMapId }) {
    this.options = options
    this.depth = depth
    this.isGroup = isGroup

    this.element.classList.add('imp-object-list-item')
    if (isGroup) this.element.classList.add('imp-object-list-item-group')
    this.element.dataset.listItemId = this.options.id
    this.element.dataset.imageMapId = imageMapId

    if (depth > 0) {
      this.element.style.marginLeft = 25 + (depth - 1) * 22 + 'px'
      this.element.style.borderLeft = '1px solid #eee'
    }

    if (this.isGroup) {
      this.iconElement.classList.add('imp-object-list-item-folder-icon')
      this.element.appendChild(this.iconElement)
    }

    let p = document.createElement('p')
    p.innerHTML = this.options.title
    this.element.appendChild(p)

    this.openFolder()
    this.redraw()
  }
  show() {
    this.visible = true
    this.redraw()
  }
  hide() {
    this.visible = false
    this.redraw()
  }
  openFolder() {
    this.iconElement.innerHTML = icons.caretDown
  }
  closeFolder() {
    this.iconElement.innerHTML = icons.caretRight
  }
  redraw() {
    if (this.visible) this.element.classList.remove('imp-object-list-item-hidden')
    if (!this.visible) this.element.classList.add('imp-object-list-item-hidden')
  }
}