adding strike_select with new naming conventions
This commit is contained in:
Родитель
affdb5d46b
Коммит
a6ccb9780a
|
@ -1,6 +0,0 @@
|
|||
<aura:documentation>
|
||||
<aura:description>Documentation</aura:description>
|
||||
<aura:example name="ExampleName" ref="exampleComponentName" label="Label">
|
||||
Example Description
|
||||
</aura:example>
|
||||
</aura:documentation>
|
|
@ -1,2 +0,0 @@
|
|||
.THIS {
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
<aura:documentation>
|
||||
<aura:description>Documentation</aura:description>
|
||||
<aura:example name="ExampleName" ref="exampleComponentName" label="Label">
|
||||
Example Description
|
||||
</aura:example>
|
||||
</aura:documentation>
|
|
@ -1,10 +0,0 @@
|
|||
<aura:component >
|
||||
<aura:attribute name="name" type="String" default="StrikeOptionGroup"/>
|
||||
<aura:attribute name="label" type="String"/>
|
||||
<aura:method name="hideGroup" action="{!c.hideGroup}"/>
|
||||
<aura:method name="showGroup" action="{!c.showGroup}"/>
|
||||
<li aura:id="optionGroupLabel" class="slds-dropdown__header" role="separator">
|
||||
<span class="slds-text-title--caps">{!v.label}</span>
|
||||
</li>
|
||||
{!v.body}
|
||||
</aura:component>
|
|
@ -1,33 +0,0 @@
|
|||
public with sharing class StrikeLookupController {
|
||||
|
||||
@AuraEnabled
|
||||
public static String getRecords(String searchTerm, String sObjectToSearch, String searchField, String whereClause, String returnedRecordLimit, String orderBy, Boolean recentEnabled) {
|
||||
|
||||
String query = 'SELECT Id,' + String.escapeSingleQuotes(searchField) + ' FROM ' + String.escapeSingleQuotes(sObjectToSearch) + ' WHERE ';
|
||||
System.debug(query);
|
||||
|
||||
if(recentEnabled == true && (searchTerm == null || searchTerm == '')) {
|
||||
query = query + 'LastViewedDate != NULL ORDER BY LastViewedDate DESC LIMIT 5';
|
||||
} else if (searchTerm != null || searchTerm != '') {
|
||||
|
||||
query = query + String.escapeSingleQuotes(searchField) + ' LIKE \'%' + String.escapeSingleQuotes(searchTerm) + '%\'';
|
||||
|
||||
if(whereClause != null){
|
||||
query = query + ' AND ' + String.escapeSingleQuotes(whereClause);
|
||||
}
|
||||
|
||||
if(orderBy != null){
|
||||
query = query + 'ORDER BY ' + String.escapeSingleQuotes(orderBy);
|
||||
|
||||
}
|
||||
|
||||
if (returnedRecordLimit != null){
|
||||
query = query + ' LIMIT ' + String.escapeSingleQuotes(returnedRecordLimit);
|
||||
}
|
||||
}
|
||||
List<sObject> records = Database.query(query);
|
||||
|
||||
System.debug(records);
|
||||
return JSON.serialize(records);
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
|
||||
<apiVersion>34.0</apiVersion>
|
||||
<status>Active</status>
|
||||
</ApexClass>
|
|
@ -1,6 +0,0 @@
|
|||
<aura:documentation>
|
||||
<aura:description>Documentation</aura:description>
|
||||
<aura:example name="ExampleName" ref="exampleComponentName" label="Label">
|
||||
Example Description
|
||||
</aura:example>
|
||||
</aura:documentation>
|
|
@ -1,7 +0,0 @@
|
|||
({
|
||||
rerender: function(component, helper){
|
||||
|
||||
|
||||
|
||||
}
|
||||
})
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
||||
<apiVersion>34.0</apiVersion>
|
||||
<description>Application event to notify other components whenever the menu is clicked</description>
|
||||
</AuraDefinitionBundle>
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
||||
<apiVersion>34.0</apiVersion>
|
||||
<description>Notifies the parent component when there is a change to this component</description>
|
||||
</AuraDefinitionBundle>
|
|
@ -1,3 +0,0 @@
|
|||
<aura:event type="COMPONENT" description="Event template">
|
||||
<aura:attribute name="optionHidden" type="Boolean"/>
|
||||
</aura:event>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
||||
<apiVersion>34.0</apiVersion>
|
||||
<description>Will display options within a select menu or Option group</description>
|
||||
<description>event is fired when Add New Record is clicked</description>
|
||||
</AuraDefinitionBundle>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
||||
<apiVersion>34.0</apiVersion>
|
||||
<description>For grouping the options in the menu</description>
|
||||
<description>fires an event when the menu is clicked</description>
|
||||
</AuraDefinitionBundle>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
||||
<apiVersion>34.0</apiVersion>
|
||||
<description>Advanced Select Menu for Lightning</description>
|
||||
<description>is fired when an option is selected</description>
|
||||
</AuraDefinitionBundle>
|
|
@ -1,5 +1,6 @@
|
|||
<aura:component controller="StrikeLookupController" access="global">
|
||||
|
||||
|
||||
|
||||
<aura:attribute name="placeholderText" type="String" default="Select An Option" description="Placeholder text that will appear as a default setting when no option is selected"/>
|
||||
<aura:attribute name="label" type="String" description="Text that is displayed above the menu that can be used to describe the component"/>
|
||||
<aura:attribute name="isRequired" type="Boolean" default="{!false}" description="Boolean value that determines wheter a '*' is displayed on the component"/>
|
||||
|
@ -7,6 +8,9 @@
|
|||
<aura:attribute name="value" type="String" description='The value of the component after an option is selected'/>
|
||||
<aura:attribute name="searchType" type="String" description="determines whether search is enabled for the component. There are three posible values: 'static' for a static search of all SelectOption values that are configured into the component, 'lookup' for an apex search of a given object, 'none' for no search option"/>
|
||||
|
||||
<!-- Internal attributes -->
|
||||
<aura:attribute name="doneRendering" type="Boolean" description="flag set for when the component is done rendering"/>
|
||||
<aura:attribute name="lookupInputShouldFocus" type="Boolean" default="{!true}" description="boolean value that determines whether the lookup components input field should be focused" />
|
||||
<!-- Static Search Attributes -->
|
||||
<!-- internal attributes: -->
|
||||
<aura:attribute name="selectedIcon" type="String" description="the icon of the selected SelectOption"/>
|
||||
|
@ -29,12 +33,12 @@
|
|||
<!-- /Lookup attributes -->
|
||||
|
||||
<!-- Event registration and handlers -->
|
||||
<aura:registerEvent name="menuClicked" type="c:menuClicked"/>
|
||||
<aura:registerEvent name="addNewRecord" type="c:addNewRecord"/>
|
||||
<aura:registerEvent name="menuClicked" type="c:strike_evt_menuClicked" description="used to help blurring action when more than one StrikeSelect component is on a page. Fires when menu is clicked"/>
|
||||
<aura:registerEvent name="addNewRecord" type="c:strike_evt_addNewRecord" description="fires an event that notifies when the addNewRecord button is pressed"/>
|
||||
<aura:handler event="aura:doneRendering" action="{!c.doneRendering}" />
|
||||
<aura:handler name='init' value="{!this}" action="{!c.onInit}"/>
|
||||
<aura:handler name="notifyParent" event="c:notifyParent" action="{!c.handleNotifyParent}" includeFacets="true"/>
|
||||
<aura:handler event="c:menuClicked" action="{!c.checkIfOpen}"/>
|
||||
<aura:handler name="notifyParent" event="c:strike_evt_notifyParent" action="{!c.handleNotifyParent}" includeFacets="true" description="handles when a StrikeOption is clicked"/>
|
||||
<aura:handler event="c:strike_evt_menuClicked" action="{!c.checkIfOpen}" description="handles the menuClicked event to ensure only one menu is open on a page"/>
|
||||
<aura:handler name="change" value="{!v.value}" action="{!c.handleValueChange}"/>
|
||||
|
||||
|
||||
|
@ -116,11 +120,11 @@
|
|||
</span>
|
||||
</li>
|
||||
</aura:if>
|
||||
<c:StrikeOptionGroup label="Recent Records" aura:id="recentRecordsLabel">
|
||||
<c:strike_selectOptionGroup label="Recent Records" aura:id="recentRecordsLabel">
|
||||
<aura:iteration items="{!v.returnedRecords}" var="record">
|
||||
<c:StrikeOption value="{!record.Id}" label="{!record.Label}" iconName="{!v.lookupIcon}" isLookup="true" />
|
||||
<c:strike_selectOption value="{!record.Id}" label="{!record.Label}" iconName="{!v.lookupIcon}" isLookup="true" />
|
||||
</aura:iteration>
|
||||
</c:StrikeOptionGroup>
|
||||
</c:strike_selectOptionGroup>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
||||
<apiVersion>34.0</apiVersion>
|
||||
<description>Sends an event notifying the User's intention to add new record</description>
|
||||
<description>select picklist, static search and lookup component for strike project</description>
|
||||
</AuraDefinitionBundle>
|
|
@ -12,13 +12,22 @@
|
|||
|
||||
},
|
||||
doneRendering: function(component, event, helper){
|
||||
|
||||
if (!$A.util.isEmpty(component.find('searchInput'))) {
|
||||
component.find('searchInput').getElement().focus();
|
||||
};
|
||||
if (!$A.util.isEmpty(component.find('lookupInput'))){
|
||||
if (!$A.util.isEmpty(component.find('lookupInput')) && component.get('v.lookupInputShouldFocus')){
|
||||
component.find('lookupInput').getElement().focus();
|
||||
}
|
||||
|
||||
|
||||
var recentRecordsLabel = component.find('recentRecordsLabel');
|
||||
var showMostRecent = component.get('v.showMostRecent');
|
||||
|
||||
if (recentRecordsLabel && !showMostRecent){
|
||||
recentRecordsLabel.hideGroup();
|
||||
}
|
||||
component.set('v.doneRendering', true);
|
||||
},
|
||||
toggleMenu : function(component, event, helper) {
|
||||
var trigger = component.find('dropdown-trigger');
|
||||
|
@ -33,7 +42,7 @@
|
|||
|
||||
}
|
||||
|
||||
var appEvent = $A.get("e.c:menuClicked");
|
||||
var appEvent = $A.get("e.c:strike_evt_menuClicked");
|
||||
appEvent.fire();
|
||||
|
||||
if (menuIsOpen){
|
||||
|
@ -50,10 +59,7 @@
|
|||
|
||||
},
|
||||
handleNotifyParent: function(component,event,helper){
|
||||
|
||||
helper.updateValue(component,event,helper);
|
||||
|
||||
|
||||
},
|
||||
checkIfOpen: function(component,event,helper){
|
||||
helper.blur(component,event,helper);
|
|
@ -7,11 +7,20 @@
|
|||
if (menuIsOpen){
|
||||
if (searchType === 'lookup') {
|
||||
|
||||
var lookupPill = component.find('lookupPillContainer');
|
||||
|
||||
var lookupMenu = component.find('lookupMenu');
|
||||
|
||||
$A.util.removeClass(lookupMenu, 'slds-show slds-lookup__menu');
|
||||
$A.util.addClass(lookupMenu, 'slds-hide');
|
||||
|
||||
var lookupInput = component.find('lookupInput');
|
||||
|
||||
lookupInput.getElement().value = '';
|
||||
helper.getLookupRecords(component,event,helper);
|
||||
|
||||
lookupInput.getElement().blur();
|
||||
component.set('v.lookupInputShouldFocus', false);
|
||||
|
||||
|
||||
} else {
|
||||
var trigger = component.find('dropdown-trigger');
|
||||
|
@ -19,6 +28,11 @@
|
|||
|
||||
$A.util.removeClass(trigger, 'slds-is-open');
|
||||
$A.util.removeClass(menu, 'slds-is-open');
|
||||
var searchInput = component.find('searchInput');
|
||||
if (searchInput) {
|
||||
searchInput.getElement().value = '';
|
||||
helper.doStaticSearch(component,event,helper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -109,18 +123,14 @@
|
|||
});
|
||||
},
|
||||
updateValue: function(component,event,helper){
|
||||
|
||||
var svgComp = component.find('svgComp');
|
||||
|
||||
// var staticSearchInput = component.find('searchInput');
|
||||
|
||||
if (svgComp) {
|
||||
svgComp.destroy();
|
||||
}
|
||||
|
||||
// if (staticSearchInput){
|
||||
|
||||
// staticSearchInput.set('v.value', '')
|
||||
// }
|
||||
|
||||
component.set('v.value', event.getParam('value'));
|
||||
component.set('v.selectedOptionLabel', event.getParam('label'));
|
||||
component.set('v.selectedIcon', event.getParam('iconName'));
|
||||
|
@ -131,16 +141,18 @@
|
|||
|
||||
var searchType = component.get('v.searchType');
|
||||
|
||||
if(searchType === 'static'){
|
||||
var trigger = component.find('dropdown-trigger');
|
||||
var menu = component.find('dropdown-menu');
|
||||
$A.util.removeClass(trigger, 'slds-is-open');
|
||||
$A.util.removeClass(menu, 'slds-is-open');
|
||||
}
|
||||
if(searchType == 'lookup'){
|
||||
var lookupPill = component.find('lookupPillContainer');
|
||||
var lookupMenu = component.find('lookupMenu');
|
||||
var lookupInput = component.find('lookupInput');
|
||||
var doneRendering = component.get('v.doneRendering');
|
||||
component.set('v.lookupInputShouldFocus', true);
|
||||
if (doneRendering) {
|
||||
if(lookupInput){
|
||||
lookupInput.getElement().value = '';
|
||||
helper.getLookupRecords(component,event,helper);
|
||||
}
|
||||
}
|
||||
|
||||
$A.util.removeClass(lookupMenu, 'slds-show slds-lookup__menu');
|
||||
$A.util.removeClass(lookupInput, 'slds-show');
|
||||
|
@ -148,7 +160,23 @@
|
|||
$A.util.addClass(lookupPill, 'slds-show');
|
||||
$A.util.addClass(lookupMenu, 'slds-hide');
|
||||
$A.util.addClass(lookupInput, 'slds-hide');
|
||||
} else {
|
||||
var trigger = component.find('dropdown-trigger');
|
||||
var menu = component.find('dropdown-menu');
|
||||
$A.util.removeClass(trigger, 'slds-is-open');
|
||||
$A.util.removeClass(menu, 'slds-is-open');
|
||||
|
||||
var doneRendering = component.get('v.doneRendering');
|
||||
|
||||
if (doneRendering) {
|
||||
var searchInput = component.find('searchInput');
|
||||
|
||||
if(searchInput){
|
||||
|
||||
searchInput.getElement().value = '';
|
||||
helper.doStaticSearch(component,event,helper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
<aura:component >
|
||||
<aura:attribute name="label" type="String"/>
|
||||
<aura:attribute name="value" type="String"/>
|
||||
<aura:attribute name="iconName" type="String"/>
|
||||
<aura:attribute name="label" type="String" description="label to be displayed on the component"/>
|
||||
<aura:attribute name="value" type="String" description="the value of the component"/>
|
||||
<aura:attribute name="iconName" type="String" description="name of the icon to be displayed"/>
|
||||
<!-- internal attributes -->
|
||||
<aura:attribute name="isHidden" type="Boolean"/>
|
||||
<aura:attribute name="isCustomIcon" type="Boolean" />
|
||||
<aura:attribute name="isHidden" type="Boolean" description="boolean value that affects the markup if the component is hidden during a static search"/>
|
||||
<aura:attribute name="isCustomIcon" type="Boolean" description="boolean value that determines whether or not to use svg to render icon"/>
|
||||
<aura:attribute name="isLookup" type="Boolean" description="boolean value used to determine which markup to use"/>
|
||||
|
||||
<aura:handler name="init" value="{!this}" action="{!c.onInit}"/>
|
||||
<aura:method name="checkIfFiltered" action="{!c.checkIfFiltered}"/>
|
||||
<aura:method name="optionSelected" action="{!c.optionSelected}"/>
|
||||
<aura:registerEvent name="notifyParent" type="c:notifyParent"/>
|
||||
<aura:method name="checkIfFiltered" action="{!c.checkIfFiltered}" description="is called by strike select when a search term is entered"/>
|
||||
<aura:method name="optionSelected" action="{!c.optionSelected}" description="is called by the parent on init if a value is initially entered into the strike select component"/>
|
||||
<aura:registerEvent name="notifyParent" type="c:strike_evt_notifyParent" description="is fired when an option is selected"/>
|
||||
|
||||
<li aura:id="thisOption" class="slds-dropdown__item" role="presentation" onclick="{!c.optionSelected}">
|
||||
<aura:if isTrue="{!v.isLookup}">
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
||||
<apiVersion>34.0</apiVersion>
|
||||
<description>Component to be used for each option in the strike_select component</description>
|
||||
</AuraDefinitionBundle>
|
|
@ -0,0 +1,3 @@
|
|||
<design:component>
|
||||
|
||||
</design:component>
|
|
@ -0,0 +1,10 @@
|
|||
<aura:component >
|
||||
<aura:attribute name="name" type="String" default="StrikeOptionGroup" description="The name of the component"/>
|
||||
<aura:attribute name="label" type="String" description="The label to be displayed"/>
|
||||
<aura:method name="hideGroup" action="{!c.hideGroup}" description="is called when the group should be hidden during a static search"/>
|
||||
<aura:method name="showGroup" action="{!c.showGroup}" description="is called when the group name should be shown during a static search"/>
|
||||
<li aura:id="optionGroupLabel" class="slds-dropdown__header" role="separator">
|
||||
<span class="slds-text-title--caps">{!v.label}</span>
|
||||
</li>
|
||||
{!v.body}
|
||||
</aura:component>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
||||
<apiVersion>34.0</apiVersion>
|
||||
<description>Notifies the option group whether or not the option is visible</description>
|
||||
<description>Grouping for the strike_select component</description>
|
||||
</AuraDefinitionBundle>
|
|
@ -0,0 +1,2 @@
|
|||
.THIS {
|
||||
}
|
Загрузка…
Ссылка в новой задаче