UNPKG

gd-sprest-js

Version:

SharePoint 2013/Online js components.

41 lines (40 loc) 1.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _1 = require("."); /** * Command Button */ exports.CommandButton = function (props) { // Determine the class name var className = [ "ms-CommandButton", props.className || "", props.isAction ? "ms-CommandButton--actionButton" : "", props.isActive ? "is-active" : "", props.isDisabled ? "is-disabled" : "", props.isInline ? "ms-CommandButton--inline" : "", props.isPivot ? "ms-CommandButton--pivot" : "", props.isTextOnly ? "ms-CommandButton--TextOnly" : "", props.menu ? "is-menu" : "", props.text ? "" : "ms-CommandButton--noLabel" ].join(' ').trim(); // Get the menu props and set the default settings var menuProps = props.menu; if (menuProps) { // Update the menu props menuProps.className = "is-opened ms-ContextualMenu--hasIcons " + (props.menu.className || ""); menuProps.isHidden = false; } // Return the template return [ '<div class="' + className + '">', '<button class="ms-CommandButton-button">', props.icon ? '<span class="ms-CommandButton-icon"><i class="ms-Icon ms-Icon--' + props.icon + '"></i></span>' : '', props.text ? '<span class="ms-CommandButton-label">' + props.text + '</span>' : '', props.menu ? '<span class="ms-CommandButton-dropdownIcon"><i class="ms-Icon ms-Icon--ChevronDown"></i></span>' : '', '</button>', props.isSplit ? '<button class="ms-CommandButton-splitIcon"><i class="ms-Icon ms-Icon--ChevronDown"></i></button>' : '', menuProps ? _1.ContextualMenu(menuProps) : '', '</div>' ].join('\n'); };