Thai authorities are investigating the cause of a fatal explosion at a fireworks factory north of Bangkok, which killed at least 20 people.