***Made an important edit to make the "partition" part of the question more clear
Let $m,n$ be positive integers. Denote $\left[ m\right] \equiv \{ 1,\ldots ,m\}$.
Let $$\mathbf{w} \equiv \left(w_1, \ldots, w_n \right) $$ be a weight, so that $ w_j \in \left[ m \right] \cup \{ 0 \} $ and $w_1 + \dots + w_n = m$.
Let $\mathbf{A}$ be a matrix of dimensions $m \times n$.
For a given matrix $\mathbf{A}$ and weight $\mathbf{w}$ I want to list all possible lists, where each list consists of exactly one element from each and every row of $\mathbf{A}$, so $m$ elements in total, such that the first $ w_1 $ elements are from the first column of $\mathbf{A}$, the next $ w_2 $ elements are from the second column of $\mathbf{A}$, ... the next $ w_j $ elements are from the $j$-th column of $\mathbf{A}$, ... and the last $ w_n $ elements are from the $n$-th column of $\mathbf{A}$. (Notice that some $w_j$'s may be $ 0 $, also the $w_j$'s are not necessarily pairwise distinct)
What is a nice way to do this?