mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
feat(TextOverlayTooltip): WIP
This commit is contained in:
@@ -11,7 +11,7 @@ export const CommercialDocHeader = styled.div`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
export const CommercialDocTopHeader = styled.div`
|
export const CommercialDocTopHeader = styled.div`
|
||||||
margin-bottom: 25px;
|
margin-bottom: 30px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const CommercialDocEntriesTable = styled(DataTable)`
|
export const CommercialDocEntriesTable = styled(DataTable)`
|
||||||
|
|||||||
27
src/components/DataTableCells/TextOverviewTooltipCell.js
Normal file
27
src/components/DataTableCells/TextOverviewTooltipCell.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Tooltip, Position } from '@blueprintjs/core';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Text overview tooltip cell.
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
|
export function TextOverviewTooltipCell({ cell: { value } }) {
|
||||||
|
const SUBMENU_POPOVER_MODIFIERS = {
|
||||||
|
flip: { boundariesElement: 'viewport', padding: 20 },
|
||||||
|
offset: { offset: '0, 10' },
|
||||||
|
preventOverflow: { boundariesElement: 'viewport', padding: 40 },
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Tooltip
|
||||||
|
content={value}
|
||||||
|
position={Position.BOTTOM_LEFT}
|
||||||
|
boundary={'viewport'}
|
||||||
|
minimal={true}
|
||||||
|
modifiers={SUBMENU_POPOVER_MODIFIERS}
|
||||||
|
targetClassName={'table-tooltip-overview-target'}
|
||||||
|
>
|
||||||
|
{value}
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ import CheckBoxFieldCell from './CheckBoxFieldCell';
|
|||||||
import SwitchFieldCell from './SwitchFieldCell';
|
import SwitchFieldCell from './SwitchFieldCell';
|
||||||
import TextAreaCell from './TextAreaCell';
|
import TextAreaCell from './TextAreaCell';
|
||||||
import BranchesListFieldCell from './BranchesListFieldCell';
|
import BranchesListFieldCell from './BranchesListFieldCell';
|
||||||
|
import { TextOverviewTooltipCell } from './TextOverviewTooltipCell';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
AccountsListFieldCell,
|
AccountsListFieldCell,
|
||||||
@@ -25,4 +26,5 @@ export {
|
|||||||
SwitchFieldCell,
|
SwitchFieldCell,
|
||||||
TextAreaCell,
|
TextAreaCell,
|
||||||
BranchesListFieldCell,
|
BranchesListFieldCell,
|
||||||
|
TextOverviewTooltipCell,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ import DrawerHeaderContent from './Drawer/DrawerHeaderContent';
|
|||||||
import Postbox from './Postbox';
|
import Postbox from './Postbox';
|
||||||
import AccountsSuggestField from './AccountsSuggestField';
|
import AccountsSuggestField from './AccountsSuggestField';
|
||||||
import MaterialProgressBar from './MaterialProgressBar';
|
import MaterialProgressBar from './MaterialProgressBar';
|
||||||
import { MoneyFieldCell } from './DataTableCells';
|
|
||||||
import AvaterCell from './AvaterCell';
|
import AvaterCell from './AvaterCell';
|
||||||
|
|
||||||
import { ItemsMultiSelect } from './Items';
|
import { ItemsMultiSelect } from './Items';
|
||||||
@@ -105,6 +104,7 @@ export * from './Currencies';
|
|||||||
export * from './FormTopbar'
|
export * from './FormTopbar'
|
||||||
export * from './Paper';
|
export * from './Paper';
|
||||||
export * from './Accounts'
|
export * from './Accounts'
|
||||||
|
export * from './DataTableCells';
|
||||||
|
|
||||||
const Hint = FieldHint;
|
const Hint = FieldHint;
|
||||||
|
|
||||||
@@ -167,7 +167,6 @@ export {
|
|||||||
Postbox,
|
Postbox,
|
||||||
AccountsSuggestField,
|
AccountsSuggestField,
|
||||||
MaterialProgressBar,
|
MaterialProgressBar,
|
||||||
MoneyFieldCell,
|
|
||||||
ItemsMultiSelect,
|
ItemsMultiSelect,
|
||||||
AvaterCell,
|
AvaterCell,
|
||||||
MoreMenuItems,
|
MoreMenuItems,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import {
|
|||||||
FormattedMessage as T,
|
FormattedMessage as T,
|
||||||
Choose,
|
Choose,
|
||||||
Can,
|
Can,
|
||||||
MODIFIER,
|
TextOverviewTooltipCell,
|
||||||
} from 'components';
|
} from 'components';
|
||||||
import {
|
import {
|
||||||
SaleInvoiceAction,
|
SaleInvoiceAction,
|
||||||
@@ -27,19 +27,6 @@ import {
|
|||||||
} from '../../../common/abilityOption';
|
} from '../../../common/abilityOption';
|
||||||
import { useInvoiceDetailDrawerContext } from './InvoiceDetailDrawerProvider';
|
import { useInvoiceDetailDrawerContext } from './InvoiceDetailDrawerProvider';
|
||||||
|
|
||||||
export function TooltipAccessor({ cell: { value } }) {
|
|
||||||
return (
|
|
||||||
<Tooltip
|
|
||||||
content={value}
|
|
||||||
position={Position.BOTTOM_LEFT}
|
|
||||||
boundary={'viewport'}
|
|
||||||
className={MODIFIER.SELECT_LIST_TOOLTIP_ITEMS} // block
|
|
||||||
>
|
|
||||||
{value}
|
|
||||||
</Tooltip>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve invoice readonly details table columns.
|
* Retrieve invoice readonly details table columns.
|
||||||
*/
|
*/
|
||||||
@@ -54,52 +41,54 @@ export const useInvoiceReadonlyEntriesColumns = () => {
|
|||||||
{
|
{
|
||||||
Header: intl.get('product_and_service'),
|
Header: intl.get('product_and_service'),
|
||||||
accessor: 'item.name',
|
accessor: 'item.name',
|
||||||
Cell: TooltipAccessor,
|
Cell: TextOverviewTooltipCell,
|
||||||
width: getColumnWidth(entries, 'item.name', {
|
|
||||||
minWidth: 100,
|
|
||||||
maxWidth: 150,
|
|
||||||
magicSpacing: 5,
|
|
||||||
}),
|
|
||||||
className: 'name',
|
|
||||||
disableSortBy: true,
|
disableSortBy: true,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
|
width: 150,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: intl.get('description'),
|
Header: intl.get('description'),
|
||||||
accessor: 'description',
|
accessor: 'description',
|
||||||
// Cell: TooltipAccessor,
|
Cell: TextOverviewTooltipCell,
|
||||||
className: 'description',
|
|
||||||
width: getColumnWidth(entries, 'description', {
|
|
||||||
minWidth: 100,
|
|
||||||
maxWidth: 150,
|
|
||||||
magicSpacing: 5,
|
|
||||||
}),
|
|
||||||
disableSortBy: true,
|
disableSortBy: true,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
|
width: 75,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: intl.get('quantity'),
|
Header: intl.get('quantity'),
|
||||||
accessor: 'quantity',
|
accessor: 'quantity',
|
||||||
Cell: FormatNumberCell,
|
Cell: FormatNumberCell,
|
||||||
width: 100,
|
|
||||||
align: 'right',
|
align: 'right',
|
||||||
disableSortBy: true,
|
disableSortBy: true,
|
||||||
|
textOverview: true,
|
||||||
|
width: getColumnWidth(entries, 'quantity', {
|
||||||
|
minWidth: 60,
|
||||||
|
magicSpacing: 5,
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: intl.get('rate'),
|
Header: intl.get('rate'),
|
||||||
accessor: 'rate',
|
accessor: 'rate',
|
||||||
Cell: FormatNumberCell,
|
Cell: FormatNumberCell,
|
||||||
width: 100,
|
|
||||||
align: 'right',
|
align: 'right',
|
||||||
disableSortBy: true,
|
disableSortBy: true,
|
||||||
|
textOverview: true,
|
||||||
|
width: getColumnWidth(entries, 'rate', {
|
||||||
|
minWidth: 60,
|
||||||
|
magicSpacing: 5,
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: intl.get('amount'),
|
Header: intl.get('amount'),
|
||||||
accessor: 'amount',
|
accessor: 'amount',
|
||||||
Cell: FormatNumberCell,
|
Cell: FormatNumberCell,
|
||||||
width: 100,
|
|
||||||
align: 'right',
|
align: 'right',
|
||||||
disableSortBy: true,
|
disableSortBy: true,
|
||||||
|
textOverview: true,
|
||||||
|
width: getColumnWidth(entries, 'amount', {
|
||||||
|
minWidth: 60,
|
||||||
|
magicSpacing: 5,
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
|
|||||||
@@ -290,3 +290,8 @@ html[lang^='ar'] {
|
|||||||
.font-bold {
|
.font-bold {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
span.table-tooltip-overview-target{
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user