function viewAble(lineup) {
const node = lineup.node;
Object.defineProperties(node, {
lineup: {
value: 'lineup'
},
value: {
get: () => lineup.getSelection().map(index => lineup.data.data[index]),
set: value => {
const data = lineup.data.data;
lineup.setSelection(value ? value.map(v => data.indexOf(v)) : []);
}
}
});
lineup.on('selectionChanged', () =>
node.dispatchEvent(new CustomEvent('input'))
);
function check() {
const height = node.querySelector(
LineUpJS.version.startsWith('3')
? '.lineup-multi-engine > main'
: '.le-body'
).clientHeight;
if (height > 100) {
lineup.update();
} else {
setTimeout(check, 100);
}
}
setTimeout(check, 100);
return node;
}