GithubHelp home page GithubHelp logo

chaos-tech-corp / linear-path Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 111 KB

Linear Path component for Picklist fields for any object with auto-scale functionality.

License: GNU General Public License v3.0

JavaScript 97.95% CSS 2.05%
salesforce salesforce-lightning salesforce-lightning-components lightning-component

linear-path's Introduction

Deploy

Linear Path

This component creates a linear path view from a picklist field in any object in Salesforce and allow to scale down the component to fit in its parent container.

linear path example

It also mimics the Opportunity Path behaviour with any picklist, allowing for "Won" and "Close" values.

linear path example

Usage

Define the linear_path component in a custom component markup:

<aura:component>

    <c:linear_path fieldName="StageName" 
                   recordId="{!v.recordId}" 
                   scale="true"/>

</aura:component>

The component is available in the lightning page designer, so it can be added to any record page without writting any code.

Component Properties

  • fieldName (String) - Name of the picklist field to display.
  • recordId (String) - Id of the record to use.
  • scale (Boolean) - Default value is false. Indicates whether the path will be scaled down to fit in its container.
  • closedValues (String) - List of the values of the picklist assigned as Closed/Won, separated by semi-colon;
  • closedLostValues (String) - List of the values of the picklist assigned as Closed/Lost, separated by semi-colon;
  • closedValueName (String) - Display value for the last option of the picklist where all Close values are grouped.

Lightning App Builder Editor Properties

  • Field Name (String) - Name of the picklist field to display.
  • Enable Scaling? (Boolean) - Default value is false. Indicates whether the path will be scaled down to fit in its container.
  • Closed Won Values (String) - List of the values of the picklist assigned as Closed/Won, separated by semi-colon;
  • Closed Lost Values (String) - List of the values of the picklist assigned as Closed/Lost, separated by semi-colon;
  • Closed Value Text (String) - Display value for the last option of the picklist where all Close values are grouped.

Exmaple configuration for the image above:

Picklist field named demo with values: Draft, Initiated, Pending, Proposed, Signed, Activated, Cancelled.

  • Field Name: 'Demo__c'
  • Enable Scaling?: false
  • Closed Won Values: 'Activated'
  • Closed Lost Values: 'Cancelled'
  • Closed Value Text: 'Activated'
NOTES & CONSIDERATIONS

If scale is set to false, content will be hidden if it doesn't fit in the container, otherwise it will scale down to fit in the available space.

It has special management for the StageName field in the Opportunity object (try to mimic it), so it won't show the closed values, instead it will display just Close, unless the Opportunity it is closed, it will then show the StageName value, same as the generic Lightning Path component.

Current version has no functionality, just displayes the picklist values.

DIFFERENCES WITH THE PATH COMPONENT

This component is for display purposes only of the picklist, it does not contain the Mark Stage as Complete button and does not display the StageName.

In the image below:

  • First is the Path component showing the path updated button.
  • Second is the Path component hiding the path update button.
  • Third is the Linear Path component, without the update button and the Stage Name label, note there is no padding or marging left from the empty containers of the label and the button.

linear path example

DISCLAIMER

This component is based on the Path Blueprint from the Lightning Design System.

How to Deploy it in your Salesforce Org (Sandbox)

Open the Developer Console and proceed as follows:

  1. Create a new Apex Class (File > New > Apex Class) and name it: linear_path_controller.
  2. Create a new Lightning Component (File > New > Lightning Component) and name it linear_path.
  3. Copy and pase the code from the SRC directory into the recently created files.
    • For the lightning component:
      • COMPONENT: linear_path.cmp
      • CONTROLLER: linear_path.js
      • DESIGN: linear_path.design
      • STYLE: linear_path.css
    • For the Apex Class: linear_path_controller.apxc

Alternatively you can use deploy2.org to deploy directly from Github to your Sandbox.

Deploy

linear-path's People

Contributors

jachaos avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

rahman123

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.