/* * Copyright 2007-2017 Charles du Jeu - Abstrium SAS * This file is part of Pydio. * * Pydio is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Pydio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Pydio. If not, see . * * The latest code can be found at . */ /** * Two columns layout used for Workspaces and Plugins editors */ var PaperEditorLayout = React.createClass({ propTypes:{ title:React.PropTypes.any, titleActionBar:React.PropTypes.any, leftNav:React.PropTypes.any, contentFill:React.PropTypes.bool, className:React.PropTypes.string }, toggleMenu:function(){ var crtLeftOpen = (this.state && this.state.forceLeftOpen); this.setState({forceLeftOpen:!crtLeftOpen}); }, render:function(){ return (

{this.props.title}

{this.props.titleActionBar}
{this.props.leftNav}
{this.props.children}
); } }); /** * Navigation subheader used by PaperEditorLayout */ var PaperEditorNavHeader = React.createClass({ propTypes:{ label:React.PropTypes.string }, render:function(){ return (
{this.props.children} {this.props.label}
); } }); /** * Navigation entry used by PaperEditorLayout. */ var PaperEditorNavEntry = React.createClass({ propTypes:{ keyName:React.PropTypes.string.isRequired, onClick:React.PropTypes.func.isRequired, label:React.PropTypes.string, selectedKey:React.PropTypes.string, isLast:React.PropTypes.bool, // Drop Down Data dropDown:React.PropTypes.bool, dropDownData:React.PropTypes.object, dropDownChange:React.PropTypes.func, dropDownDefaultItems:React.PropTypes.array }, onClick:function(){ this.props.onClick(this.props.keyName); }, captureDropDownClick: function(){ if(this.preventClick){ this.preventClick = false; return; } this.props.onClick(this.props.keyName); }, dropDownChange: function(event, index, item){ this.preventClick = true; this.props.dropDownChange(item); }, render:function(){ if(!this.props.dropDown || !this.props.dropDownData){ return (
{this.props.children} {this.props.label}
); } // dropDown & dropDownData are loaded var menuItemsTpl = [{text:this.props.label, payload:'-1'}]; if(this.props.dropDownDefaultItems){ menuItemsTpl = menuItemsTpl.concat(this.props.dropDownDefaultItems); } this.props.dropDownData.forEach(function(v, k){ menuItemsTpl.push({text:v.label, payload:v}); }); return (
); } }); export {PaperEditorLayout, PaperEditorNavEntry, PaperEditorNavHeader}