function isNonImmutable(item) { return ( item && typeof item === 'object' && !isReactElement(item) && !isImmutable(item) ); }
,renderKWIC:function(item,idx) { if (React.isValidElement(item)) { return item; } else { var component=item.Component||KWICTab; var title=item.q+" in "+item.db; return E(component,{key:idx,title:title, excerpts:item.excerpts,db:item.db,q:item.q}); } }
React.Children.forEach(children, function (child) { if (child === null) return; if (React.isValidElement(child) && child.type.displayName === 'ListItem') { nestedListItems.push(child); } else { contentChildren.push(child); } });
/** * Make sure an item is not a non immutable object. The only exceptions are valid * react elements and objects specifically set to be ignored. * @param {String} key The item to test's key * @param {Any} item The item to test * @param {Object} component The component * @return {Boolean} True if non-immutable object, else false. */ function checkNonImmutableObject(key, item, component) { if (item && typeof item === 'object' && !isReactElement(item) && !isImmutable(item) ) { console.warn('WARN: component: ' + component.constructor.displayName + ' received non-immutable object: ' + key); } }
{value.map((value, key) => { var onRemove = this.onRemove.bind(null, key); var children = <Element className="rf-RepeatingFieldset__child" value={value} />; return React.isValidElement(Item) ? cloneElement( Item, {key, onRemove, children, index: key, ref: key} ) : <Item key={key} ref={key} index={key} onRemove={onRemove}>{children}</Item>; })}
return React.Children.map(children, (child, i) => { var curProps = (typeof props === 'function') ? props(child, i) : props; return React.isValidElement(child) ? React.cloneElement(child, keepOriginalProps ? merge(child.props, curProps) : curProps) : child; });
_createTextElement: function _createTextElement(styles, data, key) { var isAnElement = React.isValidElement(data); var mergedStyles = isAnElement ? this.mergeStyles(styles, data.props.style) : null; return isAnElement ? React.cloneElement(data, { key: key, style: mergedStyles }) : React.createElement( 'div', { key: key, style: styles }, data ); },
var innerContent = React.Children.map(self.props.children, function(child) { var type = (vIndex == 0 && numChilds >= 2) ? 0 : 1; // 0: Toolbar, 1: Content, 2: Footer if (React.isValidElement(child) && (typeof child.props.panelComponentType !== "undefined")) { switch (String(child.props.panelComponentType)) { case "Toolbar": type = 0; break; case "Content": type = 1; break; case "Footer": type = 2; break; } } if (vIndex == 0) { if (type == 0 && self.props.showToolbar) mods.push('withToolbar'); sheet = self.getSheet("Tab", mods); } switch (type) { case 0: return (React.createElement("div", {key: vIndex++, style: sheet.toolbar.style}, child)); case 1: return (React.createElement("div", {key: vIndex++, style: sheet.content.style}, child)); case 2: return (React.createElement("div", {key: vIndex++, style: sheet.footer.style}, child)); } });
content = reduce([value].concat(cell), function (v, fn) { if (v && React.isValidElement(v.value)) { return v; } if (isPlainObject(v)) { return merge(v, { value: fn(v.value, data, i, property) }); } var val = fn(v, data, i, property); if (val && !isUndefined(val.value)) { return val; } return { value: val }; });
render: function render() { var _props = this.props; var checked = _props.checked; var children = _props.children; var desktop = _props.desktop; var disabled = _props.disabled; var focusState = _props.focusState; var innerDivStyle = _props.innerDivStyle; var insetChildren = _props.insetChildren; var leftIcon = _props.leftIcon; var rightIcon = _props.rightIcon; var secondaryText = _props.secondaryText; var style = _props.style; var value = _props.value; var other = _objectWithoutProperties(_props, ['checked', 'children', 'desktop', 'disabled', 'focusState', 'innerDivStyle', 'insetChildren', 'leftIcon', 'rightIcon', 'secondaryText', 'style', 'value']); var disabledColor = this.context.muiTheme.palette.disabledColor; var textColor = this.context.muiTheme.palette.textColor; var leftIndent = desktop ? 64 : 72; var sidePadding = desktop ? 24 : 16; var styles = { root: { color: disabled ? disabledColor : textColor, lineHeight: desktop ? '32px' : '48px', fontSize: desktop ? 15 : 16, whiteSpace: 'nowrap' }, innerDivStyle: { paddingLeft: leftIcon || insetChildren || checked ? leftIndent : sidePadding, paddingRight: sidePadding, paddingBottom: 0, paddingTop: 0 }, secondaryText: { float: 'right' }, leftIconDesktop: { padding: 0, left: 24, top: 4 }, rightIconDesktop: { padding: 0, right: 24, top: 4, fill: Colors.grey600 } }; var mergedRootStyles = this.mergeStyles(styles.root, style); var mergedInnerDivStyles = this.mergeStyles(styles.innerDivStyle, innerDivStyle); //Left Icon var leftIconElement = leftIcon ? leftIcon : checked ? React.createElement(CheckIcon, null) : null; if (leftIconElement && desktop) { var mergedLeftIconStyles = this.mergeStyles(styles.leftIconDesktop, leftIconElement.props.style); leftIconElement = React.cloneElement(leftIconElement, { style: mergedLeftIconStyles }); } //Right Icon var rightIconElement = undefined; if (rightIcon) { var mergedRightIconStyles = desktop ? this.mergeStyles(styles.rightIconDesktop, rightIcon.props.style) : null; rightIconElement = React.cloneElement(rightIcon, { style: mergedRightIconStyles }); } //Secondary Text var secondaryTextElement = undefined; if (secondaryText) { var secondaryTextIsAnElement = React.isValidElement(secondaryText); var mergedSecondaryTextStyles = secondaryTextIsAnElement ? this.mergeStyles(styles.secondaryText, secondaryText.props.style) : null; secondaryTextElement = secondaryTextIsAnElement ? React.cloneElement(secondaryText, { style: mergedSecondaryTextStyles }) : React.createElement( 'div', { style: styles.secondaryText }, secondaryText ); } return React.createElement( ListItem, _extends({}, other, { disabled: disabled, innerDivStyle: mergedInnerDivStyles, insetChildren: insetChildren, leftIcon: leftIconElement, ref: 'listItem', rightIcon: rightIconElement, style: mergedRootStyles }), children, secondaryTextElement ); },
var invariant = require('./invariant'); var {ScalarNode, CompositeNode, ListNode} = require('./schema'); var Element = React.createClass({ propTypes: { value: PropTypes.Value }, render() { var Component; var {value: {node}} = this.props; Component = node.props.get('component'); if (Component) { return React.isValidElement(Component) ? cloneWithProps(Component, this.props) : React.createElement(Component, this.props); } else { if (node instanceof ListNode) { Component = require('./RepeatingFieldset'); } else if (node instanceof CompositeNode) { Component = require('./Fieldset'); } else if (node instanceof ScalarNode) { Component = require('./Field'); } else { invariant(false, 'invalid schema node: ' + node); } return <Component {...this.props} />; } },
function (child) { if (React.isValidElement(child)) { return resolveStyles(component, child, existingKeyMap); } return child; }
column : this.props.column, rowIdx : this.props.rowIdx, isExpanded : this.props.isExpanded }); return ( <div {...this.props} className={className} style={style}> {cellContent} <div className="drag-handle" draggable="true" onDragStart={this.props.handleDragStart}> </div> </div> ); }, renderCellContent(props) { var formatter = React.isValidElement(this.props.formatter) ? cloneWithProps(this.props.formatter, props) : this.props.formatter(props); return (<div className="react-grid-Cell__value">{formatter} {this.props.cellControls}</div>) }, getDefaultProps() { return { formatter: simpleCellFormatter }; }, getStyle() { var style = { position: 'absolute', width: this.props.column.width,
if (currentChild) { if (validChildrenCount === 0) firstKey = key; newFragments[key] = currentChild; validChildrenCount++; } } if (validChildrenCount === 0) return undefined; if (validChildrenCount === 1) return newFragments[firstKey]; return createFragment(newFragments); }, extend(children, extendedProps, extendedChildren) { return React.isValidElement(children) ? React.Children.map(children, (child) => { const newProps = typeof(extendedProps) === 'function' ? extendedProps(child) : extendedProps; const newChildren = typeof(extendedChildren) === 'function' ? extendedChildren(child) : extendedChildren ? extendedChildren : child.props.children; return React.cloneElement(child, newProps, newChildren); }) : children; }, };
return ( <div className={className} style={this.getStyle()}> {cell} {this.props.column.resizeable ? <ResizeHandle onDrag={this.onDrag} onDragStart={this.onDragStart} onDragEnd={this.onDragEnd} /> : null} </div> ); }, getCell() { if (React.isValidElement(this.props.renderer)) { return React.addons.cloneWithProps(this.props.renderer, {column : this.props.column}); } else { return this.props.renderer({column: this.props.column}); } }, getDefaultProps() { return { renderer: simpleCellRenderer }; }, getInitialState() { return {resizing: false}; },