Passengers are entitled to compensation for a flight cancelled due to airline staff illness, the UK's highest court has ruled.