Skip to content

Commit

Permalink
Merge pull request #182 from SFDO-Community/feature/indicator-builder
Browse files Browse the repository at this point in the history
Level set work between standard interface branches
  • Loading branch information
thombehrens authored Nov 13, 2024
2 parents c919609 + ef006fa commit 4f911d1
Show file tree
Hide file tree
Showing 45 changed files with 2,066 additions and 93 deletions.
4 changes: 1 addition & 3 deletions .forceignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,4 @@ package.xml
**/profiles/**
**/settings/**
**/Account/**
**/Contact/**

**/unpackaged/**
**/Contact/**
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

With Salesforce Indicators, you can visually highlight important data at a glance, making it easy to focus on what matters most. This Custom Metadata driven Lightning Web Component is all about making key details pop, and giving you lightning-quick insights at a glance on your Salesforce records.


Features:
* Visualize your data - Display key details in a visually engaging and clutter-free manner, allowing users to quickly understand important information on the record, summarize related records, or highlight exceptions.
* Make your data come alive - Add a mix of Salesforce and custom colors to match your branding to create visually appealing indicators for your Lightning pages giving your users a more engaging experience.
Expand All @@ -14,38 +13,39 @@ Salesforce Indicators is part of the [Salesforce Open Source Commons](https://he

## Latest Release
* [Install Salesforce Indicators](https://install.salesforce.org/products/indicators)
* [Release Notes](https://github.com/SFDO-Community/Salesforce-Indicators/wiki/Release-Notes)
* [Release Notes](https://sfdo-community-sprints.github.io/indicators-documentation/docs/release-notes/)

## Project Documentation
* Documentation can be found in the repository [Wiki](https://github.com/SFDO-Community/Salesforce-Indicators/wiki).
* Check out the [Cookbook](https://github.com/SFDO-Community/Salesforce-Indicators/wiki/Cookbook) to help you build Indicators that work for your org.
* Documentation can be found on our [Documentation Site](https://sfdo-community-sprints.github.io/indicators-documentation/).
* Check out the [Getting Started with Salesforce Indicators](https://sfdo-community-sprints.github.io/indicators-documentation/docs/getting-started/) page to help get started with how to set up Salesforce Indicators in your org.

## Ask Questions and Get Help
* Salesforce Indicators is a community built and maintained Salesforce package, please help support this project and share your experiences in the [Trailblazer Community Group](https://trailhead.salesforce.com/trailblazer-community/groups/0F94S000000HEDASA4?tab=discussion). Ask any questions about the Salesforce Indicators project, or the Open Source Commons.
* If you have any enhancements or issue you can [Log an Issue](https://github.com/SFDO-Community/Salesforce-Indicators/issues).
* If you have any enhancements or issue you can [Log an Issue](https://github.com/SFDO-Community/Salesforce-Indicators/issues)..

## Vision & Goals
* Enhance the current Indicators Bundle Component to improve the experience for Admins and Users.
* Complete the documentation with different recipes to help Admins get up and running quickly.
* Showcase and review different apps you can use to achieve similar results, and show how you will probably want to use Salesforce Indicators anyway.
* Build our planned Components - these components are built on the same Custom Metadata framework and just show the data in different ways:
* A Grid Component to quickly show your users excptions or a checklist of fields on the record. Optionally show field values, a custom message for each field, and if the field has an exception.
* A Grid Component to quickly show your users excptions or a checklist of fields on the record. Optionally show field values, a custom message for each field, and if the field has an exception.
* A Panel Component to provide more value and features than the standard record highlights panel horizontally, or a panel that display the key data vertically.

# How to Contribute:
- [Install Salesforce Indicators](https://install.salesforce.org/products/indicators)
- [Set up the Indicator Bundle](https://github.com/SFDO-Community/Salesforce-Indicators/wiki/Indicator-Bundle)
- [Set up Salesforce Indicators](https://sfdo-community-sprints.github.io/indicators-documentation/docs/setup-salesforce-indicators/)
- Ask any questions on our [Trailblazer Community Group](https://trailhead.salesforce.com/trailblazer-community/groups/0F94S000000HEDASA4?tab=discussion)
- Add your own Recipes to the [Cookbook](https://github.com/SFDO-Community/Salesforce-Indicators/wiki/Cookbook) and
- Add reviews of any [similar or competitor components](https://github.com/SFDO-Community/Salesforce-Indicators/wiki/Other-Apps-and-Components-to-Enhance-Your-Org)
- [Volunteer](https://github.com/SFDO-Community/Salesforce-Indicators/wiki/How-to-Volunteer) to enhance the code
- Add your own [Recipes](https://sfdo-community-sprints.github.io/indicators-documentation/docs/recipes/) to our documentation
- Add reviews of any [similar or competitor components](https://sfdo-community-sprints.github.io/indicators-documentation/docs/components/other-solutions/)
- [Volunteer](https://sfdo-community-sprints.github.io/indicators-documentation/docs/getting-involved/how-to-volunteer/) to enhance the app
- [Log an Issue](https://github.com/SFDO-Community/Salesforce-Indicators/issues)
- Join us at an upcoming [Salesforce Commons Community Sprint](https://trailhead.salesforce.com/trailblazer-community/groups/0F94S000000GwVK?tab=discussion)

## Project Acomplishments
* Rebuilt the component to support Custom Metadata Types
* Built the component to support Custom Metadata Types
* Enhancements to the Indicator Bundle Component
* The Indicator Key compnent and Setup components to help build and understand the Indicators easily
* New companion components (Grid and Panel) in progress
* Packaging and release setup
* Marketing and release of Salesforce Indicators
* New UI for building Salesforce Indicators in progress
3 changes: 3 additions & 0 deletions cumulusci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,23 @@ tasks:

deploy_sample_indicators:
description: Deploys - Sample Indicators
name: Deploy Sample Indicators
group: Salesforce Metadata
class_path: cumulusci.tasks.salesforce.Deploy
options:
path: unpackaged/config/sample_AccountContact

deploy_sample_indicators_layouts:
description: Deploys - Sample Indicators Layouts
name: Deploy Page Layouts for Sample Indicators
group: Salesforce Metadata
class_path: cumulusci.tasks.salesforce.Deploy
options:
path: unpackaged/config/sample_AccountContact_FlexiPages

deploy_training_indicators:
description: Deploys - Example Indicators used for Training
name: Deploy Training Indicators
group: Salesforce Metadata
class_path: cumulusci.tasks.salesforce.Deploy
options:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { createElement } from 'lwc';
import IndicatorBuilder from 'c/indicatorBuilder';

describe('c-indicator-builder', () => {
afterEach(() => {
// The jsdom instance is shared across test cases in a single file so reset the DOM
while (document.body.firstChild) {
document.body.removeChild(document.body.firstChild);
}
});

it('TODO: test case generated by CLI command, please fill in test logic', () => {
// Arrange
const element = createElement('c-indicator-builder', {
is: IndicatorBuilder
});

// Act
document.body.appendChild(element);

// Assert
// const div = element.shadowRoot.querySelector('div');
expect(1).toBe(1);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<template>
<template lwc:if={activeVariant}>
<div class="slds-grid slds-gutters">
<div class="slds-col slds-size_3-of-4 slds-grid slds-wrap slds-border_right">
<div class="variantDesign slds-col slds-size_1-of-1 slds-p-bottom_x-small">
<p class="slds-text-heading_small">Design</p>
<lightning-input label="Indicator Label" value={activeVariant.label} data-property="label"
oncommit={handleVariantPropertyChange}></lightning-input>
<lightning-combobox label="Select Icon Source" options={iconSourceOptions}
value={activeVariant.iconSource} dropdown-alignment="auto" data-property="iconSource"
onchange={handleVariantPropertyChange}></lightning-combobox>
<div class="iconSourceInputs">
<template lwc:if={iconSourceIs.sldsIcon}>
<c-fsc_combobox label="Select Icon" options={iconOptions} icon-size="small"
value={activeVariant.sourceValue} data-property="sourceValue"
onchange={handleVariantPropertyChange}></c-fsc_combobox>
</template>
<template lwc:elseif={iconSourceIs.url}>
<lightning-input label="Enter URL" value={activeVariant.sourceValue}
data-property="sourceValue" onchange={handleVariantPropertyChange}></lightning-input>
</template>
<template lwc:elseif={iconSourceIs.staticResource}>
<lightning-input label="Select Static Resource" value={activeVariant.sourceValue}
data-property="sourceValue" onchange={handleVariantPropertyChange}></lightning-input>
</template>
<template lwc:elseif={iconSourceIs.staticText}>
<lightning-input label="Enter Static Text" value={activeVariant.sourceValue}
class="slds-p-top_xxx-small" data-property="sourceValue"
onchange={handleVariantPropertyChange}></lightning-input>
</template>
<lightning-input label="Hover Text" value={activeVariant.hoverText} data-property="hoverText"
onchange={handleVariantPropertyChange}></lightning-input>
<template lwc:if={showColourOption}>
<lightning-input label="Override Colours" type="checkbox" data-property="overrideColours"
checked={activeVariant.overrideColours}
onchange={handleVariantPropertyChange}></lightning-input>
</template>
<template lwc:if={showColourSelectors}>
<lightning-input label="Select Foreground Colour" type="color"
data-property="foregroundColour" value={activeVariant.foregroundColour}
onchange={handleVariantPropertyChange}></lightning-input>
<lightning-input label="Select Background Colour" type="color"
data-property="backgroundColour" value={activeVariant.backgroundColour}
onchange={handleVariantPropertyChange}></lightning-input>
</template>

</div>
</div>
<template lwc:if={activeVariant.isExtension}>
<div class="variantLogic slds-col slds-size_1-of-1 slds-p-top_x-small">
<p class="slds-text-heading_small">Extension Logic</p>
<lightning-combobox label="Show When Field:" options={activeWhenToDisplayOptions}
value={activeVariant.whenToDisplay} data-property="whenToDisplay"
onchange={handleVariantPropertyChange} dropdown-alignment="auto"></lightning-combobox>
<template lwc:if={filterTypeIs.text}>
<lightning-input label="Text"></lightning-input>
</template>
<template lwc:elseif={filterTypeIs.number}>
<lightning-input label="Number" type="number"></lightning-input>
</template>
<template lwc:elseif={filterTypeIs.numericRange}>
<lightning-input label="Greater Than or Equal To" type="number"></lightning-input>
<lightning-input label="Less Than" type="number"></lightning-input>
</template>
</div>
</template>
</div>
<div>
<h2 class="slds-text-heading_small slds-col">Preview</h2>
<div class="slds-col">
<c-indicator-bundle-item icon-source={activeVariant.iconSource}
source-value={activeVariant.sourceValue} ind-size="large"
ind-foreground-color={activeVariant.foregroundColour}
ind-background-color={activeVariant.backgroundColour} ind-hover-text={activeVariant.hoverText}>
</c-indicator-bundle-item>
</div>
</div>
</div>
</template>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import { LightningElement, api, track } from 'lwc';

const FIELD_TYPE_CATEGORIES = {
TEXT: ['Reference', 'Address', 'Email', 'Location', 'Phone', 'Picklist', 'ComboBox', 'MultiPicklist', 'String', 'TextArea', 'EncryptedString', 'URL'],
NUMERIC: ['Currency', 'Number', 'Percent', 'Integer', 'Double', 'Int', 'Long'],
DATE: ['Date', 'DateTime', 'Time'],
BOOLEAN: ['Boolean'],
}

export default class IndicatorBuilderExtension extends LightningElement {
@api indicator = {};
@api activeVariant = {};
@api iconOptions = [];

get activeVariantString() {
return JSON.stringify(this.activeVariant);
}

get iconSourceIs() {
return { [this.activeVariant.iconSource]: true }
}

get filterTypeIs() {
let matchingOption = this.whenToDisplayOptions.find(option => option.value == this.activeVariant.whenToDisplay);
return matchingOption ? { [matchingOption.showMatch]: true } : {};
}

get showColourOption() {
return this.iconSourceIs.sldsIcon;
}
get showColourSelectors() {
return this.iconSourceIs.staticText || (this.showColourOption && this.activeVariant.overrideColours);
}

get activeWhenToDisplayOptions() {
return this.whenToDisplayOptions.filter(option => option.fieldTypes.includes(this.indicator.fieldType));
}

iconSourceOptions = [
{ label: 'Lightning Icon', value: 'sldsIcon' },
{ label: 'Static Text', value: 'staticText' },
{ label: 'URL', value: 'url' },
{ label: 'Static Resource', value: 'staticResource' },
];

whenToDisplayOptions = [
// { label: 'Is not blank', value: 'notBlank', fieldTypes: [...FIELD_TYPE_CATEGORIES.TEXT, ...FIELD_TYPE_CATEGORIES.NUMERIC, ...FIELD_TYPE_CATEGORIES.DATE] },
// { label: 'Is blank', value: 'isBlank', fieldTypes: [...FIELD_TYPE_CATEGORIES.TEXT, ...FIELD_TYPE_CATEGORIES.NUMERIC, ...FIELD_TYPE_CATEGORIES.DATE] },
{ label: 'Contains text', value: 'containsText', fieldTypes: FIELD_TYPE_CATEGORIES.TEXT, showMatch: 'text' },
{ label: 'Equals', value: 'equalsText', fieldTypes: FIELD_TYPE_CATEGORIES.TEXT, showMatch: 'text' },
{ label: 'Equals', value: 'equalsNumber', fieldTypes: [...FIELD_TYPE_CATEGORIES.NUMERIC, ...FIELD_TYPE_CATEGORIES.DATE], showMatch: 'number' },
{ label: 'Is greater than', value: 'greaterThan', fieldTypes: [...FIELD_TYPE_CATEGORIES.NUMERIC, ...FIELD_TYPE_CATEGORIES.DATE], showMatch: 'number' },
{ label: 'Is less than', value: 'lessThan', fieldTypes: [...FIELD_TYPE_CATEGORIES.NUMERIC, ...FIELD_TYPE_CATEGORIES.DATE], showMatch: 'number' },
{ label: 'Is within range', value: 'inRange', fieldTypes: [...FIELD_TYPE_CATEGORIES.NUMERIC, ...FIELD_TYPE_CATEGORIES.DATE], showMatch: 'numericRange' },
{ label: 'Is true', value: 'isTrue', fieldTypes: FIELD_TYPE_CATEGORIES.BOOLEAN, showMatch: 'boolean' },
{ label: 'Is false', value: 'isFalse', fieldTypes: FIELD_TYPE_CATEGORIES.BOOLEAN, showMatch: 'boolean' },
];

connectedCallback() {
}

handleVariantPropertyChange(event) {
if (event.currentTarget.dataset.property) {
let target = event.currentTarget;
let tagName = target.tagName.toLowerCase();
let value;
if (tagName === 'c-icon-selector') {
value = event.detail;
} else if (target.type === 'checkbox') {
value = target.checked;
} else if (tagName === 'lightning-combobox') {
value = event.detail.value;
} else {
value = target.value;
}

let variant = { ...this.activeVariant };

variant[target.dataset.property] = value;
if (target.dataset.property === 'iconSource') {
variant.sourceValue = null;
}

this.dispatchEvent(new CustomEvent('variantchange', { detail: variant }));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>61.0</apiVersion>
<isExposed>false</isExposed>
</LightningComponentBundle>
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <h3 slot="title">
</template>
</template>
<!-- TODO: Do we put this in a Layout which would be responsive to the container, this could allow for empty slots too -->
<div class="slds-var-m-left_medium">
<div class="slds-var-m-left_medium slds-clearfix ">
<template if:true={results}>
<template for:each={results} for:item="fld">
<c-indicator-bundle-item if:true={fld.fShowAvatar} key={fld.fName}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default class IndicatorBundle extends LightningElement {
if(this.bundle.CardIconBackground || this.bundle.CardIconForeground ){
this.card.iconClass = 'cardIcon slds-var-m-right_xx-small ';
} else {
this.card.iconClass = 'slds-var-m-right_xx-small ';
this.card.iconClass = 'slds-var-m-right_x-small ';
}

// console.log('Card Data');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
}

.indicatorIcon {
--slds-c-icon-color-foreground-default: var(--foregroundColor);
--slds-c-icon-color-foreground: var(--foregroundColor);
--slds-c-icon-color-background: var(--backgroundColor);
--slds-c-avatar-text-color: var(--foregroundColor);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<template>
<template if:false={record}>
<lightning-avatar
size={indSize}
variant={indShape}
initials={indText}
src={indImage}
fallback-icon-name={indIcon}
alternative-text={indHoverText}
class={indClass}>
</lightning-avatar>
</template>
<div class="slds-var-m-bottom_x-small slds-float_left">
<template if:false={record}>
<lightning-avatar
size={indSize}
variant={indShape}
initials={indText}
src={indImage}
fallback-icon-name={indIcon}
alternative-text={indHoverText}
class={indClass}>
</lightning-avatar>
</template>
</div>
</template>
Loading

0 comments on commit 4f911d1

Please sign in to comment.