renderItem: function(item, index, array){ var props = this.props var hiddenStyle = props.hiddenStyle var activeIndex = props.activeIndex || 0 //make sure the wrapping article gets the correct style //if it is the active item var style = {} var className = BASE_CLASS_NAME + '-item ' if (index !== activeIndex){ copy(hiddenStyle, style) } else { copy(props.activeStyle, style) className += props.activeClassName || '' } //default style for items if (props.defaultStyle){ item.props.style = copy(props.defaultStyle, item.props.style) } //default className for items if (props.defaultClassName){ item.props.className = item.props.className || '' item.props.className += ' ' + props.defaultClassName } return ( React.createElement("article", {key: index, style: style, className: className}, item ) ) }
render: function(){ var props = this.props var side = this.props.side props.className = props.className || '' props.className += ' ' + BASE_CLASS_NAME + '-scroller ' + side if (props.active && props.visible){ props.className += ' active' } var scrollerStyle = copy(SCROLLER_STYLE) props.style = copy(props.style, scrollerStyle) props.style.width = props.style.width || props.width props.style[side] = 0 if (!props.visible){ props.style.display = 'none' } return props.factory? props.factory(props, side): React.createElement("div", React.__spread({}, props)) }
render: function(){ var props = copy(this.props) var titleStyle = copy(LIST_ITEM_STYLE) copy(props.titleStyle, titleStyle) var titleClassName = [props.titleClassName || '', BASE_CLASS_NAME + '-item-title'] var nodes = React.Children.map(props.children, this.renderTitle(props, titleClassName, titleStyle), this) props.className = props.className || '' props.className += ' ' + BASE_CLASS_NAME + '-strip' props.style = props.style || {} props.style.position = 'relative' var listStyle = copy(LIST_STYLE) if (this.state.scrollPos){ listStyle.left = -this.state.scrollPos } var scrollerLeft = this.renderScroller(-1) var scrollerRight= this.renderScroller(1) return ( React.createElement("nav", React.__spread({}, props), React.createElement("ul", {ref: "list", style: listStyle}, nodes ), scrollerLeft, scrollerRight ) ) },
renderTitle: F.curry(function(parentProps, classNameArray, titleStyle, child, index){ var anchorStyle = parentProps.anchorStyle var activeStyle = parentProps.activeStyle var activeClassName = parentProps.activeClassName var activeIndex = parentProps.activeIndex || 0 var childProps = child.props var title = childProps.tabTitle || childProps.title titleStyle = copy(titleStyle) //ALLOW each item to also specify a titleStyle copy(childProps.titleStyle, titleStyle) //and a titleClassName var titleClassName = classNameArray.concat(childProps.titleClassName || '') if (index == activeIndex){ copy(activeStyle, titleStyle) titleClassName.push(activeClassName || '') } return ( React.createElement("li", { key: index, onClick: this.handleChange.bind(this, index), style: titleStyle, className: titleClassName.join(' ') }, React.createElement("a", {href: "#", style: anchorStyle}, title) ) ) }),
render: function(){ var props = copy(this.props) props.children = props.children || [] var activeIndex = props.activeIndex || 0 props.activeIndex = Math.min(activeIndex, props.children.length - 1) props.className = props.className || '' props.className += ' ' + BASE_CLASS_NAME var StripComponent = this.renderStrip(props) var ContainerComponent = this.renderContainer(props) var Content = props.tabVerticalPosition == 'bottom'? [ContainerComponent, StripComponent]: [StripComponent, ContainerComponent] var divProps = { className: props.className, style : props.style } return ( React.createElement("div", React.__spread({}, divProps), Content ) ) },
renderScroller: function(direction){ if (!this.props.enableScroll){ return } var onDoubleClick = direction == -1? this.handleScrollLeftMax: this.handleScrollRightMax var onMouseDown = direction == -1? this.handleScrollLeft: this.handleScrollRight var side = direction == -1? 'left': 'right' var visible = direction == -1? this.state.hasLeftScroll: this.state.hasRightScroll return ScrollerFactory(copy(this.props.scrollerProps, { factory : this.props.scrollerFactory, active : this.state.scrollDirection==direction && this.state.scrolling, onDoubleClick: onDoubleClick, onMouseDown : onMouseDown, style : this.props.scrollerStyle, side : side, width : this.props.scrollerWidth, visible : visible })) }
} if (index == arr.length - 1){ classes.push('dp-next') } return ( React.createElement("td", {key: yearText, className: classes.join(' '), onClick: this.handleClick.bind(this, date)}, yearText ) ) }, handleClick: function(date, event) { event.target.value = date ;(this.props.onSelect || emptyFn)(date, event) } }) copy({ getHeaderText: function(value) { var year = moment(value).get('year') var offset = year % 10 year = year - offset - 1 return year + ' - ' + (year + 11) } }, DecadeView) module.exports = DecadeView
renderMonth: function(date) { var monthText = FORMAT.month(date) var classes = ["dp-cell dp-month"] var dateTimestamp = +date if (dateTimestamp == this.props.moment){ classes.push('dp-value') } return ( React.createElement("td", {key: monthText, className: classes.join(' '), onClick: this.handleClick.bind(this, date)}, monthText ) ) }, handleClick: function(date) { event.target.value = date ;(this.props.onSelect || emptyFn)(date, event) } }) copy({ getHeaderText: function(moment) { return toMoment(moment).format('YYYY') } }, YearView) module.exports = YearView
renderWeekDayNames: function(){ var names = this.props.weekDayNames return ( React.createElement("tr", {className: "dp-row dp-week-day-names"}, names.map(function(name) {return React.createElement("td", {key: name, className: "dp-cell dp-week-day-name"}, name);}) ) ) }, handleClick: function(date, timestamp, event) { if (this.props.minDate && timestamp < this.props.minDate){ return } if (this.props.maxDate && timestamp > this.props.maxDate){ return } event.target.value = date ;(this.props.onChange || emptyFn)(date, event) } }) copy({ getHeaderText: function(moment) { return toMoment(moment).format('MMMM YYYY') } }, MonthView) module.exports = MonthView