Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
renderCustomRowRenderer(props) {
const { ref, ...otherProps } = props;
const CustomRowRenderer = this.props.rowRenderer;
const customRowRendererProps = { ...otherProps, renderBaseRow: (p) => };
if (CustomRowRenderer.type === Row) {
// In the case where Row is specified as the custom render, ensure the correct ref is passed
return ;
}
if (isValidElementType(CustomRowRenderer)) {
return ;
}
if (isElement(CustomRowRenderer)) {
return React.cloneElement(CustomRowRenderer, customRowRendererProps);
}
}
getCell = () => {
const { height, column, renderer } = this.props;
if (isElement(renderer)) {
// if it is a string, it's an HTML element, and column is not a valid property, so only pass height
if (typeof this.props.renderer.type === 'string') {
return React.cloneElement(renderer, { height });
}
return React.cloneElement(renderer, { column, height });
}
return renderer({ column });
};
isHTMLElement(child) {
return isElement(child) && typeof child.type === 'string';
}
function cloneNode(value: React.ReactNode): React.ReactNode {
if (Array.isArray(value)) {
return value.map(n => cloneNode(n));
}
if (isElement(value)) {
const el = value as React.ReactElement;
const { children, ...otherProps } = el.props;
return {
...el,
props: {
...otherProps,
children: cloneNode(children)
}
};
}
return value;
}
function getDataType(data: Object): PropType {
if (data === null) {
return 'null';
} else if (data === undefined) {
return 'undefined';
}
if (isElement(data)) {
return 'react_element';
}
if (typeof HTMLElement !== 'undefined' && data instanceof HTMLElement) {
return 'html_element';
}
const type = typeof data;
switch (type) {
case 'boolean':
return 'boolean';
case 'function':
return 'function';
case 'number':
if (Number.isNaN(data)) {
return 'nan';
render() {
const { children } = this.props;
if (isElement(children)) {
return children;
}
return <span>{children}</span>;
}
}
return childrenArray.filter(Boolean).map((child, index) => {
if (!isElement(child) || this.isHTMLElement(child)) {
return child;
}
return React.cloneElement((child), {
...child.props,
key: this.childKeys[index],
childOfForm: true,
addInputToFormState: this.addInputDataToState,
labelAlign: isLabelRightAligned ? 'right' : 'left'
});
});
}
isValidElement(element) {
return isElement(element);
}
renderIcon = (icon: IconProps, position: IconPosition) => {
if (ReactIs.isElement(icon)) {
return {icon};
}
return null;
};
isValidElement(element) {
return isElement(element);
}