qbs-react-grid 2.2.4 → 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 -157
- 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 -165
- package/src/qbsTable/labels.ts +0 -58
- package/src/qbsTable/utilities/VerticalDropDownMenu.tsx +0 -178
package/src/less/qbs-table.less
CHANGED
|
@@ -104,156 +104,52 @@
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
.qbs-table[data-theme='dark'] {
|
|
107
|
-
background-color: #
|
|
108
|
-
color: #
|
|
107
|
+
background-color: #333333;
|
|
108
|
+
color: #ffffff;
|
|
109
109
|
|
|
110
|
-
.qbs-table-border-wrap {
|
|
111
|
-
border-color: #3d3d3d;
|
|
112
|
-
background: #262626;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.qbs-table-toolbar-container,
|
|
116
|
-
.qbs-table-toolbar,
|
|
117
|
-
.qbs-table-toolbar-sub-container,
|
|
118
|
-
.sub-qbs-table-toolbar {
|
|
119
|
-
color: #f5f5f5;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.qbs-table-search-container {
|
|
123
|
-
.input {
|
|
124
|
-
border-color: #4a4a4a;
|
|
125
|
-
background: #2d2d2d;
|
|
126
|
-
color: #f5f5f5;
|
|
127
|
-
|
|
128
|
-
&:hover,
|
|
129
|
-
&:focus {
|
|
130
|
-
border-color: #6b6b6b;
|
|
131
|
-
background: #2d2d2d;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.search-button,
|
|
136
|
-
.close-button {
|
|
137
|
-
color: #d1d1d1;
|
|
138
|
-
background-color: transparent;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.qbs-table-column-popup,
|
|
143
|
-
.qbs-table-popup-container {
|
|
144
|
-
background: #2d2d2d;
|
|
145
|
-
color: #f5f5f5;
|
|
146
|
-
border-color: #4a4a4a;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.qbs-table-popup-label,
|
|
150
|
-
.qbs-table-popup-value,
|
|
151
|
-
.qbs-table-reset-link {
|
|
152
|
-
color: #f5f5f5;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.qbs-table-custom-pagination,
|
|
156
|
-
.qbs-table-pagination-text,
|
|
157
|
-
.rows-count {
|
|
158
|
-
color: #f5f5f5;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.qbs-table-icon-container svg path {
|
|
162
|
-
stroke: #e5e5e5;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.custom-select-trigger,
|
|
166
|
-
.custom-select-options {
|
|
167
|
-
background: #2d2d2d;
|
|
168
|
-
color: #f5f5f5;
|
|
169
|
-
border-color: #4a4a4a;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
.qbs-card-container {
|
|
173
|
-
border-color: #4a4a4a;
|
|
174
|
-
background: #262626;
|
|
175
|
-
color: #f5f5f5;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.nodata-title {
|
|
179
|
-
color: #f5f5f5;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.tooltiptext {
|
|
183
|
-
background-color: #3d3d3d;
|
|
184
|
-
color: #fff;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.qbs-table-custom-pagination[data-theme='dark'] {
|
|
189
|
-
color: #f5f5f5;
|
|
190
|
-
|
|
191
|
-
.rows-count,
|
|
192
|
-
.qbs-table-pagination-text {
|
|
193
|
-
color: #f5f5f5;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.qbs-table-icon-container svg path {
|
|
197
|
-
stroke: #e5e5e5;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.rs-table-cell-content[data-theme='dark'] {
|
|
202
|
-
background-color: #262626;
|
|
203
|
-
color: #f5f5f5;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
.qbs-table[data-theme='dark'] {
|
|
207
|
-
.rs-table,
|
|
208
|
-
.rs-table-body-row-wrapper,
|
|
209
|
-
.rs-table-row,
|
|
210
|
-
.rs-table-cell,
|
|
211
110
|
.rs-table-cell-group,
|
|
212
|
-
.rs-table-
|
|
213
|
-
.rs-table-
|
|
214
|
-
background-color: #262626;
|
|
215
|
-
color: #f5f5f5;
|
|
111
|
+
.rs-table-cell-group-fixed-left,
|
|
112
|
+
.rs-table-cell-group-fixed-right {
|
|
113
|
+
background-color: #262626 !important;
|
|
216
114
|
}
|
|
217
115
|
|
|
218
|
-
.rs-table-cell-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
.rs-table-row-
|
|
224
|
-
|
|
225
|
-
background-color: #1b2028;
|
|
226
|
-
color: #f5f5f5;
|
|
116
|
+
.rs-table-hover .rs-table-body-row-wrapper .rs-table-row:hover .rs-table-cell-group,
|
|
117
|
+
.rs-table-hover .rs-table-body-row-wrapper .rs-table-row:hover .rs-table-cell-group-fixed-left,
|
|
118
|
+
.rs-table-hover .rs-table-body-row-wrapper .rs-table-row:hover .rs-table-cell-group-fixed-right,
|
|
119
|
+
.rs-table-hover .rs-table-body-row-wrapper .rs-table-row:hover .rs-table-cell-group > div,
|
|
120
|
+
.rs-table-hover .rs-table-body-row-wrapper .rs-table-row:hover .rs-table-cell-group .rs-table-cell,
|
|
121
|
+
.rs-table-hover .rs-table-body-row-wrapper .rs-table-row:hover .rs-table-cell-group .rs-table-cell-content {
|
|
122
|
+
background-color: #1d2633 !important;
|
|
227
123
|
}
|
|
228
124
|
|
|
229
|
-
.rs-table-
|
|
230
|
-
.rs-table-
|
|
231
|
-
.rs-table-
|
|
232
|
-
|
|
125
|
+
.rs-table-row:has(.qbs-table-checkbox-input:checked) .rs-table-cell-group-scroll .rs-table-cell,
|
|
126
|
+
.rs-table-row:has(.qbs-table-checkbox-input:checked) .rs-table-cell-group-scroll .rs-table-cell-content,
|
|
127
|
+
.rs-table-row.qbs-table-row-checked .rs-table-cell-group-scroll .rs-table-cell,
|
|
128
|
+
.rs-table-row.qbs-table-row-checked .rs-table-cell-group-scroll .rs-table-cell-content {
|
|
129
|
+
background-color: #8f5cff1f !important;
|
|
233
130
|
}
|
|
234
131
|
|
|
235
|
-
.rs-table-cell
|
|
236
|
-
|
|
132
|
+
.rs-table-row:has(.qbs-table-checkbox-input:checked) .rs-table-cell-group-fixed-left,
|
|
133
|
+
.rs-table-row:has(.qbs-table-checkbox-input:checked) .rs-table-cell-group-fixed-right,
|
|
134
|
+
.rs-table-row.qbs-table-row-checked .rs-table-cell-group-fixed-left,
|
|
135
|
+
.rs-table-row.qbs-table-row-checked .rs-table-cell-group-fixed-right,
|
|
136
|
+
.rs-table-row:has(.qbs-table-checkbox-input:checked) .rs-table-cell-group-fixed-left > div,
|
|
137
|
+
.rs-table-row:has(.qbs-table-checkbox-input:checked) .rs-table-cell-group-fixed-right > div,
|
|
138
|
+
.rs-table-row:has(.qbs-table-checkbox-input:checked) .rs-table-cell-group-fixed-left .rs-table-cell,
|
|
139
|
+
.rs-table-row:has(.qbs-table-checkbox-input:checked) .rs-table-cell-group-fixed-right .rs-table-cell,
|
|
140
|
+
.rs-table-row:has(.qbs-table-checkbox-input:checked) .rs-table-cell-group-fixed-left .rs-table-cell-content,
|
|
141
|
+
.rs-table-row:has(.qbs-table-checkbox-input:checked) .rs-table-cell-group-fixed-right .rs-table-cell-content {
|
|
142
|
+
background-color: #2a2438 !important;
|
|
237
143
|
}
|
|
238
144
|
|
|
239
|
-
.
|
|
240
|
-
background-color: #
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
.rs-table-scrollbar-handle {
|
|
244
|
-
background-color: #5a5a5a;
|
|
145
|
+
.qbs-table-checkbox .qbs-table-checkbox-input:checked ~ label {
|
|
146
|
+
background-color: #8f5cff !important;
|
|
147
|
+
border-color: #a78bfa !important;
|
|
245
148
|
}
|
|
246
149
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
text-align: right;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.rs-table-cell-wrap {
|
|
254
|
-
justify-content: flex-start;
|
|
255
|
-
width: 100%;
|
|
256
|
-
}
|
|
150
|
+
.rs-table-cell-content[data-theme='dark'] {
|
|
151
|
+
background-color: #333333;
|
|
152
|
+
color: #ffffff;
|
|
257
153
|
}
|
|
258
154
|
/* Dropdown container */
|
|
259
155
|
.qbs-table-menu-dropdown {
|
|
@@ -387,98 +283,70 @@
|
|
|
387
283
|
.qbs-table-tooltip {
|
|
388
284
|
cursor: pointer;
|
|
389
285
|
position: relative;
|
|
390
|
-
|
|
286
|
+
width: auto;
|
|
287
|
+
display: flex;
|
|
391
288
|
}
|
|
392
289
|
|
|
393
290
|
.qbs-table-tooltip .tooltiptext {
|
|
394
291
|
visibility: hidden;
|
|
395
|
-
background-color:
|
|
396
|
-
color:
|
|
292
|
+
background-color: black;
|
|
293
|
+
color: white;
|
|
397
294
|
text-align: center;
|
|
398
|
-
padding: 6px
|
|
399
|
-
border-radius:
|
|
295
|
+
padding: 6px;
|
|
296
|
+
border-radius: 4px;
|
|
400
297
|
position: absolute;
|
|
401
|
-
z-index:
|
|
298
|
+
z-index: 9999;
|
|
402
299
|
opacity: 0;
|
|
403
|
-
transition: opacity 0.
|
|
300
|
+
transition: opacity 0.3s;
|
|
404
301
|
font-size: 12px;
|
|
405
|
-
font-
|
|
302
|
+
font-style: normal;
|
|
303
|
+
font-weight: 400;
|
|
406
304
|
line-height: 16px;
|
|
407
|
-
|
|
408
|
-
max-width: min(280px, 90vw);
|
|
409
|
-
pointer-events: none;
|
|
410
|
-
inset-inline-start: 50%;
|
|
411
|
-
translate: -50% 0;
|
|
305
|
+
width: 100px;
|
|
412
306
|
}
|
|
413
307
|
|
|
414
308
|
.qbs-table-tooltip.up .tooltiptext {
|
|
415
|
-
bottom: calc(100% +
|
|
416
|
-
|
|
309
|
+
bottom: calc(100% + 10px);
|
|
310
|
+
right: -8px;
|
|
311
|
+
left: unset;
|
|
417
312
|
}
|
|
418
313
|
|
|
419
314
|
.qbs-table-tooltip.down .tooltiptext {
|
|
315
|
+
right: -10px;
|
|
420
316
|
top: calc(100% + 8px);
|
|
421
|
-
bottom: auto;
|
|
422
317
|
}
|
|
423
318
|
|
|
319
|
+
// .qbs-table-tooltip:hover .tooltiptext {
|
|
320
|
+
// visibility: visible;
|
|
321
|
+
// opacity: 1;
|
|
322
|
+
// }
|
|
323
|
+
|
|
424
324
|
.qbs-table-tooltip .tooltiptext::after {
|
|
425
325
|
content: '';
|
|
426
326
|
position: absolute;
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
border: 5px solid transparent;
|
|
327
|
+
border-width: 5px;
|
|
328
|
+
border-style: solid;
|
|
430
329
|
}
|
|
431
330
|
|
|
432
331
|
.qbs-table-tooltip.up .tooltiptext::after {
|
|
433
|
-
|
|
434
|
-
|
|
332
|
+
border-color: black transparent transparent !important;
|
|
333
|
+
right: 12px !important;
|
|
334
|
+
margin-left: -5px !important;
|
|
335
|
+
top: 100% !important;
|
|
336
|
+
left: unset !important;
|
|
435
337
|
}
|
|
436
338
|
|
|
437
339
|
.qbs-table-tooltip.down .tooltiptext::after {
|
|
438
|
-
|
|
439
|
-
|
|
340
|
+
border-color: transparent transparent black;
|
|
341
|
+
bottom: 100% !important;
|
|
342
|
+
right: 12px !important;
|
|
343
|
+
margin-left: -5px !important;
|
|
344
|
+
left: unset !important;
|
|
440
345
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
visibility: hidden;
|
|
446
|
-
opacity: 0;
|
|
447
|
-
pointer-events: none;
|
|
448
|
-
background-color: var(--tooltip-bg, #222);
|
|
449
|
-
color: var(--tooltip-text, #fff);
|
|
450
|
-
text-align: center;
|
|
451
|
-
padding: 6px 10px;
|
|
452
|
-
border-radius: 6px;
|
|
453
|
-
font-size: 12px;
|
|
454
|
-
font-weight: 500;
|
|
455
|
-
line-height: 16px;
|
|
456
|
-
white-space: nowrap;
|
|
457
|
-
max-width: min(280px, 90vw);
|
|
458
|
-
transition: opacity 0.15s ease;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
.qbs-table-tooltip-floating.tooltiptext.is-positioned {
|
|
462
|
-
visibility: visible;
|
|
463
|
-
opacity: 1;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
.qbs-table-tooltip-floating.tooltiptext::after {
|
|
467
|
-
content: '';
|
|
468
|
-
position: absolute;
|
|
469
|
-
left: var(--tooltip-arrow-offset, 50%);
|
|
470
|
-
translate: -50% 0;
|
|
471
|
-
border: 5px solid transparent;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
.qbs-table-tooltip-floating--down.tooltiptext::after {
|
|
475
|
-
bottom: 100%;
|
|
476
|
-
border-bottom-color: var(--tooltip-bg, #222);
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
.qbs-table-tooltip-floating--up.tooltiptext::after {
|
|
480
|
-
top: 100%;
|
|
481
|
-
border-top-color: var(--tooltip-bg, #222);
|
|
346
|
+
.qbs-table-tooltip.down .tooltiptext {
|
|
347
|
+
top: 145% !important;
|
|
348
|
+
right: -10px !important;
|
|
349
|
+
left: auto !important;
|
|
482
350
|
}
|
|
483
351
|
.rs-table-row {
|
|
484
352
|
overflow: visible !important;
|
|
@@ -879,8 +747,8 @@
|
|
|
879
747
|
.qbs-table-top-icons {
|
|
880
748
|
color: #999696;
|
|
881
749
|
|
|
882
|
-
.active
|
|
883
|
-
color: #
|
|
750
|
+
.active{
|
|
751
|
+
color: #EC6A17;
|
|
884
752
|
}
|
|
885
753
|
}
|
|
886
754
|
.qbs-card-empty-wrapper {
|
|
@@ -889,4 +757,4 @@
|
|
|
889
757
|
align-items: center;
|
|
890
758
|
height: 100%;
|
|
891
759
|
width: 100%;
|
|
892
|
-
}
|
|
760
|
+
}
|
|
@@ -4,7 +4,6 @@ import { Link } from 'react-router-dom';
|
|
|
4
4
|
import Cell from '../Cell';
|
|
5
5
|
import { handleCellFormat } from './utilities/handleFormatCell';
|
|
6
6
|
import MenuDropDown from './utilities/menuDropDown';
|
|
7
|
-
import VerticalMenuDropdown from './utilities/VerticalDropDownMenu';
|
|
8
7
|
|
|
9
8
|
const CHECKBOX_LINE_HEIGHT = '36px';
|
|
10
9
|
export const CheckCell: React.FC<any> = React.memo(
|
|
@@ -38,38 +37,17 @@ export const CheckCell: React.FC<any> = React.memo(
|
|
|
38
37
|
)
|
|
39
38
|
);
|
|
40
39
|
export const ActionCell: React.FC<any> = React.memo(
|
|
41
|
-
({
|
|
42
|
-
rowData,
|
|
43
|
-
handleMenuActions,
|
|
44
|
-
dataTheme,
|
|
45
|
-
actionProps,
|
|
46
|
-
tableBodyRef,
|
|
47
|
-
rowIndex,
|
|
48
|
-
dropType,
|
|
49
|
-
wheelWrapperRef
|
|
50
|
-
}) => {
|
|
40
|
+
({ rowData, handleMenuActions, dataTheme, actionProps, tableBodyRef, rowIndex }) => {
|
|
51
41
|
return (
|
|
52
42
|
<div>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
wheelWrapperRef={wheelWrapperRef}
|
|
62
|
-
/>
|
|
63
|
-
) : (
|
|
64
|
-
<MenuDropDown
|
|
65
|
-
tableBodyRef={tableBodyRef}
|
|
66
|
-
actionDropDown={actionProps}
|
|
67
|
-
rowData={rowData}
|
|
68
|
-
dataTheme={dataTheme}
|
|
69
|
-
rowIndex={rowIndex}
|
|
70
|
-
handleMenuActions={handleMenuActions}
|
|
71
|
-
/>
|
|
72
|
-
)}
|
|
43
|
+
<MenuDropDown
|
|
44
|
+
tableBodyRef={tableBodyRef}
|
|
45
|
+
actionDropDown={actionProps}
|
|
46
|
+
rowData={rowData}
|
|
47
|
+
dataTheme={dataTheme}
|
|
48
|
+
rowIndex={rowIndex}
|
|
49
|
+
handleMenuActions={handleMenuActions}
|
|
50
|
+
/>
|
|
73
51
|
</div>
|
|
74
52
|
);
|
|
75
53
|
}
|
|
@@ -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
|
|
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,
|
|
@@ -95,40 +91,17 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
95
91
|
childDetailHeading = '',
|
|
96
92
|
isCustomTableCardView = false,
|
|
97
93
|
handleTableCardView,
|
|
98
|
-
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
|
|
94
|
+
handleCustomCardLoader
|
|
114
95
|
}) => {
|
|
115
|
-
const labels = useMemo(() => mergeLabels(labelsProp), [labelsProp]);
|
|
116
96
|
const [loading, setLoading] = useState(false);
|
|
117
97
|
const [columns, setColumns] = useState(propColumn);
|
|
118
98
|
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();
|
|
99
|
+
const dataTheme = useMemo(() => localStorage.getItem('theme') ?? theme, [theme]);
|
|
124
100
|
const [isOpen, setIsOpen] = useState(false);
|
|
125
101
|
const prevColumns = useRef<any | null>(null);
|
|
126
102
|
const [tableViewToggle, setTableViewToggle] = useState(tableView);
|
|
127
103
|
const isMobile = useResponsiveStore();
|
|
128
104
|
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
105
|
const handleSortColumn = useCallback(
|
|
133
106
|
(sortColumn: any, sortType: any) => {
|
|
134
107
|
setLoading(true);
|
|
@@ -180,6 +153,16 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
180
153
|
[checkedKeys]
|
|
181
154
|
);
|
|
182
155
|
|
|
156
|
+
const rowKeyField = dataRowKey ?? 'id';
|
|
157
|
+
const getRowClassName = useCallback(
|
|
158
|
+
(rowData: Record<string, unknown>) => {
|
|
159
|
+
if (!selection) return '';
|
|
160
|
+
const key = rowData?.[rowKeyField] as string | number | undefined;
|
|
161
|
+
return key !== undefined && checkedKeys?.includes(key) ? 'qbs-table-row-checked' : '';
|
|
162
|
+
},
|
|
163
|
+
[selection, checkedKeys, rowKeyField]
|
|
164
|
+
);
|
|
165
|
+
|
|
183
166
|
const handleToggle = useCallback(
|
|
184
167
|
(columnName: string) => {
|
|
185
168
|
let lastVisibleColumn: any = null;
|
|
@@ -215,7 +198,6 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
215
198
|
|
|
216
199
|
const handleColumnWidth = useCallback((newWidth?: number, dataKey?: any) => {
|
|
217
200
|
if (newWidth === undefined || dataKey === undefined) return;
|
|
218
|
-
REFRESH_KEY = REFRESH_KEY + 1;
|
|
219
201
|
setColumns(prevColumns =>
|
|
220
202
|
prevColumns.map(column =>
|
|
221
203
|
column.field === dataKey ? { ...column, colWidth: newWidth } : column
|
|
@@ -232,14 +214,6 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
232
214
|
);
|
|
233
215
|
}
|
|
234
216
|
}, [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
217
|
|
|
244
218
|
const onReorder = useCallback((columns: QbsColumnProps[]) => {
|
|
245
219
|
setColumns(columns);
|
|
@@ -247,6 +221,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
247
221
|
|
|
248
222
|
// useEffect(() => {
|
|
249
223
|
// }, [columns]);
|
|
224
|
+
|
|
250
225
|
const handleClear = ([]) => {
|
|
251
226
|
setCheckedKeys([]);
|
|
252
227
|
handleChecked([]);
|
|
@@ -276,31 +251,11 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
276
251
|
searchPlaceholder: searchPlaceholder,
|
|
277
252
|
setTableViewToggle: setTableViewToggle,
|
|
278
253
|
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
|
|
254
|
+
enableTableToggle: enableTableToggle
|
|
287
255
|
};
|
|
256
|
+
const themeToggle = useMemo(() => document.getElementById('themeToggle') as HTMLInputElement, []);
|
|
288
257
|
|
|
289
258
|
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
259
|
const handleThemeToggle = () => {
|
|
305
260
|
if (themeToggle?.checked) {
|
|
306
261
|
document.body.setAttribute('data-theme', 'dark');
|
|
@@ -325,10 +280,11 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
325
280
|
themeToggle?.removeEventListener('change', handleThemeToggle);
|
|
326
281
|
document.removeEventListener('DOMContentLoaded', handleDOMContentLoaded);
|
|
327
282
|
};
|
|
328
|
-
}, [
|
|
283
|
+
}, [themeToggle]);
|
|
329
284
|
|
|
330
285
|
const handleExpanded = useCallback(
|
|
331
286
|
(rowData: any) => {
|
|
287
|
+
console.log(rowData);
|
|
332
288
|
const keyValue = dataRowKey as string;
|
|
333
289
|
const key = rowData[keyValue];
|
|
334
290
|
|
|
@@ -618,46 +574,24 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
618
574
|
[columns, dataTheme]
|
|
619
575
|
);
|
|
620
576
|
|
|
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
577
|
return (
|
|
635
|
-
<div
|
|
636
|
-
className={`qbs-table ${classes.tableContainerClass}`}
|
|
637
|
-
data-theme={dataTheme}
|
|
638
|
-
dir={rtl ? 'rtl' : 'ltr'}
|
|
639
|
-
>
|
|
578
|
+
<div className={`qbs-table ${classes.tableContainerClass}`} data-theme={dataTheme}>
|
|
640
579
|
{toolbar && <ToolBar {...toolbarProps} />}
|
|
641
580
|
<div className="qbs-table-border-wrap">
|
|
642
581
|
{tableViewToggle ? (
|
|
643
582
|
<Table
|
|
644
583
|
height={autoHeight ? undefined : height}
|
|
645
|
-
key={tableKey
|
|
584
|
+
key={tableKey}
|
|
646
585
|
tableKey={tableKey}
|
|
647
586
|
data={data}
|
|
648
|
-
rtl={rtl}
|
|
649
587
|
tableBodyRef={tableBodyRef as React.RefObject<HTMLDivElement>}
|
|
650
588
|
dataTheme={dataTheme}
|
|
651
589
|
wordWrap={wordWrap}
|
|
652
|
-
wheelWrapperRef={wheelWrapperRef}
|
|
653
|
-
rowHeight={rowHeight}
|
|
654
590
|
autoHeight={autoHeight}
|
|
655
|
-
handleInfiniteScroll={handleInfiniteScroll}
|
|
656
591
|
sortColumn={sortColumn}
|
|
657
592
|
style={{ position: 'relative' }}
|
|
658
593
|
sortType={sortType}
|
|
659
594
|
onSortColumn={handleSortColumn}
|
|
660
|
-
infiniteLoading={infiniteLoading}
|
|
661
595
|
onRowClick={onRowClick}
|
|
662
596
|
tableBodyHeight={tableBodyHeight}
|
|
663
597
|
cellBordered={cellBordered}
|
|
@@ -666,7 +600,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
666
600
|
renderEmpty ? (
|
|
667
601
|
renderEmpty(info)
|
|
668
602
|
) : (
|
|
669
|
-
<NoData title={emptyTitle ??
|
|
603
|
+
<NoData title={emptyTitle ?? 'No Data Found'} subtitle={emptySubTitle} />
|
|
670
604
|
)
|
|
671
605
|
}
|
|
672
606
|
columns={columns}
|
|
@@ -674,11 +608,12 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
674
608
|
headerHeight={headerHeight}
|
|
675
609
|
rowExpandedHeight={rowExpandedHeight}
|
|
676
610
|
loading={isLoading ?? loading}
|
|
677
|
-
showHeader
|
|
611
|
+
showHeader
|
|
678
612
|
defaultChecked
|
|
679
613
|
expandedRowKeys={expandedRowKeys}
|
|
680
614
|
onExpandChange={onExpandChange}
|
|
681
615
|
rowKey={dataRowKey ?? 'id'}
|
|
616
|
+
rowClassName={selection ? getRowClassName : undefined}
|
|
682
617
|
defaultExpandAllRows={defaultExpandAllRows}
|
|
683
618
|
shouldUpdateScroll={shouldUpdateScroll}
|
|
684
619
|
renderRowExpanded={rowData => {
|
|
@@ -783,12 +718,9 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
783
718
|
onReorder={onReorder}
|
|
784
719
|
isOpen={isOpen}
|
|
785
720
|
tableHeight={height}
|
|
786
|
-
viewMode={viewMode}
|
|
787
|
-
setViewMode={setViewMode}
|
|
788
721
|
setIsOpen={setIsOpen}
|
|
789
722
|
handleResetColumns={handleResetColumns}
|
|
790
723
|
handleColumnToggle={handleColumnToggle}
|
|
791
|
-
labels={labels}
|
|
792
724
|
/>
|
|
793
725
|
</HeaderCell>
|
|
794
726
|
<Cell />
|
|
@@ -810,20 +742,15 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
810
742
|
onToggle={handleToggle}
|
|
811
743
|
tableHeight={height}
|
|
812
744
|
onReorder={onReorder}
|
|
813
|
-
viewMode={viewMode}
|
|
814
|
-
setViewMode={setViewMode}
|
|
815
745
|
isOpen={isOpen}
|
|
816
746
|
setIsOpen={setIsOpen}
|
|
817
747
|
handleResetColumns={handleResetColumns}
|
|
818
748
|
handleColumnToggle={handleColumnToggle}
|
|
819
|
-
labels={labels}
|
|
820
749
|
/>
|
|
821
750
|
)}
|
|
822
751
|
</HeaderCell>
|
|
823
752
|
<ActionCell
|
|
824
753
|
tableBodyRef={tableBodyRef}
|
|
825
|
-
dropType={dropType}
|
|
826
|
-
wheelWrapperRef={wheelWrapperRef}
|
|
827
754
|
actionProps={actionProps}
|
|
828
755
|
className={`${classes.cellClass} ${classes.actionCellClass}`}
|
|
829
756
|
handleMenuActions={handleMenuActions}
|
|
@@ -849,7 +776,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
849
776
|
>
|
|
850
777
|
{(data?.length === 0 || !data) && !isLoading && (
|
|
851
778
|
<div className="flex flex-col gap-2 p-2 mt-6 card-empty-container">
|
|
852
|
-
<NoData title={emptyTitle ??
|
|
779
|
+
<NoData title={emptyTitle ?? 'No Data Found'} subtitle={emptySubTitle} />
|
|
853
780
|
</div>
|
|
854
781
|
)}
|
|
855
782
|
{isLoading ? (
|
|
@@ -876,7 +803,6 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
876
803
|
columns={columns}
|
|
877
804
|
tableBodyRef={tableBodyRef}
|
|
878
805
|
actionProps={actionProps}
|
|
879
|
-
labels={labels}
|
|
880
806
|
/>
|
|
881
807
|
)}
|
|
882
808
|
</div>
|
|
@@ -885,9 +811,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
885
811
|
</div>
|
|
886
812
|
)}
|
|
887
813
|
<div>
|
|
888
|
-
{pagination && data?.length > 0 &&
|
|
889
|
-
<Pagination paginationProps={paginationProps} labels={labels} dataTheme={dataTheme} />
|
|
890
|
-
)}
|
|
814
|
+
{pagination && data?.length > 0 && <Pagination paginationProps={paginationProps} />}
|
|
891
815
|
</div>
|
|
892
816
|
</div>
|
|
893
817
|
</div>
|