|
1 | | -# Lightning Components |
2 | | -A library of lightweight Salesforce Lightning components that streamline developing by automatically applying sobject-level security, field-level security, field types and more. |
| 1 | +# Simple Lightning Components |
| 2 | +A library of lightweight Salesforce Lightning components that simplify developing in Lightning by automatically: |
| 3 | +* Honoring SObject-level security & field-level security for displaying fields & allowing fields to be edited |
| 4 | +* Displaying the correct input field type based on the field's metadata, including lookup fields & support for polymorphic fields like Task.WhoId & Task.WhatId |
| 5 | +* Translating SObject labels, field labels and picklist options |
3 | 6 |
|
4 | 7 | <a href="https://githubsfdeploy.herokuapp.com" target="_blank"> |
5 | | - <img alt="Deploy to Salesforce" |
6 | | - src="https://raw.githubusercontent.com/afawcett/githubsfdeploy/master/deploy.png"> |
| 8 | + <img alt="Deploy to Salesforce" src="https://raw.githubusercontent.com/afawcett/githubsfdeploy/master/deploy.png"> |
7 | 9 | </a> |
8 | 10 |
|
9 | | -## sobjectMetadata.cmp |
10 | | -* An extensible, markup-less component that returns an instance of LightningMetadataController.SObjectMetadata for the specified SObject |
11 | | - |
12 | | - `<c:sobjectMetadata sobjectName="Account" aura:id="accountMetadataService" />` |
13 | | - |
14 | | -## fieldMetadata.cmp |
15 | | -* An extensible, markup-less component that returns an instance of LightningMetadataController.FieldMetadata for the specified field |
16 | | - |
17 | | - `<c:fieldMetadata sobjectName="Account" fieldName="Type" aura:id="accountTypeMetadataService" />` |
18 | | - |
19 | | -## inputField.cmp |
20 | | -* Provides a simple way to display an SObject's field as an input (editable) that automatically determines sobject-level security, field-level security, the field type, field label, etc. Attributes can be overridden to allow control over the field when needed |
21 | | - |
22 | | - `<c:inputField sobjectName="Account" fieldName="Type" record="{!v.myAccount}" />` |
23 | | - |
24 | | -## lookup.cmp |
25 | | -* Provides lookup functionality that Salesforce does not provide for developers in LEX. This component is used by inputField.cmp for lookup fields. |
26 | | - |
27 | | - Users can search for the record or choose one of the recently viewed records automatically displayed on focus |
28 | | - `<c:lookup sobjectName="Contact" fieldName="AccountId" record="{!v.myContact}" />` |
29 | | - |
30 | | - Polymorphic fields, like Task.WhoId, automatically display an SObject Switcher. |
31 | | - SObject-level permissions are automatically applied - only objects that the user has permission to view are displayed in the SObject Switcher. |
32 | | - `<c:lookup sobjectName="Task" fieldName="WhoId" record="{!v.myTask}" />` |
33 | | -  |
34 | | - |
35 | | - |
36 | | -## outputField.cmp |
37 | | -* Provides a simple way to display an SObject's field as an output (read-only) that automatically determines sobject-level security, field-level security, the field type, field label, etc. Attributes can be overridden to allow control over the field when needed |
38 | | - |
39 | | - `<c:inputField sobjectName="Account" fieldName="Type" record="{!v.myAccount}" />` |
40 | | - |
41 | | -## sobjectLabel.cmp |
42 | | -* Displays the localized version of the provided SObject's label |
43 | | - |
44 | | - `<c:sobjectLabel sobjectName="Account" />` |
45 | | - |
46 | | -* Feature: Show the SObject's plural label |
47 | | - |
48 | | - `<c:sobjectLabel sobjectName="Account" variant="labelPlural" />` |
49 | | - |
50 | | -## fieldLabel.cmp |
51 | | -* Displays the localized version of the provided field's label |
52 | | - |
53 | | - `<c:fieldLabel sobjectName="Account" fieldName="Type" />` |
54 | | - |
55 | | -* Feature: Show the field's inline help text |
56 | | - |
57 | | - `<c:fieldLabel sobjectName="Account" fieldName="Type" showHelpText="true" />` |
58 | | - |
59 | | -## modal.cmp |
60 | | -* Generates a modal window and displays your contents inside |
61 | | - ``` |
62 | | - <c:modal title="My Modal" isOpen="{!v.showModal}"> |
63 | | - <aura:set attribute="body"> |
64 | | - <p>This paragraph will be shown inside the modal</p> |
65 | | - </aura:set> |
66 | | - </c:modal> |
67 | | - ``` |
68 | | -
|
69 | | -## objectPropertyValue.cmp |
70 | | -* Displays the specified property of any javascript object - this is helpful since Lightning does not allow you to dynamically get a property value by name (like 'myObject[someProperty]') |
71 | | -
|
72 | | - `<c:objectPropertyValue object="{!v.my.complex.nested.object}" propertyName="someProperty" />` |
73 | | -
|
74 | | -# Apex Classes |
75 | | -
|
76 | | -## LightningMetadataController.cls |
| 11 | +## Simple Admin component |
| 12 | +* simpleAdmin.cmp - this is a demo component that provides examples of how to use the other components. It's also a handy admin tool to quickly get information about your org. |
| 13 | + |
| 14 | +## Metadata Components |
| 15 | +Several no-markup components are included. These can be used to dynamically access metadata about your org in Lightning components |
| 16 | +* **currentUser.cmp**: return info about the current user. Additional user fields can be returned by setting currentUser.additionalFieldApiNames |
| 17 | +* **environmentMetadata.cmp**: returns an instance of EnvironmentMetadata for the specified SObjectenvironmentMetadata.cmp |
| 18 | +* **fieldMetadata.cmp**: returns an instance of FieldMetadata for the specified SObjectfieldMetadata.cmp |
| 19 | +* **fieldSetMetadata.cmp**: returns an instance of FieldSetMetadata for the specified SObjectfieldSetMetadata.cmp |
| 20 | +* **listviewMetadata.cmp**: returns an instance of ListviewMetadata for the specified SObjectlistviewMetadata.cmp |
| 21 | +* **queueMetadata.cmp**: returns an instance of QueueMetadata for the specified SObjectqueueMetadata.cmp |
| 22 | +* **recordTypeMetadata.cmp**: returns an instance of RecordTypeMetadata for the specified SObjectrecordTypeMetadata.cmp |
| 23 | +* **sobjectMetadata.cmp**: returns an instance of SObjectMetadata for the specified SObjectsobjectMetadata.cmp |
| 24 | + |
| 25 | +## UI Components |
| 26 | +These components are used to build UIs in Lightning - several of these leverage the metadata service components |
| 27 | +* **fieldLabel.cmp**: Displays the localized version of the provided field's label |
| 28 | +* **inputField.cmp**: Provides a simple way to display an SObject's field as an input (editable) that automatically determines sobject-level security, field-level security, the field type, field label, etc. Attributes can be overridden to allow control over the field when needed |
| 29 | +* **lookup.cmp**: Provides lookup functionality that Salesforce does not provide for developers in LEX. This component is used by inputField.cmp for lookup fields. |
| 30 | +* **modal.cmp**: Generates a modal window and displays your contents inside |
| 31 | +* **objectPropertyValue.cmp**: Displays the specified property of any javascript object - this is helpful since Lightning does not allow you to dynamically get a property value by name (like 'myObject[someProperty]') |
| 32 | +* **outputField.cmp**: Provides a simple way to display an SObject's field as an output (read-only) that automatically determines sobject-level security, field-level security, the field type, field label, etc. Attributes can be overridden to allow control over the field when needed |
| 33 | +* **sobjectLabel.cmp**: Displays the localized version of the provided SObject's label |
| 34 | + |
| 35 | +## Apex Classes |
| 36 | + |
| 37 | +### LightningMetadataController.cls |
77 | 38 | Contains methods for describing your orgs metadata and returning the info as aura-friendly objects that can be consumed by Lightning Components |
78 | 39 | * getSObjectMetadata(String sobjectName) - returns an instance of LightningMetadataController.SObjectMetadata |
79 | | -* getFieldMetadata(String sobjectName, String fieldName) - returns an instance of LightningMetadataController.FieldMetadata |
| 40 | +* getFieldMetadata(String sobjectName, String fieldName) - returns an instance of LightningMetadataController.FieldMetadata |
| 41 | + |
| 42 | +### SimpleMetadata classes |
| 43 | +The remaining metadata classes (SObjectMetadata.cls, FieldMetadata.cls, etc) are part of the [SimpleMetadata](https://github.com/jongpie/SimpleMetadata) project - any bugs or enhancements for those classes are maintained in that project, and the latest version is used in this repo. |
0 commit comments