stk-table-vue 0.8.13 → 0.9.0-beta.1

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 (38) hide show
  1. package/README.md +172 -180
  2. package/lib/src/StkTable/StkTable.vue.d.ts +22 -2
  3. package/lib/src/StkTable/useScrollbar.d.ts +57 -0
  4. package/lib/src/StkTable/utils/index.d.ts +10 -0
  5. package/lib/stk-table-vue.js +563 -294
  6. package/lib/style.css +49 -2
  7. package/package.json +74 -72
  8. package/src/StkTable/StkTable.vue +1730 -1653
  9. package/src/StkTable/components/DragHandle.vue +9 -9
  10. package/src/StkTable/components/SortIcon.vue +6 -6
  11. package/src/StkTable/components/TriangleIcon.vue +3 -3
  12. package/src/StkTable/const.ts +50 -50
  13. package/src/StkTable/index.ts +4 -4
  14. package/src/StkTable/style.less +627 -580
  15. package/src/StkTable/types/highlightDimOptions.ts +26 -26
  16. package/src/StkTable/types/index.ts +297 -297
  17. package/src/StkTable/useAutoResize.ts +91 -91
  18. package/src/StkTable/useColResize.ts +216 -216
  19. package/src/StkTable/useFixedCol.ts +150 -148
  20. package/src/StkTable/useFixedStyle.ts +75 -75
  21. package/src/StkTable/useGetFixedColPosition.ts +65 -65
  22. package/src/StkTable/useHighlight.ts +257 -257
  23. package/src/StkTable/useKeyboardArrowScroll.ts +112 -112
  24. package/src/StkTable/useMaxRowSpan.ts +55 -55
  25. package/src/StkTable/useMergeCells.ts +120 -123
  26. package/src/StkTable/useRowExpand.ts +88 -88
  27. package/src/StkTable/useScrollRowByRow.ts +114 -79
  28. package/src/StkTable/useScrollbar.ts +187 -0
  29. package/src/StkTable/useThDrag.ts +102 -102
  30. package/src/StkTable/useTrDrag.ts +113 -118
  31. package/src/StkTable/useTree.ts +161 -161
  32. package/src/StkTable/useVirtualScroll.ts +494 -494
  33. package/src/StkTable/utils/constRefUtils.ts +29 -29
  34. package/src/StkTable/utils/index.ts +287 -242
  35. package/src/StkTable/utils/useTriggerRef.ts +33 -33
  36. package/src/VirtualTree.vue +622 -622
  37. package/src/VirtualTreeSelect.vue +367 -367
  38. package/src/vite-env.d.ts +10 -10
@@ -1,581 +1,628 @@
1
- /**高亮渐暗 */
2
- @keyframes stk-table-dim {
3
- from {
4
- background-color: var(--highlight-color);
5
- }
6
- }
7
-
8
- .stk-table {
9
- /* contain: strict;*/
10
- --row-height: 28px;
11
- --header-row-height: var(--row-height);
12
- --cell-padding-y: 0;
13
- --cell-padding-x: 8px;
14
- --resize-handle-width: 4px;
15
- --border-color: #e8e8f4;
16
- --border-width: 1px;
17
- --td-bgc: #fff;
18
- --td-hover-color: #71a2fd;
19
- --td-active-color: #386ccc;
20
- --th-bgc: #f1f1f9;
21
- --th-color: #272841;
22
- --tr-active-bgc: rgb(230, 247, 255);
23
- --tr-hover-bgc: rgba(230, 247, 255, 0.7);
24
- --bg-border-top: linear-gradient(180deg, var(--border-color) var(--border-width), transparent var(--border-width));
25
- --bg-border-right: linear-gradient(270deg, var(--border-color) var(--border-width), transparent var(--border-width));
26
- --bg-border-bottom: linear-gradient(0deg, var(--border-color) var(--border-width), transparent var(--border-width));
27
- --bg-border-left: linear-gradient(90deg, var(--border-color) var(--border-width), transparent var(--border-width));
28
- --highlight-color: #71a2fd;
29
- --highlight-duration: 2s;
30
- --highlight-timing-function: linear;
31
- /* 斑马纹颜色*/
32
- --stripe-bgc: #fafafc;
33
-
34
- --sort-arrow-color: #757699;
35
- --sort-arrow-hover-color: #8f90b5;
36
- --sort-arrow-active-color: #1b63d9;
37
- --sort-arrow-active-sub-color: #cbcbe1;
38
-
39
- --fold-icon-color: #757699;
40
- --fold-icon-hover-color: #8f90b5;
41
- /** 列宽拖动指示器颜色 */
42
- --col-resize-indicator-color: #87879c;
43
-
44
- /** 固定列阴影颜色 */
45
- --fixed-col-shadow-color-from: rgba(0, 0, 0, 0.1);
46
- --fixed-col-shadow-color-to: rgba(0, 0, 0, 0);
47
-
48
- /** 拖动行hover背景 */
49
- --drag-handle-hover-color: #d0d1e0;
50
-
51
- position: relative;
52
- overflow: auto;
53
- display: flex;
54
- flex-direction: column;
55
- box-sizing: border-box;
56
-
57
- /**深色模式 */
58
- &.dark {
59
- --th-bgc: #202029;
60
- --th-color: #c0c0d1;
61
- --td-bgc: #1b1b24;
62
- --td-hover-color: #70a6ff;
63
- --td-active-color: #386ccc;
64
- --border-color: #292933;
65
- --tr-active-bgc: #283f63;
66
- --tr-hover-bgc: #1a2b46;
67
- --table-bgc: #1b1b24;
68
- /* 不能用rgba,因为固定列时,会变成半透明*/
69
- --highlight-color: #1e4c99;
70
-
71
- --stripe-bgc: #202029;
72
-
73
- --sort-arrow-color: #5d6064;
74
- --sort-arrow-hover-color: #727782;
75
- --sort-arrow-active-color: #d0d1d2;
76
- --sort-arrow-active-sub-color: #5d6064;
77
-
78
- --fold-icon-color: #5d6064;
79
- --fold-icon-hover-color: #727782;
80
-
81
- --col-resize-indicator-color: #5d6064;
82
-
83
- --fixed-col-shadow-color-from: rgba(135, 135, 156, 0.1);
84
- --fixed-col-shadow-color-to: rgba(135, 135, 156, 0);
85
-
86
- --drag-handle-hover-color: #5d6064;
87
-
88
- /* background-color: var(--table-bgc); */
89
- /* ⭐这里加background-color会导致表格出滚动白屏*/
90
- color: #d1d1e0;
91
- }
92
-
93
- &.headless {
94
- &.bordered {
95
- border-top: 1px solid var(--border-color);
96
- background-image: var(--bg-border-right), var(--bg-border-bottom);
97
- }
98
- }
99
-
100
- /* 调整列宽的话,表格宽度应当自适应 */
101
- &.col-resizable {
102
- .stk-table-main {
103
- width: fit-content;
104
- min-width: min-content;
105
- }
106
- }
107
-
108
- /** 调整列宽的时候不要触发th事件。否则会导致触发表头点击排序 */
109
- &.is-col-resizing {
110
- th {
111
- pointer-events: none;
112
- }
113
- }
114
-
115
- &.bordered {
116
- /**
117
- * border-left: 此方案用于减少cell 中border-left 的css选择。同时利于多级表头border-left问题。利于横向滚动border-left
118
- * - box-shadow inset 方案不生效,且占用属性。
119
- * - outline 方案绘制在图形外
120
- * - 绝对定位元素。需要根据滚动条位置动态计算。不合适。
121
- * - sticky 定位方案需要占用位置。高度为0。
122
- */
123
- border-left: 1px solid var(--border-color);
124
- /* 下面border用于表格内容不满高度时,绘制表格边界线 */
125
- background-image: var(--bg-border-top), var(--bg-border-right), var(--bg-border-bottom);
126
-
127
- th,
128
- td {
129
- background-image: var(--bg-border-right), var(--bg-border-bottom);
130
- }
131
-
132
- thead tr:first-child th {
133
- background-image: var(--bg-border-top), var(--bg-border-right), var(--bg-border-bottom);
134
- }
135
- }
136
-
137
- &.bordered-h {
138
- border-left: none;
139
- --bg-border-right: linear-gradient(transparent, transparent);
140
- --bg-border-left: linear-gradient(transparent, transparent);
141
- }
142
-
143
- &.bordered-v {
144
- --bg-border-bottom: linear-gradient(transparent, transparent);
145
- --bg-border-top: linear-gradient(transparent, transparent);
146
- }
147
-
148
- &.bordered-body-v {
149
- tbody {
150
- --bg-border-bottom: linear-gradient(transparent, transparent);
151
- }
152
- }
153
-
154
- &.bordered-body-h {
155
- tbody {
156
- --bg-border-right: linear-gradient(transparent, transparent);
157
- }
158
- }
159
-
160
- &.stripe {
161
- &:not(.vt-on) .stk-tbody-main tr:nth-child(even) {
162
- background-color: var(--stripe-bgc);
163
- }
164
-
165
- &.vt-on .stk-tbody-main tr:nth-child(odd) {
166
- background-color: var(--stripe-bgc);
167
- }
168
-
169
- &.row-hover .stk-tbody-main tr:hover {
170
- background-color: var(--tr-hover-bgc);
171
- }
172
-
173
- &.row-active .stk-tbody-main tr.active {
174
- background-color: var(--tr-active-bgc);
175
- }
176
- }
177
-
178
- /** more weight for custom row background*/
179
- &.row-hover .stk-tbody-main tr:hover {
180
- background-color: var(--tr-hover-bgc);
181
- }
182
-
183
- &.row-active .stk-tbody-main tr.active {
184
- background-color: var(--tr-active-bgc);
185
- }
186
-
187
- /* 单元格悬浮 */
188
- &.cell-hover tbody td:hover {
189
- box-shadow: inset 0 0 0 2px var(--td-hover-color);
190
- }
191
-
192
- /* 单元格高亮 */
193
- &.cell-active tbody td.active {
194
- box-shadow: inset 0 0 0 2px var(--td-active-color);
195
- }
196
-
197
- /* td 溢出*/
198
- &.text-overflow {
199
- .table-cell-wrapper {
200
- white-space: nowrap;
201
- overflow: hidden;
202
- text-overflow: ellipsis;
203
- }
204
- }
205
-
206
- /* th 溢出*/
207
- &.header-text-overflow {
208
- .table-header-cell-wrapper {
209
- white-space: nowrap;
210
- overflow: hidden;
211
- }
212
-
213
- .table-header-title {
214
- text-overflow: ellipsis;
215
- overflow: hidden;
216
- }
217
- }
218
-
219
- /**虚拟滚动模式 */
220
- &.virtual {
221
-
222
- /* 为不影响布局,表头行高要定死*/
223
- .table-header-cell-wrapper {
224
- overflow: hidden;
225
- max-height: calc(var(--header-row-height) * var(--row-span, 1));
226
-
227
- .table-header-title {
228
- max-height: inherit;
229
- }
230
- }
231
-
232
- tbody td {
233
- height: var(--row-height);
234
-
235
- .table-cell-wrapper {
236
- max-height: var(--row-height);
237
- overflow: hidden;
238
- }
239
- }
240
-
241
- .padding-top-tr td {
242
- height: 0;
243
- }
244
-
245
- .expand-cell .table-cell-wrapper {
246
- white-space: nowrap;
247
- }
248
-
249
- // .expanded-row .table-cell-wrapper{
250
- // overflow: auto;
251
- // }
252
- }
253
-
254
- &.auto-row-height {
255
- tbody td {
256
- height: unset;
257
-
258
- .table-cell-wrapper {
259
- max-height: unset;
260
- overflow: initial;
261
- }
262
- }
263
- }
264
-
265
- &.fixed-relative-mode {
266
- th {
267
- position: relative;
268
- }
269
-
270
- .fixed-cell--active {
271
- position: relative;
272
- }
273
- }
274
-
275
- &.scroll-row-by-row {
276
- .stk-table-main {
277
- position: sticky;
278
- top: 0;
279
- }
280
- }
281
-
282
- .row-by-row-table-height {
283
- width: 1px;
284
- flex-shrink: 0;
285
- position: absolute;
286
- left: 0;
287
- top: 0;
288
- }
289
-
290
- th,
291
- td {
292
- font-size: 14px;
293
- box-sizing: border-box;
294
- padding: var(--cell-padding-y) var(--cell-padding-x);
295
- }
296
-
297
- th {
298
- color: var(--th-color);
299
- background-color: inherit;
300
- /**
301
- * 保证向上滚动时,表头不被遮挡。
302
- * z-index:2 为防止固定列阴影重叠。
303
- */
304
- z-index: 2;
305
- position: sticky;
306
-
307
- &.sortable {
308
- cursor: pointer;
309
- }
310
-
311
- &:not(.sorter-desc):not(.sorter-asc):hover .table-header-sorter {
312
- .arrow-up {
313
- fill: var(--sort-arrow-hover-color);
314
- }
315
-
316
- .arrow-down {
317
- fill: var(--sort-arrow-hover-color);
318
- }
319
- }
320
-
321
- &.sorter-desc .table-header-sorter {
322
- display: inline;
323
-
324
- .arrow-up {
325
- fill: var(--sort-arrow-active-sub-color);
326
- }
327
-
328
- .arrow-down {
329
- fill: var(--sort-arrow-active-color);
330
- }
331
- }
332
-
333
- &.sorter-asc .table-header-sorter {
334
- display: inline;
335
-
336
- .arrow-up {
337
- fill: var(--sort-arrow-active-color);
338
- }
339
-
340
- .arrow-down {
341
- fill: var(--sort-arrow-active-sub-color);
342
- }
343
- }
344
- }
345
-
346
- thead tr {
347
- background-color: var(--th-bgc);
348
- height: var(--header-row-height);
349
- }
350
-
351
- tbody tr {
352
- background-color: var(--td-bgc);
353
- height: var(--row-height);
354
- }
355
-
356
- .vt-x-left,
357
- .vt-x-right {
358
- padding: 0;
359
- background: none;
360
- pointer-events: none;
361
- }
362
-
363
- /** 列宽调整指示器 */
364
- .column-resize-indicator {
365
- width: 0;
366
- height: 100%;
367
- border-left: 2px solid var(--col-resize-indicator-color);
368
- position: absolute;
369
- z-index: 10;
370
- display: none;
371
- pointer-events: none;
372
- }
373
-
374
- .stk-table-main {
375
- border-spacing: 0;
376
- border-collapse: separate;
377
- width: fit-content;
378
- /* 不加会导致width 超过100%时为100%,行hover高亮会断开*/
379
- min-width: 100%;
380
-
381
- &.fixed-mode {
382
- table-layout: fixed;
383
- min-width: min-content;
384
- }
385
- }
386
-
387
- .fixed-cell {
388
- background-color: inherit;
389
- }
390
-
391
- .highlight-cell {
392
- animation-name: stk-table-dim;
393
- animation-duration: var(--highlight-duration);
394
- animation-timing-function: var(--highlight-timing-function);
395
- /* 必须分开写,否则var(step(x))不兼容旧浏览器*/
396
- }
397
-
398
- .seq-column {
399
- text-align: center;
400
- }
401
-
402
- .drag-row-cell {
403
- .table-cell-wrapper {
404
- display: inline-flex;
405
- align-items: center;
406
- }
407
-
408
- .drag-row-handle {
409
- cursor: grab;
410
- border-radius: 4px;
411
-
412
- &:hover {
413
- background-color: var(--drag-handle-hover-color);
414
- }
415
-
416
- &:active {
417
- cursor: grabbing;
418
- }
419
-
420
- >svg {
421
- vertical-align: -2px;
422
- }
423
- }
424
- }
425
-
426
- .tr-dragging {
427
- opacity: 0.5;
428
- }
429
-
430
- .tr-dragging-over {
431
- background-color: var(--tr-hover-bgc);
432
- }
433
-
434
- /*固定列阴影-左*/
435
- .fixed-cell--left {
436
- --shadow-rotate: 90deg;
437
-
438
- &.fixed-cell--shadow::after {
439
- right: -10px;
440
- }
441
- }
442
-
443
- /*固定列阴影-右*/
444
- .fixed-cell--right {
445
- --shadow-rotate: -90deg;
446
-
447
- &.fixed-cell--shadow::after {
448
- left: -10px;
449
- }
450
- }
451
-
452
- /*固定列阴影*/
453
- .fixed-cell--shadow::after {
454
- content: '';
455
- width: 10px;
456
- height: 100%;
457
- top: 0px;
458
- position: absolute;
459
- pointer-events: none;
460
- background-image: linear-gradient(var(--shadow-rotate), var(--fixed-col-shadow-color-from), var(--fixed-col-shadow-color-to));
461
- }
462
-
463
- .fixed-cell--active {
464
- position: sticky;
465
- }
466
-
467
- th.fixed-cell--active {
468
- z-index: 3;
469
- }
470
-
471
- td.fixed-cell--active {
472
- z-index: 1;
473
- }
474
-
475
- .table-header-cell-wrapper {
476
- max-width: 100%;
477
- display: inline-flex;
478
- align-items: center;
479
- }
480
-
481
- .table-header-title {
482
- overflow: hidden;
483
- }
484
-
485
- .table-header-sorter {
486
- flex-shrink: 0;
487
- margin-left: 4px;
488
- width: 16px;
489
- height: 16px;
490
- display: none;
491
-
492
- .arrow-up,
493
- .arrow-down {
494
- fill: var(--sort-arrow-color);
495
- }
496
- }
497
-
498
- .table-header-resizer {
499
- position: absolute;
500
- top: 0;
501
- bottom: 0;
502
- cursor: col-resize;
503
- width: var(--resize-handle-width);
504
-
505
- &.left {
506
- left: 0;
507
- }
508
-
509
- &.right {
510
- right: 0;
511
- }
512
- }
513
-
514
- /* td inherit tr bgc*/
515
- .highlight-row {
516
- animation-name: stk-table-dim;
517
- animation-duration: var(--highlight-duration);
518
- /* 必须分开写,否则var(step(x))不兼容旧浏览器*/
519
- animation-timing-function: var(--highlight-timing-function);
520
- }
521
-
522
- .stk-table-no-data {
523
- background-color: var(--table-bgc);
524
- line-height: var(--row-height);
525
- text-align: center;
526
- font-size: 14px;
527
- position: sticky;
528
- left: 0px;
529
- border-right: var(--border-width) solid var(--border-color);
530
- border-bottom: var(--border-width) solid var(--border-color);
531
- display: flex;
532
- flex-direction: column;
533
- align-items: center;
534
- justify-content: center;
535
-
536
- &.no-data-full {
537
- flex: 1;
538
- }
539
- }
540
-
541
- .expanded,
542
- .tree-expanded {
543
- >.table-cell-wrapper .stk-fold-icon::before {
544
- transform: rotate(90deg);
545
- }
546
- }
547
-
548
-
549
- .stk-fold-icon {
550
- display: inline-flex;
551
- width: 16px;
552
- height: 16px;
553
- cursor: pointer;
554
- align-items: center;
555
-
556
- &::before {
557
- content: '';
558
- display: block;
559
- margin: 0 2px;
560
- width: 0;
561
- height: 0;
562
- border-left: 5px solid var(--fold-icon-color);
563
- border-top: 4px solid transparent;
564
- border-bottom: 4px solid transparent;
565
- transition: transform 0.2s ease;
566
- }
567
-
568
- &:hover::before {
569
- border-left: 5px solid var(--fold-icon-hover-color);
570
- }
571
- }
572
-
573
- td.cell-hover {
574
- background-color: var(--tr-hover-bgc);
575
- }
576
-
577
- td.cell-active {
578
- background-color: var(--tr-active-bgc);
579
- }
580
-
1
+ /**高亮渐暗 */
2
+ @keyframes stk-table-dim {
3
+ from {
4
+ background-color: var(--highlight-color);
5
+ }
6
+ }
7
+
8
+ .stk-table {
9
+ /* contain: strict;*/
10
+ --row-height: 28px;
11
+ --header-row-height: var(--row-height);
12
+ --cell-padding-y: 0;
13
+ --cell-padding-x: 8px;
14
+ --resize-handle-width: 4px;
15
+ --border-color: #e8e8f4;
16
+ --border-width: 1px;
17
+ --td-bgc: #fff;
18
+ --td-hover-color: #71a2fd;
19
+ --td-active-color: #386ccc;
20
+ --th-bgc: #f1f1f9;
21
+ --th-color: #272841;
22
+ --tr-active-bgc: rgb(230, 247, 255);
23
+ --tr-hover-bgc: rgba(230, 247, 255, 0.7);
24
+ --bg-border-top: linear-gradient(180deg, var(--border-color) var(--border-width), transparent var(--border-width));
25
+ --bg-border-right: linear-gradient(270deg, var(--border-color) var(--border-width), transparent var(--border-width));
26
+ --bg-border-bottom: linear-gradient(0deg, var(--border-color) var(--border-width), transparent var(--border-width));
27
+ --bg-border-left: linear-gradient(90deg, var(--border-color) var(--border-width), transparent var(--border-width));
28
+ --highlight-color: #71a2fd;
29
+ --highlight-duration: 2s;
30
+ --highlight-timing-function: linear;
31
+ /* 斑马纹颜色*/
32
+ --stripe-bgc: #fafafc;
33
+
34
+ --sort-arrow-color: #757699;
35
+ --sort-arrow-hover-color: #8f90b5;
36
+ --sort-arrow-active-color: #1b63d9;
37
+ --sort-arrow-active-sub-color: #cbcbe1;
38
+
39
+ --fold-icon-color: #757699;
40
+ --fold-icon-hover-color: #8f90b5;
41
+ /** 列宽拖动指示器颜色 */
42
+ --col-resize-indicator-color: #87879c;
43
+
44
+ /** 固定列阴影颜色 */
45
+ --fixed-col-shadow-color-from: rgba(0, 0, 0, 0.1);
46
+ --fixed-col-shadow-color-to: rgba(0, 0, 0, 0);
47
+
48
+ /** 拖动行hover背景 */
49
+ --drag-handle-hover-color: #d0d1e0;
50
+
51
+ /** 自定义滚动条颜色 */
52
+ --sb-thumb-color: #c1c1d7;
53
+ --sb-thumb-hover-color: #a8a8c1;
54
+
55
+ position: relative;
56
+ overflow: auto;
57
+ display: flex;
58
+ flex-direction: column;
59
+ box-sizing: border-box;
60
+
61
+ /**深色模式 */
62
+ &.dark {
63
+ --th-bgc: #202029;
64
+ --th-color: #c0c0d1;
65
+ --td-bgc: #1b1b24;
66
+ --td-hover-color: #70a6ff;
67
+ --td-active-color: #386ccc;
68
+ --border-color: #292933;
69
+ --tr-active-bgc: #283f63;
70
+ --tr-hover-bgc: #1a2b46;
71
+ --table-bgc: #1b1b24;
72
+ /* 不能用rgba,因为固定列时,会变成半透明*/
73
+ --highlight-color: #1e4c99;
74
+
75
+ --stripe-bgc: #202029;
76
+
77
+ --sort-arrow-color: #5d6064;
78
+ --sort-arrow-hover-color: #727782;
79
+ --sort-arrow-active-color: #d0d1d2;
80
+ --sort-arrow-active-sub-color: #5d6064;
81
+
82
+ --fold-icon-color: #5d6064;
83
+ --fold-icon-hover-color: #727782;
84
+
85
+ --col-resize-indicator-color: #5d6064;
86
+
87
+ --fixed-col-shadow-color-from: rgba(135, 135, 156, 0.1);
88
+ --fixed-col-shadow-color-to: rgba(135, 135, 156, 0);
89
+
90
+ --drag-handle-hover-color: #5d6064;
91
+
92
+ --sb-thumb-color: rgba(93, 96, 100, .9);
93
+ --sb-thumb-hover-color: rgb(114, 119, 130);
94
+
95
+ /* background-color: var(--table-bgc); */
96
+ /* ⭐这里加background-color会导致表格出滚动白屏*/
97
+ color: #d1d1e0;
98
+ }
99
+
100
+ &.scrollbar-on {
101
+ overflow: hidden;
102
+ }
103
+
104
+ &.headless {
105
+ &.bordered {
106
+ border-top: 1px solid var(--border-color);
107
+ background-image: var(--bg-border-right), var(--bg-border-bottom);
108
+ }
109
+ }
110
+
111
+ /* 调整列宽的话,表格宽度应当自适应 */
112
+ &.col-resizable {
113
+ .stk-table-main {
114
+ width: fit-content;
115
+ min-width: min-content;
116
+ }
117
+ }
118
+
119
+ /** 调整列宽的时候不要触发th事件。否则会导致触发表头点击排序 */
120
+ &.is-col-resizing {
121
+ th {
122
+ pointer-events: none;
123
+ }
124
+ }
125
+
126
+ &.bordered {
127
+ /**
128
+ * border-left: 此方案用于减少cell 中border-left 的css选择。同时利于多级表头border-left问题。利于横向滚动border-left
129
+ * - box-shadow inset 方案不生效,且占用属性。
130
+ * - outline 方案绘制在图形外
131
+ * - 绝对定位元素。需要根据滚动条位置动态计算。不合适。
132
+ * - sticky 定位方案需要占用位置。高度为0。
133
+ */
134
+ border-left: 1px solid var(--border-color);
135
+ /* 下面border用于表格内容不满高度时,绘制表格边界线 */
136
+ background-image: var(--bg-border-top), var(--bg-border-right), var(--bg-border-bottom);
137
+
138
+ th,
139
+ td {
140
+ background-image: var(--bg-border-right), var(--bg-border-bottom);
141
+ }
142
+
143
+ thead tr:first-child th {
144
+ background-image: var(--bg-border-top), var(--bg-border-right), var(--bg-border-bottom);
145
+ }
146
+ }
147
+
148
+ &.bordered-h {
149
+ border-left: none;
150
+ --bg-border-right: linear-gradient(transparent, transparent);
151
+ --bg-border-left: linear-gradient(transparent, transparent);
152
+ }
153
+
154
+ &.bordered-v {
155
+ --bg-border-bottom: linear-gradient(transparent, transparent);
156
+ --bg-border-top: linear-gradient(transparent, transparent);
157
+ }
158
+
159
+ &.bordered-body-v {
160
+ tbody {
161
+ --bg-border-bottom: linear-gradient(transparent, transparent);
162
+ }
163
+ }
164
+
165
+ &.bordered-body-h {
166
+ tbody {
167
+ --bg-border-right: linear-gradient(transparent, transparent);
168
+ }
169
+ }
170
+
171
+ &.stripe {
172
+ &:not(.vt-on) .stk-tbody-main tr:nth-child(even) {
173
+ background-color: var(--stripe-bgc);
174
+ }
175
+
176
+ &.vt-on .stk-tbody-main tr:nth-child(odd) {
177
+ background-color: var(--stripe-bgc);
178
+ }
179
+
180
+ &.row-hover .stk-tbody-main tr:hover {
181
+ background-color: var(--tr-hover-bgc);
182
+ }
183
+
184
+ &.row-active .stk-tbody-main tr.active {
185
+ background-color: var(--tr-active-bgc);
186
+ }
187
+ }
188
+
189
+ /** more weight for custom row background*/
190
+ &.row-hover .stk-tbody-main tr:hover {
191
+ background-color: var(--tr-hover-bgc);
192
+ }
193
+
194
+ &.row-active .stk-tbody-main tr.active {
195
+ background-color: var(--tr-active-bgc);
196
+ }
197
+
198
+ /* 单元格悬浮 */
199
+ &.cell-hover tbody td:hover {
200
+ box-shadow: inset 0 0 0 2px var(--td-hover-color);
201
+ }
202
+
203
+ /* 单元格高亮 */
204
+ &.cell-active tbody td.active {
205
+ box-shadow: inset 0 0 0 2px var(--td-active-color);
206
+ }
207
+
208
+ /* td 溢出*/
209
+ &.text-overflow {
210
+ .table-cell-wrapper {
211
+ white-space: nowrap;
212
+ overflow: hidden;
213
+ text-overflow: ellipsis;
214
+ }
215
+ }
216
+
217
+ /* th 溢出*/
218
+ &.header-text-overflow {
219
+ .table-header-cell-wrapper {
220
+ white-space: nowrap;
221
+ overflow: hidden;
222
+ }
223
+
224
+ .table-header-title {
225
+ text-overflow: ellipsis;
226
+ overflow: hidden;
227
+ }
228
+ }
229
+
230
+ /**虚拟滚动模式 */
231
+ &.virtual {
232
+
233
+ /* 为不影响布局,表头行高要定死*/
234
+ .table-header-cell-wrapper {
235
+ overflow: hidden;
236
+ max-height: calc(var(--header-row-height) * var(--row-span, 1));
237
+
238
+ .table-header-title {
239
+ max-height: inherit;
240
+ }
241
+ }
242
+
243
+ tbody td {
244
+ height: var(--row-height);
245
+
246
+ .table-cell-wrapper {
247
+ max-height: var(--row-height);
248
+ overflow: hidden;
249
+ }
250
+ }
251
+
252
+ .padding-top-tr td {
253
+ height: 0;
254
+ }
255
+
256
+ .expand-cell .table-cell-wrapper {
257
+ white-space: nowrap;
258
+ }
259
+
260
+ // .expanded-row .table-cell-wrapper{
261
+ // overflow: auto;
262
+ // }
263
+ }
264
+
265
+ &.auto-row-height {
266
+ tbody td {
267
+ height: unset;
268
+
269
+ .table-cell-wrapper {
270
+ max-height: unset;
271
+ overflow: initial;
272
+ }
273
+ }
274
+ }
275
+
276
+ &.fixed-relative-mode {
277
+ th {
278
+ position: relative;
279
+ }
280
+
281
+ .fixed-cell--active {
282
+ position: relative;
283
+ }
284
+ }
285
+
286
+ &.scroll-row-by-row {
287
+ .stk-table-main {
288
+ position: sticky;
289
+ top: 0;
290
+ }
291
+ }
292
+
293
+ .row-by-row-table-height {
294
+ width: 1px;
295
+ flex-shrink: 0;
296
+ position: absolute;
297
+ left: 0;
298
+ top: 0;
299
+ }
300
+
301
+ th,
302
+ td {
303
+ font-size: 14px;
304
+ box-sizing: border-box;
305
+ padding: var(--cell-padding-y) var(--cell-padding-x);
306
+ }
307
+
308
+ th {
309
+ color: var(--th-color);
310
+ background-color: inherit;
311
+ /**
312
+ * 保证向上滚动时,表头不被遮挡。
313
+ * z-index:2 为防止固定列阴影重叠。
314
+ */
315
+ z-index: 2;
316
+ position: sticky;
317
+
318
+ &.sortable {
319
+ cursor: pointer;
320
+ }
321
+
322
+ &:not(.sorter-desc):not(.sorter-asc):hover .table-header-sorter {
323
+ .arrow-up {
324
+ fill: var(--sort-arrow-hover-color);
325
+ }
326
+
327
+ .arrow-down {
328
+ fill: var(--sort-arrow-hover-color);
329
+ }
330
+ }
331
+
332
+ &.sorter-desc .table-header-sorter {
333
+ display: inline;
334
+
335
+ .arrow-up {
336
+ fill: var(--sort-arrow-active-sub-color);
337
+ }
338
+
339
+ .arrow-down {
340
+ fill: var(--sort-arrow-active-color);
341
+ }
342
+ }
343
+
344
+ &.sorter-asc .table-header-sorter {
345
+ display: inline;
346
+
347
+ .arrow-up {
348
+ fill: var(--sort-arrow-active-color);
349
+ }
350
+
351
+ .arrow-down {
352
+ fill: var(--sort-arrow-active-sub-color);
353
+ }
354
+ }
355
+ }
356
+
357
+ thead tr {
358
+ background-color: var(--th-bgc);
359
+ height: var(--header-row-height);
360
+ }
361
+
362
+ tbody tr {
363
+ background-color: var(--td-bgc);
364
+ height: var(--row-height);
365
+ }
366
+
367
+ .vt-x-left,
368
+ .vt-x-right {
369
+ padding: 0;
370
+ }
371
+
372
+ /** 列宽调整指示器 */
373
+ .column-resize-indicator {
374
+ width: 0;
375
+ height: 100%;
376
+ border-left: 2px solid var(--col-resize-indicator-color);
377
+ position: absolute;
378
+ z-index: 10;
379
+ display: none;
380
+ pointer-events: none;
381
+ }
382
+
383
+ .stk-table-main {
384
+ border-spacing: 0;
385
+ border-collapse: separate;
386
+ width: fit-content;
387
+ /* 不加会导致width 超过100%时为100%,行hover高亮会断开*/
388
+ min-width: 100%;
389
+
390
+ &.fixed-mode {
391
+ table-layout: fixed;
392
+ min-width: min-content;
393
+ }
394
+ }
395
+
396
+ .fixed-cell {
397
+ background-color: inherit;
398
+ }
399
+
400
+ .highlight-cell {
401
+ animation-name: stk-table-dim;
402
+ animation-duration: var(--highlight-duration);
403
+ animation-timing-function: var(--highlight-timing-function);
404
+ /* 必须分开写,否则var(step(x))不兼容旧浏览器*/
405
+ }
406
+
407
+ .seq-column {
408
+ text-align: center;
409
+ }
410
+
411
+ .drag-row-cell {
412
+ .table-cell-wrapper {
413
+ display: inline-flex;
414
+ align-items: center;
415
+ }
416
+
417
+ .drag-row-handle {
418
+ cursor: grab;
419
+ border-radius: 4px;
420
+
421
+ &:hover {
422
+ background-color: var(--drag-handle-hover-color);
423
+ }
424
+
425
+ &:active {
426
+ cursor: grabbing;
427
+ }
428
+
429
+ >svg {
430
+ vertical-align: -2px;
431
+ }
432
+ }
433
+ }
434
+
435
+ .tr-dragging {
436
+ opacity: 0.5;
437
+ }
438
+
439
+ .tr-dragging-over {
440
+ background-color: var(--tr-hover-bgc);
441
+ }
442
+
443
+ /*固定列阴影-左*/
444
+ .fixed-cell--left {
445
+ --shadow-rotate: 90deg;
446
+
447
+ &.fixed-cell--shadow::after {
448
+ right: -10px;
449
+ }
450
+ }
451
+
452
+ /*固定列阴影-右*/
453
+ .fixed-cell--right {
454
+ --shadow-rotate: -90deg;
455
+
456
+ &.fixed-cell--shadow::after {
457
+ left: -10px;
458
+ }
459
+ }
460
+
461
+ /*固定列阴影*/
462
+ .fixed-cell--shadow::after {
463
+ content: '';
464
+ width: 10px;
465
+ height: 100%;
466
+ top: 0px;
467
+ position: absolute;
468
+ pointer-events: none;
469
+ background-image: linear-gradient(var(--shadow-rotate), var(--fixed-col-shadow-color-from), var(--fixed-col-shadow-color-to));
470
+ }
471
+
472
+ .fixed-cell--active {
473
+ position: sticky;
474
+ }
475
+
476
+ th.fixed-cell--active {
477
+ z-index: 3;
478
+ }
479
+
480
+ td.fixed-cell--active {
481
+ z-index: 1;
482
+ }
483
+
484
+ .table-header-cell-wrapper {
485
+ max-width: 100%;
486
+ display: inline-flex;
487
+ align-items: center;
488
+ }
489
+
490
+ .table-header-title {
491
+ overflow: hidden;
492
+ }
493
+
494
+ .table-header-sorter {
495
+ flex-shrink: 0;
496
+ margin-left: 4px;
497
+ width: 16px;
498
+ height: 16px;
499
+ display: none;
500
+
501
+ .arrow-up,
502
+ .arrow-down {
503
+ fill: var(--sort-arrow-color);
504
+ }
505
+ }
506
+
507
+ .table-header-resizer {
508
+ position: absolute;
509
+ top: 0;
510
+ bottom: 0;
511
+ cursor: col-resize;
512
+ width: var(--resize-handle-width);
513
+
514
+ &.left {
515
+ left: 0;
516
+ }
517
+
518
+ &.right {
519
+ right: 0;
520
+ }
521
+ }
522
+
523
+ /* td inherit tr bgc*/
524
+ .highlight-row {
525
+ animation-name: stk-table-dim;
526
+ animation-duration: var(--highlight-duration);
527
+ /* 必须分开写,否则var(step(x))不兼容旧浏览器*/
528
+ animation-timing-function: var(--highlight-timing-function);
529
+ }
530
+
531
+ .stk-table-no-data {
532
+ background-color: var(--table-bgc);
533
+ line-height: var(--row-height);
534
+ text-align: center;
535
+ font-size: 14px;
536
+ position: sticky;
537
+ left: 0px;
538
+ border-right: var(--border-width) solid var(--border-color);
539
+ border-bottom: var(--border-width) solid var(--border-color);
540
+ display: flex;
541
+ flex-direction: column;
542
+ align-items: center;
543
+ justify-content: center;
544
+
545
+ &.no-data-full {
546
+ flex: 1;
547
+ }
548
+ }
549
+
550
+ .expanded,
551
+ .tree-expanded {
552
+ >.table-cell-wrapper .stk-fold-icon::before {
553
+ transform: rotate(90deg);
554
+ }
555
+ }
556
+
557
+
558
+ .stk-fold-icon {
559
+ display: inline-flex;
560
+ width: 16px;
561
+ height: 16px;
562
+ cursor: pointer;
563
+ align-items: center;
564
+
565
+ &::before {
566
+ content: '';
567
+ display: block;
568
+ margin: 0 2px;
569
+ width: 0;
570
+ height: 0;
571
+ border-left: 5px solid var(--fold-icon-color);
572
+ border-top: 4px solid transparent;
573
+ border-bottom: 4px solid transparent;
574
+ transition: transform 0.2s ease;
575
+ }
576
+
577
+ &:hover::before {
578
+ border-left: 5px solid var(--fold-icon-hover-color);
579
+ }
580
+ }
581
+
582
+ td.cell-hover {
583
+ background-color: var(--tr-hover-bgc);
584
+ }
585
+
586
+ td.cell-active {
587
+ background-color: var(--tr-active-bgc);
588
+ }
589
+
590
+ }
591
+
592
+ .stk-table:hover .stk-sb-thumb {
593
+ opacity: 0.7;
594
+ }
595
+
596
+ .stk-sb-thumb {
597
+ z-index: 100;
598
+ position: sticky;
599
+ background-color: var(--sb-thumb-color);
600
+ border-radius: 4px;
601
+ transition: transform 0.1s ease, opacity 0.5s ease;
602
+ user-select: none;
603
+ opacity: 0;
604
+ flex-shrink: 0;
605
+
606
+ &:hover {
607
+ background-color: var(--sb-thumb-hover-color);
608
+ }
609
+
610
+ &:active {
611
+ opacity: 1;
612
+ background-color: var(--sb-thumb-hover-color);
613
+ }
614
+
615
+ &.vertical {
616
+ margin-left: auto;
617
+ top:0;
618
+ right: 0;
619
+ width: var(--sb-width);
620
+ }
621
+
622
+ &.horizontal {
623
+ margin-top: auto;
624
+ bottom: 0;
625
+ left:0;
626
+ height: var(--sb-height);
627
+ }
581
628
  }