qbs-react-grid 1.2.2 → 1.2.3

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.
Files changed (35) hide show
  1. package/dist/css/qbs-react-grid.css +1 -1
  2. package/dist/css/qbs-react-grid.min.css +1 -1
  3. package/dist/css/qbs-react-grid.min.css.map +1 -1
  4. package/es/less/qbs-table.less +89 -22
  5. package/es/qbsTable/QbsTable.js +7 -1
  6. package/es/qbsTable/Toolbar.js +9 -7
  7. package/es/qbsTable/commontypes.d.ts +3 -0
  8. package/es/qbsTable/utilities/CardComponent.d.ts +2 -0
  9. package/es/qbsTable/utilities/CardComponent.js +28 -9
  10. package/es/qbsTable/utilities/CardMenuDropdown.js +12 -8
  11. package/es/qbsTable/utilities/SwitchCardColumns.js +2 -2
  12. package/es/qbsTable/utilities/ToolTip.js +2 -5
  13. package/es/qbsTable/utilities/store.d.ts +2 -0
  14. package/es/qbsTable/utilities/store.js +60 -0
  15. package/lib/less/qbs-table.less +89 -22
  16. package/lib/qbsTable/QbsTable.js +7 -1
  17. package/lib/qbsTable/Toolbar.js +8 -6
  18. package/lib/qbsTable/commontypes.d.ts +3 -0
  19. package/lib/qbsTable/utilities/CardComponent.d.ts +2 -0
  20. package/lib/qbsTable/utilities/CardComponent.js +27 -8
  21. package/lib/qbsTable/utilities/CardMenuDropdown.js +13 -8
  22. package/lib/qbsTable/utilities/SwitchCardColumns.js +2 -2
  23. package/lib/qbsTable/utilities/ToolTip.js +2 -5
  24. package/lib/qbsTable/utilities/store.d.ts +2 -0
  25. package/lib/qbsTable/utilities/store.js +66 -0
  26. package/package.json +1 -1
  27. package/src/less/qbs-table.less +89 -22
  28. package/src/qbsTable/QbsTable.tsx +6 -2
  29. package/src/qbsTable/Toolbar.tsx +8 -7
  30. package/src/qbsTable/commontypes.ts +3 -0
  31. package/src/qbsTable/utilities/CardComponent.tsx +91 -61
  32. package/src/qbsTable/utilities/CardMenuDropdown.tsx +10 -8
  33. package/src/qbsTable/utilities/SwitchCardColumns.tsx +2 -2
  34. package/src/qbsTable/utilities/ToolTip.tsx +1 -4
  35. 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
- <ThreeDotIcon />
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-56 z-10 shadow-modalShadow bg-white dark:bg-[#424242] dark:text-white"
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-2 hover:bg-background '}
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 dark:text-white'
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 ">{'Edit this column'}</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={`tooltiptext `}>
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
+ };