function transform(items, props, parent) {
	if (!items) {
		return undefined;
	}
	const state = props.state || DEFAULT_STATE;
	const selectedId = state.get(SELECTED_ATTR);
	const opened = state.get(OPENED_ATTR);

	return items.map(item => {
		const elem = {
			...item,
			id: item[props.idAttr],
			isOpened: item.isOpened || opened.includes(item[props.idAttr]),
			name: item[props.nameAttr],
			parent,
		};

		elem.children = transform(item[props.childrenAttr], props, elem);

		if (item[props.idAttr] === selectedId) {
			for (let current = elem; current.parent; current = current.parent) {
				current.parent.isOpened = true;
			}
		}

		return elem;
	});
}
/**
 * recursive function to apply change on all data and support attr mapping
 * @param {Array<Object>} items is the list of pure items, your data
 * @param {Object} props the configuration of the Tree container
 * @return {Array} of items ready to be put as the structure of TreeView component
 */
recursive function to apply change on all data and support attr mapping
@param {Array} items is the list of pure items, your data
@param {Object} props the configuration of the Tree container
@return {Array} of items ready to be put as the structure of TreeView component
recursive function to apply change on all data and support attr mapping @param { Array } items is the list of pure items your data @param { Object } props the configuration of the Tree container @return { Array } of items ready to be put as the structure of TreeView component
function transform(items, props, parent) {
	if (!items) {
		return undefined;
	}
	const state = props.state || DEFAULT_STATE;
	const selectedId = state.get(SELECTED_ATTR);
	const opened = state.get(OPENED_ATTR);
	return items.map(item => {
		const elem = {
			...item,
			id: item[props.idAttr],
			isOpened: item.isOpened || opened.includes(item[props.idAttr]),
			name: item[props.nameAttr],
			parent,
		};
		elem.children = transform(item[props.childrenAttr], props, elem);
		if (item[props.idAttr] === selectedId) {
			for (let current = elem; current.parent; current = current.parent) {
				current.parent.isOpened = true;
			}
		}
		return elem;
	});
}
function transform ( items , props , parent ) { if ( ! items ) { return undefined ; } const state = props . state || DEFAULT_STATE ; const selectedId = state . get ( SELECTED_ATTR ) ; const opened = state . get ( OPENED_ATTR ) ; return items . map ( item => { const elem = { ... item , id : item [ props . idAttr ] , isOpened : item . isOpened || opened . includes ( item [ props . idAttr ] ) , name : item [ props . nameAttr ] , parent , } ; elem . children = transform ( item [ props . childrenAttr ] , props , elem ) ; if ( item [ props . idAttr ] === selectedId ) { for ( let current = elem ; current . parent ; current = current . parent ) { current . parent . isOpened = true ; } } return elem ; } ) ; }
recursive function to apply change on all data and support attr mapping
 @param {Array<Object>} items is the list of pure items, your data
 @param {Object} props the configuration of the Tree container
 @return {Array} of items ready to be put as the structure of TreeView component
recursive function to apply change on all data and support attr mapping @param { Array<Object > } items is the list of pure items your data @param { Object } props the configuration of the Tree container @return { Array } of items ready to be put as the structure of TreeView component