qbs-react-grid 2.2.4 → 2.2.6

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 (100) 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/Cell.js +1 -2
  5. package/es/Pagination.d.ts +0 -3
  6. package/es/Pagination.js +3 -8
  7. package/es/Table.d.ts +0 -3
  8. package/es/Table.js +12 -18
  9. package/es/index.d.ts +1 -1
  10. package/es/less/pagination.less +9 -9
  11. package/es/less/qbs-table.less +73 -205
  12. package/es/qbsTable/CustomTableCell.js +15 -11
  13. package/es/qbsTable/QbsTable.js +48 -124
  14. package/es/qbsTable/TableCardList.js +41 -52
  15. package/es/qbsTable/Toolbar.js +13 -62
  16. package/es/qbsTable/commontypes.d.ts +3 -30
  17. package/es/qbsTable/utilities/CardComponent.d.ts +0 -2
  18. package/es/qbsTable/utilities/CardComponent.js +3 -7
  19. package/es/qbsTable/utilities/CardMenuDropdown.d.ts +0 -2
  20. package/es/qbsTable/utilities/CardMenuDropdown.js +7 -7
  21. package/es/qbsTable/utilities/ColumShowHide.d.ts +0 -4
  22. package/es/qbsTable/utilities/ColumShowHide.js +6 -9
  23. package/es/qbsTable/utilities/SearchInput.d.ts +0 -1
  24. package/es/qbsTable/utilities/SearchInput.js +1 -3
  25. package/es/qbsTable/utilities/ToolTip.d.ts +1 -8
  26. package/es/qbsTable/utilities/ToolTip.js +31 -107
  27. package/es/qbsTable/utilities/VerticalDropDownMenu.d.ts +7 -9
  28. package/es/qbsTable/utilities/VerticalDropDownMenu.js +71 -63
  29. package/es/qbsTable/utilities/empty.js +1 -1
  30. package/es/qbsTable/utilities/icons.d.ts +0 -3
  31. package/es/qbsTable/utilities/icons.js +1 -65
  32. package/es/qbsTable/utilities/tablecalc.d.ts +1 -1
  33. package/es/qbsTable/utilities/tablecalc.js +2 -7
  34. package/es/utils/useCellDescriptor.js +1 -0
  35. package/es/utils/useScrollListener.d.ts +0 -1
  36. package/es/utils/useScrollListener.js +3 -5
  37. package/lib/Cell.js +1 -2
  38. package/lib/Pagination.d.ts +0 -3
  39. package/lib/Pagination.js +3 -8
  40. package/lib/Table.d.ts +0 -3
  41. package/lib/Table.js +12 -18
  42. package/lib/index.d.ts +1 -1
  43. package/lib/less/pagination.less +9 -9
  44. package/lib/less/qbs-table.less +73 -205
  45. package/lib/qbsTable/CustomTableCell.js +15 -11
  46. package/lib/qbsTable/QbsTable.js +48 -124
  47. package/lib/qbsTable/TableCardList.js +41 -52
  48. package/lib/qbsTable/Toolbar.js +12 -61
  49. package/lib/qbsTable/commontypes.d.ts +3 -30
  50. package/lib/qbsTable/utilities/CardComponent.d.ts +0 -2
  51. package/lib/qbsTable/utilities/CardComponent.js +3 -7
  52. package/lib/qbsTable/utilities/CardMenuDropdown.d.ts +0 -2
  53. package/lib/qbsTable/utilities/CardMenuDropdown.js +5 -6
  54. package/lib/qbsTable/utilities/ColumShowHide.d.ts +0 -4
  55. package/lib/qbsTable/utilities/ColumShowHide.js +6 -9
  56. package/lib/qbsTable/utilities/SearchInput.d.ts +0 -1
  57. package/lib/qbsTable/utilities/SearchInput.js +1 -3
  58. package/lib/qbsTable/utilities/ToolTip.d.ts +1 -8
  59. package/lib/qbsTable/utilities/ToolTip.js +30 -107
  60. package/lib/qbsTable/utilities/VerticalDropDownMenu.d.ts +7 -9
  61. package/lib/qbsTable/utilities/VerticalDropDownMenu.js +71 -63
  62. package/lib/qbsTable/utilities/empty.js +1 -1
  63. package/lib/qbsTable/utilities/icons.d.ts +0 -3
  64. package/lib/qbsTable/utilities/icons.js +3 -70
  65. package/lib/qbsTable/utilities/tablecalc.d.ts +1 -1
  66. package/lib/qbsTable/utilities/tablecalc.js +2 -7
  67. package/lib/utils/useCellDescriptor.js +1 -0
  68. package/lib/utils/useScrollListener.d.ts +0 -1
  69. package/lib/utils/useScrollListener.js +3 -5
  70. package/package.json +10 -2
  71. package/src/Cell.tsx +1 -3
  72. package/src/HeaderCell.tsx +1 -0
  73. package/src/Pagination.tsx +3 -10
  74. package/src/Table.tsx +10 -23
  75. package/src/customSelect.tsx +88 -88
  76. package/src/index.ts +1 -1
  77. package/src/less/pagination.less +9 -9
  78. package/src/less/qbs-table.less +73 -205
  79. package/src/qbsTable/CustomTableCell.tsx +23 -27
  80. package/src/qbsTable/QbsTable.tsx +26 -100
  81. package/src/qbsTable/TableCardList.tsx +20 -34
  82. package/src/qbsTable/Toolbar.tsx +11 -53
  83. package/src/qbsTable/commontypes.ts +2 -32
  84. package/src/qbsTable/utilities/CardComponent.tsx +2 -7
  85. package/src/qbsTable/utilities/CardMenuDropdown.tsx +6 -11
  86. package/src/qbsTable/utilities/ColumShowHide.tsx +6 -33
  87. package/src/qbsTable/utilities/SearchInput.tsx +1 -3
  88. package/src/qbsTable/utilities/ToolTip.tsx +27 -138
  89. package/src/qbsTable/utilities/VerticalDropDownMenu.tsx +89 -74
  90. package/src/qbsTable/utilities/empty.tsx +2 -2
  91. package/src/qbsTable/utilities/icons.tsx +1 -78
  92. package/src/qbsTable/utilities/tablecalc.ts +2 -8
  93. package/src/utils/useCellDescriptor.ts +1 -0
  94. package/src/utils/useScrollListener.ts +3 -13
  95. package/src/utils/useTableRows.ts +1 -1
  96. package/es/qbsTable/labels.d.ts +0 -48
  97. package/es/qbsTable/labels.js +0 -34
  98. package/lib/qbsTable/labels.d.ts +0 -48
  99. package/lib/qbsTable/labels.js +0 -42
  100. package/src/qbsTable/labels.ts +0 -58
@@ -6,10 +6,8 @@ import ColumnGroup from '../ColumnGroup';
6
6
  import HeaderCell from '../HeaderCell';
7
7
  import Pagination from '../Pagination';
8
8
  import Table from '../Table';
9
- import isRTL from '../utils/isRTL';
10
9
  import useResponsiveStore from '../utils/useResponsiveStore';
11
10
  import { QbsColumnProps, QbsTableProps } from './commontypes';
12
- import { mergeLabels } from './labels';
13
11
  import {
14
12
  ActionCell,
15
13
  CheckCell,
@@ -32,7 +30,6 @@ import '../../dist/css/qbs-react-grid.css';
32
30
 
33
31
  const CHECKBOX_LINE_HEIGHT = '36px';
34
32
  const COLUMN_WIDTH = 250;
35
- let REFRESH_KEY = 0;
36
33
  const QbsTable: React.FC<QbsTableProps> = ({
37
34
  handleColumnSort,
38
35
  data,
@@ -54,7 +51,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
54
51
  minHeight,
55
52
  height = 630,
56
53
  onExpandChange,
57
- wordWrap: propsWordWrap,
54
+ wordWrap,
58
55
  dataRowKey = 'id',
59
56
  defaultExpandAllRows,
60
57
  handleRowExpanded,
@@ -62,7 +59,6 @@ const QbsTable: React.FC<QbsTableProps> = ({
62
59
  rowExpand = false,
63
60
  actionProps = [],
64
61
  theme,
65
- rtl: rtlProp,
66
62
  handleMenuActions,
67
63
  onRowClick,
68
64
  expandedRowKeys,
@@ -96,39 +92,17 @@ const QbsTable: React.FC<QbsTableProps> = ({
96
92
  isCustomTableCardView = false,
97
93
  handleTableCardView,
98
94
  handleCustomCardLoader,
99
- hasMoreData,
100
- loadMoreData,
101
- infiniteLoading,
102
- infiniteScroll = false,
103
- viewMode: propsViewMode,
104
- rowViewToggle = false,
105
- defaultRowView = true,
106
- fullWidthView = false,
107
- setTableFullView,
108
- setRowViewToggle,
109
- dropType = 'horizondal',
110
- rowHeight,
111
- isFullScreen,
112
- showHeader = true,
113
- labels: labelsProp
95
+ dropType
114
96
  }) => {
115
- const labels = useMemo(() => mergeLabels(labelsProp), [labelsProp]);
116
97
  const [loading, setLoading] = useState(false);
117
98
  const [columns, setColumns] = useState(propColumn);
118
99
  const [checkedKeys, setCheckedKeys] = useState<(number | string)[]>([]);
119
- const dataTheme = useMemo(
120
- () => theme ?? (typeof localStorage !== 'undefined' ? localStorage.getItem('theme') : null) ?? 'light',
121
- [theme]
122
- );
123
- const rtl = rtlProp ?? isRTL();
100
+ const dataTheme = useMemo(() => localStorage.getItem('theme') ?? theme, [theme]);
124
101
  const [isOpen, setIsOpen] = useState(false);
125
102
  const prevColumns = useRef<any | null>(null);
126
103
  const [tableViewToggle, setTableViewToggle] = useState(tableView);
127
104
  const isMobile = useResponsiveStore();
128
105
  const tableBodyRef = useRef<HTMLDivElement>(null);
129
- const wheelWrapperRef = useRef<HTMLDivElement>(null);
130
- const [viewMode, setViewMode] = useState(propsViewMode ?? 'expanded');
131
- const [wordWrap, setWordWrap] = useState(propsWordWrap ?? false);
132
106
  const handleSortColumn = useCallback(
133
107
  (sortColumn: any, sortType: any) => {
134
108
  setLoading(true);
@@ -180,6 +154,16 @@ const QbsTable: React.FC<QbsTableProps> = ({
180
154
  [checkedKeys]
181
155
  );
182
156
 
157
+ const rowKeyField = dataRowKey ?? 'id';
158
+ const getRowClassName = useCallback(
159
+ (rowData: Record<string, unknown>) => {
160
+ if (!selection) return '';
161
+ const key = rowData?.[rowKeyField] as string | number | undefined;
162
+ return key !== undefined && checkedKeys?.includes(key) ? 'qbs-table-row-checked' : '';
163
+ },
164
+ [selection, checkedKeys, rowKeyField]
165
+ );
166
+
183
167
  const handleToggle = useCallback(
184
168
  (columnName: string) => {
185
169
  let lastVisibleColumn: any = null;
@@ -215,7 +199,6 @@ const QbsTable: React.FC<QbsTableProps> = ({
215
199
 
216
200
  const handleColumnWidth = useCallback((newWidth?: number, dataKey?: any) => {
217
201
  if (newWidth === undefined || dataKey === undefined) return;
218
- REFRESH_KEY = REFRESH_KEY + 1;
219
202
  setColumns(prevColumns =>
220
203
  prevColumns.map(column =>
221
204
  column.field === dataKey ? { ...column, colWidth: newWidth } : column
@@ -232,14 +215,6 @@ const QbsTable: React.FC<QbsTableProps> = ({
232
215
  );
233
216
  }
234
217
  }, [wordWrap]);
235
- useEffect(() => {
236
- if (!defaultRowView) {
237
- setWordWrap('break-word');
238
- } else {
239
- setWordWrap(false);
240
- }
241
- REFRESH_KEY = REFRESH_KEY + 1;
242
- }, [defaultRowView]);
243
218
 
244
219
  const onReorder = useCallback((columns: QbsColumnProps[]) => {
245
220
  setColumns(columns);
@@ -247,6 +222,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
247
222
 
248
223
  // useEffect(() => {
249
224
  // }, [columns]);
225
+
250
226
  const handleClear = ([]) => {
251
227
  setCheckedKeys([]);
252
228
  handleChecked([]);
@@ -276,31 +252,11 @@ const QbsTable: React.FC<QbsTableProps> = ({
276
252
  searchPlaceholder: searchPlaceholder,
277
253
  setTableViewToggle: setTableViewToggle,
278
254
  tableViewToggle: tableViewToggle,
279
- enableTableToggle: enableTableToggle,
280
- rowViewToggle: rowViewToggle,
281
- defaultRowView: defaultRowView,
282
- fullWidthView: fullWidthView,
283
- setTableFullView: setTableFullView,
284
- setRowViewToggle: setRowViewToggle,
285
- isFullScreen: isFullScreen,
286
- labels
255
+ enableTableToggle: enableTableToggle
287
256
  };
257
+ const themeToggle = useMemo(() => document.getElementById('themeToggle') as HTMLInputElement, []);
288
258
 
289
259
  useEffect(() => {
290
- if (!dataTheme || typeof document === 'undefined') return;
291
-
292
- document.body.setAttribute('data-theme', dataTheme === 'dark' ? 'dark' : 'light');
293
- document.documentElement.dataset.theme = dataTheme;
294
- }, [dataTheme]);
295
-
296
- const themeToggle = useMemo(
297
- () => (typeof document !== 'undefined' ? document.getElementById('themeToggle') : null),
298
- []
299
- ) as HTMLInputElement | null;
300
-
301
- useEffect(() => {
302
- if (theme || typeof document === 'undefined') return;
303
-
304
260
  const handleThemeToggle = () => {
305
261
  if (themeToggle?.checked) {
306
262
  document.body.setAttribute('data-theme', 'dark');
@@ -325,10 +281,11 @@ const QbsTable: React.FC<QbsTableProps> = ({
325
281
  themeToggle?.removeEventListener('change', handleThemeToggle);
326
282
  document.removeEventListener('DOMContentLoaded', handleDOMContentLoaded);
327
283
  };
328
- }, [theme, themeToggle]);
284
+ }, [themeToggle]);
329
285
 
330
286
  const handleExpanded = useCallback(
331
287
  (rowData: any) => {
288
+ console.log(rowData);
332
289
  const keyValue = dataRowKey as string;
333
290
  const key = rowData[keyValue];
334
291
 
@@ -618,46 +575,24 @@ const QbsTable: React.FC<QbsTableProps> = ({
618
575
  [columns, dataTheme]
619
576
  );
620
577
 
621
- const handleInfiniteScroll = (scroll: number) => {
622
- if (!infiniteScroll) return;
623
- const wrapper = wheelWrapperRef.current;
624
- if (!wrapper || !hasMoreData || infiniteLoading) return;
625
-
626
- const { scrollTop, clientHeight } = wrapper;
627
- const scrollHeight = Math.abs(scroll) + (height - headerHeight);
628
- // Trigger fetch when user scrolls within 100px of bottom
629
- if (scrollTop + clientHeight >= scrollHeight - 70) {
630
- loadMoreData?.(); // fetch next page here
631
- }
632
- };
633
-
634
578
  return (
635
- <div
636
- className={`qbs-table ${classes.tableContainerClass}`}
637
- data-theme={dataTheme}
638
- dir={rtl ? 'rtl' : 'ltr'}
639
- >
579
+ <div className={`qbs-table ${classes.tableContainerClass}`} data-theme={dataTheme}>
640
580
  {toolbar && <ToolBar {...toolbarProps} />}
641
581
  <div className="qbs-table-border-wrap">
642
582
  {tableViewToggle ? (
643
583
  <Table
644
584
  height={autoHeight ? undefined : height}
645
- key={tableKey + REFRESH_KEY}
585
+ key={tableKey}
646
586
  tableKey={tableKey}
647
587
  data={data}
648
- rtl={rtl}
649
588
  tableBodyRef={tableBodyRef as React.RefObject<HTMLDivElement>}
650
589
  dataTheme={dataTheme}
651
590
  wordWrap={wordWrap}
652
- wheelWrapperRef={wheelWrapperRef}
653
- rowHeight={rowHeight}
654
591
  autoHeight={autoHeight}
655
- handleInfiniteScroll={handleInfiniteScroll}
656
592
  sortColumn={sortColumn}
657
593
  style={{ position: 'relative' }}
658
594
  sortType={sortType}
659
595
  onSortColumn={handleSortColumn}
660
- infiniteLoading={infiniteLoading}
661
596
  onRowClick={onRowClick}
662
597
  tableBodyHeight={tableBodyHeight}
663
598
  cellBordered={cellBordered}
@@ -666,7 +601,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
666
601
  renderEmpty ? (
667
602
  renderEmpty(info)
668
603
  ) : (
669
- <NoData title={emptyTitle ?? labels.noDataFound} subtitle={emptySubTitle} />
604
+ <NoData title={emptyTitle ?? 'No Data Found'} subtitle={emptySubTitle} />
670
605
  )
671
606
  }
672
607
  columns={columns}
@@ -674,11 +609,12 @@ const QbsTable: React.FC<QbsTableProps> = ({
674
609
  headerHeight={headerHeight}
675
610
  rowExpandedHeight={rowExpandedHeight}
676
611
  loading={isLoading ?? loading}
677
- showHeader={showHeader}
612
+ showHeader
678
613
  defaultChecked
679
614
  expandedRowKeys={expandedRowKeys}
680
615
  onExpandChange={onExpandChange}
681
616
  rowKey={dataRowKey ?? 'id'}
617
+ rowClassName={selection ? getRowClassName : undefined}
682
618
  defaultExpandAllRows={defaultExpandAllRows}
683
619
  shouldUpdateScroll={shouldUpdateScroll}
684
620
  renderRowExpanded={rowData => {
@@ -783,12 +719,9 @@ const QbsTable: React.FC<QbsTableProps> = ({
783
719
  onReorder={onReorder}
784
720
  isOpen={isOpen}
785
721
  tableHeight={height}
786
- viewMode={viewMode}
787
- setViewMode={setViewMode}
788
722
  setIsOpen={setIsOpen}
789
723
  handleResetColumns={handleResetColumns}
790
724
  handleColumnToggle={handleColumnToggle}
791
- labels={labels}
792
725
  />
793
726
  </HeaderCell>
794
727
  <Cell />
@@ -810,24 +743,20 @@ const QbsTable: React.FC<QbsTableProps> = ({
810
743
  onToggle={handleToggle}
811
744
  tableHeight={height}
812
745
  onReorder={onReorder}
813
- viewMode={viewMode}
814
- setViewMode={setViewMode}
815
746
  isOpen={isOpen}
816
747
  setIsOpen={setIsOpen}
817
748
  handleResetColumns={handleResetColumns}
818
749
  handleColumnToggle={handleColumnToggle}
819
- labels={labels}
820
750
  />
821
751
  )}
822
752
  </HeaderCell>
823
753
  <ActionCell
824
754
  tableBodyRef={tableBodyRef}
825
- dropType={dropType}
826
- wheelWrapperRef={wheelWrapperRef}
827
755
  actionProps={actionProps}
828
756
  className={`${classes.cellClass} ${classes.actionCellClass}`}
829
757
  handleMenuActions={handleMenuActions}
830
758
  dataTheme={dataTheme}
759
+ dropType={dropType}
831
760
  />
832
761
  </Column>
833
762
  )}
@@ -849,7 +778,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
849
778
  >
850
779
  {(data?.length === 0 || !data) && !isLoading && (
851
780
  <div className="flex flex-col gap-2 p-2 mt-6 card-empty-container">
852
- <NoData title={emptyTitle ?? labels.noDataFound} subtitle={emptySubTitle} />
781
+ <NoData title={emptyTitle ?? 'No Data Found'} subtitle={emptySubTitle} />
853
782
  </div>
854
783
  )}
855
784
  {isLoading ? (
@@ -876,7 +805,6 @@ const QbsTable: React.FC<QbsTableProps> = ({
876
805
  columns={columns}
877
806
  tableBodyRef={tableBodyRef}
878
807
  actionProps={actionProps}
879
- labels={labels}
880
808
  />
881
809
  )}
882
810
  </div>
@@ -885,9 +813,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
885
813
  </div>
886
814
  )}
887
815
  <div>
888
- {pagination && data?.length > 0 && (
889
- <Pagination paginationProps={paginationProps} labels={labels} dataTheme={dataTheme} />
890
- )}
816
+ {pagination && data?.length > 0 && <Pagination paginationProps={paginationProps} />}
891
817
  </div>
892
818
  </div>
893
819
  </div>
@@ -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,
@@ -83,21 +82,15 @@ const QbsTable: React.FC<QbsTableProps> = ({
83
82
  autoHeight,
84
83
  emptySubTitle,
85
84
  emptyTitle,
86
- dropType = 'horizontal',
87
- labels: labelsProp
85
+ dropType
88
86
  }) => {
89
- const labels = useMemo(() => mergeLabels(labelsProp), [labelsProp]);
90
87
  const [loading, setLoading] = useState(false);
91
88
  const [columns, setColumns] = useState(propColumn);
92
89
  const [checkedKeys, setCheckedKeys] = useState<(number | string)[]>([]);
93
- const dataTheme = useMemo(
94
- () => theme ?? (typeof localStorage !== 'undefined' ? localStorage.getItem('theme') : null) ?? 'light',
95
- [theme]
96
- );
90
+ const dataTheme = useMemo(() => localStorage.getItem('theme') ?? theme, [theme]);
97
91
  const [isOpen, setIsOpen] = useState(false);
98
92
  const prevColumns = useRef<any | null>(null);
99
93
  const tableBodyRef = useRef<HTMLDivElement>(null);
100
- const wheelWrapperRef = useRef<HTMLDivElement>(null);
101
94
  const handleSortColumn = useCallback(
102
95
  (sortColumn: any, sortType: any) => {
103
96
  setLoading(true);
@@ -149,6 +142,16 @@ const QbsTable: React.FC<QbsTableProps> = ({
149
142
  [checkedKeys]
150
143
  );
151
144
 
145
+ const rowKeyField = dataRowKey ?? 'id';
146
+ const getRowClassName = useCallback(
147
+ (rowData: Record<string, unknown>) => {
148
+ if (!selection) return '';
149
+ const key = rowData?.[rowKeyField] as string | number | undefined;
150
+ return key !== undefined && checkedKeys?.includes(key) ? 'qbs-table-row-checked' : '';
151
+ },
152
+ [selection, checkedKeys, rowKeyField]
153
+ );
154
+
152
155
  const handleToggle = useCallback(
153
156
  (columnName: string) => {
154
157
  let lastVisibleColumn: any = null;
@@ -234,25 +237,11 @@ const QbsTable: React.FC<QbsTableProps> = ({
234
237
  onSelect: handleClear,
235
238
  handleColumnToggle: handleColumnToggle,
236
239
  dataLength: data?.length,
237
- searchPlaceholder: searchPlaceholder,
238
- labels
240
+ searchPlaceholder: searchPlaceholder
239
241
  };
242
+ const themeToggle = useMemo(() => document.getElementById('themeToggle') as HTMLInputElement, []);
240
243
 
241
244
  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
245
  const handleThemeToggle = () => {
257
246
  if (themeToggle?.checked) {
258
247
  document.body.setAttribute('data-theme', 'dark');
@@ -277,10 +266,11 @@ const QbsTable: React.FC<QbsTableProps> = ({
277
266
  themeToggle?.removeEventListener('change', handleThemeToggle);
278
267
  document.removeEventListener('DOMContentLoaded', handleDOMContentLoaded);
279
268
  };
280
- }, [theme, themeToggle]);
269
+ }, [themeToggle]);
281
270
 
282
271
  const handleExpanded = useCallback(
283
272
  (rowData: any) => {
273
+ console.log(rowData);
284
274
  const keyValue = dataRowKey as string;
285
275
  const key = rowData[keyValue];
286
276
 
@@ -471,7 +461,6 @@ const QbsTable: React.FC<QbsTableProps> = ({
471
461
  wordWrap={wordWrap}
472
462
  autoHeight={autoHeight}
473
463
  sortColumn={sortColumn}
474
- wheelWrapperRef={wheelWrapperRef}
475
464
  style={{ position: 'relative' }}
476
465
  sortType={sortType}
477
466
  onSortColumn={handleSortColumn}
@@ -483,7 +472,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
483
472
  renderEmpty ? (
484
473
  renderEmpty(info)
485
474
  ) : (
486
- <NoData title={emptyTitle ?? labels.noDataFound} subtitle={emptySubTitle} />
475
+ <NoData title={emptyTitle ?? 'No Data Found'} subtitle={emptySubTitle} />
487
476
  )
488
477
  }
489
478
  columns={columns}
@@ -496,6 +485,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
496
485
  expandedRowKeys={expandedRowKeys}
497
486
  onExpandChange={onExpandChange}
498
487
  rowKey={dataRowKey ?? 'id'}
488
+ rowClassName={selection ? getRowClassName : undefined}
499
489
  defaultExpandAllRows={defaultExpandAllRows}
500
490
  shouldUpdateScroll={shouldUpdateScroll}
501
491
  renderRowExpanded={rowData => {
@@ -601,7 +591,6 @@ const QbsTable: React.FC<QbsTableProps> = ({
601
591
  setIsOpen={setIsOpen}
602
592
  handleResetColumns={handleResetColumns}
603
593
  handleColumnToggle={handleColumnToggle}
604
- labels={labels}
605
594
  />
606
595
  </HeaderCell>
607
596
  <Cell />
@@ -627,26 +616,23 @@ const QbsTable: React.FC<QbsTableProps> = ({
627
616
  setIsOpen={setIsOpen}
628
617
  handleResetColumns={handleResetColumns}
629
618
  handleColumnToggle={handleColumnToggle}
630
- labels={labels}
631
619
  />
632
620
  )}
633
621
  </HeaderCell>
634
622
  <ActionCell
635
623
  tableBodyRef={tableBodyRef}
636
624
  actionProps={actionProps}
637
- dropType={dropType}
638
625
  className={`${classes.cellClass} ${classes.actionCellClass}`}
639
626
  handleMenuActions={handleMenuActions}
640
627
  dataTheme={dataTheme}
628
+ dropType={dropType}
641
629
  />
642
630
  </Column>
643
631
  )}
644
632
  </Table>
645
633
 
646
634
  <div>
647
- {pagination && data?.length > 0 && (
648
- <Pagination paginationProps={paginationProps} labels={labels} dataTheme={dataTheme} />
649
- )}
635
+ {pagination && data?.length > 0 && <Pagination paginationProps={paginationProps} />}
650
636
  </div>
651
637
  </div>
652
638
  </div>
@@ -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, ContentView, DefaultView, ExpandIcon, TableView } from './utilities/icons';
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 ?? labels.search}
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 table_custom_ctions ">
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={labels.switchToTableView}>
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={labels.switchToCardView}>
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
- {labels.clear}
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={`btn ${actions?.buttonClassName}`}
154
+ className="btn"
195
155
  disabled={actions.disabled}
196
156
  onClick={() => actions?.action(checkedKeys)}
197
157
  >
198
- {actions?.icon && <span className="mr-2">{actions?.icon}</span>}
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?: React.ReactNode;
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;
@@ -92,6 +87,7 @@ export interface QbsTableProps {
92
87
  expandedRowKeys?: readonly number[];
93
88
  setExpandedRowKeys?: (value: readonly number[]) => void;
94
89
  handleMenuActions?: (actions: ActionProps, rowData: any) => void;
90
+ dropType?: 'vertical' | string;
95
91
  handleRowExpanded?: (rowData: any) => React.ReactNode;
96
92
  shouldUpdateScroll?: boolean;
97
93
  rowExpand?: boolean;
@@ -99,15 +95,12 @@ export interface QbsTableProps {
99
95
  advancefilter?: ReactElement | ReactNode;
100
96
  tableHeaderActions?: ReactElement | ReactNode;
101
97
  searchPlaceholder?: string;
102
- labels?: QbsTableLabels;
103
98
  selectedRowActions?: {
104
99
  actionTitle?: string;
105
100
  action: (checked: (number | string)[]) => void;
106
101
  disabled?: boolean;
107
102
  hidden?: boolean;
108
103
  customHide?: string;
109
- buttonClassName?: string;
110
- icon?: ReactElement | ReactNode;
111
104
  }[];
112
105
  selectedRows?: (number | string)[];
113
106
  classes?: { [key: string]: any };
@@ -138,20 +131,6 @@ export interface QbsTableProps {
138
131
  handleTableCardView?: (data: any) => React.ReactNode;
139
132
  isCustomTableCardView?: boolean;
140
133
  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
134
  }
156
135
 
157
136
  export interface QbsTableToolbarProps {
@@ -177,7 +156,6 @@ export interface QbsTableToolbarProps {
177
156
  dataLength: number;
178
157
  headerHeight?: number;
179
158
  searchPlaceholder?: string;
180
- labels?: QbsTableLabels;
181
159
  tableView?: boolean;
182
160
  enableTableToggle?: boolean;
183
161
  tableViewToggle?: boolean;
@@ -188,13 +166,5 @@ export interface QbsTableToolbarProps {
188
166
  disabled?: boolean;
189
167
  hidden?: boolean;
190
168
  customHide?: string;
191
- buttonClassName?: string;
192
- icon?: ReactElement | ReactNode;
193
169
  }[];
194
- rowViewToggle?: boolean;
195
- defaultRowView?: boolean;
196
- fullWidthView?: boolean;
197
- setTableFullView?: (value: boolean) => void;
198
- setRowViewToggle?: (value: boolean) => void;
199
- isFullScreen?: boolean;
200
170
  }