constructor(options) {
        super(options.name)
        this.name          = null
        this.box           = null
        this.sidebar       = null
        this.parent        = null
        this.nodes         = [] // Sidebar child nodes
        this.menu          = []
        this.routeData     = {} // data for dynamic routes
        this.selected      = null // current selected node (readonly)
        this.icon          = null
        this.style         = ''
        this.topHTML       = ''
        this.bottomHTML    = ''
        this.multi         = false
        this.editable      = false
        this.reorder       = false
        this.flatButton    = false
        this.keyboard      = true
        this.flat          = false
        this.hasFocus      = false
        this.levelPadding  = 12
        this.toggleAlign   = 'right' // can be left or right
        this.skipRefresh   = false
        this.tabIndex      = null // will only be set if > 0 and not null
        this.handle        = { width: 0, style: '', text: '', tooltip: '' },
        this.badge         = null
        this.onClick       = null // Fire when user click on Node Text
        this.onSelect      = null
        this.onUnselect    = null
        this.onDblClick    = null // Fire when user dbl clicks
        this.onMouseEnter  = null // mouse enter/leave over an item
        this.onMouseLeave  = null
        this.onContextMenu = null
        this.onMenuClick   = null // when context menu item selected
        this.onExpand      = null // Fire when node expands
        this.onCollapse    = null // Fire when node collapses
        this.onKeydown     = null
        this.onRender      = null
        this.onRefresh     = null
        this.onResize      = null
        this.onDestroy     = null
        this.onFocus       = null
        this.onBlur        = null
        this.onFlat        = null
        this.onEdit        = null
        this.onRename      = null
        this.onReorder     = null
        this.onDragStart   = null
        this.onDragOver    = null
        this.node_template = {
            id: null,
            text: '',
            order: null,
            count: null,
            icon: null,
            nodes: [],
            style: '', // additional style for subitems
            route: null,
            selected: false,
            expanded: false,
            hidden: false,
            disabled: false,
            group: false, // if true, it will build as a group
            groupShowHide: true,
            collapsible: false,
            plus: false, // if true, plus will be shown even if there is no sub nodes
            childOffset: 0,
            // events
            onClick: null,
            onDblClick: null,
            onContextMenu: null,
            onExpand: null,
            onCollapse: null,
            // internal
            parent: null, // node object
            sidebar: null
        }
        this.last = {
            badge: {},
            renaming: false,
            move: null,     // object, move details
        }
        let nodes = options.nodes
        delete options.nodes
        // mix in options
        Object.assign(this, options)
        // add item via method to makes sure item_template is applied
        if (Array.isArray(nodes)) this.add(nodes)
        // need to reassign back to keep it in config
        options.nodes = nodes
        // render if box specified
        if (typeof this.box == 'string') this.box = query(this.box).get(0)
        if (this.box) this.render(this.box)
    }
Part of w2ui 2.0 library
 - Dependencies: mQuery, w2utils, w2base, w2tooltip, w2menu

== TODO ==
 - dbl click should be like it is in grid (with timer not HTML dbl click event)
 - node.style is misleading - should be there to apply color for example
 - node.plus - is not working

== 2.0 changes
 - remove jQuery dependency
 - deprecarted obj.img, node.img
 - CSP - fixed inline events
 - observeResize for the box
 - search(..., compare) - comparison function
 - editable = true
 - edit(id) - new method
 - onEdit, onRename - new events
 - reorder = true - to allow reorder
 - mouseDown - for reorder
 - onReorder, onDragStart, onDragOver - events
 - this.mutlti - for multi select (ctrl for one at a time and shift for range)
 - onSelect, onUnselect - new events
 - prev(), next(), getChain()