qbs-react-grid 1.1.15 → 1.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/qbs-react-grid.css +22 -0
- package/dist/css/qbs-react-grid.min.css +1 -1
- package/dist/css/qbs-react-grid.min.css.map +1 -1
- package/es/Row.d.ts +3 -0
- package/es/Row.js +8 -3
- package/es/Table.d.ts +1 -0
- package/es/Table.js +20 -6
- package/es/less/qbs-table.less +24 -0
- package/es/qbsTable/CustomTableCell.d.ts +1 -0
- package/es/qbsTable/CustomTableCell.js +71 -2
- package/es/qbsTable/QbsTable.js +22 -2
- package/es/qbsTable/commontypes.d.ts +9 -0
- package/es/qbsTable/utilities/ToolTip.js +30 -18
- package/lib/Row.d.ts +3 -0
- package/lib/Row.js +8 -3
- package/lib/Table.d.ts +1 -0
- package/lib/Table.js +20 -6
- package/lib/less/qbs-table.less +24 -0
- package/lib/qbsTable/CustomTableCell.d.ts +1 -0
- package/lib/qbsTable/CustomTableCell.js +76 -4
- package/lib/qbsTable/QbsTable.js +21 -1
- package/lib/qbsTable/commontypes.d.ts +9 -0
- package/lib/qbsTable/utilities/ToolTip.js +29 -17
- package/package.json +1 -1
- package/src/Row.tsx +8 -2
- package/src/Table.tsx +44 -8
- package/src/less/qbs-table.less +24 -0
- package/src/qbsTable/CustomTableCell.tsx +60 -1
- package/src/qbsTable/QbsTable.tsx +31 -2
- package/src/qbsTable/commontypes.ts +9 -0
- package/src/qbsTable/utilities/ToolTip.tsx +27 -15
- package/src/qbsTable/utilities/menuDropDown.tsx +1 -0
- package/src/utils/useTableDimension.ts +0 -1
|
@@ -7,7 +7,13 @@ import HeaderCell from '../HeaderCell';
|
|
|
7
7
|
import Pagination from '../Pagination';
|
|
8
8
|
import Table from '../Table';
|
|
9
9
|
import { QbsColumnProps, QbsTableProps } from './commontypes';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
ActionCell,
|
|
12
|
+
CheckCell,
|
|
13
|
+
CustomTableCell,
|
|
14
|
+
ExpandCell,
|
|
15
|
+
CustomRowStatus
|
|
16
|
+
} from './CustomTableCell';
|
|
11
17
|
import ToolBar from './Toolbar';
|
|
12
18
|
import ColumToggle from './utilities/ColumShowHide';
|
|
13
19
|
import debounce from './utilities/debounce';
|
|
@@ -63,7 +69,8 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
63
69
|
handleResetColumns,
|
|
64
70
|
selectedRows,
|
|
65
71
|
headerHeight = 40,
|
|
66
|
-
tableBodyHeight
|
|
72
|
+
tableBodyHeight,
|
|
73
|
+
customRowStatus
|
|
67
74
|
}) => {
|
|
68
75
|
const [loading, setLoading] = useState(false);
|
|
69
76
|
const [columns, setColumns] = useState(propColumn);
|
|
@@ -407,6 +414,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
407
414
|
),
|
|
408
415
|
[columns, dataTheme]
|
|
409
416
|
);
|
|
417
|
+
|
|
410
418
|
return (
|
|
411
419
|
<div className={`qbs-table ${classes.tableContainerClass}`} data-theme={dataTheme}>
|
|
412
420
|
{toolbar && <ToolBar {...toolbarProps} />}
|
|
@@ -417,12 +425,14 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
417
425
|
dataTheme={dataTheme}
|
|
418
426
|
wordWrap={wordWrap}
|
|
419
427
|
sortColumn={sortColumn}
|
|
428
|
+
style={{ position: 'relative' }}
|
|
420
429
|
sortType={sortType}
|
|
421
430
|
onSortColumn={handleSortColumn}
|
|
422
431
|
onRowClick={onRowClick}
|
|
423
432
|
tableBodyHeight={tableBodyHeight}
|
|
424
433
|
cellBordered={cellBordered}
|
|
425
434
|
bordered={bordered}
|
|
435
|
+
columns={columns}
|
|
426
436
|
minHeight={minHeight}
|
|
427
437
|
headerHeight={headerHeight}
|
|
428
438
|
loading={isLoading ?? loading}
|
|
@@ -496,6 +506,24 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
496
506
|
/>
|
|
497
507
|
</Column>
|
|
498
508
|
)}
|
|
509
|
+
{customRowStatus && Object.keys(customRowStatus)?.length > 0 && (
|
|
510
|
+
<Column width={50} align="center" fixed="left">
|
|
511
|
+
<HeaderCell
|
|
512
|
+
verticalAlign={findGrouped() ? 'middle' : undefined}
|
|
513
|
+
className={` ${classes.headerlClass}`}
|
|
514
|
+
>
|
|
515
|
+
{' '}
|
|
516
|
+
</HeaderCell>
|
|
517
|
+
<CustomRowStatus
|
|
518
|
+
getIcon={customRowStatus.getIcon}
|
|
519
|
+
dataKey={customRowStatus.field}
|
|
520
|
+
rowClick={customRowStatus.onClick}
|
|
521
|
+
path={customRowStatus.getPath}
|
|
522
|
+
link={customRowStatus.link}
|
|
523
|
+
toolTip={customRowStatus.toolTip}
|
|
524
|
+
/>
|
|
525
|
+
</Column>
|
|
526
|
+
)}
|
|
499
527
|
{columnsRendered}
|
|
500
528
|
{!actionProps ||
|
|
501
529
|
(actionProps?.length === 0 && columnToggle && (
|
|
@@ -546,6 +574,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
546
574
|
</Column>
|
|
547
575
|
)}
|
|
548
576
|
</Table>
|
|
577
|
+
|
|
549
578
|
<div>
|
|
550
579
|
{pagination && data?.length > 0 && <Pagination paginationProps={paginationProps} />}
|
|
551
580
|
</div>
|
|
@@ -101,6 +101,15 @@ export interface QbsTableProps {
|
|
|
101
101
|
handleResetColumns?: () => void;
|
|
102
102
|
headerHeight?: number;
|
|
103
103
|
tableBodyHeight?: string;
|
|
104
|
+
customRowStatus?: {
|
|
105
|
+
getIcon?: (data: any) => ReactElement;
|
|
106
|
+
onClick?: (rowData: any) => void;
|
|
107
|
+
hidden?: boolean;
|
|
108
|
+
toolTip?: string | ReactElement;
|
|
109
|
+
link?: boolean;
|
|
110
|
+
field?: boolean;
|
|
111
|
+
getPath?: (data: any) => string;
|
|
112
|
+
};
|
|
104
113
|
}
|
|
105
114
|
|
|
106
115
|
export interface QbsTableToolbarProps {
|
|
@@ -1,24 +1,36 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState, useRef } from 'react';
|
|
2
2
|
|
|
3
3
|
const TooltipComponent: React.FC<any> = ({ title, children }) => {
|
|
4
|
-
const [
|
|
5
|
-
const
|
|
4
|
+
const [dropdownPosition, setDropdownPosition] = useState('bottom-position');
|
|
5
|
+
const dropRef = useRef(null);
|
|
6
|
+
const menuButtonRef = useRef<HTMLElement>(null);
|
|
7
|
+
const adjustDropdownPosition = () => {
|
|
8
|
+
if (menuButtonRef.current && dropRef.current) {
|
|
9
|
+
const inputBoxRect = menuButtonRef.current?.getBoundingClientRect();
|
|
10
|
+
const viewportHeight = window.innerHeight;
|
|
6
11
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
12
|
+
const spaceAbove = inputBoxRect.top;
|
|
13
|
+
const spaceBelow = viewportHeight - inputBoxRect.bottom;
|
|
14
|
+
if (spaceAbove > spaceBelow) {
|
|
15
|
+
setDropdownPosition('top-position');
|
|
16
|
+
} else {
|
|
17
|
+
setDropdownPosition('bottom-position');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
10
20
|
};
|
|
11
21
|
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
window.addEventListener('scroll', handleScroll);
|
|
14
|
-
return () => {
|
|
15
|
-
window.removeEventListener('scroll', handleScroll);
|
|
16
|
-
};
|
|
17
|
-
}, [scrollY]);
|
|
18
22
|
return (
|
|
19
|
-
<div className={`qbs-table-tooltip ${
|
|
20
|
-
<span
|
|
21
|
-
|
|
23
|
+
<div className={`qbs-table-tooltip ${dropdownPosition == 'bottom-position' ? 'down' : 'up'} `}>
|
|
24
|
+
<span
|
|
25
|
+
ref={menuButtonRef}
|
|
26
|
+
style={{ display: 'flex' }}
|
|
27
|
+
onMouseEnter={() => adjustDropdownPosition()}
|
|
28
|
+
>
|
|
29
|
+
{children}
|
|
30
|
+
</span>
|
|
31
|
+
<span ref={dropRef} className={`tooltiptext`}>
|
|
32
|
+
{title}
|
|
33
|
+
</span>
|
|
22
34
|
</div>
|
|
23
35
|
);
|
|
24
36
|
};
|
|
@@ -41,6 +41,7 @@ const MenuDropDown: React.FC<Props> = ({ actionDropDown, handleMenuActions, rowD
|
|
|
41
41
|
setOpenMenu(false);
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
|
|
44
45
|
return (
|
|
45
46
|
<div className="qbs-table-menu-dropdown" ref={menuRef}>
|
|
46
47
|
<button className="qbs-table-dropbtn" onClick={toggleMenu} ref={menuButtonRef}>
|