Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/firefly/js/tables/tables-typedefs.jsdoc
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@
* @prop {boolean} [showPaging=true] enable/disable paging feature. When false, all data will be displayed.
* @prop {boolean} [showSave=true]
* @prop {boolean} [showFilterButton=true]
* @prop {boolean} [showSelectRowFilter=true] show the checkbox-header action to filter on selected rows
* @prop {boolean} [showAddColumn=true] when true, allow add column to table
* @prop {boolean} [showInfoButton=true] when true, shows additional information about table, if available
* @prop {boolean} [showOptionButton=true]
Expand Down
17 changes: 10 additions & 7 deletions src/firefly/js/tables/ui/BasicTableView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,16 @@ const BasicTableViewInternal = React.memo(({ selectable:selectableIn= false, sho
error, tbl_ui_id=uniqueTblUiId(), currentPage, startIdx=0, highlightedRowHandler, cellRenderers, onRowDoubleClick} = props;

const uiStates = getTableUiById(tbl_ui_id) || {};
const {tbl_id, columnWidths, scrollLeft=0, scrollTop=0, triggeredBy, showTypes, showFilters, showUnits, filterInfo,
selectable, sortInfo, textView} = uiStates;
const {tbl_id, columnWidths, scrollLeft=0, scrollTop=0, triggeredBy, showTypes, showFilters, showSelectRowFilter,
showUnits, filterInfo, selectable, sortInfo, textView} = uiStates;
const tableRef = useRef();

useEffect( () => {
if (!isEmpty(columns)) {
const changes = omitBy(pick(props, 'showTypes', 'showFilters', 'showUnits', 'filterInfo','selectable', 'sortInfo', 'textView'), isUndefined);
const changes = omitBy(
pick(props, 'showTypes', 'showFilters', 'showSelectRowFilter', 'showUnits', 'filterInfo', 'selectable', 'sortInfo', 'textView'),
isUndefined
);

const showUnits = !!columns.find?.((col) => col?.units);
if (isUndefined(changes.showUnits)) changes.showUnits = showUnits;
Expand Down Expand Up @@ -169,7 +172,7 @@ const BasicTableViewInternal = React.memo(({ selectable:selectableIn= false, sho
}, [columns, columnWidths, width, adjScrollLeft, adjScrollTop]);

const makeColumnsProps = {columns, data, selectable, selectInfoCls, renderers,
columnWidths, filterInfo, sortInfo, showHeader, showUnits, showTypes, showFilters,
columnWidths, filterInfo, sortInfo, showHeader, showUnits, showTypes, showFilters, showSelectRowFilter,
onSort, onFilter, onRowSelect, onSelectAll, onFilterSelected, startIdx, cellRenderers, tbl_id};

const rowClassNameGetter = highlightedRowHandler || defHighlightedRowHandler(tbl_id, hlRowIdx, startIdx);
Expand Down Expand Up @@ -474,7 +477,8 @@ function makeColumnTag(props, col, idx) {
);
}

function makeSelColTag({selectable, onSelectAll, showUnits, showTypes, showFilters, onFilterSelected, selectInfoCls, onRowSelect}) {
function makeSelColTag({selectable, onSelectAll, showUnits, showTypes, showFilters, showSelectRowFilter,
onFilterSelected, selectInfoCls, onRowSelect}) {

if (!selectable) return false;

Expand All @@ -483,12 +487,11 @@ function makeSelColTag({selectable, onSelectAll, showUnits, showTypes, showFilte
<Column
key='selectable-checkbox'
columnKey='selectable-checkbox'
header={<SelectableHeader {...{checked, onSelectAll, showUnits, showTypes, showFilters, onFilterSelected}} />}
header={<SelectableHeader {...{checked, onSelectAll, showUnits, showTypes, showFilters, showSelectRowFilter, onFilterSelected}} />}
cell={<SelectableCell selectInfoCls={selectInfoCls} onRowSelect={onRowSelect} />}
fixed={true}
width={25}
allowCellsRecycling={true}
/>
);
}

6 changes: 4 additions & 2 deletions src/firefly/js/tables/ui/TablePanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const defaultOptions = {
showSave: true,
showOptionButton: true,
showFilterButton: true,
showSelectRowFilter: true,
showInfoButton: true,
showAddColumn: true,
showTypes: true,
Expand Down Expand Up @@ -88,7 +89,7 @@ export function TablePanel({tbl_id, tbl_ui_id, tableModel, variant='outlined', s

const {selectable, renderers, title, removable, rowHeight, rowHeightGetter,
showToolbar, showTitle, showMetaInfo,
columns, showHeader, showUnits, allowUnits, showTypes, showFilters, textView,
columns, showHeader, showUnits, allowUnits, showTypes, showFilters, showSelectRowFilter, textView,
error, startIdx, hlRowIdx, currentPage, selectInfo, showMask,
filterInfo, sortInfo, data, backgroundable, highlightedRowHandler, cellRenderers, onRowDoubleClick} = tblState;

Expand Down Expand Up @@ -132,7 +133,7 @@ export function TablePanel({tbl_id, tbl_ui_id, tableModel, variant='outlined', s
<BasicTableView
callbacks={connector}
{ ...{columns, data, hlRowIdx, rowHeight, rowHeightGetter, selectable, showUnits,
allowUnits, showTypes, showFilters, selectInfoCls, filterInfo, sortInfo, textView,
allowUnits, showTypes, showFilters, showSelectRowFilter, selectInfoCls, filterInfo, sortInfo, textView,
showMask, currentPage, showHeader, renderers, tbl_ui_id, highlightedRowHandler,
startIdx, cellRenderers, onRowDoubleClick} }
/>
Expand Down Expand Up @@ -169,6 +170,7 @@ TablePanel.propTypes = {
showToggleTextView: PropTypes.bool,
showOptionButton: PropTypes.bool,
showFilterButton: PropTypes.bool,
showSelectRowFilter: PropTypes.bool,
showAddColumn: PropTypes.bool,
showInfoButton: PropTypes.bool,
showSearchButton: PropTypes.bool,
Expand Down
5 changes: 3 additions & 2 deletions src/firefly/js/tables/ui/TableRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ function EnumSelect({col, tbl_id, filterInfoCls, onFilter}) {
);
}

export function SelectableHeader ({checked, onSelectAll, showUnits, showTypes, showFilters, onFilterSelected, sx}) {
export function SelectableHeader ({checked, onSelectAll, showUnits, showTypes, showFilters, showSelectRowFilter=true,
onFilterSelected, sx}) {
return (
<Stack alignItems='center' height={1} justifyContent='space-between' py='2px' sx={sx}>
<Checkbox size='sm'
Expand All @@ -225,7 +226,7 @@ export function SelectableHeader ({checked, onSelectAll, showUnits, showTypes, s
onChange={(e) => onSelectAll(e.target.checked)}/>
{/*{showUnits && <Box height='1em'/>}*/}
{/*{showTypes && <Box height='1em'/>}*/}
{showFilters && <FilterButton iconButtonSize='28px'
{showFilters && showSelectRowFilter && <FilterButton iconButtonSize='28px'
onClick={onFilterSelected}
tip='Filter on selected rows'/>}
</Stack>
Expand Down
3 changes: 1 addition & 2 deletions src/firefly/js/visualize/ui/FileUploadViewPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ function AnalysisInfo({report,supported=true,UNKNOWN_FORMAT}) {
);
}

const tblOptions = {showToolbar:false, border:false, showOptionButton:false, showFilters:true};
const tblOptions = {showToolbar:false, border:false, showOptionButton:false, showFilters:true, showSelectRowFilter:false};

function AnalysisTable({summaryModel, detailsModel, report, isMoc, UNKNOWN_FORMAT, acceptList, acceptOneItem}) {
if (!summaryModel) return null;
Expand Down Expand Up @@ -916,4 +916,3 @@ const FileAnalysis = ({report, summaryModel, detailsModel, isMoc, UNKNOWN_FORMAT
);
}
};