The previous behavior when using the Shift key to select multiple items in Waterfall layout was a bit unpredictable. Shift selection normally adds all items in collection order between the first and last item you clicked on. With waterfall layout, this doesn't make sense because the items may be rendered out of order (according to the shortest column). Now the LayoutDelegate interface supports overriding the getKeyRange behavior of SelectionManager. WaterfallLayout uses this to implement a spacial algorithm that selects items contained by the rectangle formed between the first and last item you shift clicked on.
When switching layout options like t-shirt size and density, the entire CardView would be unmounted and re-mounted. This was due to Virtualizer in RAC returning a new CollectionRoot component each time the layout changed (due to useMemo). Now Virtualizer passes the layout via a context and always uses the same component. We also avoid changing the layout entirely by using the layoutOptions object to pass info to the existing layout.
On small screens, small areas (e.g. resizable rails), or high zoom levels, the larger card sizes may no longer fit in the available space. We now treat the CardView size prop more like a maximum size. If at last two columns do not fit, we will reduce the t-shirt size until we find a size that does fit. This enables CardView to be more responsive out of the box. I also added render props support to Card so its contents can respond to the currently rendered size, e.g. change the size of an Avatar or hide an ActionMenu.
Question: Is this a good default? Do we need a way to set a minimum t-shirt size that a card could go down to, or a way to disable this behavior entirely? Rename size to maxSize (not sure I like this)?
Three updates for S2 CardView:
The previous behavior when using the
Shift
key to select multiple items in Waterfall layout was a bit unpredictable. Shift selection normally adds all items in collection order between the first and last item you clicked on. With waterfall layout, this doesn't make sense because the items may be rendered out of order (according to the shortest column). Now theLayoutDelegate
interface supports overriding thegetKeyRange
behavior ofSelectionManager
. WaterfallLayout uses this to implement a spacial algorithm that selects items contained by the rectangle formed between the first and last item you shift clicked on.When switching layout options like t-shirt size and density, the entire CardView would be unmounted and re-mounted. This was due to Virtualizer in RAC returning a new
CollectionRoot
component each time the layout changed (due touseMemo
). Now Virtualizer passes the layout via a context and always uses the same component. We also avoid changing the layout entirely by using thelayoutOptions
object to pass info to the existing layout.On small screens, small areas (e.g. resizable rails), or high zoom levels, the larger card sizes may no longer fit in the available space. We now treat the CardView
size
prop more like a maximum size. If at last two columns do not fit, we will reduce the t-shirt size until we find a size that does fit. This enables CardView to be more responsive out of the box. I also added render props support toCard
so its contents can respond to the currently renderedsize
, e.g. change the size of an Avatar or hide an ActionMenu.Question: Is this a good default? Do we need a way to set a minimum t-shirt size that a card could go down to, or a way to disable this behavior entirely? Rename
size
tomaxSize
(not sure I like this)?