qbs-react-grid 2.2.3 → 2.2.5
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/Cell.js +1 -2
- package/es/Pagination.d.ts +0 -3
- package/es/Pagination.js +3 -8
- package/es/Table.d.ts +0 -3
- package/es/Table.js +12 -18
- package/es/index.d.ts +1 -1
- package/es/less/pagination.less +9 -9
- package/es/less/qbs-table.less +73 -205
- package/es/qbsTable/CustomTableCell.js +2 -13
- package/es/qbsTable/QbsTable.js +46 -124
- package/es/qbsTable/TableCardList.js +39 -52
- package/es/qbsTable/Toolbar.js +13 -62
- package/es/qbsTable/commontypes.d.ts +2 -30
- package/es/qbsTable/utilities/CardComponent.d.ts +0 -2
- package/es/qbsTable/utilities/CardComponent.js +3 -7
- package/es/qbsTable/utilities/CardMenuDropdown.d.ts +0 -2
- package/es/qbsTable/utilities/CardMenuDropdown.js +7 -7
- package/es/qbsTable/utilities/ColumShowHide.d.ts +0 -4
- package/es/qbsTable/utilities/ColumShowHide.js +6 -9
- package/es/qbsTable/utilities/SearchInput.d.ts +0 -1
- package/es/qbsTable/utilities/SearchInput.js +1 -3
- package/es/qbsTable/utilities/ToolTip.d.ts +1 -8
- package/es/qbsTable/utilities/ToolTip.js +31 -107
- package/es/qbsTable/utilities/empty.js +1 -1
- package/es/qbsTable/utilities/icons.d.ts +0 -3
- package/es/qbsTable/utilities/icons.js +1 -65
- package/es/qbsTable/utilities/tablecalc.d.ts +1 -1
- package/es/qbsTable/utilities/tablecalc.js +2 -7
- package/es/utils/useCellDescriptor.js +1 -0
- package/es/utils/useScrollListener.d.ts +0 -1
- package/es/utils/useScrollListener.js +3 -5
- package/lib/Cell.js +1 -2
- package/lib/Pagination.d.ts +0 -3
- package/lib/Pagination.js +3 -8
- package/lib/Table.d.ts +0 -3
- package/lib/Table.js +12 -18
- package/lib/index.d.ts +1 -1
- package/lib/less/pagination.less +9 -9
- package/lib/less/qbs-table.less +73 -205
- package/lib/qbsTable/CustomTableCell.js +2 -13
- package/lib/qbsTable/QbsTable.js +46 -124
- package/lib/qbsTable/TableCardList.js +39 -52
- package/lib/qbsTable/Toolbar.js +12 -61
- package/lib/qbsTable/commontypes.d.ts +2 -30
- package/lib/qbsTable/utilities/CardComponent.d.ts +0 -2
- package/lib/qbsTable/utilities/CardComponent.js +3 -7
- package/lib/qbsTable/utilities/CardMenuDropdown.d.ts +0 -2
- package/lib/qbsTable/utilities/CardMenuDropdown.js +5 -6
- package/lib/qbsTable/utilities/ColumShowHide.d.ts +0 -4
- package/lib/qbsTable/utilities/ColumShowHide.js +6 -9
- package/lib/qbsTable/utilities/SearchInput.d.ts +0 -1
- package/lib/qbsTable/utilities/SearchInput.js +1 -3
- package/lib/qbsTable/utilities/ToolTip.d.ts +1 -8
- package/lib/qbsTable/utilities/ToolTip.js +30 -107
- package/lib/qbsTable/utilities/empty.js +1 -1
- package/lib/qbsTable/utilities/icons.d.ts +0 -3
- package/lib/qbsTable/utilities/icons.js +3 -70
- package/lib/qbsTable/utilities/tablecalc.d.ts +1 -1
- package/lib/qbsTable/utilities/tablecalc.js +2 -7
- package/lib/utils/useCellDescriptor.js +1 -0
- package/lib/utils/useScrollListener.d.ts +0 -1
- package/lib/utils/useScrollListener.js +3 -5
- package/package.json +2 -2
- package/src/Cell.tsx +1 -3
- package/src/HeaderCell.tsx +1 -0
- package/src/Pagination.tsx +3 -10
- package/src/Table.tsx +10 -23
- package/src/customSelect.tsx +88 -88
- package/src/index.ts +1 -1
- package/src/less/pagination.less +9 -9
- package/src/less/qbs-table.less +73 -205
- package/src/qbsTable/CustomTableCell.tsx +9 -31
- package/src/qbsTable/QbsTable.tsx +25 -101
- package/src/qbsTable/TableCardList.tsx +19 -35
- package/src/qbsTable/Toolbar.tsx +11 -53
- package/src/qbsTable/commontypes.ts +1 -32
- package/src/qbsTable/utilities/CardComponent.tsx +2 -7
- package/src/qbsTable/utilities/CardMenuDropdown.tsx +6 -11
- package/src/qbsTable/utilities/ColumShowHide.tsx +6 -33
- package/src/qbsTable/utilities/SearchInput.tsx +1 -3
- package/src/qbsTable/utilities/ToolTip.tsx +27 -138
- package/src/qbsTable/utilities/empty.tsx +2 -2
- package/src/qbsTable/utilities/icons.tsx +1 -78
- package/src/qbsTable/utilities/tablecalc.ts +2 -8
- package/src/utils/useCellDescriptor.ts +1 -0
- package/src/utils/useScrollListener.ts +3 -13
- package/src/utils/useTableRows.ts +1 -1
- package/es/qbsTable/labels.d.ts +0 -48
- package/es/qbsTable/labels.js +0 -34
- package/es/qbsTable/utilities/VerticalDropDownMenu.d.ts +0 -13
- package/es/qbsTable/utilities/VerticalDropDownMenu.js +0 -166
- package/lib/qbsTable/labels.d.ts +0 -48
- package/lib/qbsTable/labels.js +0 -42
- package/lib/qbsTable/utilities/VerticalDropDownMenu.d.ts +0 -13
- package/lib/qbsTable/utilities/VerticalDropDownMenu.js +0 -174
- package/src/qbsTable/labels.ts +0 -58
- package/src/qbsTable/utilities/VerticalDropDownMenu.tsx +0 -187
|
@@ -7,7 +7,6 @@ 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 { mergeLabels } from './labels';
|
|
11
10
|
import {
|
|
12
11
|
ActionCell,
|
|
13
12
|
CheckCell,
|
|
@@ -82,22 +81,15 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
82
81
|
renderEmpty,
|
|
83
82
|
autoHeight,
|
|
84
83
|
emptySubTitle,
|
|
85
|
-
emptyTitle
|
|
86
|
-
dropType = 'horizontal',
|
|
87
|
-
labels: labelsProp
|
|
84
|
+
emptyTitle
|
|
88
85
|
}) => {
|
|
89
|
-
const labels = useMemo(() => mergeLabels(labelsProp), [labelsProp]);
|
|
90
86
|
const [loading, setLoading] = useState(false);
|
|
91
87
|
const [columns, setColumns] = useState(propColumn);
|
|
92
88
|
const [checkedKeys, setCheckedKeys] = useState<(number | string)[]>([]);
|
|
93
|
-
const dataTheme = useMemo(
|
|
94
|
-
() => theme ?? (typeof localStorage !== 'undefined' ? localStorage.getItem('theme') : null) ?? 'light',
|
|
95
|
-
[theme]
|
|
96
|
-
);
|
|
89
|
+
const dataTheme = useMemo(() => localStorage.getItem('theme') ?? theme, [theme]);
|
|
97
90
|
const [isOpen, setIsOpen] = useState(false);
|
|
98
91
|
const prevColumns = useRef<any | null>(null);
|
|
99
92
|
const tableBodyRef = useRef<HTMLDivElement>(null);
|
|
100
|
-
const wheelWrapperRef = useRef<HTMLDivElement>(null);
|
|
101
93
|
const handleSortColumn = useCallback(
|
|
102
94
|
(sortColumn: any, sortType: any) => {
|
|
103
95
|
setLoading(true);
|
|
@@ -149,6 +141,16 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
149
141
|
[checkedKeys]
|
|
150
142
|
);
|
|
151
143
|
|
|
144
|
+
const rowKeyField = dataRowKey ?? 'id';
|
|
145
|
+
const getRowClassName = useCallback(
|
|
146
|
+
(rowData: Record<string, unknown>) => {
|
|
147
|
+
if (!selection) return '';
|
|
148
|
+
const key = rowData?.[rowKeyField] as string | number | undefined;
|
|
149
|
+
return key !== undefined && checkedKeys?.includes(key) ? 'qbs-table-row-checked' : '';
|
|
150
|
+
},
|
|
151
|
+
[selection, checkedKeys, rowKeyField]
|
|
152
|
+
);
|
|
153
|
+
|
|
152
154
|
const handleToggle = useCallback(
|
|
153
155
|
(columnName: string) => {
|
|
154
156
|
let lastVisibleColumn: any = null;
|
|
@@ -234,25 +236,11 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
234
236
|
onSelect: handleClear,
|
|
235
237
|
handleColumnToggle: handleColumnToggle,
|
|
236
238
|
dataLength: data?.length,
|
|
237
|
-
searchPlaceholder: searchPlaceholder
|
|
238
|
-
labels
|
|
239
|
+
searchPlaceholder: searchPlaceholder
|
|
239
240
|
};
|
|
241
|
+
const themeToggle = useMemo(() => document.getElementById('themeToggle') as HTMLInputElement, []);
|
|
240
242
|
|
|
241
243
|
useEffect(() => {
|
|
242
|
-
if (!dataTheme || typeof document === 'undefined') return;
|
|
243
|
-
|
|
244
|
-
document.body.setAttribute('data-theme', dataTheme === 'dark' ? 'dark' : 'light');
|
|
245
|
-
document.documentElement.dataset.theme = dataTheme;
|
|
246
|
-
}, [dataTheme]);
|
|
247
|
-
|
|
248
|
-
const themeToggle = useMemo(
|
|
249
|
-
() => (typeof document !== 'undefined' ? document.getElementById('themeToggle') : null),
|
|
250
|
-
[]
|
|
251
|
-
) as HTMLInputElement | null;
|
|
252
|
-
|
|
253
|
-
useEffect(() => {
|
|
254
|
-
if (theme || typeof document === 'undefined') return;
|
|
255
|
-
|
|
256
244
|
const handleThemeToggle = () => {
|
|
257
245
|
if (themeToggle?.checked) {
|
|
258
246
|
document.body.setAttribute('data-theme', 'dark');
|
|
@@ -277,10 +265,11 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
277
265
|
themeToggle?.removeEventListener('change', handleThemeToggle);
|
|
278
266
|
document.removeEventListener('DOMContentLoaded', handleDOMContentLoaded);
|
|
279
267
|
};
|
|
280
|
-
}, [
|
|
268
|
+
}, [themeToggle]);
|
|
281
269
|
|
|
282
270
|
const handleExpanded = useCallback(
|
|
283
271
|
(rowData: any) => {
|
|
272
|
+
console.log(rowData);
|
|
284
273
|
const keyValue = dataRowKey as string;
|
|
285
274
|
const key = rowData[keyValue];
|
|
286
275
|
|
|
@@ -471,7 +460,6 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
471
460
|
wordWrap={wordWrap}
|
|
472
461
|
autoHeight={autoHeight}
|
|
473
462
|
sortColumn={sortColumn}
|
|
474
|
-
wheelWrapperRef={wheelWrapperRef}
|
|
475
463
|
style={{ position: 'relative' }}
|
|
476
464
|
sortType={sortType}
|
|
477
465
|
onSortColumn={handleSortColumn}
|
|
@@ -483,7 +471,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
483
471
|
renderEmpty ? (
|
|
484
472
|
renderEmpty(info)
|
|
485
473
|
) : (
|
|
486
|
-
<NoData title={emptyTitle ??
|
|
474
|
+
<NoData title={emptyTitle ?? 'No Data Found'} subtitle={emptySubTitle} />
|
|
487
475
|
)
|
|
488
476
|
}
|
|
489
477
|
columns={columns}
|
|
@@ -496,6 +484,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
496
484
|
expandedRowKeys={expandedRowKeys}
|
|
497
485
|
onExpandChange={onExpandChange}
|
|
498
486
|
rowKey={dataRowKey ?? 'id'}
|
|
487
|
+
rowClassName={selection ? getRowClassName : undefined}
|
|
499
488
|
defaultExpandAllRows={defaultExpandAllRows}
|
|
500
489
|
shouldUpdateScroll={shouldUpdateScroll}
|
|
501
490
|
renderRowExpanded={rowData => {
|
|
@@ -601,7 +590,6 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
601
590
|
setIsOpen={setIsOpen}
|
|
602
591
|
handleResetColumns={handleResetColumns}
|
|
603
592
|
handleColumnToggle={handleColumnToggle}
|
|
604
|
-
labels={labels}
|
|
605
593
|
/>
|
|
606
594
|
</HeaderCell>
|
|
607
595
|
<Cell />
|
|
@@ -627,14 +615,12 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
627
615
|
setIsOpen={setIsOpen}
|
|
628
616
|
handleResetColumns={handleResetColumns}
|
|
629
617
|
handleColumnToggle={handleColumnToggle}
|
|
630
|
-
labels={labels}
|
|
631
618
|
/>
|
|
632
619
|
)}
|
|
633
620
|
</HeaderCell>
|
|
634
621
|
<ActionCell
|
|
635
622
|
tableBodyRef={tableBodyRef}
|
|
636
623
|
actionProps={actionProps}
|
|
637
|
-
dropType={dropType}
|
|
638
624
|
className={`${classes.cellClass} ${classes.actionCellClass}`}
|
|
639
625
|
handleMenuActions={handleMenuActions}
|
|
640
626
|
dataTheme={dataTheme}
|
|
@@ -644,9 +630,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
644
630
|
</Table>
|
|
645
631
|
|
|
646
632
|
<div>
|
|
647
|
-
{pagination && data?.length > 0 &&
|
|
648
|
-
<Pagination paginationProps={paginationProps} labels={labels} dataTheme={dataTheme} />
|
|
649
|
-
)}
|
|
633
|
+
{pagination && data?.length > 0 && <Pagination paginationProps={paginationProps} />}
|
|
650
634
|
</div>
|
|
651
635
|
</div>
|
|
652
636
|
</div>
|
package/src/qbsTable/Toolbar.tsx
CHANGED
|
@@ -3,9 +3,8 @@ import React, { useCallback, useRef, useState } from 'react';
|
|
|
3
3
|
import useResponsiveStore from '../utils/useResponsiveStore';
|
|
4
4
|
import { QbsTableToolbarProps } from './commontypes';
|
|
5
5
|
import debounce from './utilities/debounce';
|
|
6
|
-
import { CardView,
|
|
6
|
+
import { CardView, TableView } from './utilities/icons';
|
|
7
7
|
import SearchInput from './utilities/SearchInput';
|
|
8
|
-
import { formatSelectedItems, mergeLabels } from './labels';
|
|
9
8
|
import { getRowDisplayRange } from './utilities/tablecalc';
|
|
10
9
|
import TooltipComponent from './utilities/ToolTip';
|
|
11
10
|
|
|
@@ -28,16 +27,8 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
|
|
|
28
27
|
searchPlaceholder,
|
|
29
28
|
tableViewToggle,
|
|
30
29
|
setTableViewToggle,
|
|
31
|
-
enableTableToggle = false
|
|
32
|
-
rowViewToggle = false,
|
|
33
|
-
defaultRowView = true,
|
|
34
|
-
fullWidthView = false,
|
|
35
|
-
setTableFullView,
|
|
36
|
-
setRowViewToggle,
|
|
37
|
-
isFullScreen = false,
|
|
38
|
-
labels: labelsProp
|
|
30
|
+
enableTableToggle = false
|
|
39
31
|
}) => {
|
|
40
|
-
const labels = mergeLabels(labelsProp);
|
|
41
32
|
const debouncedOnSearch = useCallback(debounce(onSearch ?? (() => {}), 1000), [onSearch]);
|
|
42
33
|
const [searchParam, setSearchParam] = useState<string | undefined>(searchValue);
|
|
43
34
|
const toolbarRef = useRef<HTMLDivElement>(null);
|
|
@@ -82,8 +73,7 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
|
|
|
82
73
|
<div className="qbs-table-primary-filter">
|
|
83
74
|
{search && (
|
|
84
75
|
<SearchInput
|
|
85
|
-
placeholder={searchPlaceholder ??
|
|
86
|
-
searchAriaLabel={labels.searchAriaLabel}
|
|
76
|
+
placeholder={searchPlaceholder ?? 'Search'}
|
|
87
77
|
handleChange={handleChange}
|
|
88
78
|
handleSearch={handleSearch}
|
|
89
79
|
searchValue={searchParam}
|
|
@@ -113,38 +103,10 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
|
|
|
113
103
|
</span>
|
|
114
104
|
)}
|
|
115
105
|
{tableHeaderActions}
|
|
116
|
-
<div className=" pr-1 cursor-pointer relative
|
|
117
|
-
{(rowViewToggle || isFullScreen) && (
|
|
118
|
-
<div className="flex gap-2 qbs-row-switch-cntainer">
|
|
119
|
-
{rowViewToggle && (
|
|
120
|
-
<div className="flex gap-2 table_cell_style">
|
|
121
|
-
<TooltipComponent tableBodyRef={toolbarRef} title={labels.switchToDefaultView}>
|
|
122
|
-
<div onClick={() => setRowViewToggle?.(true)}>
|
|
123
|
-
<DefaultView className={`${defaultRowView ? 'active' : ''}`} />
|
|
124
|
-
</div>
|
|
125
|
-
</TooltipComponent>
|
|
126
|
-
<TooltipComponent tableBodyRef={toolbarRef} title={labels.switchToRelaxedView}>
|
|
127
|
-
<div onClick={() => setRowViewToggle?.(false)}>
|
|
128
|
-
<ContentView className={`${!defaultRowView ? 'active' : ''}`} />
|
|
129
|
-
</div>
|
|
130
|
-
</TooltipComponent>
|
|
131
|
-
</div>
|
|
132
|
-
)}
|
|
133
|
-
{isFullScreen && (
|
|
134
|
-
<div className=" table_full_width">
|
|
135
|
-
<TooltipComponent tableBodyRef={toolbarRef} title={labels.switchToFullScreen}>
|
|
136
|
-
<div onClick={() => setTableFullView?.(!fullWidthView)}>
|
|
137
|
-
<ExpandIcon className={`${fullWidthView ? 'active' : ''}`} />
|
|
138
|
-
</div>
|
|
139
|
-
</TooltipComponent>
|
|
140
|
-
</div>
|
|
141
|
-
)}
|
|
142
|
-
</div>
|
|
143
|
-
)}
|
|
144
|
-
|
|
106
|
+
<div className=" pr-1 cursor-pointer relative ">
|
|
145
107
|
{enableTableToggle && !isMobile && (
|
|
146
108
|
<div className="qbs-table-top-icons flex gap-2">
|
|
147
|
-
<TooltipComponent tableBodyRef={toolbarRef} title={
|
|
109
|
+
<TooltipComponent tableBodyRef={toolbarRef} title={'Switch to Table View'}>
|
|
148
110
|
<div onClick={() => setTableViewToggle?.(true)}>
|
|
149
111
|
<TableView className={`${tableViewToggle ? 'active' : ''}`} />
|
|
150
112
|
</div>
|
|
@@ -153,7 +115,7 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
|
|
|
153
115
|
<div className="border-r h-4 w-1"></div>
|
|
154
116
|
|
|
155
117
|
<div onClick={() => setTableViewToggle?.(false)}>
|
|
156
|
-
<TooltipComponent tableBodyRef={toolbarRef} title={
|
|
118
|
+
<TooltipComponent tableBodyRef={toolbarRef} title={'Switch to Card View'}>
|
|
157
119
|
<CardView className={`${!tableViewToggle ? 'active' : ''}`} />
|
|
158
120
|
</TooltipComponent>
|
|
159
121
|
</div>
|
|
@@ -179,24 +141,21 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
|
|
|
179
141
|
>
|
|
180
142
|
{checkedKeys && checkedKeys?.length > 0 ? (
|
|
181
143
|
<div className="qbs-table-toolbar-sub-container-start">
|
|
182
|
-
<div className="selected-row">
|
|
183
|
-
{formatSelectedItems(labels.selectedItems, checkedKeys?.length ?? 0)}
|
|
184
|
-
</div>
|
|
144
|
+
<div className="selected-row">{`Selected Items(${checkedKeys?.length}) `}</div>
|
|
185
145
|
<div className="selected-row-action">
|
|
186
146
|
<button className="btn" onClick={() => onSelect?.([])}>
|
|
187
|
-
|
|
147
|
+
Clear
|
|
188
148
|
</button>
|
|
189
149
|
{selectedRowActions?.map((actions, index: number) => (
|
|
190
150
|
<>
|
|
191
151
|
{handleHide(actions) && (
|
|
192
152
|
<button
|
|
193
153
|
key={index.toString()}
|
|
194
|
-
className=
|
|
154
|
+
className="btn"
|
|
195
155
|
disabled={actions.disabled}
|
|
196
156
|
onClick={() => actions?.action(checkedKeys)}
|
|
197
157
|
>
|
|
198
|
-
{actions
|
|
199
|
-
<span>{actions.actionTitle}</span>
|
|
158
|
+
{actions.actionTitle}
|
|
200
159
|
</button>
|
|
201
160
|
)}
|
|
202
161
|
</>
|
|
@@ -210,8 +169,7 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
|
|
|
210
169
|
{getRowDisplayRange(
|
|
211
170
|
paginationProps.total ?? 0,
|
|
212
171
|
paginationProps.rowsPerPage ?? 0,
|
|
213
|
-
paginationProps.currentPage ?? 0
|
|
214
|
-
labels.showingRange
|
|
172
|
+
paginationProps.currentPage ?? 0
|
|
215
173
|
)}
|
|
216
174
|
</div>
|
|
217
175
|
)}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import React, { ReactElement, ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
import type { QbsTableLabels } from './labels';
|
|
4
|
-
|
|
5
|
-
export type { QbsTableLabels };
|
|
6
|
-
|
|
7
3
|
interface Content {
|
|
8
4
|
cell: ReactNode | string;
|
|
9
5
|
toolTip?: string;
|
|
@@ -47,7 +43,7 @@ export interface PaginationProps {
|
|
|
47
43
|
export interface ActionProps {
|
|
48
44
|
title?: string;
|
|
49
45
|
action?: (row: any) => void;
|
|
50
|
-
icon
|
|
46
|
+
icon: React.ReactNode;
|
|
51
47
|
toolTip?: string;
|
|
52
48
|
hidden?: boolean;
|
|
53
49
|
hide?: (data: any, index?: number) => boolean;
|
|
@@ -78,7 +74,6 @@ export interface QbsTableProps {
|
|
|
78
74
|
searchValue?: string;
|
|
79
75
|
handleSearchValue?: (value?: string) => void;
|
|
80
76
|
theme?: string;
|
|
81
|
-
rtl?: boolean;
|
|
82
77
|
onRowClick?: (data: any) => void;
|
|
83
78
|
cellBordered?: boolean;
|
|
84
79
|
bordered?: boolean;
|
|
@@ -99,15 +94,12 @@ export interface QbsTableProps {
|
|
|
99
94
|
advancefilter?: ReactElement | ReactNode;
|
|
100
95
|
tableHeaderActions?: ReactElement | ReactNode;
|
|
101
96
|
searchPlaceholder?: string;
|
|
102
|
-
labels?: QbsTableLabels;
|
|
103
97
|
selectedRowActions?: {
|
|
104
98
|
actionTitle?: string;
|
|
105
99
|
action: (checked: (number | string)[]) => void;
|
|
106
100
|
disabled?: boolean;
|
|
107
101
|
hidden?: boolean;
|
|
108
102
|
customHide?: string;
|
|
109
|
-
buttonClassName?: string;
|
|
110
|
-
icon?: ReactElement | ReactNode;
|
|
111
103
|
}[];
|
|
112
104
|
selectedRows?: (number | string)[];
|
|
113
105
|
classes?: { [key: string]: any };
|
|
@@ -138,20 +130,6 @@ export interface QbsTableProps {
|
|
|
138
130
|
handleTableCardView?: (data: any) => React.ReactNode;
|
|
139
131
|
isCustomTableCardView?: boolean;
|
|
140
132
|
handleCustomCardLoader?: () => React.ReactNode;
|
|
141
|
-
hasMoreData?: boolean;
|
|
142
|
-
loadMoreData?: () => void;
|
|
143
|
-
infiniteScroll?: boolean;
|
|
144
|
-
infiniteLoading?: boolean;
|
|
145
|
-
viewMode?: string;
|
|
146
|
-
rowViewToggle?: boolean;
|
|
147
|
-
defaultRowView?: boolean;
|
|
148
|
-
fullWidthView?: boolean;
|
|
149
|
-
setTableFullView?: (value: boolean) => void;
|
|
150
|
-
setRowViewToggle?: (value: boolean) => void;
|
|
151
|
-
dropType?: 'horizondal' | 'vertical';
|
|
152
|
-
rowHeight?: number;
|
|
153
|
-
isFullScreen?: boolean;
|
|
154
|
-
showHeader?: boolean;
|
|
155
133
|
}
|
|
156
134
|
|
|
157
135
|
export interface QbsTableToolbarProps {
|
|
@@ -177,7 +155,6 @@ export interface QbsTableToolbarProps {
|
|
|
177
155
|
dataLength: number;
|
|
178
156
|
headerHeight?: number;
|
|
179
157
|
searchPlaceholder?: string;
|
|
180
|
-
labels?: QbsTableLabels;
|
|
181
158
|
tableView?: boolean;
|
|
182
159
|
enableTableToggle?: boolean;
|
|
183
160
|
tableViewToggle?: boolean;
|
|
@@ -188,13 +165,5 @@ export interface QbsTableToolbarProps {
|
|
|
188
165
|
disabled?: boolean;
|
|
189
166
|
hidden?: boolean;
|
|
190
167
|
customHide?: string;
|
|
191
|
-
buttonClassName?: string;
|
|
192
|
-
icon?: ReactElement | ReactNode;
|
|
193
168
|
}[];
|
|
194
|
-
rowViewToggle?: boolean;
|
|
195
|
-
defaultRowView?: boolean;
|
|
196
|
-
fullWidthView?: boolean;
|
|
197
|
-
setTableFullView?: (value: boolean) => void;
|
|
198
|
-
setRowViewToggle?: (value: boolean) => void;
|
|
199
|
-
isFullScreen?: boolean;
|
|
200
169
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useRef, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { QbsColumnProps } from '../commontypes';
|
|
4
|
-
import { mergeLabels, type QbsTableLabels } from '../labels';
|
|
5
4
|
import CardMenuDropdown from './CardMenuDropdown';
|
|
6
5
|
import { handleCellFormat } from './handleFormatCell';
|
|
7
6
|
import { ArrowUpIcon } from './icons';
|
|
@@ -18,7 +17,6 @@ type Props = {
|
|
|
18
17
|
handleMenuActions?: () => void;
|
|
19
18
|
cardColumLimit?: number;
|
|
20
19
|
childDetailHeading?: string;
|
|
21
|
-
labels?: QbsTableLabels;
|
|
22
20
|
};
|
|
23
21
|
|
|
24
22
|
const CardComponent: React.FC<Props> = ({
|
|
@@ -29,10 +27,8 @@ const CardComponent: React.FC<Props> = ({
|
|
|
29
27
|
index,
|
|
30
28
|
cardColumLimit = 5,
|
|
31
29
|
handleMenuActions,
|
|
32
|
-
childDetailHeading = ''
|
|
33
|
-
labels: labelsProp
|
|
30
|
+
childDetailHeading = ''
|
|
34
31
|
}) => {
|
|
35
|
-
const labels = mergeLabels(labelsProp);
|
|
36
32
|
const [viewMore, setViewMore] = useState(false);
|
|
37
33
|
const initialDisplayCount = cardColumLimit;
|
|
38
34
|
|
|
@@ -106,14 +102,13 @@ const CardComponent: React.FC<Props> = ({
|
|
|
106
102
|
iconName="more"
|
|
107
103
|
rowIndex={index}
|
|
108
104
|
handleMenuActions={handleMenuActions}
|
|
109
|
-
labels={labels}
|
|
110
105
|
/>
|
|
111
106
|
</div>
|
|
112
107
|
|
|
113
108
|
{columns.length > initialDisplayCount && (
|
|
114
109
|
<TooltipComponent
|
|
115
110
|
tableBodyRef={useCardRef}
|
|
116
|
-
title={viewMore ?
|
|
111
|
+
title={viewMore ? ' View Less' : 'View More'}
|
|
117
112
|
enabled={false}
|
|
118
113
|
>
|
|
119
114
|
<button
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
2
4
|
import { ActionProps } from '../commontypes';
|
|
3
|
-
import { mergeLabels, type QbsTableLabels } from '../labels';
|
|
4
5
|
import { ThreeDotIcon } from './icons';
|
|
5
6
|
import TooltipComponent from './ToolTip';
|
|
6
7
|
|
|
@@ -12,16 +13,9 @@ type Props = {
|
|
|
12
13
|
dataTheme?: string;
|
|
13
14
|
tableBodyRef: React.RefObject<HTMLDivElement>;
|
|
14
15
|
rowIndex?: number;
|
|
15
|
-
labels?: QbsTableLabels;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
const CardMenuDropdown: React.FC<Props> = ({
|
|
19
|
-
actionDropDown,
|
|
20
|
-
handleMenuActions,
|
|
21
|
-
rowData,
|
|
22
|
-
labels: labelsProp
|
|
23
|
-
}) => {
|
|
24
|
-
const labels = mergeLabels(labelsProp);
|
|
18
|
+
const CardMenuDropdown: React.FC<Props> = ({ actionDropDown, handleMenuActions, rowData }) => {
|
|
25
19
|
const [openMenu, setOpenMenu] = useState(false);
|
|
26
20
|
const [menuPositionStyles, setMenuPositionStyles] = useState<{
|
|
27
21
|
top?: string;
|
|
@@ -52,6 +46,7 @@ const CardMenuDropdown: React.FC<Props> = ({
|
|
|
52
46
|
const dropdownHeight = 200; // Adjust this if your dropdown height varies
|
|
53
47
|
const spaceBelow = window.innerHeight - buttonRect.bottom;
|
|
54
48
|
const spaceAbove = buttonRect.top;
|
|
49
|
+
console.log(spaceAbove, spaceBelow, dropdownHeight);
|
|
55
50
|
if (spaceBelow < dropdownHeight && spaceAbove > spaceBelow) {
|
|
56
51
|
setMenuPositionStyles({
|
|
57
52
|
bottom: '30px',
|
|
@@ -81,7 +76,7 @@ const CardMenuDropdown: React.FC<Props> = ({
|
|
|
81
76
|
return (
|
|
82
77
|
<div className="dropdown text-black dark:text-white dark:bg-[#424242] bg-white" ref={menuRef}>
|
|
83
78
|
<button className="dropdown-toggle" onClick={toggleMenu} ref={menuButtonRef}>
|
|
84
|
-
<TooltipComponent title=
|
|
79
|
+
<TooltipComponent title="Actions" enabled={false} ref={menuButtonRef}>
|
|
85
80
|
<ThreeDotIcon />
|
|
86
81
|
</TooltipComponent>
|
|
87
82
|
</button>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { QbsColumnProps } from '../commontypes';
|
|
4
|
-
import { mergeLabels, type QbsTableLabels } from '../labels';
|
|
5
4
|
import { SettingsIcon } from './icons';
|
|
6
5
|
|
|
7
6
|
interface ColumnToggleProps {
|
|
@@ -13,9 +12,6 @@ interface ColumnToggleProps {
|
|
|
13
12
|
handleColumnToggle?: (columns: QbsColumnProps[]) => void;
|
|
14
13
|
handleResetColumns?: () => void;
|
|
15
14
|
tableHeight?: number;
|
|
16
|
-
viewMode?: string;
|
|
17
|
-
setViewMode?: (value: string) => void;
|
|
18
|
-
labels?: QbsTableLabels;
|
|
19
15
|
}
|
|
20
16
|
|
|
21
17
|
const ColumnToggle: React.FC<ColumnToggleProps> = ({
|
|
@@ -26,10 +22,8 @@ const ColumnToggle: React.FC<ColumnToggleProps> = ({
|
|
|
26
22
|
setIsOpen,
|
|
27
23
|
handleResetColumns,
|
|
28
24
|
handleColumnToggle,
|
|
29
|
-
tableHeight = 450
|
|
30
|
-
labels: labelsProp
|
|
25
|
+
tableHeight = 450
|
|
31
26
|
}) => {
|
|
32
|
-
const labels = mergeLabels(labelsProp);
|
|
33
27
|
const [draggedItem, setDraggedItem] = useState<number | null>(null);
|
|
34
28
|
const popupRef = useRef<HTMLDivElement | null>(null);
|
|
35
29
|
const [dragOverPosition, setDragOverPosition] = useState<number | null>();
|
|
@@ -189,7 +183,7 @@ const ColumnToggle: React.FC<ColumnToggleProps> = ({
|
|
|
189
183
|
>
|
|
190
184
|
<div className="qbs-table-popup-container">
|
|
191
185
|
<div className="qbs-table-popup-item">
|
|
192
|
-
<div className="qbs-table-popup-label">
|
|
186
|
+
<div className="qbs-table-popup-label">FIXED COLUMNS</div>
|
|
193
187
|
<div className="qbs-table-columns-container">
|
|
194
188
|
<div className="qbs-table-column">
|
|
195
189
|
{columns.map((column, index) =>
|
|
@@ -200,7 +194,7 @@ const ColumnToggle: React.FC<ColumnToggleProps> = ({
|
|
|
200
194
|
</div>
|
|
201
195
|
<div className="qbs-table-divider"></div>
|
|
202
196
|
<div className="qbs-table-popup-item">
|
|
203
|
-
<div className="qbs-table-popup-label">
|
|
197
|
+
<div className="qbs-table-popup-label">VISIBLE COLUMNS</div>
|
|
204
198
|
<div className="qbs-table-columns-container">
|
|
205
199
|
<div className="qbs-table-column">
|
|
206
200
|
{columns.map((column, index) =>
|
|
@@ -213,7 +207,7 @@ const ColumnToggle: React.FC<ColumnToggleProps> = ({
|
|
|
213
207
|
<>
|
|
214
208
|
<div className="qbs-table-divider"></div>
|
|
215
209
|
<div className="qbs-table-popup-item">
|
|
216
|
-
<div className="qbs-table-popup-label">
|
|
210
|
+
<div className="qbs-table-popup-label">AVAILABLE COLUMNS</div>
|
|
217
211
|
<div className="qbs-table-columns-container">
|
|
218
212
|
<div className="qbs-table-column">
|
|
219
213
|
{columns.map((column, index) =>
|
|
@@ -237,35 +231,14 @@ const ColumnToggle: React.FC<ColumnToggleProps> = ({
|
|
|
237
231
|
href="#"
|
|
238
232
|
onClick={() => handleResetColumns?.()}
|
|
239
233
|
>
|
|
240
|
-
|
|
234
|
+
Reset to default
|
|
241
235
|
</a>
|
|
242
236
|
<a className="qbs-table-reset-link" href="#" onClick={() => handleColToggle()}>
|
|
243
|
-
|
|
237
|
+
Save
|
|
244
238
|
</a>
|
|
245
239
|
</div>
|
|
246
240
|
</>
|
|
247
241
|
)}
|
|
248
|
-
{/* <div className="qbs-table-popup-item">
|
|
249
|
-
<label className="flex items-center gap-2">
|
|
250
|
-
<input
|
|
251
|
-
type="radio"
|
|
252
|
-
value="compact"
|
|
253
|
-
checked={viewMode === 'compact'}
|
|
254
|
-
onChange={() => setViewMode?.('compact')}
|
|
255
|
-
/>
|
|
256
|
-
Compact View
|
|
257
|
-
</label>
|
|
258
|
-
|
|
259
|
-
<label className="flex items-center gap-2">
|
|
260
|
-
<input
|
|
261
|
-
type="radio"
|
|
262
|
-
value="expanded"
|
|
263
|
-
checked={viewMode === 'expanded'}
|
|
264
|
-
onChange={() => setViewMode?.('expanded')}
|
|
265
|
-
/>
|
|
266
|
-
Default View
|
|
267
|
-
</label>
|
|
268
|
-
</div> */}
|
|
269
242
|
</div>
|
|
270
243
|
</div>
|
|
271
244
|
)}
|
|
@@ -2,14 +2,12 @@ import React, { memo, useCallback } from 'react';
|
|
|
2
2
|
|
|
3
3
|
export interface SearchProps {
|
|
4
4
|
placeholder: string;
|
|
5
|
-
searchAriaLabel?: string;
|
|
6
5
|
handleChange: (value: string) => void;
|
|
7
6
|
searchValue: string | undefined;
|
|
8
7
|
handleSearch: (value?: string) => void;
|
|
9
8
|
}
|
|
10
9
|
const SearchInput: React.FC<SearchProps> = ({
|
|
11
10
|
placeholder,
|
|
12
|
-
searchAriaLabel = 'Search',
|
|
13
11
|
handleChange,
|
|
14
12
|
searchValue,
|
|
15
13
|
handleSearch
|
|
@@ -39,7 +37,7 @@ const SearchInput: React.FC<SearchProps> = ({
|
|
|
39
37
|
placeholder={placeholder}
|
|
40
38
|
value={searchValue ?? ''}
|
|
41
39
|
onChange={handleInputChange}
|
|
42
|
-
aria-label=
|
|
40
|
+
aria-label="Search"
|
|
43
41
|
/>
|
|
44
42
|
<button
|
|
45
43
|
className="search-button absolute left-1 bottom-1.5 bg-white text-grey-dark"
|