Class constructor for Snackbar MDL component.
Implements MDL component design pattern defined at:
https://github.com/jasonmayes/mdl-component-design-pattern

@constructor
@param {HTMLElement} element The element that will be upgraded.
172328
function MaterialSnackbar(element) {
    this.element_ = element;
    this.textElement_ = this.element_.querySelector('.' + this.cssClasses_.MESSAGE);
    this.actionElement_ = this.element_.querySelector('.' + this.cssClasses_.ACTION);
    if (!this.textElement_) {
      throw new Error('There must be a message element for a snackbar.');
    }
    if (!this.actionElement_) {
      throw new Error('There must be an action element for a snackbar.');
    }
    this.active = false;
    this.actionHandler_ = undefined;
    this.message_ = undefined;
    this.actionText_ = undefined;
    this.timeoutID_ = undefined;
    this.queuedNotifications_ = [];
    this.setActionHidden_(true);
  }
892939
function (/*HTMLElement*/ el) {
		TL.DomEvent.addListener(el, TL.Draggable.START, TL.DomEvent.stopPropagation);
		TL.DomEvent.addListener(el, 'click', TL.DomEvent.stopPropagation);
		TL.DomEvent.addListener(el, 'dblclick', TL.DomEvent.stopPropagation);
	}
592340
private void createElement(XsdElement element, String apiName) {
        String elementName = element.getName();

        if (!createdElements.containsKey(getCleanName(elementName))){
            createdElements.put(getCleanName(elementName), element);
            xsdAsmInstance.generateClassFromElement(element, apiName);
        }
    }
1215134
function selectorBlockHandler(element) {
    if (element.type === 'Selector') {
        const name = []
        let discard = false
        element.children.forEach(e => {
            switch (e.type) {
                case "ClassSelector":
                    name.push("." + e.name);
                    break;
                    //not support for now
                case "Combinator":
                    name.push(e.name);
                    discard = true
                    return null
                case "TypeSelector":
                    name.push(e.name);
                    break;
                case "IdSelector":
                    //not support for now
                    name.push("#" + e.name);
                    discard = true
                    return null
                case "WhiteSpace":
                    name.push(" ");
                    break
                default: {
                    // console.warn('unknown selector type:', e)
                    discard = true
                    return null
                }
            }
        })
        if (!discard)
            return name.join("")
        else return null
    }
}
1125185
function Connector(htmlElement, canvas)
{
	/**
	 * declaring html element
	 */
	this.htmlElement = htmlElement;
	
	/**
	 * the canvas this connector is in
	 */
	this.canvas = canvas;
	
	/**
	 * the source block
	 */
	this.source = null;
	
	/**
	 * the destination block
	 */
	this.destination = null;	
	
	/**
	 * preferred orientation
	 */
	this.preferredSourceOrientation = AUTO;
	this.preferredDestinationOrientation = AUTO;
	
	/**
	 * css class to be applied to the connector's segments
	 */
	this.connectorClass;
	
	/**
	 * minimum length for a connector segment.
	 */
	this.minSegmentLength = 10;

	/**
	 * size of the connector, i.e.: thickness of the segments.
	 */
	this.size = 1;
	
	/**
	 * connector's color
	 */
	this.color = 'black';
	
	/**
	 * move listeners, they are notify when connector moves
	 */
	this.moveListeners = new Array();
	
	this.firstSegment;
	
	this.segmentsPool;
	
	this.segmentsNumber = 0;
	
	this.strategy;
		
	this.initConnector = function()
	{
		// detect the connector id
		if(this.htmlElement.id)
			this.id = this.htmlElement.id;
		else
			this.id = this.htmlElement.className;
			
		// split the class name to get the ids of the source and destination blocks
		var splitted = htmlElement.className.split(' ');
		if(splitted.length < 3)
		{
			alert('Unable to create connector \'' + id + '\', class is not in the correct format: connector <sourceBlockId>, <destBlockId>');
			return;
		}
		
		this.connectorClass = splitted[0] + ' ' + splitted[1] + ' ' + splitted[2];
		
		this.source = this.canvas.findBlock(splitted[1]);
		if(!this.source)
		{
			alert('cannot find source block with id \'' + splitted[1] + '\'');
			return;
		}
		
		this.destination = this.canvas.findBlock(splitted[2]);
		if(!this.destination)
		{
			// alert('cannot find destination block with id \'' + splitted[2] + '\'');
			return;
		}
		
		// check preferred orientation
		if(hasClass(this.htmlElement, 'vertical'))
		{
			this.preferredSourceOrientation = VERTICAL;
			this.preferredDestinationOrientation = VERTICAL;
		}
		else if(hasClass(this.htmlElement, 'horizontal'))
		{
			this.preferredSourceOrientation = HORIZONTAL;
			this.preferredDestinationOrientation = HORIZONTAL;
		}
		else
		{
			// check preferred orientation on source side
			if(hasClass(this.htmlElement, 'vertical_start'))
				this.preferredSourceOrientation = VERTICAL;
			else if(hasClass(this.htmlElement, 'horizontal_start'))
				this.preferredSourceOrientation = HORIZONTAL;
			else if(hasClass(this.htmlElement, 'left_start'))
				this.preferredSourceOrientation = LEFT;
			else if(hasClass(this.htmlElement, 'right_start'))
				this.preferredSourceOrientation = RIGHT;
			else if(hasClass(this.htmlElement, 'up_start'))
				this.preferredSourceOrientation = UP;
			else if(hasClass(this.htmlElement, 'down_start'))
				this.preferredSourceOrientation = DOWN;
			
			// check preferred orientation on destination side
			if(hasClass(this.htmlElement, 'vertical_end'))
				this.preferredDestinationOrientation = VERTICAL;
			else if(hasClass(this.htmlElement, 'horizontal_end'))
				this.preferredDestinationOrientation = HORIZONTAL;
			else if(hasClass(this.htmlElement, 'left_end'))
				this.preferredDestinationOrientation = LEFT;
			else if(hasClass(this.htmlElement, 'right_end'))
				this.preferredDestinationOrientation = RIGHT;
			else if(hasClass(this.htmlElement, 'up_end'))
				this.preferredDestinationOrientation = UP;
			else if(hasClass(this.htmlElement, 'down_end'))
				this.preferredDestinationOrientation = DOWN;
		}
		
		// get the first strategy as default
		this.strategy = strategies[0](this);
		this.repaint();
		
		this.source.moveListeners.push(this);
		this.destination.moveListeners.push(this);
		
		// call inspectors for this connector
		var i;
		for(i = 0; i < inspectors.length; i++)
		{
			inspectors[i].inspect(this);
		}
		
		// remove old html element
		this.htmlElement.parentNode.removeChild(this.htmlElement);
	}
	
	this.getStartSegment = function() {
		return this.firstSegment;
	}
	
	this.getEndSegment = function() {
		var s = this.firstSegment;
		while (s.nextSegment)
			s = s.nextSegment;
		return s;
	}
	
	this.getMiddleSegment = function() {
		return this.strategy?  this.strategy.getMiddleSegment(): null;
	}
	
	this.createSegment = function() {
		var segment;
		
		// if the pool contains more objects, borrow the segment, create it otherwise
		if(this.segmentsPool) {
			segment = this.segmentsPool;
			this.segmentsPool = this.segmentsPool.detach();
		} else {		
			segment = new Segment(this.id + "_" + (this.segmentsNumber + 1), this.canvas.htmlElement);
			segment.htmlElement.className = this.connectorClass;
			if(!getStyle(segment.htmlElement, 'background-color'))
				segment.htmlElement.style.backgroundColor = this.color;
			segment.thickness = this.size;
		}
		this.segmentsNumber++;
		
		if(this.firstSegment)
			this.firstSegment.append(segment);
		else
			this.firstSegment = segment;
		segment.visible = true;
		return segment;
	}
	
	/**
	 * Repaints the connector
	 */
	this.repaint = function() {
		// check strategies fitness and choose the best fitting one
		var maxFitness = 0;
		var fitness;
		var s;
		
		// check if any strategy is possible with preferredOrientation
		for(var i = 0; i < strategies.length; i++) {
			this.clearSegments();
			
			fitness = 0;
			s = strategies[i](this);
			if(s.isApplicable()) {
				fitness++;
				s.paint();
				// check resulting orientation against the preferred orientations
				if((this.firstSegment.orientation & this.preferredSourceOrientation) != 0)
					fitness++;
				if((this.getEndSegment().orientation & this.preferredDestinationOrientation) != 0)
					fitness++;
			}
			
			if(fitness > maxFitness) {
				this.strategy = s;
				maxFitness = fitness;
			}
		}			
		
		this.clearSegments();

		this.strategy.paint();
		this.firstSegment.draw();

		// this is needed to actually hide unused html elements	
		if(this.segmentsPool)
			this.segmentsPool.draw();
	}
	
	/**
	 * Hide all the segments and return them to pool
	 */
	this.clearSegments = function() {
		if (this.firstSegment) {
			this.firstSegment.cascadeHide();
			this.firstSegment.append(this.segmentsPool);
			this.segmentsPool = this.firstSegment;
			this.firstSegment = null;
		}	
	}
		
	this.onMove = function() {
		this.repaint();
		// notify listeners
		for (var i = 0; i < this.moveListeners.length; i++)
			this.moveListeners[i].onMove();
	}
}
325038
function MdNavItemController($element) {

  /** @private @const {!angular.JQLite} */
  this._$element = $element;

  // Data-bound variables

  /** @const {?Function} */
  this.mdNavClick;

  /** @const {?string} */
  this.mdNavHref;

  /** @const {?string} */
  this.mdNavSref;
  /** @const {?Object} */
  this.srefOpts;
  /** @const {?string} */
  this.name;

  /** @type {string} */
  this.navItemAriaLabel;

  // State variables
  /** @private {boolean} */
  this._selected = false;

  /** @private {boolean} */
  this._focused = false;
}
1198717
function(el) {

      var menu, span;

      // set element
      el.setAttribute('hashedit-element', '');

      // create element menu
      menu = document.createElement('span');
      menu.setAttribute('class', 'hashedit-element-menu');
      menu.setAttribute('contentEditable', 'false');
      menu.innerHTML = '<label><i class="material-icons">more_vert</i> ' + hashedit.i18n('Content Menu') + '</label>';

      // create a handle
      span = document.createElement('span');
      span.setAttribute('class', 'hashedit-move');
      span.innerHTML = '<i class="material-icons">apps</i> ' + hashedit.i18n('Move');

      // append the handle to the wrapper
      menu.appendChild(span);

      span = document.createElement('span');
      span.setAttribute('class', 'hashedit-properties');
      span.innerHTML = '<i class="material-icons">settings</i> ' + hashedit.i18n('Settings');

      // append the handle to the wrapper
      menu.appendChild(span);

      span = document.createElement('span');
      span.setAttribute('class', 'hashedit-remove');
      span.innerHTML = '<i class="material-icons">cancel</i> ' + hashedit.i18n('Remove');

      // append the handle to the wrapper
      menu.appendChild(span);

      // append the handle to the wrapper
      el.appendChild(menu);

    }
1281344
function _Overlay_baseOverlayConstructor(element, options) {

                    this._disposed = false;

                    // Make sure there's an input element
                    if (!element) {
                        element = _Global.document.createElement("div");
                    }

                    // Check to make sure we weren't duplicated
                    var overlay = element.winControl;
                    if (overlay) {
                        throw new _ErrorFromName("WinJS.UI._Overlay.DuplicateConstruction", strings.duplicateConstruction);
                    }

                    if (!this._element) {
                        this._element = element;
                    }

                    if (!this._element.hasAttribute("tabIndex")) {
                        this._element.tabIndex = -1;
                    }

                    this._sticky = false;
                    this._doNext = "";

                    this._element.style.visibility = "hidden";
                    this._element.style.opacity = 0;

                    // Remember ourselves
                    element.winControl = this;

                    // Attach our css class
                    _ElementUtilities.addClass(this._element, _Constants.overlayClass);
                    _ElementUtilities.addClass(this._element, "win-disposable");

                    // We don't want to be selectable, set UNSELECTABLE
                    var unselectable = this._element.getAttribute("unselectable");
                    if (unselectable === null || unselectable === undefined) {
                        this._element.setAttribute("unselectable", "on");
                    }

                    // Base animation is popIn/popOut
                    this._currentAnimateIn = this._baseAnimateIn;
                    this._currentAnimateOut = this._baseAnimateOut;
                    this._animationPromise = Promise.as();

                    // Command Animations to Queue
                    this._queuedToShow = [];
                    this._queuedToHide = [];
                    this._queuedCommandAnimation = false;

                    if (options) {
                        _Control.setOptions(this, options);
                    }

                    // Make sure _Overlay event handlers are hooked up (this aids light dismiss)
                    _Overlay._globalEventListeners.initialize();
                }
599181
function element(node, options = {}) {
  const { namespace } = options;
  const { tagName, properties, children = [] } = node;
  const el = typeof namespace !== 'undefined'
    ? document.createElementNS(namespace, tagName)
    : document.createElement(tagName);

  // Add HTML attributes
  const props = Object.keys(properties);
  const { length } = props;
  for (let i = 0; i < length; i += 1) {
    const key = props[i];
    const {
      attribute,
      property,
      mustUseAttribute,
      mustUseProperty,
      boolean,
      booleanish,
      overloadedBoolean,
      // number,
      // defined,
      commaSeparated,
      spaceSeparated,
      // commaOrSpaceSeparated,
    } = info.find(info.html, key) || {
      attribute: key,
      property: key,
    };

    let value = properties[key];
    if (Array.isArray(value)) {
      if (commaSeparated) {
        value = value.join(', ');
      } else if (spaceSeparated) {
        value = value.join(' ');
      } else {
        value = value.join(' ');
      }
    }

    try {
      if (mustUseProperty) {
        el[property] = value;
      }
      if (boolean || (overloadedBoolean && typeof value === 'boolean')) {
        if (value) {
          el.setAttribute(attribute, '');
        } else {
          el.removeAttribute(attribute);
        }
      } else if (booleanish) {
        el.setAttribute(attribute, value);
      } else if (value === true) {
        el.setAttribute(attribute, '');
      } else if (value || value === 0 || value === '') {
        el.setAttribute(attribute, value);
      }
    } catch (e) {
      if (!mustUseAttribute && property) {
        el[property] = value;
      }
      // Otherwise silently ignore
    }
  }

  // Transform children
  const { length: childrenLength } = children;
  for (let i = 0; i < childrenLength; i += 1) {
    const childEl = transform(children[i], options);
    if (childEl) {
      el.appendChild(childEl);
    }
  }

  return el;
}
706264
function(element, options) {
    _.extend(this, Backbone.Events);

    var defaults = require('../utils/default-options')();
    // set to be an object in case
    // it's undefined
    options = options || {};

    // extend the defaults
    options = _.extend(defaults, options);

    this.options = options;

    this._currentColumns = [];

    this.container = element;

    this.innerContainer = document.createElement('div');
    this.innerContainer.classList.add('inner-container');
    this.innerContainer.classList.add('hide-overflow');

    this.el = document.createElement('table');
    this.el.classList.add('table');
    this.el.classList.add('table-striped');
    this.container.classList.add('table-sink-container');
    this.innerContainer.appendChild(this.el);
    this.container.appendChild(this.innerContainer);

    this.innerContainer.style.maxHeight = options.height + 'px';

    this.resize();

    // create some scaffolding
    this.table = d3.select(this.el);
    this.thead = this.table.append('thead');
    this.tbody = this.table.append('tbody');

    // set if we should append to the existing table data
    // and not reset on batch_end
    this._append = options._append;

    this._markdownFields = this.options.markdownFields || [];

    this._bindScrollBlocker();

    // We don't need a fully-fledged data target here,
    // so we just add functions as per feedback from @demmer
    var self = this;
    this.dataTarget = {
        _data: [],
        push: function(data) {
            // clear the table if we've done batch_end / stream_end before
            if (this._data.length === 0) {
                self.clearTable();
            }

            // limit the data to avoid crashing the browser. If limit
            // is zero, then it is ignored. If the limit has been reached,
            // we return early and don't display the new data

            // check that we aren't already over the limit
            if (this._data.length >= self.options.limit) {

                // display the message and don't do anything else
                self._sendRowLimitReachedMessage();
                return;

            // check that the new data won't make us go over the limit
            } else if ((this._data.length + data.length) > self.options.limit) {

                self._sendRowLimitReachedMessage();

                // just add from new data until we get to the limit
                var i = 0;
                while (this._data.length < self.options.limit) {
                    this._data.push(data[i++]);
                }
            }
            // we're fine.
            else {
                self._clearRowLimitReachedMessage();
                this._data = this._data.concat(data);
            }

            // if you got here, draw the table
            self.onData(this._data);

        },
        batch_end: function() {
            if (self.options.update === 'replace') {
                this._data = [];
            }
        },
        stream_end: function() {
        }
    };

}
194553
private CmsContainerPageElementPanel createElement(
        Element element,
        I_CmsDropContainer dragParent,
        CmsContainerElement elementData) {

        CmsContainerPageElementPanel dragElement = new CmsContainerPageElementPanel(
            element,
            dragParent,
            elementData.getClientId(),
            elementData.getSitePath(),
            elementData.getNoEditReason(),
            elementData.getTitle(),
            elementData.getSubTitle(),
            elementData.getResourceType(),
            elementData.hasSettings(dragParent.getContainerId()),
            elementData.hasViewPermission(),
            elementData.hasWritePermission(),
            elementData.isReleasedAndNotExpired(),
            elementData.isNewEditorDisabled(),
            elementData.hasEditHandler(),
            elementData.getModelGroupId(),
            elementData.isWasModelGroup(),
            elementData.getElementView(),
            elementData.getBigIconClasses());
        dragElement.setCreateNew(elementData.isCreateNew());
        if (m_controller.requiresOptionBar(dragElement, dragParent)) {
            addOptionBar(dragElement);
        }
        if (m_controller.isInlineEditable(dragElement, dragParent)) {
            dragElement.initInlineEditor(m_controller);
        }
        return dragElement;
    }
37531
function createBaseElementProto () {
  if (baseElementProto) {
    return baseElementProto
  }

  // Base element inherits from HTMLElement
  let proto = Object.create(HTMLElement.prototype)

  /**
   * Created callback of MIPElement. It will initialize the element.
   */
  proto.createdCallback = function () {
    // get mip1 clazz from custom elements store
    let CustomElement = customElementsStore.get(this.tagName, 'mip1')

    this.classList.add('mip-element')

    /**
     * Viewport state
     * @private
     * @type {boolean}
     */
    this._inViewport = false

    /**
     * Whether the element is into the viewport.
     * @private
     * @type {boolean}
     */
    this._firstInViewport = false

    /**
     * The resources object.
     * @private
     * @type {Object}
     */
    this._resources = resources

    /**
     * Instantiated the custom element.
     * @type {Object}
     * @public
     */
    let customElement = this.customElement = new CustomElement(this)
    customElement.createdCallback()

    // Add first-screen element to performance.
    if (customElement.hasResources()) {
      performance.addFsElement(this)
    }
  }

  /**
   * When the element is inserted into the DOM, initialize the layout and add the element to the '_resources'.
   */
  proto.attachedCallback = function () {
    // Apply layout for this.
    this._layout = applyLayout(this)
    this.customElement.attachedCallback()
    this._resources.add(this)
  }

  /**
   * When the element is removed from the DOM, remove it from '_resources'.
   */
  proto.detachedCallback = function () {
    this.customElement.detachedCallback()
    this._resources.remove(this)
    performance.fsElementLoaded(this)
  }

  proto.attributeChangedCallback = function (attributeName, oldValue, newValue, namespace) {
    let ele = this.customElement
    prerender.execute(() => {
      ele.attributeChangedCallback(...arguments)
    }, this)
  }

  /**
   * Check whether the element is in the viewport.
   *
   * @return {boolean}
   */
  proto.inViewport = function () {
    return this._inViewport
  }

  /**
   * Called when the element enter or exit the viewport.
   *
   * @param {boolean} inViewport whether in viewport or not
   * And it will call the firstInviewCallback and viewportCallback of the custom element.
   */
  proto.viewportCallback = function (inViewport) {
    this._inViewport = inViewport
    if (!this._firstInViewport) {
      this._firstInViewport = true
      this.customElement.firstInviewCallback()
    }
    this.customElement.viewportCallback(inViewport)
  }

  /**
   * Check whether the building callback has been executed.
   *
   * @return {boolean}
   */
  proto.isBuilt = function () {
    return this._built
  }

  /**
   * Check whether the element need to be rendered in advance.
   *
   * @return {boolean}
   */
  proto.prerenderAllowed = function () {
    return this.customElement.prerenderAllowed()
  }

  /**
   * Build the element and the custom element.
   * This will be executed only once.
   */
  proto.build = function () {
    if (this.isBuilt()) {
      return
    }

    // Add `try ... catch` avoid the executing build list being interrupted by errors.
    try {
      this.customElement.build()
      this._built = true
      customEmit(this, 'build')
    } catch (e) {
      customEmit(this, 'build-error', e)
      console.error(e)
    }
  }

  /**
   * Method of executing event actions of the custom Element
   *
   * @param {Object} action event action
   */
  proto.executeEventAction = function (action) {
    this.customElement.executeEventAction(action)
  }

  /**
   * Called by customElement. And tell the performance that element is loaded.
   * @deprecated
   */
  proto.resourcesComplete = function () {
    performance.fsElementLoaded(this)
  }

  baseElementProto = proto

  return baseElementProto
}
973855
function configureAria(element, options) {

      var role = (options.$type === 'alert') ? 'alertdialog' : 'dialog';
      var dialogContent = element.find('md-dialog-content');
      var existingDialogId = element.attr('id');
      var dialogContentId = 'dialogContent_' + (existingDialogId || $mdUtil.nextUid());

      element.attr({
        'role': role,
        'tabIndex': '-1'
      });

      if (dialogContent.length === 0) {
        dialogContent = element;
        // If the dialog element already had an ID, don't clobber it.
        if (existingDialogId) {
          dialogContentId = existingDialogId;
        }
      }

      dialogContent.attr('id', dialogContentId);
      element.attr('aria-describedby', dialogContentId);

      if (options.ariaLabel) {
        $mdAria.expect(element, 'aria-label', options.ariaLabel);
      }
      else {
        $mdAria.expectAsync(element, 'aria-label', function() {
          // If dialog title is specified, set aria-label with it
          // See https://github.com/angular/material/issues/10582
          if (options.title) {
            return options.title;
          } else {
            var words = dialogContent.text().split(/\s+/);
            if (words.length > 3) words = words.slice(0, 3).concat('...');
            return words.join(' ');
          }
        });
      }

      // Set up elements before and after the dialog content to capture focus and
      // redirect back into the dialog.
      topFocusTrap = document.createElement('div');
      topFocusTrap.classList.add('md-dialog-focus-trap');
      topFocusTrap.tabIndex = 0;

      bottomFocusTrap = topFocusTrap.cloneNode(false);

      // When focus is about to move out of the dialog, we want to intercept it and redirect it
      // back to the dialog element.
      var focusHandler = function() {
        element.focus();
      };
      topFocusTrap.addEventListener('focus', focusHandler);
      bottomFocusTrap.addEventListener('focus', focusHandler);

      // The top focus trap inserted immeidately before the md-dialog element (as a sibling).
      // The bottom focus trap is inserted at the very end of the md-dialog element (as a child).
      element[0].parentNode.insertBefore(topFocusTrap, element[0]);
      element.after(bottomFocusTrap);
    }
1203430
function(element, options) {
        var that = this;
        that.name = NAME;
        that.$ = $(element);

        options = that.options = $.extend({}, DEFAULTS, this.$.data(), options);
        var lang   = options.lang || 'zh_cn';
        that.lang  = $.isPlainObject(lang) ? ($.extend(true, {}, LANG[lang.lang || $.zui.clientLang()], lang)) : LANG[lang];

        // Initialize here
        var $navbar = that.$.find('.tabs-navbar');
        if (!$navbar.length) {
            $navbar = $(options.navTemplate).appendTo(that.$);
        }
        that.$navbar = $navbar;

        var $nav = $navbar.find('.tabs-nav');
        if (!$nav.length) {
            $nav = $('<ul class="tabs-nav nav nav-tabs"></ul>').appendTo($navbar);
        }
        that.$nav = $nav;

        var $tabs = that.$.find('.tabs-container');
        if (!$tabs.length) {
            $tabs = $(options.containerTemplate).appendTo(that.$);
        }
        that.$tabs = $tabs;

        that.activeTabId = options.defaultTab;
        var tabs = options.tabs || [];
        that.tabs = {};
        $.each(tabs, function(index, item) {
            var tab = Tab.create(item);
            that.tabs[tab.id] = tab;

            if (!that.activeTabId) {
                that.activeTabId = tab.id;
            }

            that.renderTab(tab);
        });
        that.closedTabs = [];

        that.open(that.getActiveTab());

        $nav.on('click.' + NAME, '.tab-nav-link', function () {
            that.open(that.getTab($(this).data('id')));
        }).on('click.' + NAME, '.tab-nav-close', function (e) {
            that.close($(this).closest('.tab-nav-link').data('id'));
            e.stopPropagation();
        }).on('resize.' + NAME, function () {
            that.adjustNavs();
        });

        if (options.contextMenu) {
            $nav.contextmenu({
                selector: '.tab-nav-link',
                itemsCreator: function (e) {
                    return that.createMenuItems(that.getTab($(this).data('id')));
                },
                onShow: function () {
                    that.$.addClass('tabs-show-contextmenu');
                },
                onHide: function () {
                    that.$.removeClass('tabs-show-contextmenu');
                }
            });
        }
    }
784120
function(element, options) {
        var that       = this;
        var $element   = that.$ = $(element);
        that.name      = NAME;
        that.uuid      = $.zui.uuid();
        that.id        = 'zui-datagrid-' + that.uuid;
        options        = $.extend({}, DataGrid.DEFAULTS, that.$.data(), options);

        var lang   = options.lang || 'zh_cn';
        that.lang  = $.isPlainObject(lang) ? ($.extend(true, {}, LANG[lang.lang || $.zui.clientLang()], lang)) : LANG[lang];

        options.valueOperator    = $.extend({}, DEFAULT_VALUE_OPERATOR, options.valueOperator);
        options.rowDefaultHeight = options.rowDefaultHeight || 30;
        options.headerHeight     = options.headerHeight || options.rowDefaultHeight || 30;
        that.options             = options;
        if (typeof options.borderWidth !== 'number') {
            options.borderWidth = 1;
        }

        // Initialize
        if ($element.is('table')) {
            options.dataSource = $.extend(loadDataSourceFromTable(that.$), options.dataSource);
            $element.hide();
            $element = $('<div class="datagrid" id="datagrid-' + that.uuid + '" />').insertAfter(that.$);
        }

        var $container = $element.find('.datagrid-container:first');
        if (!$container.length) {
            $container = $('<div class="datagrid-container" />').appendTo($element);
        }
        $container.css({
            width:       options.width,
            borderWidth: options.borderWidth
        });
        var $document = $(document);
        var createScrollbar = function(direction) {
            var $scrollbar = $container.find('.datagrid-scrollbar-' + direction);
            if (!$scrollbar.length) {
                $scrollbar = $('<div class="datagrid-scrollbar datagrid-scrollbar-' + direction + '"><div class="bar"></div></div>').appendTo($container);
            }
            var isMouseDown = false;
            var lastPos = null;
            var eventSuffix = '.scrollbar' + direction + '.' + NAME + '.' + that.uuid;
            var startPagePos, startPageOffset, isClickBar, startScrollOffset;
            var handleMousePosition = function(e) {
                if (!isMouseDown) return;
                var pos = e[direction === 'h' ? 'pageX' : 'pageY'];
                if (lastPos === pos) {
                    return;
                }
                lastPos = pos;
                pos = (pos - startPagePos) + startPageOffset;
                var scroll = that.layout[direction + 'Scroll'];
                var offset;
                if (isClickBar) {
                    offset = (lastPos - startPagePos) + startScrollOffset;
                } else {
                    offset = Math.max(0, Math.min(scroll.space, pos - Math.round(scroll.barSize/2)));
                }
                if (direction === 'h') {
                    that.setScrollbarOffset(offset);
                } else {
                    that.setScrollbarOffset(null, offset);
                }
            };
            $scrollbar.on('mousedown', function(e) {
                e.preventDefault();
                isMouseDown = true;
                var scroll = that.layout[direction + 'Scroll'];
                var degree = direction === 'h' ? 'X' : 'Y';
                startPageOffset = e['offset' + degree];
                startPagePos = e['page' + degree];
                isClickBar = $(e.target).is('.bar');
                startScrollOffset = scroll.offset;
                if (isClickBar) {
                    startPageOffset += startScrollOffset;
                }
                handleMousePosition(e);
                $scrollbar.addClass('scrolling');
                $document.on('mouseup' + eventSuffix, function(e) {
                    isMouseDown = false;
                    handleMousePosition(e);
                    $document.off(eventSuffix);
                    $scrollbar.removeClass('scrolling');
                }).on('mousemove' + eventSuffix, handleMousePosition);
            });
            that['$' + direction + 'Scroll'] = $scrollbar;
            that['$' + direction + 'Scrollbar'] = $scrollbar.find('.bar');
        };
        createScrollbar('h');
        createScrollbar('v');
        var mouseWheelFactor = options.mouseWheelFactor;
        var isWindows = window.navigator.userAgent.match(/Win/i);
        if (isWindows) mouseWheelFactor *= 20;
        $container.on('mousewheel', function(event) {
            that.scroll(that.layout.scrollLeft - Math.round(event.deltaX * mouseWheelFactor), that.layout.scrollTop - Math.round(event.deltaY * mouseWheelFactor));
            event.preventDefault();
        });

        that.$container = $container;

        var $cells = $element.find('.datagrid-cells:first');
        if (!$cells.length) {
            $cells = $('<div class="datagrid-cells" />').appendTo($container);
        }
        $cells.toggleClass('datagrid-hover-cell', !!options.hoverCell)
              .toggleClass('datagrid-hover-row', !!options.hoverRow)
              .toggleClass('datagrid-hover-col', !!options.hoverCol)
              .toggleClass('datagrid-hover-shadow', !!options.hoverCol);
        that.$cells = $cells;

        // configs is an object
        that.isFuncConfigs = $.isFunction(options.configs);
        that.configs = that.isFuncConfigs ? options.configs : $.extend({}, DEFAULT_CONFIGS, options.configs);

        that.layout       = {scrollLeft: 0, scrollTop: 0};
        that.configsCache = {};
        that.userConfigs  = {};

        // states is 2D arrays
        that.states    = $.extend(true, {}, DEFAULT_STATES, options.states);
        that.cells     = [];
        that.setPager(that.states.pager);

        that.setDataSource(options.dataSource);

        if (options.responsive) {
            var lastContainerWidth = $container.width();
            $container.on('resize', function() {
                that.layout.cols = null;
                that.render();
            });
        }

        if (options.hoverCol) {
            $cells.on('mouseenter', '.datagrid-cell-head', function() {
                var $headCol = $(this);
                var colIndex = $headCol.data('col');
                that.$cells.find('.datagrid-cell.hover').removeClass('hover');
                that.$cells.find('.datagrid-cell[data-col="' + colIndex + '"]').addClass('hover');
            }).on('mouseleave', '.datagrid-cell-head.hover', function() {
                that.$cells.find('.datagrid-cell.hover').removeClass('hover');
            });
        }

        if (options.sortable) {
            $cells.on('click', '.datagrid-col-sortable', function() {
                var colIndex = $(this).data('col');
                var col = that.getColConfig(colIndex);
                var sortBy = that.states.sortBy;
                var order = that.states.order;
                if (sortBy !== col.name) {
                    sortBy = col.name;
                    order = 'desc';
                } else if (order === 'desc') {
                    order = 'asc';
                } else if (order === 'asc') {
                    sortBy = '';
                }
                that.sortBy(sortBy, order);
            });
        }

        if (options.checkable) {
            if (options.selectable && $.fn.selectable) {
                that.selectable = $cells.selectable($.extend({
                    selector: '.datagrid-row-cell',
                    // selectClass: false,
                    trigger: options.checkByClickRow ? null : '.datagrid-row-cell .datagrid-has-checkbox',
                    clickBehavior: 'multi',
                    select: function(data) {
                        that.checkRow(data.id, true);
                    },
                    unselect: function(data) {
                        that.checkRow(data.id, false);
                    }
                }, $.isPlainObject(options.selectable) ? options.selectable : null)).data('zui.selectable');
                $cells.on('click', '.datagrid-cell-head.datagrid-has-checkbox', function() {
                    that.checkRow($(this).data('row'));
                    that.selectable.syncSelectionsFromClass();
                });
            } else {
                $cells.on('click', options.checkByClickRow ? '.datagrid-row' : '.datagrid-has-checkbox', function(e) {
                    var rowIndex = $(this).data('row');
                    if (rowIndex || $(e.target).closest('.datagrid-has-checkbox').length) {
                        that.checkRow(rowIndex);
                    }
                });
            }
        }

        // Init pager
        if ($.fn.pager) {
            var $pager = that.$.find('.pager');
            if ($pager.length) {
                that.pagerObj = $pager.pager($.extend({}, that.pager, {
                    onPageChange: function(pageInfo) {
                        that.setPager(pageInfo).render();
                    }
                })).data('zui.pager');
            }
        }

        // Init searchbox
        if ($.fn.searchBox) {
            var $searchBox = that.$.find('.search-box');
            if($searchBox)  {
                that.searchbox = $searchBox.searchBox({
                    onSearchChange: function (searchString) {
                        that.search(searchString);
                    }
                });
            }
        }

        that.render();
    }
1022211
function( element,options ) {
    options = options || {};
    this.tab = typeof element === 'object' ? element : document.querySelector(element);
    this.tabs = this.tab.parentNode.parentNode;
    this.dropdown = this.tabs.querySelector('.dropdown');
    if ( /\bdropdown-menu/.test(this.tabs.className) ) {
      this.dropdown = this.tabs.parentNode;
      this.tabs = this.tabs.parentNode.parentNode;
    }
    this.options = options;

    // default tab transition duration
    this.duration = 150;
    this.options.duration = (isIE && isIE < 10)  ? 0 : (options.duration || this.duration);

    var self = this;

    this.handle = function(e) {
      e = e || window.e; e.preventDefault();
      var next = e.target; //the tab we clicked is now the next tab
      var nextContent = document.getElementById('c-'+next.getAttribute('href').replace('#','')); //this is the actual object, the next tab content to activate

      // get current active tab and content
      var activeTab = self.getActiveTab();
      var activeContent = self.getActiveContent();

      if ( !/\bactive/.test(next.parentNode.className) ) {
        // toggle "active" class name
        removeClass(activeTab,'active');
        addClass(next.parentNode,'active');

        // handle dropdown menu "active" class name
        if ( self.dropdown ) {
          if ( !(/\bdropdown-menu/.test(self.tab.parentNode.parentNode.className)) ) {
            if (/\bactive/.test(self.dropdown.className)) removeClass(self.dropdown,'active');
          } else {
            if (!/\bactive/.test(self.dropdown.className)) addClass(self.dropdown,'active');
          }
        }

        //1. hide current active content first
        removeClass(activeContent,'in');

        setTimeout(function() {
          //2. toggle current active content from view
          removeClass(activeContent,'active');
          addClass(nextContent,'active');
        }, self.options.duration);
        setTimeout(function() {
          //3. show next active content
          addClass(nextContent,'in');
        }, self.options.duration*2);
      }
    };
    this.getActiveTab = function() {
      var activeTabs = this.tabs.querySelectorAll('.active');
      if ( activeTabs.length === 1 && !/\bdropdown/.test(activeTabs[0].className) ) {
        return activeTabs[0]
      } else if ( activeTabs.length > 1 ) {
        return activeTabs[activeTabs.length-1]
      }
    };
    this.getActiveContent = function() {
      var active = this.getActiveTab().getElementsByTagName('A')[0].getAttribute('href').replace('#','');
      return active && document.getElementById('c-'+active)
    };

    // init
    this.tab.addEventListener('click', this.handle, false);
  }
897596
function Tabs(element) {
      classCallCheck(this, Tabs);

      /** @type {Element} */
      var _this = possibleConstructorReturn(this, _TinyEmitter.call(this));

      _this.element = element;

      /** @private {number} */
      _this._selectedIndex = -1;

      /**
       * List items, children of the tabs list.
       * @type {Array.<Element>}
       */
      _this.tabs = Array.from(_this.element.children);

      /**
       * Anchor elements inside the tab.
       * @type {Array.<HTMLAnchorElement>}
       */
      _this.anchors = _this.tabs.map(function (tab) {
        return tab.querySelector('a');
      });

      /**
       * Tab pane elements.
       * @type {Array.<HTMLElement>}
       */
      _this.panes = _this.anchors.map(function (anchor) {
        return document.getElementById(anchor.getAttribute('href').substring(1));
      });

      /**
       * Wrapper for the panes.
       * @type {HTMLElement}
       */
      _this.panesContainer = _this.panes[0].parentElement;

      /**
       * Get an array of [possible] hashes.
       * @type {Array.<?string>}
       */
      _this.hashes = _this.anchors.map(function (anchor) {
        return anchor.getAttribute('data-hash');
      });

      _this.init();
      return _this;
    }