Skip to content

Commit aec5bdd

Browse files
authored
Create OrderedList.cmp
1 parent 549b67d commit aec5bdd

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

src/aura/OrderedList/OrderedList.cmp

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<aura:component >
2+
3+
<!--event handlers-->
4+
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
5+
<aura:handler event="c:DataChange_AE" action="{!c.handleDataChangeAppEvent}"/>
6+
7+
<!--event registration-->
8+
<aura:registerEvent name="multiColumnSelectChange" type="c:DataChange_CE" />
9+
<aura:registerEvent name="generalCommunication" type="c:DataChange_AE"/>
10+
11+
<!--public methods-->
12+
<aura:method name="removeItem" action="{!c.deleteFromList}" description="Delete an item based on a unique key">
13+
<aura:attribute name="itemId" type="String" access="public" />
14+
</aura:method>
15+
16+
<aura:method name="moveItems" action="{!c.moveItems}" description="move items from this list to another">
17+
</aura:method>
18+
19+
<!--public attributes-->
20+
<aura:attribute name="fieldName" type="String" access="public" />
21+
<aura:attribute name="values" type="Object[]" description="all available values for this field" access="public" />
22+
<aura:attribute name="showUpDown" type="Boolean" description="Display up/down arrows" access="public" default="false" />
23+
<aura:attribute name="position" type="String" description="left or right" access="public" />
24+
25+
<!--private attributes-->
26+
<aura:attribute name="uuId" type="String" access="private" />
27+
<aura:attribute name="highlightedItem" type="Object" description="an item ready to be transferred to the selectedValues array" access="private" />
28+
<aura:attribute name="highlightedItems" type="Object[]" description="a set of items ready to be transferred to the selectedValues array" access="private" />
29+
<aura:attribute name="items" type="Object[]" description="items in this list" access="private" />
30+
<aura:attribute name="storedTimer" type="Object" description="storing a timer allows it to be cancelled" access="private" />
31+
<aura:attribute name="changeEventScheduled" type="Boolean" description="set when we are scheduled to send an event" access="private" />
32+
33+
<div class="slds">
34+
35+
<div class="slds-picklist--draggable slds-grid">
36+
37+
<div class="slds-form-element">
38+
<span class="slds-form-element__label" >{!v.fieldName}</span>
39+
<div class="slds-picklist" aura:id="items" role="application" ondrop="{!c.handleOnDropParent}"
40+
ondragenter="{!c.handleOnDragEnterDummy}" ondragleave="{!c.handleOnDragLeaveDummy}" ondragover="{!c.handleOnDragOverDummy}">
41+
<ul aria-describedby="option-drag-label" aria-multiselectable="true" class="slds-picklist__options slds-picklist__options--multi"
42+
role="listbox" tabindex="0">
43+
44+
<aura:iteration items="{!v.items}" var="item">
45+
46+
<li class="{! 'slds-picklist__item slds-is-draggable ' + item.style}"
47+
draggable="true" ondragstart="{!c.handleDragStart}"
48+
id="{!item.id}" aria-selected="false" role="option"
49+
tabindex="{!item.sort}" onclick="{!c.handleListClick}">
50+
<span id="{!item.id}" class="slds-truncate">{!item.sort} : {!item.value}</span>
51+
</li>
52+
53+
</aura:iteration>
54+
</ul>
55+
</div>
56+
</div>
57+
58+
<aura:if isTrue="{!v.showUpDown}">
59+
<div class="slds-grid slds-grid--vertical">
60+
61+
<button class="slds-button slds-button--icon-container slds-button--icon-small" title="Up" onclick="{!c.handleReorderItemUp}">
62+
<lightning:icon iconName="utility:up" size="small" class="slds-button__icon slds-button__icon--large" />
63+
<span class="slds-assistive-text">Move Selection Up</span>
64+
</button>
65+
66+
<button class="slds-button slds-button--icon-container slds-button--icon-small" title="Down" onclick="{!c.handleReorderItemDown}">
67+
<lightning:icon iconName="utility:down" size="small" class="slds-button__icon slds-button__icon--large" />
68+
<span class="slds-assistive-text">Move Selection Down</span>
69+
</button>
70+
71+
</div>
72+
</aura:if>
73+
74+
</div>
75+
</div>
76+
77+
</aura:component>

0 commit comments

Comments
 (0)