Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge main into feature/nov26-fix-percent #54

Open
wants to merge 8 commits into
base: feature/nov26-fix-percent
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,20 @@ function formatDateTimeLocale(dateStr, hasDate, hasTime) {
timeZone: TIMEZONE
};
if (hasDate) {
options.dateStyle = 'medium';
// Note that setting to short will have a 2-digit year, but we want 4 digit
//options.dateStyle = 'short';

options.year = 'numeric';
options.month = '2-digit';
options.day = '2-digit';
}
// If we leave default formatting (not setting date and time options) then time is not shown
if (hasTime) {
options.timeStyle = 'short';
// timeStyle short is the format we want, but since we need a 4 digit year, we need to set the time components manually
//options.timeStyle = 'short';

options.hour = '2-digit';
options.minute = '2-digit';
}
return new Intl.DateTimeFormat(LOCALE, options).format(new Date(dateStr));
}
Expand Down Expand Up @@ -70,7 +80,13 @@ export default class StickySelectronDataCell extends LightningElement {

get fieldValForObject() {
const inputVal = this.object?.[this.fieldName];
if (inputVal) {
// We may get a zero value from Apex that should still be rendered with our JS formatting
if (
inputVal ||
this.sfType === 'CURRENCY' ||
this.sfType === 'PERCENT' ||
this.sfType === 'DOUBLE'
) {
if (this.sfType === 'DATETIME') {
const hasDate = true;
const hasTime = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
class="slds-float_left slds-var-m-top_xx-small slds-var-p-around_x-small slds-scrollable_y grid-main"
>
<!-- Spinner -->
<template if:true={isLoading}>
<template if:true={stillShowLoading}>
<div class="slds-var-p-around_x-large spinner">
<lightning-spinner
alternative-text="Loading"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,27 @@ export default class StickySelectronMain extends LightningElement {
@api initialListCount;
isLoading = false;

// We want to continue showing the loading icon if our LWC hasn't rendered yet,
// if the input list is empty, or if the input table field metadata hasn't finished yet
// Also we have to detect if the input list is empty because someone searched and there are no hits
// Note that we compare the inputTableFieldNames length to the fieldsOnLeft length - 1 because of the Select column that is in the fieldsOnLeft but
// not in the inputTableFieldNames
get stillShowLoading() {
const shouldShowLoading =
this.isLoading ||
this.workingInputObjList.length === 0 ||
this.inputTableFieldNames.length !== this.fieldsOnLeft.length - 1;
if (shouldShowLoading) {
const inp = this.template.querySelector('lightning-input');
const searchKey = inp?.value;
// If there is a search key set, we should not show the loading icon
if (searchKey && this.workingInputObjList.length === 0) {
return false;
}
}
return shouldShowLoading;
}

@api inputTableFieldNames;
@api selectedTableFieldNames;

Expand Down Expand Up @@ -343,8 +364,15 @@ export default class StickySelectronMain extends LightningElement {
recs.push(rec);
break;
}
// Added logic to replace %, /, and $ from search key because
// we are searching just the values from Salesforce (not the HTML displayed)
} else if (typeof val === 'number') {
if (val.toString().includes(searchKey)) {
const searchKeyToCheck = searchKey
.replaceAll('%', '')
.replaceAll('/', '')
.replaceAll('$', '')
.replaceAll(',', '');
if (val.toString().includes(searchKeyToCheck)) {
recs.push(rec);
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@
<queriedFields>ssCurrency__c</queriedFields>
<queriedFields>ssDateTime__c</queriedFields>
<queriedFields>AnnualRevenue</queriedFields>
<queriedFields>NewCurrency__c</queriedFields>
<queriedFields>CreatedDate</queriedFields>
</recordLookups>
<screens>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
<field>NewCurrency__c</field>
<field>ssCurrency__c</field>
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
Expand All @@ -41,6 +41,10 @@
<behavior>Edit</behavior>
<field>ssDate__c</field>
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
<field>ssDateTime__c</field>
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
<field>ssTime__c</field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@
<behavior>Edit</behavior>
<field>NumberOfEmployees</field>
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
<field>NewCurrency__c</field>
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
<field>ssDouble__c</field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
<field>NewCurrency__c</field>
<field>ssCurrency__c</field>
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
Expand All @@ -53,6 +53,10 @@
<behavior>Edit</behavior>
<field>ssDate__c</field>
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
<field>ssDateTime__c</field>
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
<field>ssTime__c</field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
<behavior>Edit</behavior>
<field>AnnualRevenue</field>
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
<field>NewCurrency__c</field>
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
<field>ssDouble__c</field>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>ssDateTime__c</fullName>
<description>Help field for sticky selectron dev</description>
<label>ssDateTime</label>
<required>false</required>
<trackFeedHistory>false</trackFeedHistory>
<type>DateTime</type>
</CustomField>
Loading