qbs-react-grid 2.2.6 → 2.2.9
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/index.d.ts +2 -0
- package/es/index.js +2 -1
- package/es/less/qbs-table.less +58 -4
- package/es/qbsTable/CustomTableCell.js +4 -2
- package/es/qbsTable/QbsTable.js +39 -6
- package/es/qbsTable/TableCardList.js +37 -6
- package/es/qbsTable/Toolbar.js +87 -23
- package/es/qbsTable/commontypes.d.ts +18 -0
- package/es/qbsTable/labels.d.ts +25 -0
- package/es/qbsTable/labels.js +32 -0
- package/es/qbsTable/utilities/ColumShowHide.d.ts +3 -0
- package/es/qbsTable/utilities/ColumShowHide.js +112 -33
- package/es/qbsTable/utilities/VerticalDropDownMenu.js +22 -5
- package/es/qbsTable/utilities/columnToggleCoordinator.d.ts +5 -0
- package/es/qbsTable/utilities/columnToggleCoordinator.js +9 -0
- package/es/qbsTable/utilities/icons.d.ts +3 -0
- package/es/qbsTable/utilities/icons.js +67 -3
- package/es/qbsTable/utilities/verticalMenuCoordinator.d.ts +5 -0
- package/es/qbsTable/utilities/verticalMenuCoordinator.js +9 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +6 -2
- package/lib/less/qbs-table.less +58 -4
- package/lib/qbsTable/CustomTableCell.js +4 -2
- package/lib/qbsTable/QbsTable.js +39 -6
- package/lib/qbsTable/TableCardList.js +37 -6
- package/lib/qbsTable/Toolbar.js +85 -21
- package/lib/qbsTable/commontypes.d.ts +18 -0
- package/lib/qbsTable/labels.d.ts +25 -0
- package/lib/qbsTable/labels.js +40 -0
- package/lib/qbsTable/utilities/ColumShowHide.d.ts +3 -0
- package/lib/qbsTable/utilities/ColumShowHide.js +112 -32
- package/lib/qbsTable/utilities/VerticalDropDownMenu.js +21 -4
- package/lib/qbsTable/utilities/columnToggleCoordinator.d.ts +5 -0
- package/lib/qbsTable/utilities/columnToggleCoordinator.js +15 -0
- package/lib/qbsTable/utilities/icons.d.ts +3 -0
- package/lib/qbsTable/utilities/icons.js +72 -5
- package/lib/qbsTable/utilities/verticalMenuCoordinator.d.ts +5 -0
- package/lib/qbsTable/utilities/verticalMenuCoordinator.js +15 -0
- package/package.json +1 -1
- package/src/index.ts +6 -0
- package/src/less/qbs-table.less +58 -4
- package/src/qbsTable/CustomTableCell.tsx +4 -2
- package/src/qbsTable/QbsTable.tsx +30 -4
- package/src/qbsTable/TableCardList.tsx +28 -4
- package/src/qbsTable/Toolbar.tsx +99 -29
- package/src/qbsTable/commontypes.ts +19 -0
- package/src/qbsTable/labels.ts +55 -0
- package/src/qbsTable/utilities/ColumShowHide.tsx +170 -84
- package/src/qbsTable/utilities/VerticalDropDownMenu.tsx +26 -3
- package/src/qbsTable/utilities/columnToggleCoordinator.ts +14 -0
- package/src/qbsTable/utilities/icons.tsx +76 -3
- package/src/qbsTable/utilities/verticalMenuCoordinator.ts +14 -0
|
@@ -8,6 +8,7 @@ import Pagination from '../Pagination';
|
|
|
8
8
|
import Table from '../Table';
|
|
9
9
|
import useResponsiveStore from '../utils/useResponsiveStore';
|
|
10
10
|
import { QbsColumnProps, QbsTableProps } from './commontypes';
|
|
11
|
+
import { mergeQbsTableLabels } from './labels';
|
|
11
12
|
import {
|
|
12
13
|
ActionCell,
|
|
13
14
|
CheckCell,
|
|
@@ -92,8 +93,19 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
92
93
|
isCustomTableCardView = false,
|
|
93
94
|
handleTableCardView,
|
|
94
95
|
handleCustomCardLoader,
|
|
95
|
-
dropType
|
|
96
|
+
dropType,
|
|
97
|
+
labels: labelsProp,
|
|
98
|
+
rtl = false,
|
|
99
|
+
rowViewToggle = false,
|
|
100
|
+
defaultRowView = true,
|
|
101
|
+
fullWidthView = false,
|
|
102
|
+
setTableFullView,
|
|
103
|
+
setRowViewToggle,
|
|
104
|
+
isFullScreen = false,
|
|
105
|
+
rowHeight,
|
|
96
106
|
}) => {
|
|
107
|
+
const labels = useMemo(() => mergeQbsTableLabels(labelsProp), [labelsProp]);
|
|
108
|
+
const pinSide = rtl ? 'left' : 'right';
|
|
97
109
|
const [loading, setLoading] = useState(false);
|
|
98
110
|
const [columns, setColumns] = useState(propColumn);
|
|
99
111
|
const [checkedKeys, setCheckedKeys] = useState<(number | string)[]>([]);
|
|
@@ -252,7 +264,15 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
252
264
|
searchPlaceholder: searchPlaceholder,
|
|
253
265
|
setTableViewToggle: setTableViewToggle,
|
|
254
266
|
tableViewToggle: tableViewToggle,
|
|
255
|
-
enableTableToggle: enableTableToggle
|
|
267
|
+
enableTableToggle: enableTableToggle,
|
|
268
|
+
rowViewToggle,
|
|
269
|
+
defaultRowView,
|
|
270
|
+
fullWidthView,
|
|
271
|
+
setTableFullView,
|
|
272
|
+
setRowViewToggle,
|
|
273
|
+
isFullScreen,
|
|
274
|
+
labels,
|
|
275
|
+
rtl,
|
|
256
276
|
};
|
|
257
277
|
const themeToggle = useMemo(() => document.getElementById('themeToggle') as HTMLInputElement, []);
|
|
258
278
|
|
|
@@ -584,6 +604,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
584
604
|
height={autoHeight ? undefined : height}
|
|
585
605
|
key={tableKey}
|
|
586
606
|
tableKey={tableKey}
|
|
607
|
+
rtl={rtl}
|
|
587
608
|
data={data}
|
|
588
609
|
tableBodyRef={tableBodyRef as React.RefObject<HTMLDivElement>}
|
|
589
610
|
dataTheme={dataTheme}
|
|
@@ -607,6 +628,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
607
628
|
columns={columns}
|
|
608
629
|
minHeight={minHeight}
|
|
609
630
|
headerHeight={headerHeight}
|
|
631
|
+
rowHeight={rowHeight}
|
|
610
632
|
rowExpandedHeight={rowExpandedHeight}
|
|
611
633
|
loading={isLoading ?? loading}
|
|
612
634
|
showHeader
|
|
@@ -706,7 +728,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
706
728
|
{columnsRendered}
|
|
707
729
|
{!actionProps ||
|
|
708
730
|
(actionProps?.length === 0 && columnToggle && (
|
|
709
|
-
<Column width={40} fixed=
|
|
731
|
+
<Column width={40} fixed={pinSide}>
|
|
710
732
|
<HeaderCell
|
|
711
733
|
verticalAlign={findGrouped() ? 'middle' : undefined}
|
|
712
734
|
className={` ${classes.headerlClass}`}
|
|
@@ -722,13 +744,15 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
722
744
|
setIsOpen={setIsOpen}
|
|
723
745
|
handleResetColumns={handleResetColumns}
|
|
724
746
|
handleColumnToggle={handleColumnToggle}
|
|
747
|
+
labels={labels}
|
|
748
|
+
rtl={rtl}
|
|
725
749
|
/>
|
|
726
750
|
</HeaderCell>
|
|
727
751
|
<Cell />
|
|
728
752
|
</Column>
|
|
729
753
|
))}
|
|
730
754
|
{actionProps && actionProps?.length > 0 && (
|
|
731
|
-
<Column width={40} fixed=
|
|
755
|
+
<Column width={40} fixed={pinSide}>
|
|
732
756
|
<HeaderCell
|
|
733
757
|
verticalAlign={findGrouped() ? 'middle' : undefined}
|
|
734
758
|
className={` ${classes.headerlClass}`}
|
|
@@ -747,6 +771,8 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
747
771
|
setIsOpen={setIsOpen}
|
|
748
772
|
handleResetColumns={handleResetColumns}
|
|
749
773
|
handleColumnToggle={handleColumnToggle}
|
|
774
|
+
labels={labels}
|
|
775
|
+
rtl={rtl}
|
|
750
776
|
/>
|
|
751
777
|
)}
|
|
752
778
|
</HeaderCell>
|
|
@@ -7,6 +7,7 @@ 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 { mergeQbsTableLabels } from './labels';
|
|
10
11
|
import {
|
|
11
12
|
ActionCell,
|
|
12
13
|
CheckCell,
|
|
@@ -82,8 +83,18 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
82
83
|
autoHeight,
|
|
83
84
|
emptySubTitle,
|
|
84
85
|
emptyTitle,
|
|
85
|
-
dropType
|
|
86
|
+
dropType,
|
|
87
|
+
labels: labelsProp,
|
|
88
|
+
rtl = false,
|
|
89
|
+
rowViewToggle = false,
|
|
90
|
+
defaultRowView = true,
|
|
91
|
+
fullWidthView = false,
|
|
92
|
+
setTableFullView,
|
|
93
|
+
setRowViewToggle,
|
|
94
|
+
isFullScreen = false,
|
|
86
95
|
}) => {
|
|
96
|
+
const labels = useMemo(() => mergeQbsTableLabels(labelsProp), [labelsProp]);
|
|
97
|
+
const pinSide = rtl ? 'left' : 'right';
|
|
87
98
|
const [loading, setLoading] = useState(false);
|
|
88
99
|
const [columns, setColumns] = useState(propColumn);
|
|
89
100
|
const [checkedKeys, setCheckedKeys] = useState<(number | string)[]>([]);
|
|
@@ -237,7 +248,15 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
237
248
|
onSelect: handleClear,
|
|
238
249
|
handleColumnToggle: handleColumnToggle,
|
|
239
250
|
dataLength: data?.length,
|
|
240
|
-
searchPlaceholder: searchPlaceholder
|
|
251
|
+
searchPlaceholder: searchPlaceholder,
|
|
252
|
+
rowViewToggle,
|
|
253
|
+
defaultRowView,
|
|
254
|
+
fullWidthView,
|
|
255
|
+
setTableFullView,
|
|
256
|
+
setRowViewToggle,
|
|
257
|
+
isFullScreen,
|
|
258
|
+
labels,
|
|
259
|
+
rtl,
|
|
241
260
|
};
|
|
242
261
|
const themeToggle = useMemo(() => document.getElementById('themeToggle') as HTMLInputElement, []);
|
|
243
262
|
|
|
@@ -455,6 +474,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
455
474
|
height={autoHeight ? undefined : height}
|
|
456
475
|
key={tableKey}
|
|
457
476
|
tableKey={tableKey}
|
|
477
|
+
rtl={rtl}
|
|
458
478
|
data={data}
|
|
459
479
|
tableBodyRef={tableBodyRef as React.RefObject<HTMLDivElement>}
|
|
460
480
|
dataTheme={dataTheme}
|
|
@@ -575,7 +595,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
575
595
|
{columnsRendered}
|
|
576
596
|
{!actionProps ||
|
|
577
597
|
(actionProps?.length === 0 && columnToggle && (
|
|
578
|
-
<Column width={40} fixed=
|
|
598
|
+
<Column width={40} fixed={pinSide}>
|
|
579
599
|
<HeaderCell
|
|
580
600
|
verticalAlign={findGrouped() ? 'middle' : undefined}
|
|
581
601
|
className={` ${classes.headerlClass}`}
|
|
@@ -591,13 +611,15 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
591
611
|
setIsOpen={setIsOpen}
|
|
592
612
|
handleResetColumns={handleResetColumns}
|
|
593
613
|
handleColumnToggle={handleColumnToggle}
|
|
614
|
+
labels={labels}
|
|
615
|
+
rtl={rtl}
|
|
594
616
|
/>
|
|
595
617
|
</HeaderCell>
|
|
596
618
|
<Cell />
|
|
597
619
|
</Column>
|
|
598
620
|
))}
|
|
599
621
|
{actionProps && actionProps?.length > 0 && (
|
|
600
|
-
<Column width={40} fixed=
|
|
622
|
+
<Column width={40} fixed={pinSide}>
|
|
601
623
|
<HeaderCell
|
|
602
624
|
verticalAlign={findGrouped() ? 'middle' : undefined}
|
|
603
625
|
className={` ${classes.headerlClass}`}
|
|
@@ -616,6 +638,8 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
616
638
|
setIsOpen={setIsOpen}
|
|
617
639
|
handleResetColumns={handleResetColumns}
|
|
618
640
|
handleColumnToggle={handleColumnToggle}
|
|
641
|
+
labels={labels}
|
|
642
|
+
rtl={rtl}
|
|
619
643
|
/>
|
|
620
644
|
)}
|
|
621
645
|
</HeaderCell>
|
package/src/qbsTable/Toolbar.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React, { useCallback, useRef, useState } from 'react';
|
|
1
|
+
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import useResponsiveStore from '../utils/useResponsiveStore';
|
|
4
4
|
import { QbsTableToolbarProps } from './commontypes';
|
|
5
|
+
import { formatSelectedItems, mergeQbsTableLabels } from './labels';
|
|
5
6
|
import debounce from './utilities/debounce';
|
|
6
|
-
import { CardView, TableView } from './utilities/icons';
|
|
7
|
+
import { CardView, ContentView, DefaultView, ExpandIcon, TableView } from './utilities/icons';
|
|
7
8
|
import SearchInput from './utilities/SearchInput';
|
|
8
9
|
import { getRowDisplayRange } from './utilities/tablecalc';
|
|
9
10
|
import TooltipComponent from './utilities/ToolTip';
|
|
@@ -27,8 +28,17 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
|
|
|
27
28
|
searchPlaceholder,
|
|
28
29
|
tableViewToggle,
|
|
29
30
|
setTableViewToggle,
|
|
30
|
-
enableTableToggle = false
|
|
31
|
+
enableTableToggle = false,
|
|
32
|
+
rowViewToggle = false,
|
|
33
|
+
defaultRowView = true,
|
|
34
|
+
fullWidthView = false,
|
|
35
|
+
setTableFullView,
|
|
36
|
+
setRowViewToggle,
|
|
37
|
+
isFullScreen = false,
|
|
38
|
+
labels: labelsProp,
|
|
39
|
+
rtl = false,
|
|
31
40
|
}) => {
|
|
41
|
+
const labels = useMemo(() => mergeQbsTableLabels(labelsProp), [labelsProp]);
|
|
32
42
|
const debouncedOnSearch = useCallback(debounce(onSearch ?? (() => {}), 1000), [onSearch]);
|
|
33
43
|
const [searchParam, setSearchParam] = useState<string | undefined>(searchValue);
|
|
34
44
|
const toolbarRef = useRef<HTMLDivElement>(null);
|
|
@@ -39,7 +49,7 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
|
|
|
39
49
|
debouncedOnSearch(e);
|
|
40
50
|
}
|
|
41
51
|
},
|
|
42
|
-
[debouncedOnSearch]
|
|
52
|
+
[debouncedOnSearch],
|
|
43
53
|
);
|
|
44
54
|
|
|
45
55
|
const handleChange = useCallback(
|
|
@@ -51,29 +61,30 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
|
|
|
51
61
|
handleSearchValue?.(e);
|
|
52
62
|
}
|
|
53
63
|
},
|
|
54
|
-
[asyncSearch, handleSearch, handleSearchValue]
|
|
64
|
+
[asyncSearch, handleSearch, handleSearchValue],
|
|
55
65
|
);
|
|
56
|
-
const handleHide = (actions:
|
|
66
|
+
const handleHide = (actions: { hidden?: boolean; customHide?: string }) => {
|
|
57
67
|
if (actions.hidden) {
|
|
58
68
|
return false;
|
|
59
|
-
} else if (actions.customHide == '>2') {
|
|
60
|
-
return checkedKeys && checkedKeys?.length >= 2 ? true : false;
|
|
61
|
-
} else {
|
|
62
|
-
return true;
|
|
63
69
|
}
|
|
70
|
+
if (actions.customHide === '>2') {
|
|
71
|
+
return checkedKeys && checkedKeys?.length >= 2;
|
|
72
|
+
}
|
|
73
|
+
return true;
|
|
64
74
|
};
|
|
65
75
|
const isMobile = useResponsiveStore();
|
|
66
76
|
const handleFilterClick = () => {
|
|
67
77
|
setIsOpen(!isOpen);
|
|
68
78
|
};
|
|
79
|
+
|
|
69
80
|
return (
|
|
70
|
-
<div className="qbs-table-toolbar-container" ref={toolbarRef}>
|
|
71
|
-
<div className={`qbs-table-toolbar ${className}`}>
|
|
81
|
+
<div className="qbs-table-toolbar-container" ref={toolbarRef} dir={rtl ? 'rtl' : 'ltr'}>
|
|
82
|
+
<div className={`qbs-table-toolbar ${className ?? ''}`}>
|
|
72
83
|
<div className="start-container" style={{ display: 'flex', justifyContent: 'flex-end' }}>
|
|
73
84
|
<div className="qbs-table-primary-filter">
|
|
74
85
|
{search && (
|
|
75
86
|
<SearchInput
|
|
76
|
-
placeholder={searchPlaceholder ?? 'Search'}
|
|
87
|
+
placeholder={searchPlaceholder ?? labels.search ?? 'Search'}
|
|
77
88
|
handleChange={handleChange}
|
|
78
89
|
handleSearch={handleSearch}
|
|
79
90
|
searchValue={searchParam}
|
|
@@ -103,22 +114,79 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
|
|
|
103
114
|
</span>
|
|
104
115
|
)}
|
|
105
116
|
{tableHeaderActions}
|
|
106
|
-
<div className="
|
|
117
|
+
<div className="pr-1 cursor-pointer relative table_custom_ctions">
|
|
118
|
+
{(rowViewToggle || isFullScreen) && (
|
|
119
|
+
<div className="flex gap-2 qbs-row-switch-container">
|
|
120
|
+
{rowViewToggle && (
|
|
121
|
+
<div className="flex gap-2 table_cell_style qbs-table-top-icons">
|
|
122
|
+
<TooltipComponent
|
|
123
|
+
tableBodyRef={toolbarRef}
|
|
124
|
+
title={labels.switchToDefaultView ?? ''}
|
|
125
|
+
>
|
|
126
|
+
<button
|
|
127
|
+
type="button"
|
|
128
|
+
className="qbs-table-view-btn"
|
|
129
|
+
onClick={() => setRowViewToggle?.(true)}
|
|
130
|
+
>
|
|
131
|
+
<DefaultView className={`${defaultRowView ? 'active' : ''}`} />
|
|
132
|
+
</button>
|
|
133
|
+
</TooltipComponent>
|
|
134
|
+
<TooltipComponent
|
|
135
|
+
tableBodyRef={toolbarRef}
|
|
136
|
+
title={labels.switchToRelaxedView ?? ''}
|
|
137
|
+
>
|
|
138
|
+
<button
|
|
139
|
+
type="button"
|
|
140
|
+
className="qbs-table-view-btn"
|
|
141
|
+
onClick={() => setRowViewToggle?.(false)}
|
|
142
|
+
>
|
|
143
|
+
<ContentView className={`${!defaultRowView ? 'active' : ''}`} />
|
|
144
|
+
</button>
|
|
145
|
+
</TooltipComponent>
|
|
146
|
+
</div>
|
|
147
|
+
)}
|
|
148
|
+
{isFullScreen && (
|
|
149
|
+
<div className="table_full_width qbs-table-top-icons">
|
|
150
|
+
<TooltipComponent
|
|
151
|
+
tableBodyRef={toolbarRef}
|
|
152
|
+
title={labels.switchToFullScreen ?? ''}
|
|
153
|
+
>
|
|
154
|
+
<button
|
|
155
|
+
type="button"
|
|
156
|
+
className="qbs-table-view-btn"
|
|
157
|
+
onClick={() => setTableFullView?.(!fullWidthView)}
|
|
158
|
+
>
|
|
159
|
+
<ExpandIcon className={`${fullWidthView ? 'active' : ''}`} />
|
|
160
|
+
</button>
|
|
161
|
+
</TooltipComponent>
|
|
162
|
+
</div>
|
|
163
|
+
)}
|
|
164
|
+
</div>
|
|
165
|
+
)}
|
|
166
|
+
|
|
107
167
|
{enableTableToggle && !isMobile && (
|
|
108
168
|
<div className="qbs-table-top-icons flex gap-2">
|
|
109
|
-
<TooltipComponent tableBodyRef={toolbarRef} title={
|
|
110
|
-
<
|
|
169
|
+
<TooltipComponent tableBodyRef={toolbarRef} title={labels.switchToTableView ?? ''}>
|
|
170
|
+
<button
|
|
171
|
+
type="button"
|
|
172
|
+
className="qbs-table-view-btn"
|
|
173
|
+
onClick={() => setTableViewToggle?.(true)}
|
|
174
|
+
>
|
|
111
175
|
<TableView className={`${tableViewToggle ? 'active' : ''}`} />
|
|
112
|
-
</
|
|
176
|
+
</button>
|
|
113
177
|
</TooltipComponent>
|
|
114
178
|
|
|
115
|
-
<div className="border-r h-4 w-1"
|
|
179
|
+
<div className="border-r h-4 w-1" />
|
|
116
180
|
|
|
117
|
-
<
|
|
118
|
-
<
|
|
181
|
+
<TooltipComponent tableBodyRef={toolbarRef} title={labels.switchToCardView ?? ''}>
|
|
182
|
+
<button
|
|
183
|
+
type="button"
|
|
184
|
+
className="qbs-table-view-btn"
|
|
185
|
+
onClick={() => setTableViewToggle?.(false)}
|
|
186
|
+
>
|
|
119
187
|
<CardView className={`${!tableViewToggle ? 'active' : ''}`} />
|
|
120
|
-
</
|
|
121
|
-
</
|
|
188
|
+
</button>
|
|
189
|
+
</TooltipComponent>
|
|
122
190
|
</div>
|
|
123
191
|
)}
|
|
124
192
|
</div>
|
|
@@ -141,16 +209,18 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
|
|
|
141
209
|
>
|
|
142
210
|
{checkedKeys && checkedKeys?.length > 0 ? (
|
|
143
211
|
<div className="qbs-table-toolbar-sub-container-start">
|
|
144
|
-
<div className="selected-row">
|
|
212
|
+
<div className="selected-row">
|
|
213
|
+
{formatSelectedItems(checkedKeys.length, labels)}
|
|
214
|
+
</div>
|
|
145
215
|
<div className="selected-row-action">
|
|
146
|
-
<button className="btn" onClick={() => onSelect?.([])}>
|
|
147
|
-
|
|
216
|
+
<button type="button" className="btn" onClick={() => onSelect?.([])}>
|
|
217
|
+
{labels.clear}
|
|
148
218
|
</button>
|
|
149
219
|
{selectedRowActions?.map((actions, index: number) => (
|
|
150
|
-
|
|
220
|
+
<React.Fragment key={index.toString()}>
|
|
151
221
|
{handleHide(actions) && (
|
|
152
222
|
<button
|
|
153
|
-
|
|
223
|
+
type="button"
|
|
154
224
|
className="btn"
|
|
155
225
|
disabled={actions.disabled}
|
|
156
226
|
onClick={() => actions?.action(checkedKeys)}
|
|
@@ -158,7 +228,7 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
|
|
|
158
228
|
{actions.actionTitle}
|
|
159
229
|
</button>
|
|
160
230
|
)}
|
|
161
|
-
|
|
231
|
+
</React.Fragment>
|
|
162
232
|
))}
|
|
163
233
|
</div>
|
|
164
234
|
</div>
|
|
@@ -169,7 +239,7 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
|
|
|
169
239
|
{getRowDisplayRange(
|
|
170
240
|
paginationProps.total ?? 0,
|
|
171
241
|
paginationProps.rowsPerPage ?? 0,
|
|
172
|
-
paginationProps.currentPage ?? 0
|
|
242
|
+
paginationProps.currentPage ?? 0,
|
|
173
243
|
)}
|
|
174
244
|
</div>
|
|
175
245
|
)}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React, { ReactElement, ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
+
import type { QbsTableLabels } from './labels';
|
|
4
|
+
|
|
3
5
|
interface Content {
|
|
4
6
|
cell: ReactNode | string;
|
|
5
7
|
toolTip?: string;
|
|
@@ -88,6 +90,8 @@ export interface QbsTableProps {
|
|
|
88
90
|
setExpandedRowKeys?: (value: readonly number[]) => void;
|
|
89
91
|
handleMenuActions?: (actions: ActionProps, rowData: any) => void;
|
|
90
92
|
dropType?: 'vertical' | string;
|
|
93
|
+
labels?: QbsTableLabels;
|
|
94
|
+
rtl?: boolean;
|
|
91
95
|
handleRowExpanded?: (rowData: any) => React.ReactNode;
|
|
92
96
|
shouldUpdateScroll?: boolean;
|
|
93
97
|
rowExpand?: boolean;
|
|
@@ -131,6 +135,13 @@ export interface QbsTableProps {
|
|
|
131
135
|
handleTableCardView?: (data: any) => React.ReactNode;
|
|
132
136
|
isCustomTableCardView?: boolean;
|
|
133
137
|
handleCustomCardLoader?: () => React.ReactNode;
|
|
138
|
+
rowViewToggle?: boolean;
|
|
139
|
+
defaultRowView?: boolean;
|
|
140
|
+
fullWidthView?: boolean;
|
|
141
|
+
setTableFullView?: (value: boolean) => void;
|
|
142
|
+
setRowViewToggle?: (value: boolean) => void;
|
|
143
|
+
isFullScreen?: boolean;
|
|
144
|
+
rowHeight?: number;
|
|
134
145
|
}
|
|
135
146
|
|
|
136
147
|
export interface QbsTableToolbarProps {
|
|
@@ -160,6 +171,14 @@ export interface QbsTableToolbarProps {
|
|
|
160
171
|
enableTableToggle?: boolean;
|
|
161
172
|
tableViewToggle?: boolean;
|
|
162
173
|
setTableViewToggle?: (value: boolean) => void;
|
|
174
|
+
rowViewToggle?: boolean;
|
|
175
|
+
defaultRowView?: boolean;
|
|
176
|
+
fullWidthView?: boolean;
|
|
177
|
+
setTableFullView?: (value: boolean) => void;
|
|
178
|
+
setRowViewToggle?: (value: boolean) => void;
|
|
179
|
+
isFullScreen?: boolean;
|
|
180
|
+
labels?: QbsTableLabels;
|
|
181
|
+
rtl?: boolean;
|
|
163
182
|
selectedRowActions?: {
|
|
164
183
|
actionTitle?: string;
|
|
165
184
|
action: (checked: (number | string)[]) => void;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export type QbsTableLabels = {
|
|
2
|
+
search?: string;
|
|
3
|
+
searchAriaLabel?: string;
|
|
4
|
+
clear?: string;
|
|
5
|
+
selectedItems?: string;
|
|
6
|
+
switchToDefaultView?: string;
|
|
7
|
+
switchToRelaxedView?: string;
|
|
8
|
+
switchToFullScreen?: string;
|
|
9
|
+
switchToTableView?: string;
|
|
10
|
+
switchToCardView?: string;
|
|
11
|
+
noDataFound?: string;
|
|
12
|
+
showingRange?: (start: number, end: number, total: number) => string;
|
|
13
|
+
itemsPerPage?: string;
|
|
14
|
+
fixedColumns?: string;
|
|
15
|
+
visibleColumns?: string;
|
|
16
|
+
availableColumns?: string;
|
|
17
|
+
resetToDefault?: string;
|
|
18
|
+
save?: string;
|
|
19
|
+
viewMore?: string;
|
|
20
|
+
viewLess?: string;
|
|
21
|
+
actions?: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const defaultQbsTableLabels: QbsTableLabels = {
|
|
25
|
+
search: 'Search',
|
|
26
|
+
searchAriaLabel: 'Search',
|
|
27
|
+
clear: 'Clear',
|
|
28
|
+
selectedItems: 'Selected items',
|
|
29
|
+
switchToDefaultView: 'Switch to Default View',
|
|
30
|
+
switchToRelaxedView: 'Switch to Relaxed View',
|
|
31
|
+
switchToFullScreen: 'Switch to Full Screen',
|
|
32
|
+
switchToTableView: 'Switch to Table View',
|
|
33
|
+
switchToCardView: 'Switch to Card View',
|
|
34
|
+
noDataFound: 'No Data Found',
|
|
35
|
+
showingRange: (start, end, total) => `Showing ${start} to ${end} of ${total}`,
|
|
36
|
+
itemsPerPage: 'Items per page',
|
|
37
|
+
fixedColumns: 'FIXED COLUMNS',
|
|
38
|
+
visibleColumns: 'VISIBLE COLUMNS',
|
|
39
|
+
availableColumns: 'AVAILABLE COLUMNS',
|
|
40
|
+
resetToDefault: 'Reset to default',
|
|
41
|
+
save: 'Save',
|
|
42
|
+
viewMore: 'View More',
|
|
43
|
+
viewLess: 'View Less',
|
|
44
|
+
actions: 'Actions',
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const mergeQbsTableLabels = (overrides?: QbsTableLabels): QbsTableLabels => ({
|
|
48
|
+
...defaultQbsTableLabels,
|
|
49
|
+
...overrides,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export const formatSelectedItems = (count: number, labels?: QbsTableLabels): string => {
|
|
53
|
+
const merged = mergeQbsTableLabels(labels);
|
|
54
|
+
return `${merged.selectedItems} (${count})`;
|
|
55
|
+
};
|