This repository has been archived by the owner on Jun 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
SelectedLabelsFactory
jiajunGit edited this page Jul 24, 2017
·
2 revisions
The SelectedLabelsFactory is a UI component factory that constructs the container housing the labels that were selected by the user. The user can toggle the selection status of labels within this container by clicking on the labels. If the user deselects a label present within this container, the label will have its name strike out (as shown below for the d.FirstTimers label) instead of being removed from the container.
-
selected-label/select-item/{groupID}
- published when a label is selected -
selected-label/unselect-item/{groupID}
- published when a label is deselected -
selected-label/toggle-select-item-finished
- published when a label's selection is toggled by pressing enter in the search input box
-
group-label/unselect-item
- reacts by deselecting the label that is present within the container. This event is handled by thehandleExternalUnselectLabelEvent()
function. -
group-label/select-item
- reacts by selecting the label or adding it if it is not present within the container. Any conflicts that arise due to selection of labels from exclusive groups are resolved. This event is handled by thehandleExternalSelectLabelEvent()
function. -
search/toggle-select-item
- reacts by toggling the label's selection. Any conflicts that arise due to selection of labels from exclusive groups are resolved. This event is handled by thehandleSearchToggleSelectEvent()
function.
- Labels with
itemID
are added to the container using theaddLabel(itemID)
function. Any conflicts that arise due to selection of labels from exclusive groups are resolved within this function as well. - Labels within the container can be selected using the
handleLabelSelection(label)
function. Any conflicts that arise due to selection of labels from exclusive groups are resolved within this function as well. - Use
unselectLabel(label, isEmitEvent)
function to deselect labels within the container. Setting isEmitEvent to true will cause it to publish an event calledselected-label/unselect-item/{groupID}
for a label group withgroupID
to respond. - Use
isLabelSelected(label)
function to check if the label has been selected or not. - The label's selection status within ItemStorage is also updated by calling the
selectItem(itemID)
orunselectItem(itemID)
function from ItemStorage when labels are selected or deselected within the selected labels container. - Below is the HTML representation of the element that it creates:
<div class="selected-group-container">...</div>