+
+ |
-
+ |
diff --git a/force-app/main/default/lwc/simpliUIListViewsAdminModal/simpliUIListViewsAdminModal.js b/force-app/main/default/lwc/simpliUIListViewsAdminModal/simpliUIListViewsAdminModal.js
index 21ebdd2..ac01261 100644
--- a/force-app/main/default/lwc/simpliUIListViewsAdminModal/simpliUIListViewsAdminModal.js
+++ b/force-app/main/default/lwc/simpliUIListViewsAdminModal/simpliUIListViewsAdminModal.js
@@ -2,7 +2,7 @@
/* eslint-disable no-useless-return */
/* eslint-disable no-console */
/* eslint-disable no-else-return */
-import { LightningElement, wire, track, api } from 'lwc';
+import { LightningElement, wire, track, api } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { NavigationMixin, CurrentPageReference } from 'lightning/navigation';
import * as SLVHelper from 'c/simpliUIListViewsHelper';
@@ -30,7 +30,7 @@ import Column_Styles from '@salesforce/label/c.Column_Styles';
import Font from '@salesforce/label/c.Font';
import Decoration from '@salesforce/label/c.Decoration';
import Style from '@salesforce/label/c.Style';
-import constiant from '@salesforce/label/c.constiant';
+import Variant from '@salesforce/label/c.Variant';
import Transform from '@salesforce/label/c.Transform';
import Weight from '@salesforce/label/c.Weight';
import Alignment from '@salesforce/label/c.Alignment';
@@ -48,8 +48,8 @@ export default class simpliUIListViewsAdminModal extends NavigationMixin(Lightni
@api showModal; //indicates whether this modal dialog should be displayed or not.
@api listViewObject; //the object of the list view.
//have to use get/set methods as we are not using the wired approach
- @api get listViewName() { return this.lvName; }
- set listViewName(value) { this.lvName = value; this.getListViewConfig(); }
+ @api get listViewName() { return this.lvName; }
+ set listViewName(value) { this.lvName = value; this.getListViewConfig(); }
@api listViewMode; //indicates the mode of the list view calling the admin page.
@track spinner = false; //identifies if the spinner should be displayed or not.
@@ -77,82 +77,82 @@ export default class simpliUIListViewsAdminModal extends NavigationMixin(Lightni
@track newColumnStyleDecoration;
@track newColumnStyleStyle;
@track newColumnStyleTransform;
- @track newColumnStyleconstiant;
+ @track newColumnStyleVariant;
@track newColumnStyleWeight;
@track newColumnStyleAlignment;
get fontStyleList() {
return [
- { label: 'Arial', value: 'Arial' },
- { label: 'Arial Black', value: 'Arial Black' },
- { label: 'Comic Sans', value: 'Comic Sans' },
- { label: 'Courier', value: 'Courier' },
- { label: 'Georgia', value: 'Georgia' },
- { label: 'Impact', value: 'Impact' },
- { label: 'Lucida Console', value: 'Lucida Console' },
- { label: 'Lucida Sans', value: 'Lucida Sans' },
- { label: 'Palatino', value: 'Palatino' },
- { label: 'Tahoma', value: 'Tahoma' },
- { label: 'Trebuchet', value: 'Trebuchet' },
- { label: 'Times New Roman', value: 'Times New Roman' },
- { label: 'Verdana', value: 'Verdana' },
+ { label: 'Arial', value: 'Arial'},
+ { label: 'Arial Black', value: 'Arial Black'},
+ { label: 'Comic Sans', value: 'Comic Sans'},
+ { label: 'Courier', value: 'Courier'},
+ { label: 'Georgia', value: 'Georgia'},
+ { label: 'Impact', value: 'Impact'},
+ { label: 'Lucida Console', value: 'Lucida Console'},
+ { label: 'Lucida Sans', value: 'Lucida Sans'},
+ { label: 'Palatino', value: 'Palatino'},
+ { label: 'Tahoma', value: 'Tahoma'},
+ { label: 'Trebuchet', value: 'Trebuchet'},
+ { label: 'Times New Roman', value: 'Times New Roman'},
+ { label: 'Verdana', value: 'Verdana'},
];
}
-
+
get decorationStyleList() {
return [
- { label: 'None', value: 'none' },
- { label: 'Underline', value: 'underline' },
- { label: 'Overline', value: 'overline' },
- { label: 'Line Thru', value: 'line-through' },
+ { label: 'None', value: 'none'},
+ { label: 'Underline', value: 'underline'},
+ { label: 'Overline', value: 'overline'},
+ { label: 'Line Thru', value: 'line-through'},
];
}
get styleStyleList() {
return [
- { label: 'Normal', value: 'normal' },
- { label: 'Unset', value: 'unset' },
- { label: 'Italic', value: 'italic' },
- { label: 'Oblique', value: 'oblique' },
+ { label: 'Normal', value: 'normal'},
+ { label: 'Unset', value: 'unset'},
+ { label: 'Italic', value: 'italic'},
+ { label: 'Oblique', value: 'oblique'},
];
}
get transformStyleList() {
return [
- { label: 'None', value: 'none' },
- { label: 'Uppercase', value: 'uppercase' },
- { label: 'Lowercase', value: 'lowercase' },
- { label: 'Capitalize', value: 'capitalize' },
+ { label: 'None', value: 'none'},
+ { label: 'Uppercase', value: 'uppercase'},
+ { label: 'Lowercase', value: 'lowercase'},
+ { label: 'Capitalize', value: 'capitalize'},
];
}
- get constiantStyleList() {
+ get variantStyleList() {
return [
- { label: 'Normal', value: 'normal' },
- { label: 'Small Caps', value: 'small-caps' },
+ { label: 'Normal', value: 'normal'},
+ { label: 'Small Caps', value: 'small-caps'},
];
}
get weightStyleList() {
return [
- { label: 'Normal', value: 'normal' },
- { label: 'Bold', value: 'bold' },
+ { label: 'Normal', value: 'normal'},
+ { label: 'Bold', value: 'bold'},
];
}
get alignmentList() {
return [
- { label: 'Left', value: 'left' },
- { label: 'Right', value: 'right' },
- { label: 'Center', value: 'center' },
- { label: 'Justify', value: 'justify' },
+ { label: 'Left', value: 'left'},
+ { label: 'Right', value: 'right'},
+ { label: 'Center', value: 'center'},
+ { label: 'Justify', value: 'justify'},
];
}
get booleanList() {
return [
- { label: 'Yes', value: 'true' },
- { label: 'No', value: 'false' },
+ { label: 'Yes', value: 'true'},
+ { label: 'No', value: 'false'},
];
}
@@ -166,14 +166,14 @@ export default class simpliUIListViewsAdminModal extends NavigationMixin(Lightni
get operatorList() {
if (this.newConditionColumn === undefined) {
- return [];
+ return [ ];
} else if (this.newConditionColumn.type === 'boolean') {
return [
{ label: 'Equals', value: 'Equals' },
{ label: 'Not Equal', value: 'Not Equal' },
];
- } else if (this.newConditionColumn.type === 'date'
- || this.newConditionColumn.type === 'datetime') {
+ } else if (this.newConditionColumn.type === 'date'
+ || this.newConditionColumn.type === 'datetime') {
return [
{ label: 'Equals', value: 'Equals' },
{ label: 'Not Equal', value: 'Not Equal' },
@@ -201,11 +201,10 @@ export default class simpliUIListViewsAdminModal extends NavigationMixin(Lightni
];
}
- label = {
- Close, List_View_Config, Settings, Parameter_Name, Value, Select_A_Value, Highlighting, Add_Remove, Field,
- Operator, Precedence, Color, Field_Name, Remove_Condition, Select_A_Column, Enter_A_Value, Add_Condition,
- Update, Column_Styles, Font, Decoration, Style, constiant, Transform, Weight, Alignment
- }
+ label = { Close, List_View_Config, Settings, Parameter_Name, Value, Select_A_Value, Highlighting, Add_Remove, Field,
+ Operator, Precedence, Color, Field_Name, Remove_Condition, Select_A_Column, Enter_A_Value, Add_Condition,
+ Update, Column_Styles, Font, Decoration, Style, Variant, Transform, Weight, Alignment
+ }
constructor() {
super();
@@ -214,12 +213,12 @@ export default class simpliUIListViewsAdminModal extends NavigationMixin(Lightni
/*
* Method which gets called after the class has been instantiated
- * but before it is rendered. We do have access to constiables in this method.
+ * but before it is rendered. We do have access to variables in this method.
*/
renderedCallback() {
console.log('Starting simpliUIListViewsAdminModal.renderedCallback');
-
+
if (this.listViewConfig === undefined) {
this.configChanged = false;
getListViewConfig();
@@ -229,38 +228,39 @@ export default class simpliUIListViewsAdminModal extends NavigationMixin(Lightni
@wire(CurrentPageReference)
setCurrentPageReference(currentPageReference) {
this.currentPageReference = currentPageReference;
- if (this.currentPageReference) {
- window.console.log('Current Page Reference...' + JSON.stringify(this.currentPageReference));
+ if(this.currentPageReference) {
+ window.console.log('Current Page Reference...'+JSON.stringify(this.currentPageReference));
}
- let testparam = this.currentPageReference.attributes.apiName;
+ let testparam=this.currentPageReference.attributes.apiName;
console.log('OBJ Name - ' + testparam);
}
getListViewConfig() {
console.log('Starting getListViewConfig - ' + this.listViewObject + ' - ' + this.listViewName + ' - ' + this.listViewMode);
- if (this.listViewObject !== undefined && this.listViewObject !== null
- && this.listViewName !== undefined && this.listViewName !== null
- && this.listViewMode !== undefined && this.listViewMode !== null) {
+ if (this.listViewObject !== undefined && this.listViewObject !== null
+ && this.listViewName !== undefined && this.listViewName !== null
+ && this.listViewMode !== undefined && this.listViewMode !== null)
+ {
console.log('Getting ListViewConfigs - ' + this.listViewObject + ' - ' + this.listViewName + ' - ' + this.listViewMode);
- getListViewConfig({ objectName: this.listViewObject, listViewName: this.listViewName, listViewMode: this.listViewMode })
- .then(result => {
- console.log('List view config retrieval successful');
- console.log('List View Config - ' + JSON.stringify(result));
- this.listViewConfig = result;
- this.setStyleColumns();
- })
- .catch(error => {
- console.log('Error Detected - ' + JSON.stringify(error));
- this.listViewConfig = undefined;
- this.dispatchEvent(new ShowToastEvent({
- title: 'Error Retrieving List View Config',
- message: 'There was an error retrieving the list view configuration - ' + error.body.message,
- constiant: 'error',
- mode: 'sticky'
- }));
- });
+ getListViewConfig({objectName: this.listViewObject, listViewName: this.listViewName, listViewMode: this.listViewMode })
+ .then(result => {
+ console.log('List view config retrieval successful');
+ console.log('List View Config - ' + JSON.stringify(result));
+ this.listViewConfig = result;
+ this.setStyleColumns();
+ })
+ .catch(error => {
+ console.log('Error Detected - ' + JSON.stringify(error));
+ this.listViewConfig = undefined;
+ this.dispatchEvent(new ShowToastEvent({
+ title: 'Error Retrieving List View Config',
+ message: 'There was an error retrieving the list view configuration - ' + error.body.message,
+ variant: 'error',
+ mode: 'sticky'
+ }));
+ });
}
}
@@ -287,232 +287,223 @@ export default class simpliUIListViewsAdminModal extends NavigationMixin(Lightni
/*
* Wiring to get the list of objects in the system
*/
- @wire(getListViewColumns, { objectName: '$listViewObject', listViewName: '$listViewName' })
+ @wire (getListViewColumns, { objectName: '$listViewObject', listViewName: '$listViewName' })
wiredListViewColumns({ error, data }) {
- if (data) {
- console.log('List view column label retrieval successful');
+ if (data) {
+ console.log('List view column label retrieval successful');
this.listViewColumns = data;
this.setStyleColumns();
this.resetNewCondition();
this.resetNewColumnStyle();
- } else if (error) {
+ } else if (error) {
console.log('Error Detected - ' + error.body.message + ' | ' + error.body.stackTrace);
- this.listViewColumns = undefined;
+ this.listViewColumns = undefined;
this.dispatchEvent(new ShowToastEvent({
title: 'Error Retrieving List View Column Labels',
message: 'There was an error retrieving the list view column labels - ' + error.body.message + '\n\n' + error.body.stackTrace,
- constiant: 'error',
+ variant: 'error',
mode: 'sticky'
}));
}
}
- handleParamLoad(event) {
- try {
- const { target } = event;
- this.paramNameLoad = target?.name ?? '';
+ handleParamLoad(event)
+ {
+ this.paramNameLoad = event.target.name;
- this.paramValueLoad = target?.value ?? '';
+ this.paramValueLoad = event.target.value;
- console.log('Param loaded - ' + this.paramNameLoad + ' - ' + this.paramValueLoad);
+ console.log('Param loaded - ' + this.paramNameLoad + ' - ' + this.paramValueLoad);
- this.closeDisabled = true;
- this.configChanged = true;
- } catch (error) {
- SLVHelper.showErrorMessage(error);
- }
+ this.closeDisabled = true;
+ this.configChanged = true;
}
//called when a value is changed.
handleParamUpdate(event) {
- try {
- const { target } = event;
- const name = target?.name ?? '';
- const value = target?.value ?? '';
- let type = target?.dataset?.type ?? '';
- const label = target?.label ?? '';
-
- this.closeDisabled = true;
-
- if (type === undefined) {
- type = 'Boolean';
- }
- console.log('Inside handleParamChange - ' + name + '/' + value);
+ var name = event.target.name;
+ var value = event.target.value;
+ var type = event.target.dataset.type;
+ var label = event.target.label;
- console.log('Starting value - ' + this.paramValueLoad);
+ this.closeDisabled = true;
+
+ if (type === undefined) {
+ type = 'Boolean';
+ }
+
+ console.log('Inside handleParamChange - ' + name + '/' + value);
- //if we are leaving the param with no value change then do nothing.
- if (value === this.paramValueLoad) {
- this.paramValueLoad = undefined;
- this.paramNameLoad = undefined;
- return;
- }
+ console.log('Starting value - ' + this.paramValueLoad);
- console.log('Param being processed');
+ //if we are leaving the param with no value change then do nothing.
+ if (value === this.paramValueLoad) {
+ this.paramValueLoad = undefined;
+ this.paramNameLoad = undefined;
+ return;
+ }
- processParamChange({ objectName: this.listViewObject, listViewName: this.listViewName, paramName: name, paramValue: value, paramLabel: label, paramType: type })
- .then(result => {
- const resultStr = result;
+ console.log('Param being processed');
- //get the status
- let status = resultStr.substring(0, resultStr.indexOf(':'));
+ processParamChange({ objectName: this.listViewObject, listViewName: this.listViewName, paramName: name, paramValue: value, paramLabel: label, paramType: type})
+ .then(result => {
+ var resultStr = result;
- //get any associated message
- let message = resultStr.substring(resultStr.indexOf(':') + 1);
- if (message === '' && status !== 'Ok') {
- message = 'There was an error processing the records.';
- }
+ //get the status
+ let status = resultStr.substring(0, resultStr.indexOf(':'));
+
+ //get any associated message
+ let message = resultStr.substring(resultStr.indexOf(':')+1);
+ if (message === '' && status !== 'Ok') {
+ message = 'There was an error processing the records.';
+ }
- if (status === 'Ok') {
- this.dispatchEvent(new ShowToastEvent({
- title: 'Parameter Updated Successfully!',
- message: message,
- constiant: 'success',
- mode: 'dismissable'
- }));
- this.configChanged = true;
- this.getListViewConfig(); //reget the config
-
- } else {
- this.dispatchEvent(new ShowToastEvent({
- title: 'Processing Error!',
- message: message,
- constiant: 'error',
- mode: 'sticky'
- }));
- return;
- }
- })
- .catch(error => {
- console.log('Error Detected - ' + error.body.message + ' | ' + error.body.stackTrace);
+ if (status === 'Ok') {
+ this.dispatchEvent(new ShowToastEvent({
+ title: 'Parameter Updated Successfully!',
+ message: message,
+ variant: 'success',
+ mode: 'dismissable'
+ }));
+ this.configChanged = true;
+ this.getListViewConfig(); //reget the config
+
+ } else {
this.dispatchEvent(new ShowToastEvent({
- title: 'Processing Error',
- message: 'There was an error processing the param changes - ' + error.body.message,
- constiant: 'error',
+ title: 'Processing Error!',
+ message: message,
+ variant: 'error',
mode: 'sticky'
}));
return;
- });
+ }
+ })
+ .catch(error => {
+ console.log('Error Detected - ' + error.body.message + ' | ' + error.body.stackTrace);
+ this.dispatchEvent(new ShowToastEvent({
+ title: 'Processing Error',
+ message: 'There was an error processing the param changes - ' + error.body.message,
+ variant: 'error',
+ mode: 'sticky'
+ }));
+ return;
+ });
- this.paramValueLoad = undefined;
- this.paramNameLoad = undefined;
- } catch (error) {
- SLVHelper.showErrorMessage(error);
- }
+ this.paramValueLoad = undefined;
+ this.paramNameLoad = undefined;
}
//---------------------------------------------------------------------------------------------------------
// CONDITION METHODS
//---------------------------------------------------------------------------------------------------------
handleConditionChange(event) {
- this.spinner = true;
- try {
- const { target } = event;
- const id = target?.name ?? '';
- const action = target?.value ?? '';
- let resultStr;
- const valuesMap = new Map();
- let strParamsMap;
- let errorMsg = '';
+ var id = event.target.name;
+ var action = event.target.value;
+ var resultStr;
+ var valuesMap = new Map();
+ var strParamsMap;
+ var errorMsg = '';
- console.log('Id - ' + id);
- console.log('Action - ' + action);
+ console.log('Id - ' + id);
+ console.log('Action - ' + action);
+ this.spinner = true;
- //if we are REMOVING we just need to pass the id of the condition
- if (action === 'remove') {
+ //if we are REMOVING we just need to pass the id of the condition
+ if (action === 'remove') {
+
+ strParamsMap = id;
+
+ //if we are ADDING we need to pass all condition information
+ } else if (action === 'add') {
+
+ if (this.newConditionField === undefined || this.newConditionField === '') { errorMsg = 'The condition field must be provided.'}
+ else if (this.newConditionValue === undefined || this.newConditionValue === '') { errorMsg = 'The condition value must be provided.'}
+
+ //if we have an error
+ if (errorMsg !== '')
+ {
+ this.dispatchEvent(new ShowToastEvent({
+ title: 'Condition Error',
+ message: errorMsg,
+ variant: 'error',
+ mode: 'sticky'
+ }));
+ this.spinner = false;
+ return;
+ }
- strParamsMap = id;
+ valuesMap.set('field', this.newConditionField);
+ valuesMap.set('operator', this.newConditionOperator);
+ valuesMap.set('value', this.newConditionValue);
+ valuesMap.set('order', this.newConditionOrder);
+ valuesMap.set('color', this.newConditionColor);
- //if we are ADDING we need to pass all condition information
- } else if (action === 'add') {
+ strParamsMap = JSON.stringify( Array.from(valuesMap) );
+ console.log('Params Field/Value - ' + strParamsMap);
- if (this.newConditionField === undefined || this.newConditionField === '') { errorMsg = 'The condition field must be provided.' }
- else if (this.newConditionValue === undefined || this.newConditionValue === '') { errorMsg = 'The condition value must be provided.' }
+ }
- //if we have an error
- if (errorMsg !== '') {
+ processConditionChange({ objectName: this.listViewObject, listViewName: this.listViewName, action: action, conditionData: strParamsMap})
+ .then(result => {
+ resultStr = result;
+
+ //get the status
+ let status = resultStr.substring(0, resultStr.indexOf(':'));
+
+ //get any associated message
+ let message = resultStr.substring(resultStr.indexOf(':')+1);
+ if (message === '' && status === 'Ok') {
+ message = 'All conditions processed.';
+ } else if (message === '' && status !== 'Ok') {
+ message = 'There was an error processing the condition.';
+ }
+
+ if (status === 'Ok') {
this.dispatchEvent(new ShowToastEvent({
- title: 'Condition Error',
- message: errorMsg,
- constiant: 'error',
- mode: 'sticky'
+ title: 'Condition Updated Successfully!',
+ message: message,
+ variant: 'success',
+ mode: 'dismissable'
}));
+ this.getListViewConfig();
+ this.configChanged = true;
+ this.resetNewCondition();
this.spinner = false;
- return;
- }
-
- valuesMap.set('field', this.newConditionField);
- valuesMap.set('operator', this.newConditionOperator);
- valuesMap.set('value', this.newConditionValue);
- valuesMap.set('order', this.newConditionOrder);
- valuesMap.set('color', this.newConditionColor);
-
- strParamsMap = JSON.stringify(Array.from(valuesMap));
- console.log('Params Field/Value - ' + strParamsMap);
-
- }
-
- processConditionChange({ objectName: this.listViewObject, listViewName: this.listViewName, action: action, conditionData: strParamsMap })
- .then(result => {
- resultStr = result;
-
- //get the status
- let status = resultStr.substring(0, resultStr.indexOf(':'));
-
- //get any associated message
- let message = resultStr.substring(resultStr.indexOf(':') + 1);
- if (message === '' && status === 'Ok') {
- message = 'All conditions processed.';
- } else if (message === '' && status !== 'Ok') {
- message = 'There was an error processing the condition.';
- }
-
- if (status === 'Ok') {
- this.dispatchEvent(new ShowToastEvent({
- title: 'Condition Updated Successfully!',
- message: message,
- constiant: 'success',
- mode: 'dismissable'
- }));
- this.getListViewConfig();
- this.configChanged = true;
- this.resetNewCondition();
-
- } else {
- this.dispatchEvent(new ShowToastEvent({
- title: 'Processing Error!',
- message: message,
- constiant: 'error',
- mode: 'sticky'
- }));
- return;
- }
- })
- .catch(error => {
- resultStr = undefined;
- console.log('Error Detected - ' + error.body.message + ' | ' + error.body.stackTrace);
+ } else {
this.dispatchEvent(new ShowToastEvent({
- title: 'Processing Error',
- message: 'There was an error processing the condition changes - ' + error.body.message,
- constiant: 'error',
+ title: 'Processing Error!',
+ message: message,
+ variant: 'error',
mode: 'sticky'
}));
+ this.spinner = false;
return;
- });
+ }
+ })
+ .catch(error => {
+ resultStr = undefined;
+ console.log('Error Detected - ' + error.body.message + ' | ' + error.body.stackTrace);
+
+ this.dispatchEvent(new ShowToastEvent({
+ title: 'Processing Error',
+ message: 'There was an error processing the condition changes - ' + error.body.message,
+ variant: 'error',
+ mode: 'sticky'
+ }));
+ this.spinner = false;
+ return;
+ });
+
+ this.configChanged = true;
- this.configChanged = true;
- } catch (error) {
- SLVHelper.showErrorMessage(error);
- } finally {
- this.spinner = false;
- }
}
resetNewCondition() {
- if (this.listViewColumns !== undefined && this.listViewColumns.length > 0) {
+ if (this.listViewColumns !== undefined && this.listViewColumns.length > 0)
+ {
this.firstConditionField = this.listViewColumns[0].value;
this.newConditionColumn = this.listViewColumns[0];
this.newConditionField = this.listViewColumns[0].value;
@@ -524,173 +515,150 @@ export default class simpliUIListViewsAdminModal extends NavigationMixin(Lightni
}
handleConditionFieldChange(event) {
- try {
- const { target } = event;
- this.newConditionField = target?.value ?? '';
- console.log('New Condition Field Change - ' + this.newConditionField);
-
- //go find type for new field and set
- if (this.listViewColumns?.length) {
- this.listViewColumns.forEach(element => {
- if (element.value === this.newConditionField) {
- this.newConditionColumn = element;
- }
- });
- }
-
- this.newConditionValue = undefined;
- } catch (error) {
- SLVHelper.showErrorMessage(error);
- }
+ this.newConditionField = event.target.value;
+ console.log('New Condition Field Change - ' + this.newConditionField);
+
+ //go find type for new field and set
+ this.listViewColumns.forEach(element => {
+ if (element.value === this.newConditionField)
+ {
+ this.newConditionColumn = element;
+ }
+ });
+ this.newConditionValue = undefined;
}
handleConditionOperatorChange(event) {
- try {
- const { target } = event;
- this.newConditionOperator = target?.value ?? '';
- console.log('New Condition Operator Change - ' + this.newConditionOperator);
- } catch (error) {
- SLVHelper.showErrorMessage(error);
- }
+ this.newConditionOperator = event.target.value;
+ console.log('New Condition Operator Change - ' + this.newConditionOperator);
}
handleConditionValueChange(event) {
- try {
- const { target } = event;
- this.newConditionValue = target?.value ?? '';
- console.log('New Condition Value Change - ' + this.newConditionValue);
- } catch (error) {
- SLVHelper.showErrorMessage(error);
- }
+ this.newConditionValue = event.target.value;
+ console.log('New Condition Value Change - ' + this.newConditionValue);
}
handleConditionOrderChange(event) {
- try {
- const { target } = event;
- this.newConditionOrder = target.value ?? '';
- console.log('New Condition Order Change - ' + this.newConditionOrder);
- } catch (error) {
- SLVHelper.showErrorMessage(error);
- }
+ this.newConditionOrder = event.target.value;
+ console.log('New Condition Order Change - ' + this.newConditionOrder);
}
handleConditionColorChange(event) {
- try {
- const { target } = event;
- this.newConditionColor = target?.value ?? '';
- console.log('New Condition Color Change - ' + this.newConditionColor);
- } catch (error) {
- SLVHelper.showErrorMessage(error);
- }
+ this.newConditionColor = event.target.value;
+ console.log('New Condition Color Change - ' + this.newConditionColor);
}
//---------------------------------------------------------------------------------------------------------
// STYLE METHODS
//---------------------------------------------------------------------------------------------------------
handleColumnStyleChange(event) {
+ var id = event.target.name;
+ var action = event.target.value;
+ var resultStr;
+ var valuesMap = new Map();
+ var strParamsMap;
+ var errorMsg = '';
+
+ console.log('Id - ' + id);
+ console.log('Action - ' + action);
+
this.spinner = true;
- try {
- const { target } = event;
- const id = target?.name ?? '';
- const action = target?.value ?? '';
- let resultStr;
- const valuesMap = new Map();
- let strParamsMap;
- let errorMsg = '';
- console.log('Id - ' + id);
- console.log('Action - ' + action);
+ //if we are REMOVING we just need to pass the id of the column style
+ if (action === 'remove') {
- //if we are REMOVING we just need to pass the id of the column style
- if (action === 'remove') {
+ strParamsMap = id;
- strParamsMap = id;
+ //if we are ADDING we need to pass all style information
+ } else if (action === 'add') {
- //if we are ADDING we need to pass all style information
- } else if (action === 'add') {
+ if (SLVHelper.isEmpty(this.newColumnStyleField)) { errorMsg = 'The style field must be provided.'}
- if (SLVHelper.isEmpty(this.newColumnStyleField)) { errorMsg = 'The style field must be provided.' }
+ //if we have an error
+ if (errorMsg !== '')
+ {
+ this.dispatchEvent(new ShowToastEvent({
+ title: 'Style Error',
+ message: errorMsg,
+ variant: 'error',
+ mode: 'sticky'
+ }));
+ this.spinner = false;
+ return;
+ }
- //if we have an error
- if (errorMsg !== '') {
- this.dispatchEvent(new ShowToastEvent({
- title: 'Style Error',
- message: errorMsg,
- constiant: 'error',
- mode: 'sticky'
- }));
- this.spinner = false;
- return;
- }
+ valuesMap.set('field', this.newColumnStyleField);
+ valuesMap.set('font', this.newColumnStyleFont);
+ valuesMap.set('decoration', this.newColumnStyleDecoration);
+ valuesMap.set('style', this.newColumnStyleStyle);
+ valuesMap.set('transform', this.newColumnStyleTransform);
+ valuesMap.set('variant', this.newColumnStyleVariant);
+ valuesMap.set('weight', this.newColumnStyleWeight);
+ valuesMap.set('alignment', this.newColumnStyleAlignment);
+
+ strParamsMap = JSON.stringify( Array.from(valuesMap) );
+ console.log('Params Field/Value - ' + strParamsMap);
- valuesMap.set('field', this.newColumnStyleField);
- valuesMap.set('font', this.newColumnStyleFont);
- valuesMap.set('decoration', this.newColumnStyleDecoration);
- valuesMap.set('style', this.newColumnStyleStyle);
- valuesMap.set('transform', this.newColumnStyleTransform);
- valuesMap.set('constiant', this.newColumnStyleconstiant);
- valuesMap.set('weight', this.newColumnStyleWeight);
- valuesMap.set('alignment', this.newColumnStyleAlignment);
+ }
- strParamsMap = JSON.stringify(Array.from(valuesMap));
- console.log('Params Field/Value - ' + strParamsMap);
+ processColumnStyleChange({ objectName: this.listViewObject, listViewName: this.listViewName, action: action, columnStyleData: strParamsMap})
+ .then(result => {
+ resultStr = result;
- }
+ //get the status
+ let status = resultStr.substring(0, resultStr.indexOf(':'));
+
+ //get any associated message
+ let message = resultStr.substring(resultStr.indexOf(':')+1);
- processColumnStyleChange({ objectName: this.listViewObject, listViewName: this.listViewName, action: action, columnStyleData: strParamsMap })
- .then(result => {
- resultStr = result;
-
- //get the status
- let status = resultStr.substring(0, resultStr.indexOf(':'));
-
- //get any associated message
- let message = resultStr.substring(resultStr.indexOf(':') + 1);
-
- if (status === 'Ok') {
- message = 'All column styles processed.';
-
- this.dispatchEvent(new ShowToastEvent({
- title: 'Style Updated Successfully!',
- message: message,
- constiant: 'success',
- mode: 'dismissable'
- }));
- this.getListViewConfig();
- this.configChanged = true;
- this.resetNewColumnStyle();
- } else {
- message = 'There was an error processing the column style.';
- this.dispatchEvent(new ShowToastEvent({
- title: 'Processing Error!',
- message: message,
- constiant: 'error',
- mode: 'sticky'
- }));
- }
- })
- .catch(error => {
- resultStr = undefined;
- console.log('Error Detected - ' + error.body.message + ' | ' + error.body.stackTrace);
+ if (status === 'Ok') {
+ message = 'All column styles processed.';
this.dispatchEvent(new ShowToastEvent({
- title: 'Processing Error',
- message: 'There was an error processing the column style changes - ' + error.body.message,
- constiant: 'error',
+ title: 'Style Updated Successfully!',
+ message: message,
+ variant: 'success',
+ mode: 'dismissable'
+ }));
+ this.getListViewConfig();
+ this.configChanged = true;
+ this.resetNewColumnStyle();
+ this.spinner = false;
+
+ } else {
+ message = 'There was an error processing the column style.';
+
+ this.dispatchEvent(new ShowToastEvent({
+ title: 'Processing Error!',
+ message: message,
+ variant: 'error',
mode: 'sticky'
}));
- });
+ this.spinner = false;
+ return;
+ }
+ })
+ .catch(error => {
+ resultStr = undefined;
+ console.log('Error Detected - ' + error.body.message + ' | ' + error.body.stackTrace);
+
+ this.dispatchEvent(new ShowToastEvent({
+ title: 'Processing Error',
+ message: 'There was an error processing the column style changes - ' + error.body.message,
+ variant: 'error',
+ mode: 'sticky'
+ }));
+ this.spinner = false;
+ return;
+ });
+
+ this.configChanged = true;
- this.configChanged = true;
- } catch (error) {
- SLVHelper.showErrorMessage(error);
- } finally {
- this.spinner = false;
- }
}
resetNewColumnStyle() {
- if (this.styleListViewColumns !== undefined && this.styleListViewColumns.length > 0) {
+ if (this.styleListViewColumns !== undefined && this.styleListViewColumns.length > 0)
+ {
this.firstColumnStyleField = this.styleListViewColumns[0].value;
this.newColumnStyleColumn = this.styleListViewColumns[0];
this.newColumnStyleField = this.styleListViewColumns[0].value;
@@ -699,50 +667,45 @@ export default class simpliUIListViewsAdminModal extends NavigationMixin(Lightni
this.newColumnStyleDecoration = 'none';
this.newColumnStyleStyle = 'normal';
this.newColumnStyleTransform = 'none';
- this.newColumnStyleconstiant = 'normal';
+ this.newColumnStyleVariant = 'normal';
this.newColumnStyleWeight = 'normal';
this.newColumnStyleAlignment = 'left';
}
handleColumnStyleFieldChange(event) {
- try {
- const { target } = event;
- let name = target.name ?? '';
- let value = target.value ?? '';
- console.log('New Columns Style Field Name - ' + name);
- console.log('New Column Style Field Value - ' + value);
-
- if (name === 'style') this.newColumnStyleStyle = value;
- else if (name === 'transform') this.newColumnStyleTransform = value;
- else if (name === 'constiant') this.newColumnStyleconstiant = value;
- else if (name === 'fieldName') this.newColumnStyleField = value;
- else if (name === 'decoration') this.newColumnStyleDecoration = value;
- else if (name === 'font') this.newColumnStyleFont = value;
- else if (name === 'weight') this.newColumnStyleWeight = value;
- else if (name === 'alignment') this.newColumnStyleAlignment = value;
- } catch (error) {
- SLVHelper.showErrorMessage(error);
- }
+ let name = event.target.name;
+ let value = event.target.value;
+ console.log('New Columns Style Field Name - ' + name);
+ console.log('New Column Style Field Value - ' + value);
+
+ if (name === 'style') this.newColumnStyleStyle = value;
+ else if (name === 'transform') this.newColumnStyleTransform = value;
+ else if (name === 'variant') this.newColumnStyleVariant = value;
+ else if (name === 'fieldName') this.newColumnStyleField = value;
+ else if (name === 'decoration') this.newColumnStyleDecoration = value;
+ else if (name === 'font') this.newColumnStyleFont = value;
+ else if (name === 'weight') this.newColumnStyleWeight = value;
+ else if (name === 'alignment') this.newColumnStyleAlignment = value;
}
handleClose() {
- setTimeout(function () {
+ setTimeout(function(){
console.log('after');
- }, 500); //give the parameter time to be saved before sending message to parent
+ },500); //give the parameter time to be saved before sending message to parent
this.dispatchEvent(new CustomEvent('close', { detail: this.configChanged }));
this.configChanged = false;
this.resetNewCondition();
}
- handleUpdateClick() {
- setTimeout(function () {
+ handleUpdateClick(event) {
+ setTimeout(function(){
console.log('after');
- }, 500); //give the parameter time to be saved before sending message to parent
+ },500); //give the parameter time to be saved before sending message to parent
this.closeDisabled = undefined;
this.dispatchEvent(new ShowToastEvent({
title: 'Config Updated',
message: 'Config updated successfully!',
- constiant: 'success',
+ variant: 'success',
mode: 'dismissable'
}));
}
diff --git a/force-app/main/default/lwc/simpliUIListViewsEmailTemplateModal/simpliUIListViewsEmailTemplateModal.js b/force-app/main/default/lwc/simpliUIListViewsEmailTemplateModal/simpliUIListViewsEmailTemplateModal.js
index 644d5d3..495b27f 100644
--- a/force-app/main/default/lwc/simpliUIListViewsEmailTemplateModal/simpliUIListViewsEmailTemplateModal.js
+++ b/force-app/main/default/lwc/simpliUIListViewsEmailTemplateModal/simpliUIListViewsEmailTemplateModal.js
@@ -1,5 +1,5 @@
-/* eslint-disable no-console */
-import { LightningElement, track, api } from 'lwc';
+import { LightningElement, wire, track, api } from 'lwc';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import * as SLVHelper from 'c/simpliUIListViewsHelper';
import getEmailTemplates from '@salesforce/apex/ListViewActionEmailController.getEmailTemplates';
@@ -36,8 +36,8 @@ export default class SimpliUIListViewsEmailTemplateModal extends LightningElemen
@track calloutCount = 1; //indicates the number of callouts made for this component
@track inRenderedCallback = false; //indicates whether the rendered callback method is processing
get recordCount() { //count of records provided.
- return this.recordIds.size;
- }
+ return this.recordIds.size;
+ }
label = { Create, Cancel, Save_All_Data, Reset_All_Data, Send_Email_From_Template, Select_Template, Email_Templates, Record_Count, Description, Email_Subject, Email_Body, Send_Emails };
@@ -49,7 +49,8 @@ export default class SimpliUIListViewsEmailTemplateModal extends LightningElemen
console.log('Starting simpliUIListViewsEmailTemplateModal.renderedCallback for MassCreateModal');
- if (this.showModal && this.inRenderedCallback === false) {
+ if (this.showModal && this.inRenderedCallback === false)
+ {
this.inRenderedCallback = true;
this.getEmailTemplates();
}
@@ -59,70 +60,89 @@ export default class SimpliUIListViewsEmailTemplateModal extends LightningElemen
this.dispatchEvent(new CustomEvent('close'));
}
- handleCancelClick() {
+ handleCancelClick(event) {
this.dispatchEvent(new CustomEvent('close'));
}
getEmailTemplates() {
- if (this.folderName !== '') {
+
+ if (this.folderName !== '')
+ {
this.spinnerOn();
console.log('simpliUIListViewsEmailTemplateModal CALLOUT - getEmailTemplates - ' + this.calloutCount++);
- getEmailTemplates({ folderName: this.folderName })
- .then(result => {
-
- this.templateList = result;
-
- if (this.templateList.length === 0) {
- this.dispatchEvent(SLVHelper.createToast('error', '', 'No Email Templates Available', 'No email templates available in the specified email folder(' + this.folderName + ')', false));
- }
- })
- .catch(error => {
- this.dispatchEvent(SLVHelper.createToast('error', error, 'Processing Error', 'There was an error retrieving the email templates - ', true));
- }).finally(() => this.spinnerOff());
+ getEmailTemplates({folderName: this.folderName})
+ .then(result => {
+
+ this.templateList = result;
+
+ if (this.templateList.length === 0)
+ {
+ this.dispatchEvent(SLVHelper.createToast('error', '', 'No Email Templates Available', 'No email templates available in the specified email folder(' + this.folderName + ')', false));
+ this.spinnerOff();
+ return;
+ }
+
+ this.spinnerOff();
+
+ })
+ .catch(error => {
+ this.spinnerOff();
+ this.dispatchEvent(SLVHelper.createToast('error', error, 'Processing Error', 'There was an error retrieving the email templates - ', true));
+ });
}
+
}
+
+ handleTemplateChange(event) {
- async handleTemplateChange(event) {
this.spinnerOn();
- try {
- const { target } = event;
- this.selectedTemplateName = target.value ?? '';
- const result = await getEmailTemplateDetails({ devName: this.selectedTemplateName });
- if (result) {
- this.selectedTemplate = result;
- }
- } catch (error) {
- this.dispatchEvent(SLVHelper.createToast('error', error, 'Processing Error', 'There was an error retrieving the chosen email template - ', true));
- } finally {
+ this.selectedTemplateName = event.target.value;
+
+ getEmailTemplateDetails({devName: this.selectedTemplateName})
+ .then(result => {
+
+ this.selectedTemplate = result;
this.spinnerOff();
- }
+ })
+ .catch(error => {
+ this.dispatchEvent(SLVHelper.createToast('error', error, 'Processing Error', 'There was an error retrieving the chosen email template - ', true));
+ this.spinnerOff();
+ });
}
- handleProcessClick() {
+ handleProcessClick(event) {
this.spinnerOn();
- if (this.selectedTemplateName !== undefined) {
- let selectedRecordIdsStr = JSON.stringify(Array.from(this.recordIds));
+ if (this.selectedTemplateName !== undefined)
+ {
+ let selectedRecordIdsStr = JSON.stringify( Array.from(this.recordIds));
console.log('simpliUIListViewsEmailTemplateModal CALLOUT - processEmails - ' + this.calloutCount++);
- processEmails({ templateDevName: this.selectedTemplateName, whatId: this.whatIdField, recordIdsStr: selectedRecordIdsStr })
- .then(result => {
- if (result.endsWith(':success')) {
- this.dispatchEvent(SLVHelper.createToast('success', '', 'Success', this.recordCount + ' email(s) processed successfully.', false));
- this.handleClose();
- } else if (result.endsWith(':submitted')) {
- this.dispatchEvent(SLVHelper.createToast('success', '', 'Submitted', this.recordCount + ' email(s) submitted for processing.', false));
- this.handleClose();
- } else {
- this.dispatchEvent(SLVHelper.createToast('error', '', 'Processing Error', 'There was an error processing the emails - ' + result, false));
- }
- })
- .catch(error => {
- this.dispatchEvent(SLVHelper.createToast('error', error, 'Processing Error', 'There was an error processing the emails - ', true));
- }).finally(() => this.spinnerOff());
-
+ processEmails({templateDevName: this.selectedTemplateName, whatId: this.whatIdField, recordIdsStr: selectedRecordIdsStr})
+ .then(result => {
+
+ if (result.endsWith(':success'))
+ {
+ this.dispatchEvent(SLVHelper.createToast('success', '', 'Success', this.recordCount + ' email(s) processed successfully.', false));
+ this.handleClose();
+ this.spinnerOff();
+ } else if (result.endsWith(':submitted'))
+ {
+ this.dispatchEvent(SLVHelper.createToast('success', '', 'Submitted', this.recordCount + ' email(s) submitted for processing.', false));
+ this.handleClose();
+ this.spinnerOff();
+ } else {
+ this.dispatchEvent(SLVHelper.createToast('error', '', 'Processing Error', 'There was an error processing the emails - ' + result, false));
+ this.spinnerOff();
+ }
+ })
+ .catch(error => {
+ this.dispatchEvent(SLVHelper.createToast('error', error, 'Processing Error', 'There was an error processing the emails - ', true));
+ this.spinnerOff();
+ });
}
+
}
diff --git a/force-app/main/default/lwc/simpliUIListViewsExportImport/SimpliUIListViewsExportImport.css b/force-app/main/default/lwc/simpliUIListViewsExportImport/SimpliUIListViewsExportImport.css
index bc33cb2..f3df778 100644
--- a/force-app/main/default/lwc/simpliUIListViewsExportImport/SimpliUIListViewsExportImport.css
+++ b/force-app/main/default/lwc/simpliUIListViewsExportImport/SimpliUIListViewsExportImport.css
@@ -1,12 +1,12 @@
.export {
- background-color: #4caf50;
- border: none;
- color: white;
- padding: 15px 32px;
- text-align: center;
- text-decoration: none;
- display: inline-block;
- font-size: 16px;
- margin: 4px 2px;
- cursor: pointer;
-}
+ background-color: #4CAF50;
+ border: none;
+ color: white;
+ padding: 15px 32px;
+ text-align: center;
+ text-decoration: none;
+ display: inline-block;
+ font-size: 16px;
+ margin: 4px 2px;
+ cursor: pointer;
+ }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/simpliUIListViewsExportImport/simpliUIListViewsExportImport.js b/force-app/main/default/lwc/simpliUIListViewsExportImport/simpliUIListViewsExportImport.js
index c692af1..0495ab1 100644
--- a/force-app/main/default/lwc/simpliUIListViewsExportImport/simpliUIListViewsExportImport.js
+++ b/force-app/main/default/lwc/simpliUIListViewsExportImport/simpliUIListViewsExportImport.js
@@ -1,4 +1,3 @@
-/* eslint-disable no-console */
import { LightningElement, track } from 'lwc';
import * as SLVHelper from 'c/simpliUIListViewsHelper';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
@@ -20,95 +19,97 @@ export default class SimpliUIListViewsExportImport extends LightningElement {
@track inRenderedCallback = false;
@track exportJSONStr = '';
- label = { Import_Export, Import_Export_Verbage, Export, Import, Create };
+ label = { Import_Export, Import_Export_Verbage, Export, Import, Create };
renderedCallback() {
- if (this.inRenderedCallback === false) {
+ if (this.inRenderedCallback === false)
+ {
this.inRenderedCallback = true;
getConfigExportJSON()
- .then(result => {
- this.exportJSONStr = result;
- })
- .catch(error => {
- this.dispatchEvent(SLVHelper.createToast('error', error, 'Error', 'There was an error retrieving the export file - ', true));
- });
-
+ .then(result => {
+ this.exportJSONStr = result;
+ })
+ .catch(error => {
+ this.dispatchEvent(SLVHelper.createToast('error', error, 'Error', 'There was an error retrieving the export file - ', true));
+ });
+
}
}
- handleCreateButtonClick() {
+ handleCreateButtonClick(event) {
this.spinnerOn('createStart');
console.log('Export/Import CALLOUT - createGlobalConfig - ' + this.calloutCount++);
createGlobalConfig()
- .then(result => {
- if (result === true) {
- this.dispatchEvent(SLVHelper.createToast('success', '', 'Success', 'Global config created successfully.', false));
- //this.dispatchEvent(new CustomEvent('created', { detail: {name: 'createEnd', status: 'Ok'}}));
- }
- })
- .catch(error => {
- this.dispatchEvent(SLVHelper.createToast('error', error, 'Error', 'Error creating the config ', true));
- }).finally(() => this.spinnerOff('createEnd'));
+ .then(result => {
+ if (result === true)
+ {
+ this.dispatchEvent(SLVHelper.createToast('success', '', 'Success', 'Global config created successfully.', false));
+ //this.dispatchEvent(new CustomEvent('created', { detail: {name: 'createEnd', status: 'Ok'}}));
+ this.spinnerOff('createEnd');
+ }
+ })
+ .catch(error => {
+ this.dispatchEvent(SLVHelper.createToast('error', error, 'Error', 'Error creating the config ', true));
+ this.spinnerOff('createEnd');
+ });
+
}
handleExportButtonClick(event) {
- try {
- console.log('Export/Import CALLOUT - getConfigExportJSON - ' + this.calloutCount++);
- const data = new Blob([this.exportJSONStr]);
- event.target.href = URL.createObjectURL(data);
- } catch (error) {
- SLVHelper.showErrorMessage(error);
- }
+ console.log('Export/Import CALLOUT - getConfigExportJSON - ' + this.calloutCount++);
+ var data = new Blob([this.exportJSONStr]);
+ event.target.href = URL.createObjectURL(data);
}
- async handleImportButtonClick() {
+ async handleImportButtonClick(event) {
this.spinnerOn('importStart');
const fileInput = this.template.querySelector('input');
- const reader = new FileReader();
+ var reader = new FileReader();
//create the function to import the JSON once its finished reading the file.
- reader.onload = function () {
- const text = reader.result;
- importConfigJSON({ configStr: text })
- .then(result => {
- console.log('Import result - ' + result);
- dispatchEvent(new CustomEvent('created', { detail: { name: 'importEnd', status: 'Ok', data: result } }));
- if (result.includes('There was an error')) {
- dispatchEvent(new ShowToastEvent({
- title: 'File import error',
- message: result,
- variant: 'error',
- mode: 'sticky'
- }));
- } else {
- dispatchEvent(new ShowToastEvent({
- title: 'File imported successfully (Object:Success:Failure)',
- message: result,
- variant: 'success',
- mode: 'sticky'
- }));
-
- }
- })
- .catch(error => {
- dispatchEvent(SLVHelper.createToast('error', error, 'Error', 'There was an error processing the provided config - ', true));
- });
+ reader.onload = function(){
+ var text = reader.result;
+ importConfigJSON({configStr: text})
+ .then(result => {
+ console.log('Import result - ' + result);
+ dispatchEvent(new CustomEvent('created', { detail: {name: 'importEnd', status: 'Ok', data: result}}));
+ if (result.includes('There was an error'))
+ {
+ dispatchEvent(new ShowToastEvent({
+ title: 'File import error',
+ message: result,
+ variant: 'error',
+ mode: 'sticky'
+ }));
+ } else {
+ dispatchEvent(new ShowToastEvent({
+ title: 'File imported successfully (Object:Success:Failure)',
+ message: result,
+ variant: 'success',
+ mode: 'sticky'
+ }));
+
+ }
+ })
+ .catch(error => {
+ dispatchEvent(SLVHelper.createToast('error', error, 'Error', 'There was an error processing the provided config - ', true));
+ });
};
reader.readAsText(fileInput.files[0]);
- // eslint-disable-next-line @lwc/lwc/no-async-operation
- setTimeout(() => { this.spinnerOff('importEnd'); }, 5000);
+ setTimeout(() => {this.spinnerOff('importEnd');}, 5000);
}
spinnerOn(eventName) {
- this.dispatchEvent(new CustomEvent('created', { detail: { name: eventName, status: 'Ok' } }));
+ this.dispatchEvent(new CustomEvent('created', { detail: {name: eventName, status: 'Ok'}}));
}
spinnerOff(eventName) {
- this.dispatchEvent(new CustomEvent('created', { detail: { name: eventName, status: 'Ok' } }));
+ this.dispatchEvent(new CustomEvent('created', { detail: {name: eventName, status: 'Ok'}}));
}
+
}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/simpliUIListViewsFlow/simpliUIListViewsFlow.js b/force-app/main/default/lwc/simpliUIListViewsFlow/simpliUIListViewsFlow.js
index 1dd380d..12b4302 100644
--- a/force-app/main/default/lwc/simpliUIListViewsFlow/simpliUIListViewsFlow.js
+++ b/force-app/main/default/lwc/simpliUIListViewsFlow/simpliUIListViewsFlow.js
@@ -1,4 +1,3 @@
-/* eslint-disable no-console */
import {LightningElement, api} from 'lwc';
export default class simpliUIListViewsFlow extends LightningElement {
diff --git a/force-app/main/default/lwc/simpliUIListViewsFlowFrame/simpliUIListViewsFlowFrame.js b/force-app/main/default/lwc/simpliUIListViewsFlowFrame/simpliUIListViewsFlowFrame.js
index a16a3da..52ae229 100644
--- a/force-app/main/default/lwc/simpliUIListViewsFlowFrame/simpliUIListViewsFlowFrame.js
+++ b/force-app/main/default/lwc/simpliUIListViewsFlowFrame/simpliUIListViewsFlowFrame.js
@@ -1,6 +1,4 @@
-/* eslint-disable no-console */
-import {LightningElement, api, track} from 'lwc';
-
+import {LightningElement, api, wire, track} from 'lwc';
import * as SLVHelper from 'c/simpliUIListViewsHelper';
import getListViewAction from '@salesforce/apex/ListViewController.getListViewAction';
@@ -51,6 +49,7 @@ export default class SimpliUIListViewsFlowFrame extends LightningElement {
})
.catch(error => {
console.log('Error Detected - ' + error.message + ' | ' + error.stackTrace);
+ return;
});
}
diff --git a/force-app/main/default/lwc/simpliUIListViewsHelper/simpliUIListViewsHelper.js b/force-app/main/default/lwc/simpliUIListViewsHelper/simpliUIListViewsHelper.js
index 65e13e7..557913a 100644
--- a/force-app/main/default/lwc/simpliUIListViewsHelper/simpliUIListViewsHelper.js
+++ b/force-app/main/default/lwc/simpliUIListViewsHelper/simpliUIListViewsHelper.js
@@ -1,4 +1,3 @@
-/* eslint-disable no-console */
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
/*
@@ -8,17 +7,19 @@ import { ShowToastEvent } from 'lightning/platformShowToastEvent';
* @param message - String - the message body to be displayed
* @param includeStack - Boolean - indicates whether the stacktrace should be displayed with the message
*/
-export function createToast(type, error, title, message, includeStack) {
+export function createToast(type, error, title, message, includeStack)
+{
let mode = 'sticky';
if (type === 'success' || type === 'info')
mode = 'dismissable';
let errorStr = message;
- if (error !== '' && error.body !== undefined) {
+ if (error != '' && error.body !== undefined)
+ {
if (includeStack === true)
errorStr = message + ' - ' + error.body.message;
console.log('Error Detected - ' + error.body.message + ' | ' + error.body.stackTrace);
- } else if (error !== '') {
+ } else if (error != '') {
if (includeStack === true)
errorStr = message + ' - ' + error.message;
console.log('Error Detected - ' + error.message + ' | ' + error.stack);
@@ -35,27 +36,29 @@ export function createToast(type, error, title, message, includeStack) {
export function invokeWorkspaceAPI(methodName, methodArgs) {
return new Promise((resolve, reject) => {
const apiEvent = new CustomEvent("internalapievent", {
- bubbles: true,
- composed: true,
- cancelable: false,
- detail: {
- category: "workspaceAPI",
- methodName: methodName,
- methodArgs: methodArgs,
- callback: (err, response) => {
- if (err) {
- return reject(err);
- }
- return resolve(response);
- }
+ bubbles: true,
+ composed: true,
+ cancelable: false,
+ detail: {
+ category: "workspaceAPI",
+ methodName: methodName,
+ methodArgs: methodArgs,
+ callback: (err, response) => {
+ if (err) {
+ return reject(err);
+ } else {
+ return resolve(response);
+ }
}
+ }
});
-
+
window.dispatchEvent(apiEvent);
});
}
-export function isEmpty(str) {
+export function isEmpty(str)
+{
if (str === undefined || str === null || str === '') return true;
return false;
}
@@ -69,7 +72,8 @@ export function toBool(value) {
return strValue === 'true' || strValue === '1' ? true : false
}
-export function setFieldTypes(type, obj) {
+export function setFieldTypes(type, obj)
+{
if (type === 'boolean') obj.isBoolean = true; else obj.isBoolean = false;
if (type === 'currency') obj.isCurrency = true; else obj.isCurrency = false;
if (type === 'date') obj.isDate = true; else obj.isDate = false;
@@ -109,14 +113,15 @@ export function headRows(fieldMetaData) {
export function bodyRows(selectedRecordIds, listViewDataRows) {
var body = []
- listViewDataRows.forEach(row => {
+ listViewDataRows.forEach(row => {
//if no rows are selected or the Id has been selected.
- if (selectedRecordIds.size === 0 || selectedRecordIds.has(row.salesforceId)) {
- let bodyRow = [];
+ if (selectedRecordIds.size === 0 || selectedRecordIds.has(row.salesforceId))
+ {
+ var bodyRow = [];
- for (let i = 0; i < row.fields.length; i++) {
- const field = row.fields[i];
+ for (var i = 0; i < row.fields.length; i++) {
+ var field = row.fields[i];
if (field.isDate || field.isDateTime || field.isTime) {
bodyRow.push(field.prettyValue);
} else {
@@ -127,19 +132,4 @@ export function bodyRows(selectedRecordIds, listViewDataRows) {
}
});
return body;
-}
-
-// Show Error Message
-export function showErrorMessage({ message, body }) {
- let errorMessage = '';
- if (message) {
- errorMessage = message;
- } else if (body) {
- if (Array.isArray(body)) {
- errorMessage = body.map((err) => err.message).join(", ");
- } else if (typeof body.message === "string") {
- errorMessage = body.message;
- }
- }
- console.log("Error", errorMessage);
}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/simpliUIListViewsHoverDetail/simpliUIListViewsHoverDetail.css b/force-app/main/default/lwc/simpliUIListViewsHoverDetail/simpliUIListViewsHoverDetail.css
index ff681a0..28fc4ad 100644
--- a/force-app/main/default/lwc/simpliUIListViewsHoverDetail/simpliUIListViewsHoverDetail.css
+++ b/force-app/main/default/lwc/simpliUIListViewsHoverDetail/simpliUIListViewsHoverDetail.css
@@ -1,5 +1,5 @@
-.slds-popover.slds-nubbin_left {
+.slds-popover.slds-nubbin_left{
position: absolute;
- left: 0rem;
- top: -1.3rem;
-}
+ left:0rem;
+ top:-1.3rem;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/simpliUIListViewsHoverDetail/simpliUIListViewsHoverDetail.js b/force-app/main/default/lwc/simpliUIListViewsHoverDetail/simpliUIListViewsHoverDetail.js
index dd7a5f5..49033d0 100644
--- a/force-app/main/default/lwc/simpliUIListViewsHoverDetail/simpliUIListViewsHoverDetail.js
+++ b/force-app/main/default/lwc/simpliUIListViewsHoverDetail/simpliUIListViewsHoverDetail.js
@@ -1,4 +1,4 @@
-import { LightningElement, api } from 'lwc';
+import { LightningElement, api, track } from 'lwc';
export default class SimpliUIListViewsHoverDetail extends LightningElement {
@api recordId; //record Id
@@ -8,18 +8,19 @@ export default class SimpliUIListViewsHoverDetail extends LightningElement {
@api positionTop; //identifies the Y coord of the details to be displayed
@api positionLeft; //identifies the X coord of the details to be displayed
iconName = 'standard:account'; //holds the name of the icon displayed in the hover details
-
+
renderedCallback() {
const div = this.template.querySelector('[data-id="hoverDetails"]');
- if (div !== undefined && div !== null && this.recordApiName !== undefined && this.recordApiName !== null) {
+ if (div !== undefined && div !== null && this.recordApiName !== undefined && this.recordApiName !== null)
+ {
div.style.left = this.positionLeft + 'px';
div.style.top = this.positionTop + 'px';
this.iconName = 'standard:' + this.recordApiName.toLowerCase();
}
}
- handleHoverError() {
+ handleHoverError(event) {
this.dispatchEvent(new CustomEvent('error', { detail: this.recordApiName }));
}
}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/simpliUIListViewsInitCard/simpliUIListViewsInitCard.css b/force-app/main/default/lwc/simpliUIListViewsInitCard/simpliUIListViewsInitCard.css
index 7dd7f56..9e700ed 100644
--- a/force-app/main/default/lwc/simpliUIListViewsInitCard/simpliUIListViewsInitCard.css
+++ b/force-app/main/default/lwc/simpliUIListViewsInitCard/simpliUIListViewsInitCard.css
@@ -1,3 +1,3 @@
-.pageSpinnerHolder {
+.pageSpinnerHolder{
position: absolute;
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/simpliUIListViewsInitCard/simpliUIListViewsInitCard.js b/force-app/main/default/lwc/simpliUIListViewsInitCard/simpliUIListViewsInitCard.js
index ce62975..706da9a 100644
--- a/force-app/main/default/lwc/simpliUIListViewsInitCard/simpliUIListViewsInitCard.js
+++ b/force-app/main/default/lwc/simpliUIListViewsInitCard/simpliUIListViewsInitCard.js
@@ -1,5 +1,5 @@
-/* eslint-disable no-console */
-import { LightningElement, track, api } from 'lwc';
+import { LightningElement, track, api } from 'lwc';
+import { NavigationMixin } from 'lightning/navigation';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import Not_Initialized from '@salesforce/label/c.Not_Initialized';
@@ -19,16 +19,16 @@ import updateAllListViews from '@salesforce/apex/ListViewController.updateAllLis
export default class SimpliUIListViewsInitCard extends LightningElement {
@api set batchId(value) //indicates the batch Id of the list view batch process.
- {
- this.apexBatchId = value;
- if (value !== '') {
- this.isInitialized = false;
- this.showProgress = true;
+ {
+ this.apexBatchId = value;
+ if (value !== '') {
+ this.isInitialized = false;
+ this.showProgress = true;
+ }
+ }
+ get batchId() {
+ return this.apexBatchId;
}
- }
- get batchId() {
- return this.apexBatchId;
- }
@api alwaysDisplayed = undefined;
@track apexBatchId = ''; //holds the batch Id to be monitored
@@ -37,18 +37,17 @@ export default class SimpliUIListViewsInitCard extends LightningElement {
@track isInitializedCheck = false; //indicates whether the list views have been checked for initialization
@track showProgress = false; //indicates whether the progress bar should be displayed
- label = {
- Not_Initialized, Process_List_Views, List_View_Processing_Complete, List_Views_Need_Initialized_Verbage,
- List_Views_Need_Initialized, Refresh_List_Views, Refresh, List_Views_Initialized, List_Views_Initialized_Verbage,
- Processing_Status
- };
+ label = { Not_Initialized, Process_List_Views, List_View_Processing_Complete, List_Views_Need_Initialized_Verbage,
+ List_Views_Need_Initialized, Refresh_List_Views, Refresh, List_Views_Initialized, List_Views_Initialized_Verbage,
+ Processing_Status };
async renderedCallback() {
console.log('Starting simpliUIListViewsInitCard.renderedCallback');
console.log('Record id - ' + this.recordId);
- if (this.isInitializedCheck === false) {
+ if (this.isInitializedCheck === false)
+ {
this.isInitialized = await getIsInitialized({});
this.handleIsInitialized();
}
@@ -56,11 +55,12 @@ export default class SimpliUIListViewsInitCard extends LightningElement {
handleIsInitialized() {
this.isInitializedCheck = true;
- if (this.isInitialized === false) {
+ if (this.isInitialized === false)
+ {
this.spinner = false; //a special case where we set it directly.
}
this.dispatchEvent(new CustomEvent('initializedcheck', { detail: this.isInitialized }));
- }
+ }
spinnerOn(message) {
this.spinner = true;
@@ -73,16 +73,17 @@ export default class SimpliUIListViewsInitCard extends LightningElement {
}
//called when a user clicks the button to refresh the list views.
- handleProcessListViewsButtonClick() {
+ handleProcessListViewsButtonClick(event) {
this.spinnerOn('handleProcessListViewsButtonClick');
console.log('Listview process button clicked');
- updateAllListViews({})
+ updateAllListViews({ })
.then(result => {
//if we have an error then send an ERROR toast.
- if (result === 'failed') {
+ if (result === 'failed')
+ {
this.dispatchEvent(new ShowToastEvent({
title: 'Processing Error',
message: 'There was an error processing the list views.',
@@ -91,7 +92,7 @@ export default class SimpliUIListViewsInitCard extends LightningElement {
}));
this.spinnerOff('handleProcessListViewsButtonClick1');
- //else send a SUCCESS toast.
+ //else send a SUCCESS toast.
} else {
this.batchId = result;
@@ -118,7 +119,8 @@ export default class SimpliUIListViewsInitCard extends LightningElement {
mode: 'sticky'
}));
this.spinnerOff('handleProcessListViewsButtonClick3');
- })
+ });
+
}
}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/simpliUIListViewsInitProgressBar/simpliUIListViewsInitProgressBar.js b/force-app/main/default/lwc/simpliUIListViewsInitProgressBar/simpliUIListViewsInitProgressBar.js
index 4f4e205..1be765c 100644
--- a/force-app/main/default/lwc/simpliUIListViewsInitProgressBar/simpliUIListViewsInitProgressBar.js
+++ b/force-app/main/default/lwc/simpliUIListViewsInitProgressBar/simpliUIListViewsInitProgressBar.js
@@ -1,4 +1,3 @@
-/* eslint-disable no-console */
import { LightningElement, track, api } from 'lwc';
import getListViewInitProgress from '@salesforce/apex/ListViewController.getListViewInitProgress';
@@ -14,27 +13,26 @@ export default class SimpliUIListViewsInitProgressBar extends LightningElement {
batchStatus = 'Initializing';
connectedCallback() {
-
- // eslint-disable-next-line @lwc/lwc/no-async-operation
+
this._interval = setInterval(() => {
- getListViewInitProgress({ batchId: this.batchId })
- .then(result => {
+ getListViewInitProgress({batchId: this.batchId})
+ .then(result => {
- const progressResult = result.split(':'); //response = progress:status
+ const progressResult = result.split(':'); //response = progress:status
- this.progress = Number(progressResult[0]);
- this.batchStatus = progressResult[1] + ' (' + Number(progressResult[0]).toFixed(0) + '%)';
+ this.progress = Number(progressResult[0]);
+ this.batchStatus = progressResult[1] + ' (' + Number(progressResult[0]).toFixed(0) + '%)';
- if (this.progress === 100) {
- this.hasCompleted = true;
- clearInterval(this._interval);
- }
- })
- .catch(error => {
- console.log('Error Detected - ' + error.body.message + ' | ' + error.body.stackTrace);
- this.progress = 0;
- });
+ if (this.progress === 100) {
+ this.hasCompleted = true;
+ clearInterval(this._interval);
+ }
+ })
+ .catch(error => {
+ console.log('Error Detected - ' + error.body.message + ' | ' + error.body.stackTrace);
+ this.progress = 0;
+ });
}, 2000);
diff --git a/force-app/main/default/lwc/simpliUIListViewsLookup/SimpliUIListViewsLookup.css b/force-app/main/default/lwc/simpliUIListViewsLookup/SimpliUIListViewsLookup.css
index 63b27b2..2427e18 100644
--- a/force-app/main/default/lwc/simpliUIListViewsLookup/SimpliUIListViewsLookup.css
+++ b/force-app/main/default/lwc/simpliUIListViewsLookup/SimpliUIListViewsLookup.css
@@ -1,11 +1,12 @@
-.pillSize {
- width: 100%;
+.pillSize{
+ width : 100%
}
+
lightning-radio-group .slds-radio_faux {
margin-right: 10px;
}
-.slds-modal__content {
+.slds-modal__content{
overflow: initial;
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/simpliUIListViewsLookup/simpliUIListViewsLookup.js b/force-app/main/default/lwc/simpliUIListViewsLookup/simpliUIListViewsLookup.js
index 7845d74..d6fb3c3 100644
--- a/force-app/main/default/lwc/simpliUIListViewsLookup/simpliUIListViewsLookup.js
+++ b/force-app/main/default/lwc/simpliUIListViewsLookup/simpliUIListViewsLookup.js
@@ -3,8 +3,6 @@
import { api, LightningElement, track, wire } from 'lwc';
-import * as SLVHelper from 'c/simpliUIListViewsHelper';
-
import getRecordName from '@salesforce/apex/ListViewLookupController.getRecordName';
import search from '@salesforce/apex/ListViewLookupController.search';
@@ -18,12 +16,12 @@ export default class SimpliUIListViewsLookup extends LightningElement {
@api initialId = ''; //the initial ID value of the field.
@api fieldObjName; //the API name of the object that the field is on that is being populated
@api fieldName; //the API name of the field the lookup is populating. Used to create the unique key only
-
+
href;
searchTerm;
isInitialized = false; //identifies if the component has been initialized.
iconName = 'standard:account'; //the icon name used when displaying the options. This will changed based on the provided object type
-
+
uniqueKey; //a key which is unique to this lookup component and passed back with the value once a selection has been made
@track selectedName; //the string name of the selected record (used for display purposes only)
@track selectedId; //the id of the selected record
@@ -38,7 +36,8 @@ export default class SimpliUIListViewsLookup extends LightningElement {
label = { Search_Dot }
renderedCallback() {
- if (this.isInitialized === false) {
+ if (this.isInitialized === false)
+ {
this.isInitialized = true;
console.log('In simpliUIListViewsLookup.renderedCallback');
console.log('rowId - ' + this.rowId);
@@ -52,30 +51,32 @@ export default class SimpliUIListViewsLookup extends LightningElement {
this.iconName = 'standard:' + this.fieldObjName.toLowerCase();
//if we have an initial value then set that as the chosen option.
- if (this.initialId !== '' && this.initialName !== '') {
+ if (this.initialId !== '' && this.initialName !== '')
+ {
this.boxClass = 'slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-has-focus';
- this.hasValue = true;
+ this.hasValue = true;
this.selectedId = this.initialId;
this.selectedName = this.initialName;
-
- //if we do not have the name of the record to display then get it.
- } else if (this.initialId !== '' && this.initialName === '') {
- getRecordName({ selectedId: this.initialId, fieldObjName: this.fieldObjName })
- .then(result => {
- console.log('Get record name successful for ' + this.pageName);
- console.log('Record name - ' + result);
-
- this.selectedName = result;
-
- })
- .catch(error => {
- console.log('Error Detected - ' + error.body.message + ' | ' + error.body.stackTrace + ' for ' + this.pageName);
- });
+
+ //if we do not have the name of the record to display then get it.
+ } else if (this.initialId !== '' && this.initialName === '')
+ {
+ getRecordName({selectedId: this.initialId, fieldObjName: this.fieldObjName})
+ .then(result => {
+ console.log('Get record name successful for ' + this.pageName);
+ console.log('Record name - ' + result);
+
+ this.selectedName = result;
+
+ })
+ .catch(error => {
+ console.log('Error Detected - ' + error.body.message + ' | ' + error.body.stackTrace + ' for ' + this.pageName);
+ });
this.boxClass = 'slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-has-focus';
- this.hasValue = true;
+ this.hasValue = true;
this.selectedId = this.initialId;
-
+
}
console.log('selectedName - ' + this.selectedName);
@@ -86,7 +87,7 @@ export default class SimpliUIListViewsLookup extends LightningElement {
/*
* Method called when the search term has been updated and the data is searched for.
*/
- @wire(search, { searchTerm: '$searchTerm', obj: '$fieldObjName' })
+ @wire(search, {searchTerm : '$searchTerm', obj : '$fieldObjName'})
wiredRecords({ error, data }) {
if (data) {
this.options = data;
@@ -116,49 +117,39 @@ export default class SimpliUIListViewsLookup extends LightningElement {
handleBlur() {
console.log("In handleBlur");
// eslint-disable-next-line @lwc/lwc/no-async-operation
- this.blurTimeout = setTimeout(() => { this.boxClass = 'slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-has-focus' }, 300);
+ this.blurTimeout = setTimeout(() => {this.boxClass = 'slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-has-focus'}, 300);
}
/*
* Method called when a selection is made from the drop down list
*/
onSelect(event) {
- try {
- console.log("In onSelect");
- const { currentTarget } = event;
- this.selectedId = currentTarget?.dataset?.id ?? '';
- this.selectedName = currentTarget?.dataset?.value ?? '';
- console.log('selectedId - ', this.selectedId);
- console.log('selectedName - ', this.selectedName);
-
- //send selected value to parent and in return parent sends the value to @api rowId
- let rowId = this.rowId;
- let selectedValue = this.selectedId;
- let field = this.fieldName;
- this.dispatchEvent(new CustomEvent('lookupchange', { detail: { selectedValue, rowId, field }, }));
-
- if (this.blurTimeout) {
- clearTimeout(this.blurTimeout);
- }
- this.boxClass = 'slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-has-focus';
- this.hasValue = true;
- } catch (error) {
- SLVHelper.showErrorMessage(error);
+ console.log("In onSelect");
+ this.selectedId = event.currentTarget.dataset.id;
+ this.selectedName = event.currentTarget.dataset.value;
+ console.log('selectedId - ', this.selectedId);
+ console.log('selectedName - ', this.selectedName);
+
+ //send selected value to parent and in return parent sends the value to @api rowId
+ let rowId = this.rowId;
+ let selectedValue = this.selectedId;
+ let field = this.fieldName;
+ this.dispatchEvent(new CustomEvent('lookupchange', { detail: { selectedValue, rowId, field }, }));
+
+ if(this.blurTimeout) {
+ clearTimeout(this.blurTimeout);
}
+ this.boxClass = 'slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-has-focus';
+ this.hasValue = true;
}
/*
* Method called when the search term is updated.
*/
onChange(event) {
- try {
- console.log("In onChange");
- const { target } = event;
- this.searchTerm = target.value ?? '';
- console.log("searchTerm", this.searchTerm);
- } catch (error) {
- SLVHelper.showErrorMessage(error);
- }
+ console.log("In onChange");
+ this.searchTerm = event.target.value;
+ console.log("searchTerm",this.searchTerm);
}
/*
@@ -175,4 +166,5 @@ export default class SimpliUIListViewsLookup extends LightningElement {
});
this.dispatchEvent(valueSelectedEvent);
}
+
}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/simpliUIListViewsMassCreateModal/simpliUIListViewsMassCreateModal.js b/force-app/main/default/lwc/simpliUIListViewsMassCreateModal/simpliUIListViewsMassCreateModal.js
index 95c5f14..a620cc9 100644
--- a/force-app/main/default/lwc/simpliUIListViewsMassCreateModal/simpliUIListViewsMassCreateModal.js
+++ b/force-app/main/default/lwc/simpliUIListViewsMassCreateModal/simpliUIListViewsMassCreateModal.js
@@ -1,11 +1,8 @@
-/* eslint-disable no-console */
-import { LightningElement, track, api } from 'lwc';
+import { LightningElement, wire, track, api } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import createRecords from '@salesforce/apex/ListViewController.createRecords';
import getListViewDataShell from '@salesforce/apex/ListViewController.getListViewDataShell';
-import * as SLVHelper from 'c/simpliUIListViewsHelper';
-
import Create from '@salesforce/label/c.Create';
import Cancel from '@salesforce/label/c.Cancel';
import Save_All_Data from '@salesforce/label/c.Save_All_Data';
@@ -51,7 +48,7 @@ export default class SimpliUIListViewsMassCreateModal extends LightningElement {
this.dispatchEvent(new CustomEvent('close'));
}
- handleCancelClick() {
+ handleCancelClick(event) {
this.listViewData = undefined;
this.updatedRowData = new Map();
@@ -63,146 +60,155 @@ export default class SimpliUIListViewsMassCreateModal extends LightningElement {
console.log('Starting getListViewShell - ' + this.objectName + ' - ' + this.listViewName + ' - ' + this.masterObjField + ' - ' + this.joinData + ' for MassCreateModal');
console.log('Selected list view - ' + this.listViewName + ' for MassCreateModal');
- if (this.objectName !== undefined && this.listViewName !== undefined && this.listViewData === undefined && this.showModal) {
+ if (this.objectName !== undefined && this.listViewName !== undefined && this.listViewData === undefined && this.showModal)
+ {
this.spinnerOn();
console.log('Calling getListViewDataShell!');
- getListViewDataShell({ objectName: this.objectName, listViewName: this.listViewName, joinFieldName: this.masterObjField, joinData: this.joinData })
- .then(result => {
-
- console.log('result.coreListId - ' + result.coreListId + ' for MassCreateModal');
-
- //initialize list view info
- this.listViewData = result;
-
- //initialize list view row data
- this.listViewDataRows = result.rows;
-
- this.isInitialized = true;
-
- console.log('this.listViewData - ' + this.listViewData + ' for MassCreateModal');
-
- })
- .catch(error => {
- console.log('Error Detected - ' + error.message + ' | ' + error.stackTrace + ' for MassCreateModal');
- this.listViewData = undefined;
- this.dispatchEvent(new ShowToastEvent({
- title: 'Error Retrieving Data',
- message: 'There was an error setting up the mass create page - ' + error.message,
- variant: 'error',
- mode: 'sticky'
- }));
- }).finally(() => this.spinnerOff());
+ getListViewDataShell({objectName: this.objectName, listViewName: this.listViewName, joinFieldName: this.masterObjField, joinData: this.joinData })
+ .then(result => {
+
+ console.log('result.coreListId - ' + result.coreListId + ' for MassCreateModal');
+
+ //initialize list view info
+ this.listViewData = result;
+
+ //initialize list view row data
+ this.listViewDataRows = result.rows;
+
+ this.isInitialized = true;
+
+ this.spinnerOff();
+
+ console.log('this.listViewData - ' + this.listViewData + ' for MassCreateModal');
+
+ })
+ .catch(error => {
+ console.log('Error Detected - ' + error.message + ' | ' + error.stackTrace + ' for MassCreateModal');
+ this.listViewData = undefined;
+ this.spinnerOff();
+ this.dispatchEvent(new ShowToastEvent({
+ title: 'Error Retrieving Data',
+ message: 'There was an error setting up the mass create page - ' + error.message,
+ variant: 'error',
+ mode: 'sticky'
+ }));
+ });
}
}
-
- /*
- * Method called when the CREATE button is clicked.
- */
- handleCreateClick() {
+
+ /*
+ * Method called when the CREATE button is clicked.
+ */
+ handleCreateClick(event) {
let rowData = this.updatedRowData; //map of maps
this.spinnerOn();
- if (rowData !== undefined) {
+ if (rowData !== undefined)
+ {
let rowDataStr = '{'
- rowData.forEach((element, key) => {
- rowDataStr = rowDataStr + '"' + key + '":' + JSON.stringify(Array.from(element)) + ',';
- });
+ rowData.forEach((element, key) => {
+ rowDataStr = rowDataStr + '"' + key + '":' + JSON.stringify( Array.from(element)) + ',';
+ });
rowDataStr = rowDataStr.slice(0, -1) + '}';
-
+
console.log('SAVE RESULT - ' + rowDataStr + ' for MassCreateModal');
- createRecords({ objType: this.objectName, rowData: rowDataStr })
- .then(result => {
-
- if (result.endsWith(':success')) {
- console.log('Create successful for MassCreateModal');
-
- const rowCount = result.split(':')[0];
-
- this.dispatchEvent(new ShowToastEvent({
- title: 'Success',
- message: rowCount + ' record(s) created successfully.',
- variant: 'success',
- mode: 'dismissable'
- }));
-
- this.handleClose();
- } else {
- this.dispatchEvent(new ShowToastEvent({
- title: 'Error',
- message: result,
- variant: 'error',
- mode: 'sticky'
- }));
- }
- })
- .catch(error => {
- console.log('Error Detected - ' + error.message + ' | ' + error.stackTrace + ' for MassCreateModal');
+ createRecords({objType: this.objectName, rowData: rowDataStr})
+ .then(result => {
+
+ if (result.endsWith(':success'))
+ {
+ console.log('Create successful for MassCreateModal');
+
+ const rowCount = result.split(':')[0];
+
+ this.dispatchEvent(new ShowToastEvent({
+ title: 'Success',
+ message: rowCount + ' record(s) created successfully.',
+ variant: 'success',
+ mode: 'dismissable'
+ }));
+
+ this.handleClose();
+ this.spinnerOff();
+ } else {
this.dispatchEvent(new ShowToastEvent({
title: 'Error',
- message: 'There was an error creating the records. Please try again or see an administrator - ' + error.message,
+ message: result,
variant: 'error',
mode: 'sticky'
}));
- }).finally(() => this.spinnerOff());
+ this.spinnerOff();
+ }
+ })
+ .catch(error => {
+ console.log('Error Detected - ' + error.message + ' | ' + error.stackTrace + ' for MassCreateModal');
+ this.dispatchEvent(new ShowToastEvent({
+ title: 'Error',
+ message: 'There was an error creating the records. Please try again or see an administrator - ' + error.message,
+ variant: 'error',
+ mode: 'sticky'
+ }));
+ this.spinnerOff();
+ });
}
+
}
/*
* Method called when a row is edited and a field within that row is changed.
*/
handleFieldDataChange(event) {
- try {
- const { currentTarget, detail, target } = event;
- console.log('Field changed for MassCreateModal');
- let fieldValue = '';
- let rowId = '';
- let fieldName = '';
-
- //if data is coming in from a component
- if (currentTarget.dataset.type === undefined) {
- fieldValue = detail.selectedValue;
- rowId = detail.rowId;
- fieldName = detail.field;
-
- } else {
- if (currentTarget.dataset.type === 'boolean') {
- if (target.checked === true) {
- fieldValue = 'true'; //have to turn boolean into string
- } else {
- fieldValue = 'false'
- }
- rowId = currentTarget.dataset.rowId;
- fieldName = currentTarget.dataset.field;
- } else {
- fieldValue = target.value;
- rowId = currentTarget.dataset.rowId;
- fieldName = currentTarget.dataset.field;
+ console.log('Field changed for MassCreateModal');
+
+ let fieldValue = '';
+ let rowId = '';
+ let fieldName = '';
+
+ //if data is coming in from a component
+ if (event.currentTarget.dataset.type === undefined)
+ {
+ fieldValue = event.detail.selectedValue;
+ rowId = event.detail.rowId;
+ fieldName = event.detail.field;
+
+ } else {
+ if (event.currentTarget.dataset.type === 'boolean') {
+ if (event.target.checked === true) {
+ fieldValue = 'true'; //have to turn boolean into string
+ } else {
+ fieldValue = 'false'
}
+ rowId = event.currentTarget.dataset.rowId;
+ fieldName = event.currentTarget.dataset.field;
+ } else {
+ fieldValue = event.target.value;
+ rowId = event.currentTarget.dataset.rowId;
+ fieldName = event.currentTarget.dataset.field;
}
+ }
- console.log('fieldValue - ' + fieldValue + ' for MassCreateModal');
- console.log('rowId - ' + rowId + ' for MassCreateModal');
- console.log('fieldName - ' + fieldName + ' for MassCreateModal');
-
- let rowData = this.updatedRowData.get(rowId);
+ console.log('fieldValue - ' + fieldValue + ' for MassCreateModal');
+ console.log('rowId - ' + rowId + ' for MassCreateModal');
+ console.log('fieldName - ' + fieldName + ' for MassCreateModal');
- if (rowData === undefined) {
- rowData = new Map();
- this.updatedRowData.set(rowId, rowData);
+ let rowData = this.updatedRowData.get(rowId);
- if (this.masterObjField !== '')
- rowData.set(this.masterObjField, this.masterObjId);
- }
+ if (rowData === undefined)
+ {
+ rowData = new Map();
+ this.updatedRowData.set(rowId, rowData);
- rowData.set(fieldName, fieldValue);
- } catch (error) {
- SLVHelper.showErrorMessage(error);
+ if (this.masterObjField !== '')
+ rowData.set(this.masterObjField, this.masterObjId);
}
+
+ rowData.set(fieldName, fieldValue);
+
}
spinnerOn() {
@@ -220,46 +226,39 @@ export default class SimpliUIListViewsMassCreateModal extends LightningElement {
* Called when a user tries to change the width of a column.
*/
calculateWidth(event) {
- try {
- const { target, clientX } = event;
- const childObj = target
- let parObj = childObj.parentNode;
- while (parObj.tagName !== 'TH') {
- parObj = parObj.parentNode;
- }
- console.log('Final tag name ' + parObj.tagName + ' for MassCreateModal');
- const mouseStart = clientX;
- this.mouseStart = mouseStart;
- this.oldWidth = parObj.offsetWidth;
- this.parentObj = parObj;
- // Stop text selection event
- if (event.stopPropagation) event.stopPropagation();
- if (event.preventDefault) event.preventDefault();
- event.cancelBubble = true;
- event.returnValue = false;
- } catch (error) {
- SLVHelper.showErrorMessage(error);
+ var childObj = event.target
+ var parObj = childObj.parentNode;
+ while(parObj.tagName != 'TH') {
+ parObj = parObj.parentNode;
}
- }
+ console.log('Final tag name ' + parObj.tagName + ' for MassCreateModal');
+ var mouseStart=event.clientX;
+ this.mouseStart = mouseStart;
+ this.oldWidth = parObj.offsetWidth;
+ this.parentObj = parObj;
+ // Stop text selection event
+ if(event.stopPropagation) event.stopPropagation();
+ if(event.preventDefault) event.preventDefault();
+ event.cancelBubble=true;
+ event.returnValue=false;
+ };
/*
* Called when a user tries to change the width of a column.
*/
setNewWidth(event) {
- try {
- if (this.mouseStart === undefined) return;
- const { target, clientX } = event;
- const childObj = target;
- let parObj = childObj.parentNode;
- while (parObj.tagName !== 'TH') {
- parObj = parObj.parentNode;
- }
- const newWidth = clientX - parseFloat(this.mouseStart) + parseFloat(this.oldWidth);
- this.parentObj.style.width = newWidth + 'px';
- this.mouseStart = undefined;
- } catch (error) {
- SLVHelper.showErrorMessage(error);
+ if (this.mouseStart === undefined) return;
+
+ var childObj = event.target
+ var parObj = childObj.parentNode;
+ while(parObj.tagName != 'TH') {
+ parObj = parObj.parentNode;
}
- }
+ var newWidth = event.clientX- parseFloat(this.mouseStart)+parseFloat(this.oldWidth);
+ this.parentObj.style.width = newWidth+'px';
+
+ this.mouseStart = undefined;
+ };
+
}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/simpliUIListViewsModal/simpliUIListViewsModal.js b/force-app/main/default/lwc/simpliUIListViewsModal/simpliUIListViewsModal.js
index f81efcd..ef8f8dd 100644
--- a/force-app/main/default/lwc/simpliUIListViewsModal/simpliUIListViewsModal.js
+++ b/force-app/main/default/lwc/simpliUIListViewsModal/simpliUIListViewsModal.js
@@ -1,3 +1,6 @@
+import { LightningElement, wire, track, api } from 'lwc';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
import { simpliUIListViews } from 'c/simpliUIListViews';
export default class simpliUIListViewsModal extends simpliUIListViews {
diff --git a/force-app/main/default/lwc/simpliUIListViewsPicklist/simpliUIListViewsPicklist.js b/force-app/main/default/lwc/simpliUIListViewsPicklist/simpliUIListViewsPicklist.js
index 6957ecd..85045c2 100644
--- a/force-app/main/default/lwc/simpliUIListViewsPicklist/simpliUIListViewsPicklist.js
+++ b/force-app/main/default/lwc/simpliUIListViewsPicklist/simpliUIListViewsPicklist.js
@@ -9,7 +9,7 @@ import getRecordTypeId from '@salesforce/apex/ListViewsPicklistController.getRec
import None_Dash from '@salesforce/label/c.None_Dash';
export default class SimpliUIListViewsPicklist extends LightningElement {
-
+
@wire(CurrentPageReference) pageRef;
@api type; //indicates the type of component to be created. (picklist or multipicklist)
@@ -42,8 +42,8 @@ export default class SimpliUIListViewsPicklist extends LightningElement {
{ label: 'Default 1', value: 'Default1' },
{ label: 'Default 2', value: 'Default2' },
{ label: '--None--', value: "" }
- ];
-
+ ];
+
get recordTypeId() {
return this.recordTypeIdValue;
}
@@ -51,7 +51,7 @@ export default class SimpliUIListViewsPicklist extends LightningElement {
this.recordTypeIdValue = value;
}
- @api
+ @api
get selectedValue() {
return this.value;
}
@@ -68,7 +68,7 @@ export default class SimpliUIListViewsPicklist extends LightningElement {
this.value = val.split(';');
}
}
-
+
async renderedCallback() {
if (this.type === 'picklist') {
@@ -80,7 +80,7 @@ export default class SimpliUIListViewsPicklist extends LightningElement {
this.compName = this.rowId + ':' + this.pickListFieldApiName;
if (SLVHelper.isEmpty(this.recordTypeId)) {
- this.recordTypeId = await getRecordTypeId({ recordId: this.sfdcId });
+ this.recordTypeId = await getRecordTypeId({recordId: this.sfdcId});
}
console.log('In simpliUIListViewsPicklist.renderedCallback');
@@ -103,7 +103,7 @@ export default class SimpliUIListViewsPicklist extends LightningElement {
let response = data;
//if we have a valid picklist field then get the options.
- if (response.picklistFieldValues[this.pickListFieldApiName] !== undefined) {
+ if(response.picklistFieldValues[this.pickListFieldApiName] !== undefined) {
let tempOptions = [];
if (this.type === 'picklist') {
tempOptions = [{ label: '--None--', value: "" }];
@@ -116,18 +116,19 @@ export default class SimpliUIListViewsPicklist extends LightningElement {
console.log('Options - ', JSON.stringify(this.options));
//if the selected value has NOT been provided then default it.
- if (SLVHelper.isEmpty(this.selectedValue)) {
+ if(SLVHelper.isEmpty(this.selectedValue)) {
if (this.type === 'picklist') {
this.value = { label: '--None--', value: "" }.value;
} else if (this.type === 'multipicklist') {
this.value = this.selectedValue;
}
- //otherwise set it based on provided value/s
+ //otherwise set it based on provided value/s
} else {
if (this.type === 'picklist') {
let pickVal = this.options.find(listItem => listItem.value === this.value);
- if (!SLVHelper.isEmpty(pickVal)) {
+ if (!SLVHelper.isEmpty(pickVal))
+ {
this.value = pickVal.value;
}
}
@@ -144,28 +145,24 @@ export default class SimpliUIListViewsPicklist extends LightningElement {
* sends a change event message to its parent component notifying of the change.
*/
handleChange(event) {
- try {
- const { target } = event
- let tempValue = target?.value ?? '';
- console.log("event.target.value", target.value);
- console.log("this.value", tempValue);
- let selectedValue;
- if (Array.isArray(tempValue)) {
- selectedValue = tempValue.join(';');
- } else {
- selectedValue = tempValue;
- }
- let rowId = this.rowId;
- let field = this.pickListFieldApiName;
-
- //Firing change event for aura container to handle
- //For Self
- const pickValueChangeEvent = new CustomEvent('picklistchange', {
- detail: { selectedValue, rowId, field },
- });
- this.dispatchEvent(pickValueChangeEvent);
- } catch (error) {
- SLVHelper.showErrorMessage(error);
+ let tempValue = event.target.value;
+ console.log("event.target.value",event.target.value);
+ console.log("this.value",tempValue);
+ let selectedValue;
+ if (Array.isArray(tempValue)) {
+ selectedValue = tempValue.join(';');
+ } else {
+ selectedValue = tempValue;
}
+ let rowId = this.rowId;
+ let field = this.pickListFieldApiName;
+
+ //Firing change event for aura container to handle
+ //For Self
+ const pickValueChangeEvent = new CustomEvent('picklistchange', {
+ detail: { selectedValue, rowId, field },
+ });
+ this.dispatchEvent(pickValueChangeEvent);
}
+
}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/simpliUIListViewsQuickDataModal/simpliUIListViewsQuickDataModal.js b/force-app/main/default/lwc/simpliUIListViewsQuickDataModal/simpliUIListViewsQuickDataModal.js
index 69abb99..0345aac 100644
--- a/force-app/main/default/lwc/simpliUIListViewsQuickDataModal/simpliUIListViewsQuickDataModal.js
+++ b/force-app/main/default/lwc/simpliUIListViewsQuickDataModal/simpliUIListViewsQuickDataModal.js
@@ -1,5 +1,4 @@
-/* eslint-disable no-console */
-import { LightningElement, api, track } from 'lwc';
+import { LightningElement, api, track} from 'lwc';
import * as SLVHelper from 'c/simpliUIListViewsHelper';
export default class SimpliUIListViewsQuickDataModal extends LightningElement {
@@ -11,16 +10,16 @@ export default class SimpliUIListViewsQuickDataModal extends LightningElement {
@api cancelLabel;
@api showModal;
@api fieldValue;
- @api fieldType = 'string';
+ @api fieldType = 'string';
@api fieldName;
_fieldDataId = '';
@api get fieldDataId() { return this._fieldDataId; }
- set fieldDataId(value) {
- if (!SLVHelper.isEmpty(value)) {
- this._fieldDataId = value;
- this.sfdcId = this._fieldDataId.split(':')[0];
- }
- }
+ set fieldDataId(value) {
+ if (!SLVHelper.isEmpty(value)) {
+ this._fieldDataId = value;
+ this.sfdcId = this._fieldDataId.split(':')[0];
+ }
+ }
@api objectName;
@track sfdcId = '';
@@ -34,7 +33,8 @@ export default class SimpliUIListViewsQuickDataModal extends LightningElement {
console.log('SimpliUIListViewsQuickDataModal.renderedCallback starting');
console.log('this.showModal - ' + this.showModal);
console.log('this.isInitialized - ' + this.isInitialized);
- if (this.showModal && !this.isInitialized) {
+ if (this.showModal && !this.isInitialized)
+ {
if (this.cancelLabel === undefined)
this.cancelLabel = 'Cancel';
@@ -57,8 +57,7 @@ export default class SimpliUIListViewsQuickDataModal extends LightningElement {
}
this.isInitialized = true;
}
- // eslint-disable-next-line @lwc/lwc/no-async-operation
- setTimeout(() => this.setComponentFocus(), 200);
+ setTimeout(()=>this.setComponentFocus(), 200);
console.log('------ Quick Data Component Logging ------');
console.log('Heading - ' + this.heading);
console.log('Field Label - ' + this.fieldLabel);
@@ -72,7 +71,8 @@ export default class SimpliUIListViewsQuickDataModal extends LightningElement {
}
setComponentFocus() {
- if (this.isInitialized) {
+ if (this.isInitialized)
+ {
if (this.isRichText) {
this.template.querySelector('lightning-input-rich-text').focus();
} else if (this.isTextArea) {
@@ -90,26 +90,22 @@ export default class SimpliUIListViewsQuickDataModal extends LightningElement {
this.isInitialized = false;
}
- handleCancelClick() {
- this.dispatchEvent(new CustomEvent('cancel', { detail: { value: undefined, fieldDataId: undefined } }));
+ handleCancelClick(event) {
+ this.dispatchEvent(new CustomEvent('cancel', { detail: {value: undefined, fieldDataId: undefined}}));
this.resetComponent();
}
- handleOkClick() {
- this.dispatchEvent(new CustomEvent('ok', { detail: { value: this.fieldValue, fieldDataId: this.fieldDataId, fieldName: this.fieldName } }));
+ handleOkClick(event) {
+ this.dispatchEvent(new CustomEvent('ok', { detail: {value: this.fieldValue, fieldDataId: this.fieldDataId, fieldName: this.fieldName}}));
this.resetComponent();
}
handleFieldUpdate(event) {
- try {
- const { target, detail } = event;
- if (!SLVHelper.isEmpty(target.value)) {
- this.fieldValue = target.value;
- } else if (!SLVHelper.isEmpty(detail.selectedValue)) {
- this.fieldValue = detail.selectedValue;
- }
- } catch (error) {
- SLVHelper.showErrorMessage(error);
+ if (!SLVHelper.isEmpty(event.target.value)) {
+ this.fieldValue = event.target.value;
+
+ } else if (!SLVHelper.isEmpty(event.detail.selectedValue)) {
+ this.fieldValue = event.detail.selectedValue;
}
}
}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/simpliUIListViewsScheduleJob/simpliUIListViewsScheduleJob.css b/force-app/main/default/lwc/simpliUIListViewsScheduleJob/simpliUIListViewsScheduleJob.css
index 7dd7f56..9e700ed 100644
--- a/force-app/main/default/lwc/simpliUIListViewsScheduleJob/simpliUIListViewsScheduleJob.css
+++ b/force-app/main/default/lwc/simpliUIListViewsScheduleJob/simpliUIListViewsScheduleJob.css
@@ -1,3 +1,3 @@
-.pageSpinnerHolder {
+.pageSpinnerHolder{
position: absolute;
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/simpliUIListViewsScheduleJob/simpliUIListViewsScheduleJob.js b/force-app/main/default/lwc/simpliUIListViewsScheduleJob/simpliUIListViewsScheduleJob.js
index 3ba63ea..6e9419f 100644
--- a/force-app/main/default/lwc/simpliUIListViewsScheduleJob/simpliUIListViewsScheduleJob.js
+++ b/force-app/main/default/lwc/simpliUIListViewsScheduleJob/simpliUIListViewsScheduleJob.js
@@ -1,13 +1,10 @@
-/* eslint-disable no-console */
-import { LightningElement, track, api } from 'lwc';
+import { LightningElement, wire, track, api } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import getOrgWideConfigParam from '@salesforce/apex/ListViewAdminController.getOrgWideConfigParam';
import saveOrgWideConfig from '@salesforce/apex/ListViewAdminController.saveOrgWideConfig';
import scheduleRefreshJob from '@salesforce/apex/ListViewAdminController.scheduleRefreshJob';
-import * as SLVHelper from 'c/simpliUIListViewsHelper';
-
import List_View_Refresh_Scheduled from '@salesforce/label/c.List_View_Refresh_Scheduled';
import Select_Time_Period from '@salesforce/label/c.Select_Time_Period';
import Select_X_Minute from '@salesforce/label/c.Select_X_Minute';
@@ -36,8 +33,8 @@ export default class SimpliUIListViewsScheduleJob extends LightningElement {
if (value !== undefined)
this.timePeriodChanged(value);
}
- get timePeriod() {
- return this.selectedTimePeriod;
+ get timePeriod() {
+ return this.selectedTimePeriod;
}
@track isInitialized = false;
@@ -65,7 +62,7 @@ export default class SimpliUIListViewsScheduleJob extends LightningElement {
];
@track xMinutePeriodsList = [
- { label: '5', value: '5' }, { label: '10', value: '10' }, { label: '15', value: '15' },
+ { label: '5', value: '5' }, { label: '10', value: '10' }, { label: '15', value: '15' },
{ label: '20', value: '20' }, { label: '30', value: '30' },
];
@@ -74,7 +71,7 @@ export default class SimpliUIListViewsScheduleJob extends LightningElement {
{ label: '15', value: '15' }, { label: '20', value: '20' }, { label: '25', value: '25' },
{ label: '30', value: '30' }, { label: '35', value: '35' }, { label: '40', value: '40' },
{ label: '45', value: '45' }, { label: '50', value: '50' }, { label: '55', value: '55' },
- ];
+ ];
@track hourPeriodsList = [
{ label: '00', value: '0' }, { label: '01', value: '1' }, { label: '02', value: '2' },
@@ -85,83 +82,87 @@ export default class SimpliUIListViewsScheduleJob extends LightningElement {
{ label: '15', value: '15' }, { label: '16', value: '16' }, { label: '17', value: '17' },
{ label: '18', value: '18' }, { label: '19', value: '19' }, { label: '20', value: '20' },
{ label: '21', value: '21' }, { label: '22', value: '22' }, { label: '23', value: '23' },
- ];
+ ];
@track dayPeriodsList = [
{ label: Monday, value: 'MON' }, { label: Tuesday, value: 'TUE' },
{ label: Wednesday, value: 'WED' }, { label: Thursday, value: 'THU' },
{ label: Friday, value: 'FRI' }, { label: Saturday, value: 'SAT' },
{ label: Sunday, value: 'SUN' },
- ];
+ ];
@track monthPeriodsList = [
- { label: 'First Day Of Month', value: '1' },
+ { label: 'First Day Of Month', value: '1' },
{ label: '15th Of Month', value: '15' },
{ label: 'Last Day Of Month', value: 'L' },
- ];
-
- label = {
- List_View_Refresh_Scheduled, Select_Time_Period, Select_Minute, Select_Hour, Select_Day, Select_Month, Monday, Tuesday, Wednesday, Thursday,
- Friday, Saturday, Sunday, Schedule_Core_List_View_Refreshes, Schedule_Core_List_View_Refreshes_Verbage, Schedule, Scheduled, Unschedule,
- Select_X_Minute
- };
+ ];
+ label = { List_View_Refresh_Scheduled, Select_Time_Period, Select_Minute, Select_Hour, Select_Day, Select_Month, Monday, Tuesday, Wednesday, Thursday,
+ Friday, Saturday, Sunday, Schedule_Core_List_View_Refreshes, Schedule_Core_List_View_Refreshes_Verbage, Schedule, Scheduled, Unschedule,
+ Select_X_Minute };
+
renderedCallback() {
- if (this.isInitialized === false) {
+ if (this.isInitialized === false)
+ {
this.isInitialized = true;
this.spinnerOn();
getOrgWideConfigParam({ paramName: 'RefreshJob' })
- .then(result => {
-
- let refreshJobData = result.value.split(':'); //example - weekly:00:00:Tuesday
-
- if (refreshJobData[0] !== 'Not Scheduled') {
- this.isTurnedOn = true;
- this.selectedTimePeriod = refreshJobData[0];
-
- if (this.selectedTimePeriod === 'minutely')
- this.selectedXMinutes = refreshJobData[1];
- else if (this.selectedTimePeriod === 'hourly')
- this.selectedMinute = refreshJobData[1];
- else if (this.selectedTimePeriod === 'daily') {
- this.selectedMinute = refreshJobData[1];
- this.selectedHour = refreshJobData[2];
- } else if (this.selectedTimePeriod === 'weekly') {
- this.selectedMinute = refreshJobData[1];
- this.selectedHour = refreshJobData[2];
- this.selectedDay = refreshJobData[3];
- } else if (this.selectedTimePeriod === 'monthly') {
- this.selectedMinute = refreshJobData[1];
- this.selectedHour = refreshJobData[2];
- this.selectedMonth = refreshJobData[3];
- }
- this.timePeriodChanged(this.selectedTimePeriod);
- }
- })
- .catch(error => {
- let errorStr = '';
- if (error.body !== undefined) {
- errorStr = error.body.message;
- console.log('Error Detected - ' + error.body.message + ' | ' + error.body.stackTrace);
- } else {
- errorStr = error.message;
- console.log('Error Detected - ' + error.message + ' | ' + error.stack);
- }
+ .then(result => {
+
+ let refreshJobData = result.value.split(':'); //example - weekly:00:00:Tuesday
+
+ if (refreshJobData[0] !== 'Not Scheduled')
+ {
+ this.isTurnedOn = true;
+ this.selectedTimePeriod = refreshJobData[0];
+
+ if (this.selectedTimePeriod === 'minutely')
+ this.selectedXMinutes = refreshJobData[1];
+ else if (this.selectedTimePeriod === 'hourly')
+ this.selectedMinute = refreshJobData[1];
+ else if (this.selectedTimePeriod === 'daily') {
+ this.selectedMinute = refreshJobData[1];
+ this.selectedHour = refreshJobData[2];
+ } else if (this.selectedTimePeriod === 'weekly') {
+ this.selectedMinute = refreshJobData[1];
+ this.selectedHour = refreshJobData[2];
+ this.selectedDay = refreshJobData[3];
+ } else if (this.selectedTimePeriod === 'monthly') {
+ this.selectedMinute = refreshJobData[1];
+ this.selectedHour = refreshJobData[2];
+ this.selectedMonth = refreshJobData[3];
+ }
+ this.timePeriodChanged(this.selectedTimePeriod);
+ }
+
+ this.spinnerOff();
+ })
+ .catch(error => {
+ let errorStr = '';
+ if (error.body !== undefined)
+ {
+ errorStr = error.body.message;
+ console.log('Error Detected - ' + error.body.message + ' | ' + error.body.stackTrace);
+ } else {
+ errorStr = error.message;
+ console.log('Error Detected - ' + error.message + ' | ' + error.stack);
+ }
+
+ this.dispatchEvent(new ShowToastEvent({
+ title: 'Processing Error',
+ message: 'There was an error loading the refresh job config - ' + errorStr,
+ variant: 'error',
+ mode: 'sticky'
+ }));
+ this.spinnerOff();
+ return;
+ });
- this.dispatchEvent(new ShowToastEvent({
- title: 'Processing Error',
- message: 'There was an error loading the refresh job config - ' + errorStr,
- variant: 'error',
- mode: 'sticky'
- }));
- }).finally(() => {
- this.spinnerOff();
- });
}
}
- handleIsTurnedOnChange() {
+ handleIsTurnedOnChange(event) {
this.spinnerOn();
if (this.isTurnedOn === undefined)
@@ -174,7 +175,7 @@ export default class SimpliUIListViewsScheduleJob extends LightningElement {
this.scheduleText = 'Click to schedule automatic core list view refreshes';
this.saveScheduledJobConfig('Not Scheduled');
- //turning ON
+ //turning ON
} else {
this.scheduleText = 'Click to unschedule refreshes';
@@ -200,48 +201,55 @@ export default class SimpliUIListViewsScheduleJob extends LightningElement {
let parameters = new Map();
parameters.set('RefreshJob', jobDataStr);
- let strParamMap = JSON.stringify(Array.from(parameters));
+ let strParamMap = JSON.stringify( Array.from(parameters) );
console.log('Field/Value - ' + strParamMap);
- saveOrgWideConfig({ paramStr: strParamMap }).then(result => {
+ saveOrgWideConfig({ paramStr: strParamMap})
+ .then(result => {
//get the status
let status = result.substring(0, result.indexOf(':'));
-
+
//get any associated message
- let message = result.substring(result.indexOf(':') + 1);
+ let message = result.substring(result.indexOf(':')+1);
if (message === '' && status === 'Ok') {
message = 'Refresh job configuration has been saved successfully.';
- } else if (message === '' && status !== 'Ok') {
+ } else if (message === '' && status != 'Ok') {
message = 'There was an error saving the refresh job configuration.';
this.isTurnedOn = undefined;
}
if (status === 'Ok') {
+
scheduleRefreshJob()
- .then(data => {
- if (data === 'success') {
- this.dispatchEvent(new ShowToastEvent({
- title: 'Save Successful!',
- message: message,
- variant: 'success',
- mode: 'dismissable'
- }));
- this.dispatchEvent(new CustomEvent('updated', { status: 'Ok' }));
- } else {
- this.dispatchEvent(new ShowToastEvent({
- title: 'Processing Error!',
- message: 'There was a problem scheduling the job',
- variant: 'error',
- mode: 'sticky'
- }));
- this.isTurnedOn = undefined;
- }
- })
- .catch(() => {
- }).finally(() => {
+ .then(result => {
+
+ if (result == 'success')
+ {
+ this.dispatchEvent(new ShowToastEvent({
+ title: 'Save Successful!',
+ message: message,
+ variant: 'success',
+ mode: 'dismissable'
+ }));
+ this.dispatchEvent(new CustomEvent('updated', { status: 'Ok' }));
+ this.spinnerOff();
+ } else {
+ this.dispatchEvent(new ShowToastEvent({
+ title: 'Processing Error!',
+ message: 'There was a problem scheduling the job',
+ variant: 'error',
+ mode: 'sticky'
+ }));
this.spinnerOff();
- });
+ this.isTurnedOn = undefined;
+ return;
+ }
+ })
+ .catch(error => {
+ this.spinnerOff();
+ return;
+ });
} else {
this.dispatchEvent(new ShowToastEvent({
@@ -251,10 +259,13 @@ export default class SimpliUIListViewsScheduleJob extends LightningElement {
mode: 'sticky'
}));
this.spinnerOff();
+ return;
}
- }).catch(error => {
+ })
+ .catch(error => {
let errorStr = '';
- if (error.body !== undefined) {
+ if (error.body !== undefined)
+ {
errorStr = error.body.message;
console.log('Error Detected - ' + error.body.message + ' | ' + error.body.stackTrace);
} else {
@@ -269,42 +280,31 @@ export default class SimpliUIListViewsScheduleJob extends LightningElement {
mode: 'sticky'
}));
this.spinnerOff();
+ return;
});
}
handleTimePeriodChange(event) {
- try {
- const { target } = event;
- if (target?.value) {
- this.timePeriodChanged(target.value);
- }
- } catch (error) {
- SLVHelper.showErrorMessage(error);
- }
+ this.timePeriodChanged(event.target.value);
}
periodValueChange(event) {
- try {
- const { target } = event;
- const { value, name } = target;
- console.log('Selected time period - ' + this.selectedTimePeriod);
- console.log('Selected value name - ' + name);
- console.log('Period value changed - ' + value);
-
- if (name === 'X Minute List') {
- this.selectedXMinutes = value;
- } else if (name === 'Minute List') {
- this.selectedMinute = value;
- } else if (name === 'Hour List') {
- this.selectedHour = value;
- } else if (name === 'Day List') {
- this.selectedDay = value;
- } else if (name === 'Month List') {
- this.selectedMonth = value;
- }
- } catch (error) {
- SLVHelper.showErrorMessage(error);
+ console.log('Selected time period - ' + this.selectedTimePeriod);
+ console.log('Selected value name - ' + event.target.name);
+ console.log('Period value changed - ' + event.target.value);
+
+
+ if (event.target.name === 'X Minute List') {
+ this.selectedXMinutes = event.target.value;
+ } else if (event.target.name === 'Minute List') {
+ this.selectedMinute = event.target.value;
+ } else if (event.target.name === 'Hour List') {
+ this.selectedHour = event.target.value;
+ } else if (event.target.name === 'Day List') {
+ this.selectedDay = event.target.value;
+ } else if (event.target.name === 'Month List') {
+ this.selectedMonth = event.target.value;
}
}
@@ -315,32 +315,37 @@ export default class SimpliUIListViewsScheduleJob extends LightningElement {
this.displayDays = false;
this.displayMonths = false;
this.displayXMinutes = false;
-
- if (this.selectedTimePeriod === 'minutely') {
+
+ if (this.selectedTimePeriod === 'minutely')
+ {
this.displayXMinutes = true;
this.displayMinutes = false;
this.displayHours = false;
this.displayDays = false;
this.displayMonths = false;
- } else if (this.selectedTimePeriod === 'hourly') {
+ } else if (this.selectedTimePeriod === 'hourly')
+ {
this.displayXMinutes = false;
this.displayMinutes = true;
this.displayHours = false;
this.displayDays = false;
this.displayMonths = false;
- } else if (this.selectedTimePeriod === 'daily') {
+ } else if (this.selectedTimePeriod === 'daily')
+ {
this.displayXMinutes = false;
this.displayMinutes = true;
this.displayHours = true;
this.displayDays = false;
this.displayMonths = false;
- } else if (this.selectedTimePeriod === 'weekly') {
+ } else if (this.selectedTimePeriod === 'weekly')
+ {
this.displayXMinutes = false;
this.displayMinutes = true;
this.displayHours = true;
this.displayDays = true;
this.displayMonths = false;
- } else if (this.selectedTimePeriod === 'monthly') {
+ } else if (this.selectedTimePeriod === 'monthly')
+ {
this.displayXMinutes = false;
this.displayMinutes = true;
this.displayHours = true;
diff --git a/force-app/main/default/lwc/simpliUIListViewsSpinner/simpliUIListViewsSpinner.css b/force-app/main/default/lwc/simpliUIListViewsSpinner/simpliUIListViewsSpinner.css
index 1ade731..972a9df 100644
--- a/force-app/main/default/lwc/simpliUIListViewsSpinner/simpliUIListViewsSpinner.css
+++ b/force-app/main/default/lwc/simpliUIListViewsSpinner/simpliUIListViewsSpinner.css
@@ -1,9 +1,9 @@
.loader::after {
- position: absolute;
- content: attr(data-text);
- width: 100%;
- text-align: center;
- font-weight: bold;
+ position:absolute;
+ content:attr(data-text);
+ width:100%;
+ text-align:center;
+ font-weight:bold;
top: calc(50% + 1rem);
- color: grey;
-}
+ color:grey;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/simpliUIListViewsStart/simpliUIListViewsStart.js b/force-app/main/default/lwc/simpliUIListViewsStart/simpliUIListViewsStart.js
index 1d68ec2..e731680 100644
--- a/force-app/main/default/lwc/simpliUIListViewsStart/simpliUIListViewsStart.js
+++ b/force-app/main/default/lwc/simpliUIListViewsStart/simpliUIListViewsStart.js
@@ -1,5 +1,5 @@
-/* eslint-disable no-console */
import { LightningElement, wire, track } from 'lwc';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import * as SLVHelper from 'c/simpliUIListViewsHelper';
//------------------------ LABELS ------------------------
@@ -30,7 +30,7 @@ export default class SimpliUIListViewsStart extends LightningElement {
@track batchId = ''; //indicates the batch Id of the list view batch process.
@track inRenderedCallback = false; //indicates whether the rendered callback method is processing
@track calloutCount = 1; //indicates the number of callouts made for this component
-
+
label = { Feature_Overview, Quick_Start, Issues_And_Questions, Configuration, Example_App_Descriptions }
/*
@@ -38,65 +38,68 @@ export default class SimpliUIListViewsStart extends LightningElement {
* but before it is rendered. We do have access to variables in this method.
*/
async renderedCallback() {
+
console.log('Starting simpliUIListViewsStart.renderedCallback');
- if (this.config === undefined && this.hasConfig === true && this.inRenderedCallback === false) {
+ if (this.config === undefined && this.hasConfig === true && this.inRenderedCallback === false)
+ {
this.inRenderedCallback = true;
console.log('Starting getConfig()');
this.getConfig();
}
}
- @wire(getOrgWideDescriptions, {})
+ @wire (getOrgWideDescriptions, { })
wiredOrgWideDescriptions({ error, data }) {
- if (data) {
+ if (data) {
console.log('simpliUIListViewsStart CALLOUT - getOrgWideDescriptions - ' + this.calloutCount++);
- console.log('Get Org Wide Descriptions called successfully - ' + data);
- this.orgWideDescs = data;
- } else if (error) {
- this.objectActionList = undefined;
- this.dispatchEvent(SLVHelper.createToast('error', error, 'Error Retrieving Org Wide Descriptions', 'There was an error retrieving the org wide descriptions ', true));
+ console.log('Get Org Wide Descriptions called successfully - ' + data);
+ this.orgWideDescs = data;
+ } else if (error) {
+ this.objectActionList = undefined;
+ this.dispatchEvent(SLVHelper.createToast('error', error, 'Error Retrieving Org Wide Descriptions', 'There was an error retrieving the org wide descriptions ', true));
}
}
-
- @wire(getComponentDescriptions, {})
+
+ @wire (getComponentDescriptions, { })
wiredComponentDescriptions({ error, data }) {
- if (data) {
+ if (data) {
console.log('simpliUIListViewsStart CALLOUT - getComponentDescriptions - ' + this.calloutCount++);
- console.log('Get Component Descriptions called successfully - ' + data);
- this.compDescs = data;
- } else if (error) {
- this.objectActionList = undefined;
- this.dispatchEvent(SLVHelper.createToast('error', error, 'Error Retrieving Component Descriptions', 'There was an error retrieving the component descriptions ', true));
+ console.log('Get Component Descriptions called successfully - ' + data);
+ this.compDescs = data;
+ } else if (error) {
+ this.objectActionList = undefined;
+ this.dispatchEvent(SLVHelper.createToast('error', error, 'Error Retrieving Component Descriptions', 'There was an error retrieving the component descriptions ', true));
}
}
-
- @wire(getListViewDescriptions, {})
+
+ @wire (getListViewDescriptions, { })
wiredListViewsDescriptions({ error, data }) {
- if (data) {
+ if (data) {
console.log('simpliUIListViewsStart CALLOUT - getListViewDescriptions - ' + this.calloutCount++);
- console.log('Get List View Descriptions called successfully - ' + data);
- this.listViewDescs = data;
- } else if (error) {
- this.objectActionList = undefined;
- this.dispatchEvent(SLVHelper.createToast('error', error, 'Error Retrieving List View Descriptions', 'There was an error retrieving the list view descriptions ', true));
+ console.log('Get List View Descriptions called successfully - ' + data);
+ this.listViewDescs = data;
+ } else if (error) {
+ this.objectActionList = undefined;
+ this.dispatchEvent(SLVHelper.createToast('error', error, 'Error Retrieving List View Descriptions', 'There was an error retrieving the list view descriptions ', true));
}
}
- getConfig() {
+ getConfig()
+ {
this.spinner = true;
console.log('simpliUIListViewsStart CALLOUT - getOrgWideConfig - ' + this.calloutCount++);
getOrgWideConfig()
- .then(result => {
- console.log('Org wide config retrieved successfully - ' + result);
- this.hasConfig = true;
- this.config = result;
- })
- .catch(error => {
- this.dispatchEvent(SLVHelper.createToast('error', error, 'Processing Error', 'There was an error handling the config - ', true));
- this.hasConfig = false;
- this.isInitialized = false;
- }).finally(() => {
- this.spinner = false;
- })
+ .then(result => {
+ console.log('Org wide config retrieved successfully - ' + result);
+ this.hasConfig = true;
+ this.config = result;
+ this.spinner = false;
+ })
+ .catch(error => {
+ this.dispatchEvent(SLVHelper.createToast('error', error, 'Processing Error', 'There was an error handling the config - ', true));
+ this.hasConfig = false;
+ this.isInitialized = false;
+ this.spinner = false;
+ });
}
}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/simpliUIListViewsTestComp/simpliUIListViewsTestComp.css b/force-app/main/default/lwc/simpliUIListViewsTestComp/simpliUIListViewsTestComp.css
index 4a5ac47..2d2db75 100644
--- a/force-app/main/default/lwc/simpliUIListViewsTestComp/simpliUIListViewsTestComp.css
+++ b/force-app/main/default/lwc/simpliUIListViewsTestComp/simpliUIListViewsTestComp.css
@@ -1,26 +1,26 @@
.codebox {
- background: ghostwhite;
- font-size: 13px;
- padding: 7px;
- border: 1px solid lightgray;
+ background: ghostwhite;
+ font-size: 13px;
+ padding: 7px;
+ border: 1px solid lightgray;
margin: 10px;
}
.examplebox {
- background: white;
- font-size: 13px;
- padding: 7px;
- border: 1px solid lightgray;
+ background: white;
+ font-size: 13px;
+ padding: 7px;
+ border: 1px solid lightgray;
margin: 10px;
}
.splitboxleft {
- border-top: 1px solid lightgray;
- border-left: 1px solid lightgray;
+ border-top: 1px solid lightgray;
+ border-left: 1px solid lightgray;
padding-right: 5px;
}
.splitboxright {
- border-top: 1px solid lightgray;
- border-right: 1px solid lightgray;
-}
+ border-top: 1px solid lightgray;
+ border-right: 1px solid lightgray;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/simpliUIListViewsTestComp/simpliUIListViewsTestComp.js b/force-app/main/default/lwc/simpliUIListViewsTestComp/simpliUIListViewsTestComp.js
index 2de5327..695a543 100644
--- a/force-app/main/default/lwc/simpliUIListViewsTestComp/simpliUIListViewsTestComp.js
+++ b/force-app/main/default/lwc/simpliUIListViewsTestComp/simpliUIListViewsTestComp.js
@@ -1,9 +1,6 @@
-/* eslint-disable no-console */
import { LightningElement, wire, track } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
-import * as SLVHelper from 'c/simpliUIListViewsHelper';
-
import getData from '@salesforce/apex/ListViewTestCompController.getData';
export default class SimpliUIListViewsTestComp extends LightningElement {
@@ -18,61 +15,49 @@ export default class SimpliUIListViewsTestComp extends LightningElement {
return '';
}
- @wire(getData, {})
+ @wire (getData, {})
wiredGetStandAloneData({ error, data }) {
- if (data) {
- this.standAloneData = data;
- } else if (error) {
- this.standAloneData = undefined;
- this.dispatchEvent(new ShowToastEvent({
- title: 'Error',
- message: 'There was an error retrieving the stand alone data - ' + error.message,
- variant: 'error',
- mode: 'sticky'
- }));
- }
+ if (data) {
+ this.standAloneData = data;
+ } else if (error) {
+ this.standAloneData = undefined;
+ this.dispatchEvent(new ShowToastEvent({
+ title: 'Error',
+ message: 'There was an error retrieving the stand alone data - ' + error.message,
+ variant: 'error',
+ mode: 'sticky'
+ }));
+ }
}
//for event testing
- handleEventRequest() {
- let eventRequest = { type: 'refreshData' };
+ handleEventRequest(event) {
+ let eventRequest = { type: 'refreshData'};
const slvs = this.template.querySelectorAll('c-simpli-u-i-list-views');
let slv = null;
-
- if (slvs?.length) {
- slvs.forEach(tmpslv => {
- if (tmpslv.uniqueComponentId.includes("My Button Event Test")) {
- slv = tmpslv;
- }
- });
- }
+
+ slvs.forEach(tmpslv => {
+ if (tmpslv.uniqueComponentId.includes("My Button Event Test")) {
+ slv = tmpslv;
+ }
+ });
slv.eventRequest(eventRequest);
- eventRequest = { type: 'updateSetting', name: "hasMainTitle", value: false };
+ eventRequest = { type: 'updateSetting', name: "hasMainTitle", value: false};
slv.eventRequest(eventRequest);
}
//for event testing
handleEventResponse(event) {
- try {
- const { detail } = event;
- console.log('EVENT RESPONSE - ' + JSON.stringify(detail));
- } catch (error) {
- SLVHelper.showErrorMessage(error);
- }
+ console.log('EVENT RESPONSE - ' + JSON.stringify(event.detail));
}
handleExample4DataChange(event) {
- try {
- const { detail } = event;
- console.log('Handling Example 4 Data Change - ' + detail.selectedValue);
- this.selectedAccountId = detail.selectedValue ?? '';
- } catch (error) {
- SLVHelper.showErrorMessage(error);
- }
+ console.log('Handling Example 4 Data Change - ' + event.detail.selectedValue);
+ this.selectedAccountId = event.detail.selectedValue;
}
}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/simpliUIListViewsTypeAhead/simpliUIListViewsTypeAhead.css b/force-app/main/default/lwc/simpliUIListViewsTypeAhead/simpliUIListViewsTypeAhead.css
index 09a1211..9c6524a 100644
--- a/force-app/main/default/lwc/simpliUIListViewsTypeAhead/simpliUIListViewsTypeAhead.css
+++ b/force-app/main/default/lwc/simpliUIListViewsTypeAhead/simpliUIListViewsTypeAhead.css
@@ -2,6 +2,6 @@ lightning-radio-group .slds-radio_faux {
margin-right: 10px;
}
-.slds-modal__content {
+.slds-modal__content{
overflow: initial;
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/simpliUIListViewsTypeAhead/simpliUIListViewsTypeAhead.js b/force-app/main/default/lwc/simpliUIListViewsTypeAhead/simpliUIListViewsTypeAhead.js
index d20bed6..1e35c4f 100644
--- a/force-app/main/default/lwc/simpliUIListViewsTypeAhead/simpliUIListViewsTypeAhead.js
+++ b/force-app/main/default/lwc/simpliUIListViewsTypeAhead/simpliUIListViewsTypeAhead.js
@@ -1,12 +1,10 @@
/* eslint-disable no-console */
/* eslint-disable @lwc/lwc/no-async-operation */
-import { api, LightningElement, track } from 'lwc';
+import { api, LightningElement, track, wire } from 'lwc';
import getRecordName from '@salesforce/apex/ListViewTypeAheadController.getRecordName';
import search from '@salesforce/apex/ListViewTypeAheadController.search';
-import * as SLVHelper from 'c/simpliUIListViewsHelper';
-
//------------------------ LABELS ------------------------
import Search_Dot from '@salesforce/label/c.Search_Dot';
@@ -16,85 +14,92 @@ export default class SimpliUIListViewsTypeAhead extends LightningElement {
@api initialName = ''; //the initial string value of the field for display purposes only
_initialId; //the initial value of the field.
- @api set initialId(value) {
- if (this.searchType === 'schema') {
- this.searchTerm = value;
- }
- this._initialId = value;
- this.search();
- }
- get initialId() {
- return this._initialId;
- }
+ @api set initialId(value)
+ {
+ if (this.searchType === 'schema') {
+ this.searchTerm = value;
+ }
+ this._initialId = value;
+ this.search();
+ }
+ get initialId() {
+ return this._initialId;
+ }
_searchType; //indicates the type of data being searched for. i.e. sobject, metadata, schema
- @api set searchType(value) {
- if (value !== this._searchType) {
- this.searchTerm = '';
- this.oldSearchTerm = '';
- }
- this._searchType = value;
- }
- get searchType() {
- return this._searchType;
- }
+ @api set searchType(value)
+ {
+ if (value !== this._searchType) {
+ this.searchTerm = '';
+ this.oldSearchTerm = '';
+ }
+ this._searchType = value;
+ }
+ get searchType() {
+ return this._searchType;
+ }
_fieldObjName; //the API name of the object that the field is on that is being populated
- @api set fieldObjName(value) {
- if (value !== this._fieldObjName) {
- this.searchTerm = '';
- this.oldSearchTerm = '';
- }
- this._fieldObjName = value;
- }
- get fieldObjName() {
- return this._fieldObjName;
- }
+ @api set fieldObjName(value)
+ {
+ if (value !== this._fieldObjName) {
+ this.searchTerm = '';
+ this.oldSearchTerm = '';
+ }
+ this._fieldObjName = value;
+ }
+ get fieldObjName() {
+ return this._fieldObjName;
+ }
_whereClause; //any additional criteria (in SOQL format without WHERE keyword) to be applied when displaying values
- @api set whereClause(value) {
- if (value !== this._whereClause) {
- this.searchTerm = '';
- this.oldSearchTerm = '';
- }
- this._whereClause = value;
- this.search();
- }
- get whereClause() {
- return this._whereClause;
- }
+ @api set whereClause(value)
+ {
+ if (value !== this._whereClause) {
+ this.searchTerm = '';
+ this.oldSearchTerm = '';
+ }
+ this._whereClause = value;
+ this.search();
+ }
+ get whereClause() {
+ return this._whereClause;
+ }
_labelFieldName; //the API name of the label field the lookup is populating. Used to create the unique key only
- @api set labelFieldName(value) {
- if (value !== this._labelFieldName) {
- this.searchTerm = '';
- this.oldSearchTerm = '';
- }
- this._labelFieldName = value;
- }
- get labelFieldName() {
- return this._labelFieldName;
- }
+ @api set labelFieldName(value)
+ {
+ if (value !== this._labelFieldName) {
+ this.searchTerm = '';
+ this.oldSearchTerm = '';
+ }
+ this._labelFieldName = value;
+ }
+ get labelFieldName() {
+ return this._labelFieldName;
+ }
_keyFieldName; //the API name of the labels associated key field.
- @api set keyFieldName(value) {
- if (value !== this._keyFieldName) {
- this.searchTerm = '';
- this.oldSearchTerm = '';
- }
- this._keyFieldName = value;
- }
- get keyFieldName() {
- return this._keyFieldName;
- }
+ @api set keyFieldName(value)
+ {
+ if (value !== this._keyFieldName) {
+ this.searchTerm = '';
+ this.oldSearchTerm = '';
+ }
+ this._keyFieldName = value;
+ }
+ get keyFieldName() {
+ return this._keyFieldName;
+ }
_searchTerm; //the API name of the labels associated key field.
- set searchTerm(value) {
+ set searchTerm(value)
+ {
this._searchTerm = value;
}
- get searchTerm() {
- return this._searchTerm;
+ get searchTerm() {
+ return this._searchTerm;
}
@api iconName; //the icon name used when displaying the options.
@@ -102,7 +107,7 @@ export default class SimpliUIListViewsTypeAhead extends LightningElement {
href;
oldSearchTerm;
isInitialized = false; //identifies if the component has been initialized.
-
+
uniqueKey; //a key which is unique to this search component and passed back with the value once a selection has been made
@track selectedName; //the string name of the selected record (used for display purposes only)
@track selectedId; //the id of the selected record
@@ -117,8 +122,10 @@ export default class SimpliUIListViewsTypeAhead extends LightningElement {
label = { Search_Dot }
renderedCallback() {
- if (this.isInitialized === false) {
- if (this.searchType !== '' && this.searchType !== undefined) {
+ if (this.isInitialized === false)
+ {
+ if (this.searchType !== '' && this.searchType !== undefined)
+ {
console.log('In SimpliUIListViewsTypeAhead.renderedCallback');
console.log('searchType - ' + this.searchType);
console.log('initialName - ' + this.initialName);
@@ -130,30 +137,32 @@ export default class SimpliUIListViewsTypeAhead extends LightningElement {
console.log('uniqueKey - ' + this.uniqueKey);
//if we have an initial value then set that as the chosen option.
- if (this.initialId !== '' && this.initialName !== '') {
+ if (this.initialId !== '' && this.initialName !== '')
+ {
this.boxClass = 'slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-has-focus';
- this.hasValue = true;
+ this.hasValue = true;
this.selectedId = this.initialId;
this.selectedName = this.initialName;
this.isInitialized = true;
- //if we do not have the name of the record to display then get it.
- } else if (this.searchType === 'sobject' && this.initialId !== undefined && this.initialId !== '' && this.initialName === '') {
- getRecordName({ selectedId: this.initialId, objName: this.fieldObjName, labelFieldName: this.labelFieldName })
- .then(result => {
- console.log('Get record name successful');
- console.log('Record name - ' + result);
-
- this.selectedName = result;
- this.searchTerm = this.selectedName;
- this.boxClass = 'slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-has-focus';
- this.hasValue = true;
- this.selectedId = this.initialId;
- this.isInitialized = true;
- })
- .catch(error => {
- console.log('Error Detected - ' + error.body.message + ' | ' + error.body.stackTrace);
- });
+ //if we do not have the name of the record to display then get it.
+ } else if (this.searchType === 'sobject' && this.initialId !== undefined && this.initialId !== '' && this.initialName === '')
+ {
+ getRecordName({selectedId: this.initialId, objName: this.fieldObjName, labelFieldName : this.labelFieldName})
+ .then(result => {
+ console.log('Get record name successful');
+ console.log('Record name - ' + result);
+
+ this.selectedName = result;
+ this.searchTerm = this.selectedName;
+ this.boxClass = 'slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-has-focus';
+ this.hasValue = true;
+ this.selectedId = this.initialId;
+ this.isInitialized = true;
+ })
+ .catch(error => {
+ console.log('Error Detected - ' + error.body.message + ' | ' + error.body.stackTrace);
+ });
this.isInitialized = true;
}
@@ -167,31 +176,33 @@ export default class SimpliUIListViewsTypeAhead extends LightningElement {
search() {
- if ((this.searchType === 'sobject' && this.whereClause !== undefined && this.labelFieldName !== undefined && this.keyFieldName !== undefined && this.fieldObjName !== undefined)
- ||
- (this.searchType === 'schema' && this.fieldObjName !== undefined)
- &&
- this.searchTerm.length > 1) {
+ if ( (this.searchType === 'sobject' && this.whereClause !== undefined && this.labelFieldName !== undefined && this.keyFieldName !== undefined && this.fieldObjName != undefined)
+ ||
+ (this.searchType === 'schema' && this.fieldObjName !== undefined)
+ &&
+ this.searchTerm.length > 1)
+ {
let whereClauseStr = JSON.stringify(this.whereClause);
console.log('Performing search - ' + this.searchType + ', ' + this.searchTerm + ', ' + this.fieldObjName + ', ' + this.labelFieldName + ', ' + this.keyFieldName + ', ' + this.whereClause)
+
+ search({searchType : this.searchType, searchTerm : this.searchTerm, objName : this.fieldObjName, labelFieldName : this.labelFieldName, keyFieldName : this.keyFieldName, whereClauseJSON : whereClauseStr})
+ .then(result => {
+ console.log('searchType - ' + this.searchType);
+ console.log('fieldObjName - ' + this.fieldObjName);
+ console.log('result - ' + result);
+ this.options = result;
+ // console.log("Options - ", JSON.stringify(this.options));
+ if (this.options.length === 0)
+ this.options = undefined;
+ })
+ .catch(error => {
+ console.log('Error Detected - ' + error.message + ' | ' + error.stackTrace);
+ });
+
+ } else if (this.searchType === 'schema' && this.fieldObjName !== undefined)
+ {
- search({ searchType: this.searchType, searchTerm: this.searchTerm, objName: this.fieldObjName, labelFieldName: this.labelFieldName, keyFieldName: this.keyFieldName, whereClauseJSON: whereClauseStr })
- .then(result => {
- console.log('searchType - ' + this.searchType);
- console.log('fieldObjName - ' + this.fieldObjName);
- console.log('result - ' + result);
- this.options = result;
- // console.log("Options - ", JSON.stringify(this.options));
- if (this.options.length === 0)
- this.options = undefined;
- })
- .catch(error => {
- console.log('Error Detected - ' + error.message + ' | ' + error.stackTrace);
- });
-
- } else if (this.searchType === 'schema' && this.fieldObjName !== undefined) {
- console.log('searchType = schema, fieldObjName != undefined');
}
}
@@ -222,7 +233,7 @@ export default class SimpliUIListViewsTypeAhead extends LightningElement {
if (this.searchTerm === '')
this.searchTerm = this.oldSearchTerm;
// eslint-disable-next-line @lwc/lwc/no-async-operation
- this.blurTimeout = setTimeout(() => { this.boxClass = 'slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-has-focus' }, 300);
+ this.blurTimeout = setTimeout(() => {this.boxClass = 'slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-has-focus'}, 300);
}
/*
@@ -230,42 +241,32 @@ export default class SimpliUIListViewsTypeAhead extends LightningElement {
*/
onSelect(event) {
console.log("In onSelect");
- try {
- const { currentTarget } = event;
- this.selectedId = currentTarget?.dataset?.id ?? '';
- this.selectedName = currentTarget?.dataset?.value ?? '';
- console.log('selectedId - ', this.selectedId);
- console.log('selectedName - ', this.selectedName);
-
- //send selected value to parent and in return parent sends the value to @api rowId
- let selectedValue = this.selectedId;
- let field = this.labelFieldName;
- this.searchTerm = this.selectedName;
- this.dispatchEvent(new CustomEvent('valuechange', { detail: { selectedValue, field }, }));
-
- if (this.blurTimeout) {
- clearTimeout(this.blurTimeout);
- }
- this.boxClass = 'slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-has-focus';
- this.hasValue = true;
- } catch (error) {
- SLVHelper.showErrorMessage(error);
+ this.selectedId = event.currentTarget.dataset.id;
+ this.selectedName = event.currentTarget.dataset.value;
+ console.log('selectedId - ', this.selectedId);
+ console.log('selectedName - ', this.selectedName);
+
+ //send selected value to parent and in return parent sends the value to @api rowId
+ let selectedValue = this.selectedId;
+ let field = this.labelFieldName;
+ this.searchTerm = this.selectedName;
+ this.dispatchEvent(new CustomEvent('valuechange', { detail: { selectedValue, field }, }));
+
+ if(this.blurTimeout) {
+ clearTimeout(this.blurTimeout);
}
+ this.boxClass = 'slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-has-focus';
+ this.hasValue = true;
}
/*
* Method called when the search term is updated.
*/
onChange(event) {
- try {
- console.log("In onChange");
- const { target } = event;
- this.searchTerm = target?.value ?? '';
- this.search();
- console.log("searchTerm", this.searchTerm);
- } catch (error) {
- SLVHelper.showErrorMessage(error);
- }
+ console.log("In onChange");
+ this.searchTerm = event.target.value;
+ this.search();
+ console.log("searchTerm",this.searchTerm);
}
}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/simpliUIRecordDetail/simpliUIRecordDetail.js b/force-app/main/default/lwc/simpliUIRecordDetail/simpliUIRecordDetail.js
index 53a66a3..915f839 100644
--- a/force-app/main/default/lwc/simpliUIRecordDetail/simpliUIRecordDetail.js
+++ b/force-app/main/default/lwc/simpliUIRecordDetail/simpliUIRecordDetail.js
@@ -1,11 +1,11 @@
/* eslint-disable vars-on-top */
/* eslint-disable no-console */
import { LightningElement, wire, track } from 'lwc';
-import LISTVIEW_MC from '@salesforce/messageChannel/SimpliListViewMessageChannel__c';
+import LISTVIEW_MC from '@salesforce/messageChannel/SimpliListViewMessageChannel__c';
import { subscribe, unsubscribe, APPLICATION_SCOPE, MessageContext } from 'lightning/messageService';
export default class simpliUIRecordDetail extends LightningElement {
-
+
@track recordId = '';
@track recordURL = '';
@track objectType = '';
@@ -26,7 +26,7 @@ export default class simpliUIRecordDetail extends LightningElement {
*/
@wire(MessageContext)
messageContext;
-
+
/*
* Method which subscribes this component to a defined message channel. This subscription
* allows the components to send messages to each other.
@@ -35,9 +35,9 @@ export default class simpliUIRecordDetail extends LightningElement {
if (this.subscription) {
return;
}
- this.subscription = subscribe(this.messageContext, LISTVIEW_MC,
+ this.subscription = subscribe(this.messageContext, LISTVIEW_MC,
(message) => { this.handleMessage(message); },
- { scope: APPLICATION_SCOPE });
+ { scope: APPLICATION_SCOPE });
}
/*
@@ -58,9 +58,9 @@ export default class simpliUIRecordDetail extends LightningElement {
this.receivedMessage = message;
console.log('simpliUIRecordDetail received a message from ' + this.receivedMessage.uniqueComponentId);
- this.recordId = this.receivedMessage.recordIds;
- this.recordURL = window.location.origin + '/' + this.recordId;
- this.objectType = this.receivedMessage.objectType;
+ this.recordId = this.receivedMessage.recordIds;
+ this.recordURL = window.location.origin + '/' + this.recordId;
+ this.objectType = this.receivedMessage.objectType;
this.isInitialized = true;
}
|