mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
BIG-5: feat switching between compact and medium table row size.
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
||||
If,
|
||||
DashboardActionViewsList,
|
||||
DashboardFilterButton,
|
||||
DashboardRowsHeightButton
|
||||
} from 'components';
|
||||
|
||||
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||
@@ -165,6 +166,9 @@ function AccountsActionsBar({
|
||||
icon={<Icon icon="file-import-16" iconSize={16} />}
|
||||
text={<T id={'import'} />}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
<DashboardRowsHeightButton />
|
||||
<NavbarDivider />
|
||||
<Switch
|
||||
labelElement={<T id={'inactive'} />}
|
||||
defaultChecked={accountsInactiveMode}
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
Switch,
|
||||
Alignment,
|
||||
} from '@blueprintjs/core';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import { DashboardRowsHeightButton, FormattedMessage as T } from 'components';
|
||||
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||
import Icon from 'components/Icon';
|
||||
import {
|
||||
@@ -25,8 +25,10 @@ import { useRefreshItems } from 'hooks/query/items';
|
||||
import withItems from 'containers/Items/withItems';
|
||||
import withItemsActions from './withItemsActions';
|
||||
import withAlertActions from 'containers/Alert/withAlertActions';
|
||||
import withSettings from '../Settings/withSettings';
|
||||
|
||||
import { compose } from 'utils';
|
||||
import withSettingsActions from '../Settings/withSettingsActions';
|
||||
|
||||
/**
|
||||
* Items actions bar.
|
||||
@@ -42,6 +44,12 @@ function ItemsActionsBar({
|
||||
|
||||
// #withAlertActions
|
||||
openAlert,
|
||||
|
||||
// #withSettings
|
||||
itemsTableSize,
|
||||
|
||||
// #withSettingsActions
|
||||
addSetting,
|
||||
}) {
|
||||
// Items list context.
|
||||
const { itemsViews, fields } = useItemsListContext();
|
||||
@@ -72,10 +80,14 @@ function ItemsActionsBar({
|
||||
const checked = event.target.checked;
|
||||
setItemsTableState({ inactiveMode: checked });
|
||||
};
|
||||
|
||||
// Handle refresh button click.
|
||||
const handleRefreshBtnClick = () => {
|
||||
refresh();
|
||||
};
|
||||
// Handle table row size change.
|
||||
const handleTableRowSizeChange = (size) => {
|
||||
addSetting('items', 'tableSize', size);
|
||||
};
|
||||
|
||||
return (
|
||||
<DashboardActionsBar>
|
||||
@@ -131,6 +143,12 @@ function ItemsActionsBar({
|
||||
icon={<Icon icon="file-export-16" iconSize={16} />}
|
||||
text={<T id={'export'} />}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
<DashboardRowsHeightButton
|
||||
initialValue={itemsTableSize}
|
||||
onChange={handleTableRowSizeChange}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
<Switch
|
||||
labelElement={<T id={'inactive'} />}
|
||||
defaultChecked={itemsInactiveMode}
|
||||
@@ -150,11 +168,15 @@ function ItemsActionsBar({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withSettingsActions,
|
||||
withItems(({ itemsSelectedRows, itemsTableState }) => ({
|
||||
itemsSelectedRows,
|
||||
itemsInactiveMode: itemsTableState.inactiveMode,
|
||||
itemsFilterRoles: itemsTableState.filterRoles,
|
||||
})),
|
||||
withSettings(({ itemsSettings }) => ({
|
||||
itemsTableSize: itemsSettings.tableSize,
|
||||
})),
|
||||
withItemsActions,
|
||||
withAlertActions,
|
||||
)(ItemsActionsBar);
|
||||
|
||||
@@ -10,11 +10,11 @@ import TableSkeletonHeader from 'components/Datatable/TableHeaderSkeleton';
|
||||
|
||||
import { TABLES } from 'common/tables';
|
||||
|
||||
import withItems from 'containers/Items/withItems';
|
||||
import withItemsActions from 'containers/Items/withItemsActions';
|
||||
import withAlertsActions from 'containers/Alert/withAlertActions';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||
import withSettings from '../Settings/withSettings';
|
||||
|
||||
import { useItemsListContext } from './ItemsListProvider';
|
||||
import { useItemsTableColumns, ItemsActionMenuList } from './components';
|
||||
@@ -37,8 +37,8 @@ function ItemsDataTable({
|
||||
// #withDrawerActions
|
||||
openDrawer,
|
||||
|
||||
// #withItems
|
||||
itemsTableState,
|
||||
// #withSettings
|
||||
itemsTableSize,
|
||||
|
||||
// #ownProps
|
||||
tableProps,
|
||||
@@ -146,6 +146,7 @@ function ItemsDataTable({
|
||||
onCellClick={handleCellClick}
|
||||
initialColumnsWidths={initialColumnsWidths}
|
||||
onColumnResizing={handleColumnResizing}
|
||||
size={itemsTableSize}
|
||||
payload={{
|
||||
onDeleteItem: handleDeleteItem,
|
||||
onEditItem: handleEditItem,
|
||||
@@ -167,5 +168,7 @@ export default compose(
|
||||
withAlertsActions,
|
||||
withDrawerActions,
|
||||
withDialogActions,
|
||||
withItems(({ itemsTableState }) => ({ itemsTableState })),
|
||||
withSettings(({ itemsSettings }) => ({
|
||||
itemsTableSize: itemsSettings.tableSize,
|
||||
})),
|
||||
)(ItemsDataTable);
|
||||
|
||||
@@ -2,11 +2,13 @@ import { connect } from 'react-redux';
|
||||
import {
|
||||
FetchOptions,
|
||||
submitOptions,
|
||||
addSettings
|
||||
} from 'store/settings/settings.actions';
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
requestSubmitOptions: (form) => dispatch(submitOptions({ form })),
|
||||
requestFetchOptions: () => dispatch(FetchOptions({})),
|
||||
addSetting: (group, key, value) => dispatch(addSettings(group, key, value)),
|
||||
});
|
||||
|
||||
export default connect(null, mapDispatchToProps);
|
||||
|
||||
Reference in New Issue
Block a user