US President Donald Trump has turned a speech about the economy into an attack on progressive Democrats.