Skip to content

Commit

Permalink
CPE finished
Browse files Browse the repository at this point in the history
  • Loading branch information
ericrsmith35 committed Jul 9, 2024
1 parent 77451e1 commit 8dc23ac
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ export default class Datatable extends LightningElement {
let columnNumber = 0;
let lufield = '';

// if (!this.isConfigMode) this.addRemoveRowAction(); //🚀
if (!this.isConfigMode && this.isRemoveRowAction && this.removeRowLeftOrRight == "Left") this.addRemoveRowAction();

this.basicColumns.forEach(colDef => {

Expand Down Expand Up @@ -1657,7 +1657,7 @@ export default class Datatable extends LightningElement {
columnNumber += 1;
});

if (!this.isConfigMode) this.addRemoveRowAction(); //🚀
if (!this.isConfigMode && this.isRemoveRowAction && this.removeRowLeftOrRight != "Left") this.addRemoveRowAction();

this.columns = this.cols;
console.log(this.consoleLogPrefix+'this.columns',this.columns);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@
<property name="cb_isRemoveRowAction" type="String" role="inputOnly"/>
<property name="removeLabel" label="Remove Row Action Label" type="String" role="inputOnly" description="This value will be used as the text that appears when hovering on the Remove Row Action Button (Default: Remove Row)"/>
<property name="removeIcon" label="Remove Row Action Icon" type="String" role="inputOnly" description="This is the icon that will be used for the Remove Row Action Button (Default: utility:close)"/>
<property name="removeColor" label="Remove Row Action Icon Color" type="String" role="inputOnly" description="This is the color (red, green or black) for the icon that will be used for the Remove Row Action Button (Default: red)"/>
<property name="maxRemovedRows" label="Maximum number of rows that can be removed" type="Integer" role="inputOnly" description="Enter a number here if you want to restrict how many rows can be removed from the datatable (Default: 0 - no limit)"/>
<property name="removeRowLeftOrRight" label="Remove Row Action Button Location" type="String" role="inputOnly" description="Specify if the Remove Row Action column should be on the Left or the Right (Default: Right)"/>
<property name="removeColor" label="Remove Row Action Icon Color" type="String" role="inputOnly" description="This is the color (Red, Green or Black) for the icon that will be used for the Remove Row Action Button (Default: Red)"/>
<property name="maxRemovedRows" label="Maximum # of rows that can be removed" type="Integer" role="inputOnly" description="Enter a number here if you want to restrict how many rows can be removed from the datatable (Default: 0 - no limit)"/>
<property name="removeRowLeftOrRight" label="Remove Row Action Column Location" type="String" role="inputOnly" description="Specify if the Remove Row Action column should be on the Left or the Right (Default: Right)"/>
</targetConfig>
</targetConfigs>
</LightningComponentBundle>
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
</c-fsc_flow-combobox>
<c-fsc_pick-icon
mode="combobox"
oniconselection={handlePickIcon}>
oniconselection={handleTableIcon}>
</c-fsc_pick-icon>
</div>

Expand Down Expand Up @@ -413,27 +413,66 @@ <h2 class="slds-modal__title slds-hyphenate">Configure Columns</h2>

<div class={showHideRemoveRowAction}>
<c-fsc_flow-combobox
name="select_recordsPerPage"
label={inputValues.recordsPerPage.label}
value={inputValues.recordsPerPage.value}
value-type={inputValues.recordsPerPage.valueDataType}
field-level-help={inputValues.recordsPerPage.helpText}
name="select_removeLabel"
label={inputValues.removeLabel.label}
value={inputValues.removeLabel.value}
value-type={inputValues.removeLabel.valueDataType}
field-level-help={inputValues.removeLabel.helpText}
builder-context-filter-type="String"
builder-context-filter-collection-boolean={inputValues.removeLabel.isCollection}
builder-context={_builderContext}
onvaluechanged={handleFlowComboboxValueChange}
automatic-output-variables={automaticOutputVariables}>
</c-fsc_flow-combobox>

<c-fsc_flow-combobox
name="select_removeIcon"
label={inputValues.removeIcon.label}
value={inputValues.removeIcon.value}
value-type={inputValues.removeIcon.valueDataType}
field-level-help={inputValues.removeIcon.helpText}
disabled={disallowHeaderChange}
builder-context-filter-collection-boolean={inputValues.removeIcon.isCollection}
builder-context={_builderContext}
onvaluechanged={handleFlowComboboxValueChange}
automatic-output-variables={automaticOutputVariables}>
</c-fsc_flow-combobox>
<c-fsc_pick-icon
mode="combobox"
oniconselection={handleRemoveIcon}>
</c-fsc_pick-icon>

<lightning-radio-group
name="select_removeColor"
label={inputValues.removeColor.label}
options={removeColorOptions}
value={inputValues.removeColor.value}
type="button"
onchange={handleValueChange}
></lightning-radio-group>

<lightning-radio-group
name="select_removeRowLeftOrRight"
label={inputValues.removeRowLeftOrRight.label}
options={removeLeftOrRightOptions}
value={inputValues.removeRowLeftOrRight.value}
type="button"
onchange={handleValueChange}
></lightning-radio-group>

<c-fsc_flow-combobox
name="select_maxRemovedRows"
label={inputValues.maxRemovedRows.label}
value={inputValues.maxRemovedRows.value}
value-type={inputValues.maxRemovedRows.valueDataType}
field-level-help={inputValues.maxRemovedRows.helpText}
builder-context-filter-type="Number"
builder-context-filter-collection-boolean={inputValues.recordsPerPage.isCollection}
builder-context-filter-collection-boolean={inputValues.maxRemovedRows.isCollection}
builder-context={_builderContext}
onvaluechanged={handleFlowComboboxValueChange}
automatic-output-variables={automaticOutputVariables}>
</c-fsc_flow-combobox>

<div class="slds-m-top_xx-small">
<c-fsc_flow-checkbox
name="select_showFirstLastButtons"
label={inputValues.showFirstLastButtons.label}
checked={inputValues.cb_showFirstLastButtons.value}
field-level-help={inputValues.showFirstLastButtons.helpText}
oncheckboxchanged={handleCheckboxChange}
></c-fsc_flow-checkbox>
</div>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ import {LightningElement, track, api} from 'lwc';
import getCPEReturnResults from '@salesforce/apex/ers_DatatableController.getCPEReturnResults';
import { getConstants } from 'c/ers_datatableUtils';

const CONSTANTS = getConstants(); // From ers_datatableUtils : VERSION_NUMBER, MAXROWCOUNT, ROUNDWIDTH, MYDOMAIN, ISCOMMUNITY, WIZROWCOUNT, SHOW_DEBUG_INFO, DEBUG_INFO_PREFIX
const CONSTANTS = getConstants(); // From ers_datatableUtils
const CB_TRUE = CONSTANTS.CB_TRUE;
const CB_FALSE = CONSTANTS.CB_FALSE;
const CB_PREFIX = CONSTANTS.CB_ATTRIB_PREFIX;
const RECORDS_PER_PAGE = CONSTANTS.RECORDS_PER_PAGE;
const REMOVE_ROW_LABEL = CONSTANTS.REMOVE_ROW_LABEL;
const REMOVE_ROW_ICON = CONSTANTS.REMOVE_ROW_ICON;
const REMOVE_ROW_COLOR = CONSTANTS.REMOVE_ROW_COLOR;
const REMOVE_ROW_SIDE = CONSTANTS.REMOVE_ROW_SIDE;
const SHOW_DEBUG_INFO = CONSTANTS.SHOW_DEBUG_INFO;
const DEBUG_INFO_PREFIX = CONSTANTS.DEBUG_INFO_PREFIX;

Expand Down Expand Up @@ -600,10 +604,10 @@ export default class ers_datatableCPE extends LightningElement {
removeIcon: {value: null, valueDataType: null, isCollection: false, label: 'Remove Row Action Icon',
helpText: 'This is the icon that will be used for the Remove Row Action Button (Default: utility:close)'},
removeColor: {value: null, valueDataType: null, isCollection: false, label: 'Remove Row Action Icon Color',
helpText: 'This is the color (red, green or black) for the icon that will be used for the Remove Row Action Button (Default: red)'},
maxRemovedRows: {value: null, valueDataType: null, isCollection: false, label: 'Maximum number of rows that can be removed',
helpText: 'This is the color (Red, Green or Black) for the icon that will be used for the Remove Row Action Button (Default: Red)'},
maxRemovedRows: {value: null, valueDataType: null, isCollection: false, label: 'Maximum # of rows that can be removed',
helpText: 'Enter a number here if you want to restrict how many rows can be removed from the datatable (Default: 0 - no limit)'},
removeRowLeftOrRight: {value: null, valueDataType: null, isCollection: false, label: 'Remove Row Action Button Location',
removeRowLeftOrRight: {value: null, valueDataType: null, isCollection: false, label: 'Remove Row Action Column Location',
helpText: 'Specify if the Remove Row Action column should be on the Left or the Right (Default: Right)'},
};

Expand Down Expand Up @@ -678,11 +682,11 @@ export default class ers_datatableCPE extends LightningElement {
{name: 'rowActions',
attributes: [
{name: 'isRemoveRowAction'},
{name: 'removeLabel'},
{name: 'removeLabel'},
{name: 'removeIcon'},
{name: 'removeColor'},
{name: 'maxRemovedRows'},
{name: 'removeColor'},
{name: 'removeRowLeftOrRight'},
{name: 'maxRemovedRows'},
]
},
{name: 'advancedAttributes',
Expand Down Expand Up @@ -722,6 +726,32 @@ export default class ers_datatableCPE extends LightningElement {
}
]

removeColorOptions = [
{
label: 'Red',
value: 'remove-icon'
},
{
label: 'Green',
value: 'remove-icon-green'
},
{
label: 'Black',
value: 'remove-icon-black'
}
]

removeLeftOrRightOptions = [
{
label: 'Left',
value: 'Left'
},
{
label: 'Right',
value: 'Right'
}
]

// settings = {
// attributeObjectName: 'objectName',
// attributeFieldName: 'fieldName',
Expand Down Expand Up @@ -860,6 +890,21 @@ export default class ers_datatableCPE extends LightningElement {
if (this.inputValues.recordsPerPage.value == null) {
this.inputValues.recordsPerPage.value = RECORDS_PER_PAGE.toString();
}
if (this.inputValues.removeLabel.value == null) {
this.inputValues.removeLabel.value = REMOVE_ROW_LABEL;
}
if (this.inputValues.removeIcon.value == null) {
this.inputValues.removeIcon.value = REMOVE_ROW_ICON;
}
if (this.inputValues.removeColor.value == null) {
this.inputValues.removeColor.value = REMOVE_ROW_COLOR;
}
if (this.inputValues.removeRowLeftOrRight.value == null) {
this.inputValues.removeRowLeftOrRight.value = REMOVE_ROW_SIDE;
}
if (this.inputValues.maxRemovedRows.value == null) {
this.inputValues.maxRemovedRows.value = 0;
}
}

handleBuildHelpInfo() {
Expand Down Expand Up @@ -1087,7 +1132,7 @@ export default class ers_datatableCPE extends LightningElement {
let changedAttribute = event.target.name.replace(defaults.inputAttributePrefix, '');
let newType = event.detail.newValueDataType;
let newValue = event.detail.newValue;
if ((changedAttribute == 'maxNumberOfRows' || changedAttribute == 'recordsPerPage') && newType != 'reference') {
if ((changedAttribute == 'maxNumberOfRows' || changedAttribute == 'maxRemovedRows' || changedAttribute == 'recordsPerPage') && newType != 'reference') {
newType = 'Number';
}
this.dispatchFlowValueChangeEvent(changedAttribute, newValue, newType);
Expand All @@ -1108,8 +1153,15 @@ export default class ers_datatableCPE extends LightningElement {
}
}

handlePickIcon(event) {
let changedAttribute = 'tableIcon';
handleTableIcon(event) {
this.setIconAttribute('tableIcon', event);
}

handleRemoveIcon(event) {
this.setIconAttribute('removeIcon', event);
}

setIconAttribute(changedAttribute, event) {
this.inputValues[changedAttribute].value = event.detail;
this.dispatchFlowValueChangeEvent(changedAttribute, event.detail, 'String');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,25 @@ console.log("DATATABLE: isCommunity, isFlowBuilder:", isCommunity, isFlowBuilder

const getConstants = () => {
return {
VERSION_NUMBER : '4.2.1', // Current Source Code Version #
MAXROWCOUNT : 2000, // Limit the total number of records to be handled by this component
ROUNDWIDTH : 5, // Used to round off the column widths during Config Mode to nearest value
WIZROWCOUNT : 6, // Number of records to display in the Column Wizard datatable
MYDOMAIN : myDomain, // Used for building links for lookup fields
ISCOMMUNITY : isCommunity, // Used for building links for lookup fields
ISFLOWBUILDER : isFlowBuilder, // Used for building links for lookup fields
CB_TRUE : 'CB_TRUE', // Used with fsc_flowCheckbox component
CB_FALSE : 'CB_FALSE', // Used with fsc_flowCheckbox component
CB_ATTRIB_PREFIX : 'cb_', // Used with fsc_flowCheckbox component
MIN_SEARCH_TERM_SIZE : 2, // Set the minimum number of characters required to start searching
SEARCH_WAIT_TIME : 300, // Set the delay to start searching while user is typing a search term
RECORDS_PER_PAGE : 10, // Default number of records per page for pagination
SHOW_DEBUG_INFO : true, // Set to true to show sensitive debug info in the console and debug logs
DEBUG_INFO_PREFIX : 'DATATABLE: ' // Prefix to be used for debug info in the console
VERSION_NUMBER : '4.2.1', // Current Source Code Version #
MAXROWCOUNT : 2000, // Limit the total number of records to be handled by this component
ROUNDWIDTH : 5, // Used to round off the column widths during Config Mode to nearest value
WIZROWCOUNT : 6, // Number of records to display in the Column Wizard datatable
MYDOMAIN : myDomain, // Used for building links for lookup fields
ISCOMMUNITY : isCommunity, // Used for building links for lookup fields
ISFLOWBUILDER : isFlowBuilder, // Used for building links for lookup fields
CB_TRUE : 'CB_TRUE', // Used with fsc_flowCheckbox component
CB_FALSE : 'CB_FALSE', // Used with fsc_flowCheckbox component
CB_ATTRIB_PREFIX : 'cb_', // Used with fsc_flowCheckbox component
MIN_SEARCH_TERM_SIZE : 2, // Set the minimum number of characters required to start searching
SEARCH_WAIT_TIME : 300, // Set the delay to start searching while user is typing a search term
RECORDS_PER_PAGE : 10, // Default number of records per page for pagination
REMOVE_ROW_LABEL : 'Remove Row', // Default label for the Remove Row button
REMOVE_ROW_ICON : 'utility:close', // Default Icon for the Remove Row button
REMOVE_ROW_COLOR : 'remove-icon', // Default Color for the Remove Row button
REMOVE_ROW_SIDE : 'Right', // Default Side for the Remove Row button
SHOW_DEBUG_INFO : true, // Set to true to show sensitive debug info in the console and debug logs
DEBUG_INFO_PREFIX : 'DATATABLE: ' // Prefix to be used for debug info in the console
}
}

Expand Down

0 comments on commit 8dc23ac

Please sign in to comment.