Refined and aligned VF and VC Injector API's
This commit is contained in:
Родитель
b6436ffb54
Коммит
5177de2c67
|
@ -2,7 +2,7 @@
|
|||
<lightning:card>
|
||||
<p class="slds-p-horizontal_small">
|
||||
<lightning:badge label="Component A"/>
|
||||
<c:injector binding="lc_ComponentAtoB">
|
||||
<c:injector bindingName="lc_ComponentAtoB">
|
||||
<c:injectorAttribute name="message" value="A message from Component A"/>
|
||||
</c:injector>
|
||||
</p>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<aura:component implements="force:lightningQuickAction,force:hasRecordId,force:hasSObjectName" >
|
||||
<c:injector binding="lc_actionWidgetManage">
|
||||
<c:injector bindingName="lc_actionWidgetManage">
|
||||
<c:injectorAttribute name="sObjectName" value="{!v.sObjectName}"/>
|
||||
<c:injectorAttribute name="recordId" value="{!v.recordId}"/>
|
||||
</c:injector>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<aura:component implements="lightning:actionOverride,force:hasSObjectName">
|
||||
<c:injector binding="lc_actionWidgetNew">
|
||||
<c:injector bindingName="lc_actionWidgetNew">
|
||||
<c:injectorAttribute name="sObjectName" value="{!v.sObjectName}"/>
|
||||
</c:injector>
|
||||
</aura:component>
|
|
@ -2,7 +2,7 @@
|
|||
<lightning:card>
|
||||
<p class="slds-p-horizontal_small">
|
||||
<lightning:badge label="Component A"/>
|
||||
<c:injector binding="lc_ComponentAtoB">
|
||||
<c:injector bindingName="lc_ComponentAtoB">
|
||||
<c:injectorAttribute name="message" value="A message from Component A"/>
|
||||
</c:injector>
|
||||
</p>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<apex:page standardController="Widget__c" extensions="InjectorController">
|
||||
<c:injector bindingName="vf_layoutWidgetInfo" pageController="{!this}"/>
|
||||
<c:injector bindingName="vf_layoutWidgetInfo" parameters="{!standardController}"/>
|
||||
</apex:page>
|
||||
|
|
|
@ -3,7 +3,7 @@ public with sharing class WidgetInfoController {
|
|||
public ApexPages.StandardController StandardControllerValue {get;set;}
|
||||
|
||||
public class BindingProvider implements Binding.Provider {
|
||||
public Object newInstance(Object params) {
|
||||
public Object newInstance(Object params) {
|
||||
return new Component.widgetInfo(standardController = (ApexPages.StandardController) params);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<aura:component controller="InjectorController">
|
||||
<aura:attribute name="binding" type="String"/>
|
||||
<aura:attribute name="bindingName" type="String"/>
|
||||
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
|
||||
{!v.body}
|
||||
</aura:component>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// Resolve the given binding
|
||||
var action = cmp.get("c.getInstance");
|
||||
action.setStorable(true); // TODO: Investigate a means to have a more global client side cache for all vc bindings on the client
|
||||
action.setParams({ bindingName : cmp.get("v.binding") });
|
||||
action.setParams({ bindingName : cmp.get("v.bindingName") });
|
||||
action.setCallback(this, function(response) {
|
||||
var state = response.getState();
|
||||
if (state === "SUCCESS") {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
public with sharing class InjectorComponentController {
|
||||
|
||||
public String BindingValue {set;get;}
|
||||
public String BindingNameValue {set;get;}
|
||||
|
||||
public InjectorController PageControllerValue {set;get;}
|
||||
public Object ParametersValue {set;get;}
|
||||
|
||||
public ApexPages.Component getInject() {
|
||||
// TODO: Some error handling here
|
||||
return (ApexPages.Component) Injector.getInstance(BindingValue, PageControllerValue.StandardController);
|
||||
return (ApexPages.Component) Injector.getInstance(BindingNameValue, ParametersValue);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
public with sharing class InjectorController {
|
||||
|
||||
public ApexPages.StandardController StandardController;
|
||||
public ApexPages.StandardController StandardController {get;set;}
|
||||
|
||||
public InjectorController(ApexPages.StandardController StandardController) {
|
||||
this.StandardController = StandardController;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<apex:component controller="InjectorComponentController">
|
||||
<apex:attribute name="bindingName" type="String" assignTo="{!BindingValue}" description=""/>
|
||||
<apex:attribute name="pageController" type="InjectorController" assignTo="{!PageControllerValue}" description=""/>
|
||||
<apex:attribute name="bindingName" type="String" assignTo="{!BindingNameValue}" description=""/>
|
||||
<apex:attribute name="parameters" type="Object" assignTo="{!ParametersValue}" description=""/>
|
||||
<apex:dynamicComponent componentValue="{!inject}" invokeAfterAction="true"/>
|
||||
</apex:component>
|
||||
|
|
Загрузка…
Ссылка в новой задаче