This is a little tricky. The way I’d tackle this is first decide what pins you would use with an imaginary UNO connected. Then select pins on the ESP32
The main aim is to know exactly where your solder pads are pointing at on the UNO. The solder pads are under the board and are described here: Soldering pads | Arduino-FOC
There is a separade pad guide page for board 1.3 and 2.0
SOLDER PAD PWM A = ?
SOLDER PAD PWM B = ?
SOLDER PAD PWM C = ?
SOLDER PAD ENABLE = ?
SOLDER PAD ENC A = ?
SOLDER PAD ENC B = ?
SOLDER PAD ENC I = ?
GND = ? // you'll need to connect a ground between board and ESP
Once you have those chosen you are half way there. Then you’ll need to decide what pins to use on your ESP32
ESP PWM A = ?
ESP PWM B = ?
ESP PWM C = ?
ESP ENABLE = ?
ESP ENC A = ?
ESP ENC B = ?
ESP ENC I = ?
GND ?
Not all of the pins on ESP32 are suitable e.g. some are inputs and some are used for flash. In general I use the ones ‘in the middle’ i.e. don’t use below 16 (as some of these are used for flash and boot. and don’t use above 33 as these are inputs. The rest are input/output. I guess you could use inputs for encoders?
Probably worth reading something like this for pin selection: ESP32 Pinout Reference: Which GPIO pins should you use? | Random Nerd Tutorials
Once you’ve done those steps you just wire between as per your two pin tables