From b05c0d8a0dd948d8ac569c6521e0febf8abf39f6 Mon Sep 17 00:00:00 2001 From: tschug Date: Thu, 21 Nov 2024 04:12:16 -0500 Subject: [PATCH] Stable draft of Indicator Badges --- force-app/main/default/classes/Cmdt.cls | 10 ++++- .../default/classes/IndicatorController.cls | 25 +++++++++++- .../lwc/indicatorBundle/indicatorBundle.html | 38 ++++++++++++++----- .../lwc/indicatorBundle/indicatorBundle.js | 27 +++++++++++-- .../indicatorBundle.js-meta.xml | 7 ++-- .../__tests__/indicatorBundleBadge.test.js | 25 ++++++++++++ .../indicatorBundleBadge.css | 5 +++ .../indicatorBundleBadge.html | 11 ++++++ .../indicatorBundleBadge.js | 37 ++++++++++++++++++ .../indicatorBundleBadge.js-meta.xml | 5 +++ .../Badge_Icon_Position__c.field-meta.xml | 25 ++++++++++++ .../fields/Badge_Text_Color__c.field-meta.xml | 12 ++++++ .../Badge_Icon_Position__c.field-meta.xml | 25 ++++++++++++ .../fields/Badge_Text_Color__c.field-meta.xml | 12 ++++++ ...erse_Badge_Icon_Position__c.field-meta.xml | 25 ++++++++++++ ...Inverse_Badge_Text_Color__c.field-meta.xml | 12 ++++++ 16 files changed, 281 insertions(+), 20 deletions(-) create mode 100644 force-app/main/default/lwc/indicatorBundleBadge/__tests__/indicatorBundleBadge.test.js create mode 100644 force-app/main/default/lwc/indicatorBundleBadge/indicatorBundleBadge.css create mode 100644 force-app/main/default/lwc/indicatorBundleBadge/indicatorBundleBadge.html create mode 100644 force-app/main/default/lwc/indicatorBundleBadge/indicatorBundleBadge.js create mode 100644 force-app/main/default/lwc/indicatorBundleBadge/indicatorBundleBadge.js-meta.xml create mode 100644 force-app/main/default/objects/Indicator_Item_Extension__mdt/fields/Badge_Icon_Position__c.field-meta.xml create mode 100644 force-app/main/default/objects/Indicator_Item_Extension__mdt/fields/Badge_Text_Color__c.field-meta.xml create mode 100644 force-app/main/default/objects/Indicator_Item__mdt/fields/Badge_Icon_Position__c.field-meta.xml create mode 100644 force-app/main/default/objects/Indicator_Item__mdt/fields/Badge_Text_Color__c.field-meta.xml create mode 100644 force-app/main/default/objects/Indicator_Item__mdt/fields/Inverse_Badge_Icon_Position__c.field-meta.xml create mode 100644 force-app/main/default/objects/Indicator_Item__mdt/fields/Inverse_Badge_Text_Color__c.field-meta.xml diff --git a/force-app/main/default/classes/Cmdt.cls b/force-app/main/default/classes/Cmdt.cls index b36d92c..3a3b79c 100644 --- a/force-app/main/default/classes/Cmdt.cls +++ b/force-app/main/default/classes/Cmdt.cls @@ -47,7 +47,11 @@ public with sharing class Cmdt { Icon_Foreground__c, Inverse_Icon_Background__c, Inverse_Icon_Foreground__c, - Description__c + Description__c, + Badge_Text_Color__c, + Badge_Icon_Position__c, + Inverse_Badge_Text_Color__c, + Inverse_Badge_Icon_Position__c FROM Indicator_Item__mdt // WHERE Active__c = TRUE ]){ @@ -85,7 +89,9 @@ public with sharing class Cmdt { Static_Text__c, Icon_Background__c, Icon_Foreground__c, - Description__c + Description__c, + Badge_Text_Color__c, + Badge_Icon_Position__c FROM Indicator_Item_Extension__mdt // WHERE Active__c = TRUE // AND Indicator_Item__r.Active__c = TRUE diff --git a/force-app/main/default/classes/IndicatorController.cls b/force-app/main/default/classes/IndicatorController.cls index c2859c2..603c9dd 100644 --- a/force-app/main/default/classes/IndicatorController.cls +++ b/force-app/main/default/classes/IndicatorController.cls @@ -84,6 +84,14 @@ public with sharing class IndicatorController { public String InverseBackgroundColor {get; set;} @AuraEnabled public String InverseForegroundColor {get; set;} + @AuraEnabled + public String BadgeTextColor {get; set;} + @AuraEnabled + public String BadgeIconPosition {get; set;} + @AuraEnabled + public String FalseBadgeTextColor {get; set;} + @AuraEnabled + public String FalseBadgeIconPosition {get; set;} } public class IndicatorExtension { @@ -115,6 +123,10 @@ public with sharing class IndicatorController { public String BackgroundColor {get; set;} @AuraEnabled public String ForegroundColor {get; set;} + @AuraEnabled + public String BadgeTextColor {get; set;} + @AuraEnabled + public String BadgeIconPosition {get; set;} } @AuraEnabled @@ -206,6 +218,10 @@ public with sharing class IndicatorController { item.ForegroundColor = indicatorItem.Icon_Foreground__c; item.InverseBackgroundColor = indicatorItem.Inverse_Icon_Background__c; item.InverseForegroundColor = indicatorItem.Inverse_Icon_Foreground__c; + item.BadgeTextColor = indicatorItem.Badge_Text_Color__c; + item.BadgeIconPosition = indicatorItem.Badge_Icon_Position__c; + item.FalseBadgeTextColor = indicatorItem.Inverse_Badge_Text_Color__c; + item.FalseBadgeIconPosition = indicatorItem.Inverse_Badge_Icon_Position__c; List itemExtensions = Cmdt.getExtensionsForItem(indicatorItem.DeveloperName); @@ -229,7 +245,8 @@ public with sharing class IndicatorController { extension.ExtensionId = itemExtension.Id; extension.BackgroundColor = itemExtension.Icon_Background__c; extension.ForegroundColor = itemExtension.Icon_Foreground__c; - + extension.BadgeTextColor = itemExtension.Badge_Text_Color__c; + extension.BadgeIconPosition = itemExtension.Badge_Icon_Position__c; item.Extensions.add(extension); } @@ -306,6 +323,10 @@ public with sharing class IndicatorController { item.ForegroundColor = indicatorItem.Icon_Foreground__c; item.InverseBackgroundColor = indicatorItem.Inverse_Icon_Background__c; item.InverseForegroundColor = indicatorItem.Inverse_Icon_Foreground__c; + item.BadgeTextColor = indicatorItem.Badge_Text_Color__c; + item.BadgeIconPosition = indicatorItem.Badge_Icon_Position__c; + item.FalseBadgeTextColor = indicatorItem.Inverse_Badge_Text_Color__c; + item.FalseBadgeIconPosition = indicatorItem.Inverse_Badge_Icon_Position__c; List itemExtensions = Cmdt.getExtensionsForItem(indicatorItem.DeveloperName); @@ -329,6 +350,8 @@ public with sharing class IndicatorController { extension.ExtensionId = itemExtension.Id; extension.BackgroundColor = itemExtension.Icon_Background__c; extension.ForegroundColor = itemExtension.Icon_Foreground__c; + extension.BadgeTextColor = itemExtension.Badge_Text_Color__c; + extension.BadgeIconPosition = itemExtension.Badge_Icon_Position__c; item.Extensions.add(extension); } diff --git a/force-app/main/default/lwc/indicatorBundle/indicatorBundle.html b/force-app/main/default/lwc/indicatorBundle/indicatorBundle.html index b892cc9..eb911e9 100644 --- a/force-app/main/default/lwc/indicatorBundle/indicatorBundle.html +++ b/force-app/main/default/lwc/indicatorBundle/indicatorBundle.html @@ -50,17 +50,32 @@

@@ -92,6 +107,9 @@

+