Add property to show or hide bulk update actions on Table (#739)

This commit is contained in:
Sherfin Shamsudeen 2021-09-13 15:37:07 +05:30 committed by GitHub
parent e8eda697e6
commit a56aa9c954
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View file

@ -53,6 +53,9 @@ export function Table({
const showFilterButtonProperty = component.definition.properties.showFilterButton?.value;
const showFilterButton = resolveWidgetFieldValue(showFilterButtonProperty, currentState) ?? true; // default is true for backward compatibility
const showBulkUpdateActionsProperty = component.definition.properties.showBulkUpdateActions?.value;
const showBulkUpdateActions = resolveWidgetFieldValue(showBulkUpdateActionsProperty, currentState) ?? true; // default is true for backward compatibility
const clientSidePaginationProperty = component.definition.properties.clientSidePagination?.value;
const clientSidePagination = resolveWidgetFieldValue(clientSidePaginationProperty, currentState) ?? !serverSidePagination; // default is true for backward compatibility
@ -785,7 +788,7 @@ export function Table({
}
</div>
{Object.keys(componentState.changeSet || {}).length > 0 && (
{(showBulkUpdateActions && Object.keys(componentState.changeSet || {}).length > 0) && (
<div className="col">
<button
className={`btn btn-primary btn-sm ${componentState.isSavingChanges ? 'btn-loading' : ''}`}

View file

@ -17,6 +17,7 @@ export const componentTypes = [
displaySearchBox: { type: 'toggle', displayName: 'Show search box' },
showDownloadButton: { type: 'toggle', displayName: 'Show download button' },
showFilterButton: { type: 'toggle', displayName: 'Show filter button' },
showBulkUpdateActions: { type: 'toggle', displayName: 'Show bulk update actions' },
},
others: {
showOnDesktop: { type: 'toggle', displayName: 'Show on desktop? ' },
@ -76,6 +77,7 @@ export const componentTypes = [
{ name: 'email', id: 'afc9a5091750a1bd4760e38760de3b4be11a43452ae8ae07ce2eebc569fe9a7f' },
],
},
showBulkUpdateActions: { value: true },
},
events: [],
styles: {

View file

@ -595,6 +595,7 @@ class Table extends React.Component {
{displaySearchBox && renderElement(component, componentMeta, paramUpdated, dataQueries, 'serverSideSearch', 'properties', currentState)}
{renderElement(component, componentMeta, paramUpdated, dataQueries, 'showDownloadButton', 'properties', currentState)}
{renderElement(component, componentMeta, paramUpdated, dataQueries, 'showFilterButton', 'properties', currentState)}
{renderElement(component, componentMeta, paramUpdated, dataQueries, 'showBulkUpdateActions', 'properties', currentState)}
{Object.keys(componentMeta.styles).map((style) => renderElement(component, componentMeta, paramUpdated, dataQueries, style, 'styles', currentState, components))}
<div className="hr-text">Events</div>