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