qbs-react-grid 1.2.2 → 1.2.4
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 +1 -1
- package/dist/css/qbs-react-grid.min.css +1 -1
- package/dist/css/qbs-react-grid.min.css.map +1 -1
- package/es/less/qbs-table.less +89 -22
- package/es/qbsTable/QbsTable.js +7 -1
- package/es/qbsTable/Toolbar.js +9 -7
- package/es/qbsTable/commontypes.d.ts +3 -0
- package/es/qbsTable/utilities/CardComponent.d.ts +2 -0
- package/es/qbsTable/utilities/CardComponent.js +28 -9
- package/es/qbsTable/utilities/CardMenuDropdown.js +11 -7
- package/es/qbsTable/utilities/SwitchCardColumns.js +2 -2
- package/es/qbsTable/utilities/ToolTip.js +2 -5
- package/es/qbsTable/utilities/store.d.ts +2 -0
- package/es/qbsTable/utilities/store.js +60 -0
- package/lib/less/qbs-table.less +89 -22
- package/lib/qbsTable/QbsTable.js +7 -1
- package/lib/qbsTable/Toolbar.js +8 -6
- package/lib/qbsTable/commontypes.d.ts +3 -0
- package/lib/qbsTable/utilities/CardComponent.d.ts +2 -0
- package/lib/qbsTable/utilities/CardComponent.js +27 -8
- package/lib/qbsTable/utilities/CardMenuDropdown.js +12 -7
- package/lib/qbsTable/utilities/SwitchCardColumns.js +2 -2
- package/lib/qbsTable/utilities/ToolTip.js +2 -5
- package/lib/qbsTable/utilities/store.d.ts +2 -0
- package/lib/qbsTable/utilities/store.js +66 -0
- package/package.json +1 -1
- package/src/less/qbs-table.less +89 -22
- package/src/qbsTable/QbsTable.tsx +6 -2
- package/src/qbsTable/Toolbar.tsx +8 -7
- package/src/qbsTable/commontypes.ts +3 -0
- package/src/qbsTable/utilities/CardComponent.tsx +91 -61
- package/src/qbsTable/utilities/CardMenuDropdown.tsx +10 -8
- package/src/qbsTable/utilities/SwitchCardColumns.tsx +2 -2
- package/src/qbsTable/utilities/ToolTip.tsx +1 -4
- package/src/qbsTable/utilities/store.ts +61 -0
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { ActionProps } from '../commontypes';
|
|
5
5
|
import { ThreeDotIcon } from './icons';
|
|
6
|
+
import TooltipComponent from './ToolTip';
|
|
6
7
|
|
|
7
8
|
type Props = {
|
|
8
9
|
iconName: string;
|
|
@@ -72,25 +73,26 @@ const CardMenuDropdown: React.FC<Props> = ({ actionDropDown, handleMenuActions,
|
|
|
72
73
|
handleClose();
|
|
73
74
|
};
|
|
74
75
|
|
|
75
|
-
console.log(menuPositionStyles);
|
|
76
76
|
return (
|
|
77
77
|
<div className="dropdown text-black dark:text-white dark:bg-[#424242] bg-white" ref={menuRef}>
|
|
78
78
|
<button className="dropdown-toggle" onClick={toggleMenu} ref={menuButtonRef}>
|
|
79
|
-
<
|
|
79
|
+
<TooltipComponent title="Actions" enabled={false} ref={menuButtonRef}>
|
|
80
|
+
<ThreeDotIcon />
|
|
81
|
+
</TooltipComponent>
|
|
80
82
|
</button>
|
|
81
83
|
{openMenu && (
|
|
82
84
|
<div
|
|
83
|
-
className=" qbs-card-dropdown rounded absolute right-0 mt-2 w-
|
|
85
|
+
className=" qbs-card-dropdown rounded absolute right-0 mt-2 w-auto min-w-11 z-10 shadow-modalShadow bg-white dark:bg-[#424242] dark:text-white"
|
|
84
86
|
style={menuPositionStyles}
|
|
85
87
|
>
|
|
86
|
-
<div className="qbs-card-dropdown-menu px-2 bg-white rounded w-full border border-grey-border shadow-menudropdown dark:bg-[#424242] dark:text-white">
|
|
88
|
+
<div className="qbs-card-dropdown-menu px-2 bg-white rounded w-full border border-grey-border shadow-lg shadow-menudropdown dark:bg-[#424242] dark:text-white">
|
|
87
89
|
{actionDropDown?.map(
|
|
88
90
|
item =>
|
|
89
91
|
!item.hidden && (
|
|
90
92
|
<a
|
|
91
93
|
key={item.title}
|
|
92
94
|
href="#/"
|
|
93
|
-
className={'px-
|
|
95
|
+
className={'px-1 hover:bg-background no-underline whitespace-nowrap '}
|
|
94
96
|
onClick={e => {
|
|
95
97
|
e.preventDefault();
|
|
96
98
|
e.stopPropagation();
|
|
@@ -98,12 +100,12 @@ const CardMenuDropdown: React.FC<Props> = ({ actionDropDown, handleMenuActions,
|
|
|
98
100
|
}}
|
|
99
101
|
>
|
|
100
102
|
<div
|
|
101
|
-
className={` qbs-card-dropdown-menu-item ${
|
|
102
|
-
item.isWarning ? 'text-error-light' : 'text-black
|
|
103
|
+
className={` qbs-card-dropdown-menu-item no-underline ${
|
|
104
|
+
item.isWarning ? 'text-error-light' : ' text-black/70 dark:text-white'
|
|
103
105
|
} text-xxs flex items-center w-full tracking-[0.24px] font-medium `}
|
|
104
106
|
>
|
|
105
107
|
{item?.icon && <>{item.icon}</>}
|
|
106
|
-
<span className="pl-1.5">{item.title}</span>
|
|
108
|
+
<span className="pl-1.5 no-underline text-sm ">{item.title}</span>
|
|
107
109
|
</div>
|
|
108
110
|
</a>
|
|
109
111
|
)
|
|
@@ -9,14 +9,14 @@ export const CustomTableCell: React.FC<any> = React.memo(
|
|
|
9
9
|
{link && !path && !hideLink?.(rowData) ? (
|
|
10
10
|
<a
|
|
11
11
|
onClick={() => rowClick?.(rowData)}
|
|
12
|
-
className={`qbs-table-row-link ${!viewMore ? 'line-clamp-1' : ''}`}
|
|
12
|
+
className={`qbs-table-row-link no-underline ${!viewMore ? 'line-clamp-1' : ''}`}
|
|
13
13
|
>
|
|
14
14
|
{renderCell ? renderCell(rowData)?.cell : handleCellFormat(rowData[dataKey], type)}
|
|
15
15
|
</a>
|
|
16
16
|
) : path && !hideLink?.(rowData) ? (
|
|
17
17
|
<Link
|
|
18
18
|
to={path?.(rowData) ?? ''}
|
|
19
|
-
className={`qbs-table-row-link ${!viewMore ? 'line-clamp-1' : ''}`}
|
|
19
|
+
className={`qbs-table-row-link no-underline ${!viewMore ? 'line-clamp-1' : ''}`}
|
|
20
20
|
>
|
|
21
21
|
{renderCell ? renderCell(rowData)?.cell : handleCellFormat(rowData[dataKey], type)}
|
|
22
22
|
</Link>
|
|
@@ -7,14 +7,11 @@ const TooltipComponent: React.FC<any> = ({ title, children, tableBodyRef }) => {
|
|
|
7
7
|
const adjustDropdownPosition = () => {
|
|
8
8
|
if (menuButtonRef.current && tableBodyRef?.current) {
|
|
9
9
|
const inputBoxRect = menuButtonRef.current?.getBoundingClientRect();
|
|
10
|
-
const viewportHeight = tableBodyRef?.current?.offsetHeight ?? window.innerHeight;
|
|
11
10
|
const tableRect = tableBodyRef.current.getBoundingClientRect();
|
|
12
|
-
|
|
13
11
|
// Calculate positions relative to the table
|
|
14
12
|
const spaceAbove = inputBoxRect.top - tableRect.top;
|
|
15
13
|
const spaceBelow = tableRect.bottom - inputBoxRect.bottom;
|
|
16
14
|
|
|
17
|
-
console.log(viewportHeight, spaceAbove, spaceBelow);
|
|
18
15
|
if (spaceAbove > spaceBelow) {
|
|
19
16
|
setDropdownPosition('top-position');
|
|
20
17
|
} else {
|
|
@@ -32,7 +29,7 @@ const TooltipComponent: React.FC<any> = ({ title, children, tableBodyRef }) => {
|
|
|
32
29
|
>
|
|
33
30
|
{children}
|
|
34
31
|
</span>
|
|
35
|
-
<span ref={dropRef} className={
|
|
32
|
+
<span ref={dropRef} className={'tooltiptext'}>
|
|
36
33
|
{title}
|
|
37
34
|
</span>
|
|
38
35
|
</div>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export const getGridColsClass = (count: number) => {
|
|
2
|
+
switch (count) {
|
|
3
|
+
case 1:
|
|
4
|
+
return 'grid-cols-1';
|
|
5
|
+
case 2:
|
|
6
|
+
return 'grid-cols-2';
|
|
7
|
+
case 3:
|
|
8
|
+
return 'grid-cols-3';
|
|
9
|
+
case 4:
|
|
10
|
+
return 'grid-cols-4';
|
|
11
|
+
case 5:
|
|
12
|
+
return 'grid-cols-5';
|
|
13
|
+
case 6:
|
|
14
|
+
return 'grid-cols-6';
|
|
15
|
+
case 7:
|
|
16
|
+
return 'grid-cols-7';
|
|
17
|
+
case 8:
|
|
18
|
+
return 'grid-cols-8';
|
|
19
|
+
case 9:
|
|
20
|
+
return 'grid-cols-9';
|
|
21
|
+
case 10:
|
|
22
|
+
return 'grid-cols-10';
|
|
23
|
+
case 11:
|
|
24
|
+
return 'grid-cols-11';
|
|
25
|
+
case 12:
|
|
26
|
+
return 'grid-cols-12';
|
|
27
|
+
default:
|
|
28
|
+
return 'grid-cols-1';
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const getGridColSpanClass = (count: number) => {
|
|
33
|
+
switch (count) {
|
|
34
|
+
case 1:
|
|
35
|
+
return 'col-span-1';
|
|
36
|
+
case 2:
|
|
37
|
+
return 'col-span-2';
|
|
38
|
+
case 3:
|
|
39
|
+
return 'col-span-3';
|
|
40
|
+
case 4:
|
|
41
|
+
return 'col-span-4';
|
|
42
|
+
case 5:
|
|
43
|
+
return 'col-span-5';
|
|
44
|
+
case 6:
|
|
45
|
+
return 'col-span--6';
|
|
46
|
+
case 7:
|
|
47
|
+
return 'col-span--7';
|
|
48
|
+
case 8:
|
|
49
|
+
return 'col-span--8';
|
|
50
|
+
case 9:
|
|
51
|
+
return 'col-span--9';
|
|
52
|
+
case 10:
|
|
53
|
+
return 'col-span--10';
|
|
54
|
+
case 11:
|
|
55
|
+
return 'col-span--11';
|
|
56
|
+
case 12:
|
|
57
|
+
return 'col-span--12';
|
|
58
|
+
default:
|
|
59
|
+
return 'col-span--1';
|
|
60
|
+
}
|
|
61
|
+
};
|