-
Notifications
You must be signed in to change notification settings - Fork 735
Picker selection control bar and toggle all items functionality #3557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@M-i-k-e-l let's sync about the |
|
…update related references
@M-i-k-e-l I removed the |
@M-i-k-e-l the |
|
||
export default function PickerSelectionStatusBar(props: PickerSelectionStatusProps) { | ||
const {containerStyle, getLabel, showLabel = true} = props; | ||
const context = useContext(PickerContext); | ||
const {toggleAllItemsSelection, value = [], areAllItemsSelected} = context; | ||
const _value: PickerMultiValue = value as PickerMultiValue; | ||
const {toggleAllItemsSelection, selectedCount = 0, areAllItemsSelected} = context; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there should be a default value here
|
||
const checkboxIndeterminate = _value.length > 0 && !areAllItemsSelected; | ||
const checkboxIndeterminate = !!selectedCount && !areAllItemsSelected; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think selectedCount > 0
is more readable
* Picker selection control bar and toggle all items functionality * Refactor PickerScreen layout * Rename PickerSelectionControlBar to PickerSelectionStatusToolbar and update related references * Enhance selection status label functionality in PickerSelectionStatusToolbar * Refactor PickerSelectionStatusToolbar and types for improved selection handling * Remove 'none' option from select all types in Picker and update related types * Fix types issue in PickerItemsList * Refactor toggleAllItemsSelection and availableItems usage * Remove customLabel prop from PickerSelectionStatusProps * Add renderTopCustomElement and renderBottomCustomElement props to PickerSelectionStatusToolbar * Rename getLabel prop to getSelectionStatusLabe and update related usages * Refactor selectionStatus handling in PickerItemsList * Remove unnecessary null return in renderLabel * Remove renderTopCustomElement prop * Rename _onSegmentChange to onSegmentChange * Fix TypeScript ignore directive for selectAllType in Picker * Update buttonProps onPress parameter to use selectionValue and set default selectAllType to 'button' * Refactor Picker selection logic to use areAllItemsSelected and simplify selection status handling * Rename getSelectionStatusLabel to getLabel and update type definitions for clarity * Remove renderBottomCustomElement prop and add divider in PickerSelectionStatusToolbar * Refactor Picker component to remove PickerSelectAllType enum * Refactor PickerSelectionStatusToolbar to simplify props and selection handling * Rename PickerSelectionStatusToolbar to PickerSelectionStatusBar and update related references * Update buttonProps onPress to use customValue instead of selectionValue in PickerSelectionStatusBar * Add selectAllType prop to PickerSelectionStatusBar for flexible selection handling * Refactor PickerSelectionStatusBar to remove selectAllType prop and simplify selection handling * Fix type assertion for value in PickerSelectionStatusBar to ensure correct handling of PickerMultiValue * Refactor renderSelectionStatus, fix when showLabel is false * Add PickerSelectionStatusProps import to PickerScreen and index files * Remove unused setMultiFinalValue from usePickerSelection hook * Remove value from PickerSelectionStatusLabelData * selectedCount moved to usePickerSelection * PickerSelectionStatusBar simplify selectedCount --------- Co-authored-by: Miki Leib <[email protected]>
Description
Picker new
selectionStatus
feature, let the user use 2 types of "Select All" elements -Button, CheckBox
.All the draft state management are inside the new
PickerSelectionControlBar
component.This is a new feature that meant to replace
renderCustomTopElement
logic (#3465).Snapshot version for testing:
7.39.0-snapshot. 6618
Changelog
Picker new
selectionStatus
feature, support "Select All" element.Additional info
None