stk-table-vue 0.3.0 → 0.3.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.
- package/README.md +5 -9
- package/lib/stk-table-vue.js +2 -2
- package/lib/style.css +5 -3
- package/package.json +1 -1
- package/src/StkTable/StkTable.vue +1 -1
- package/src/StkTable/style.less +5 -3
- package/src/StkTable/useVirtualScroll.ts +2 -2
package/README.md
CHANGED
|
@@ -220,11 +220,6 @@ export type StkProps = {
|
|
|
220
220
|
highlightConfig?: {
|
|
221
221
|
/** 高亮持续时间(s) */
|
|
222
222
|
duration?: number;
|
|
223
|
-
/** 高亮背景色 */
|
|
224
|
-
color?: {
|
|
225
|
-
light?: { from: string; to: string };
|
|
226
|
-
dark?: { from: string; to: string };
|
|
227
|
-
};
|
|
228
223
|
/** 高亮帧率(虚拟滚动生效) */
|
|
229
224
|
fps?: number;
|
|
230
225
|
};
|
|
@@ -235,6 +230,7 @@ export type StkProps = {
|
|
|
235
230
|
};
|
|
236
231
|
};
|
|
237
232
|
```
|
|
233
|
+
|
|
238
234
|
#### Emits
|
|
239
235
|
```js
|
|
240
236
|
{
|
|
@@ -527,10 +523,10 @@ export type SortConfig<T extends Record<string, any>> = {
|
|
|
527
523
|
### 鼠标悬浮表头时,不展示title
|
|
528
524
|
* 将 `StkTableColumn` 中的 `title` 字段置为 "" 空字符串。这样th中就没有title了。
|
|
529
525
|
* 使用 `StkTableColumn` 中的 `customHeaderCell` 属性中,自定义表头渲染。
|
|
530
|
-
###
|
|
531
|
-
*
|
|
532
|
-
*
|
|
533
|
-
|
|
526
|
+
### 高亮性能
|
|
527
|
+
* 在虚拟滚动下高亮强制使用css @keyframes 实现动画。`setHighlightDimRow`/`setHighlightCellRow` 最后一个参数传入 `{method: 'css'}` 即可。(滚动后动画会中断)
|
|
528
|
+
* 指定 `{method:'animation'}` 在虚拟滚动下使用animation api实现动画。好处是动画流畅,且滚动后动画不中断。
|
|
529
|
+
* 配置 `props.highlightConfig.fps` 指定高亮帧率。降低帧率有利于性能。
|
|
534
530
|
|
|
535
531
|
## Other
|
|
536
532
|
* `$*$` 兼容注释
|
package/lib/stk-table-vue.js
CHANGED
|
@@ -941,7 +941,7 @@ function useVirtualScroll({
|
|
|
941
941
|
startIndex -= 1;
|
|
942
942
|
}
|
|
943
943
|
}
|
|
944
|
-
let endIndex = startIndex + pageSize;
|
|
944
|
+
let endIndex = startIndex + pageSize + 1;
|
|
945
945
|
if (props.stripe) {
|
|
946
946
|
endIndex += 2;
|
|
947
947
|
}
|
|
@@ -1533,7 +1533,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1533
1533
|
},
|
|
1534
1534
|
{
|
|
1535
1535
|
"--highlight-duration": props.highlightConfig.duration && props.highlightConfig.duration + "s",
|
|
1536
|
-
"--highlight-
|
|
1536
|
+
"--highlight-timing-function": unref(highlightSteps) ? `steps(${unref(highlightSteps)})` : ""
|
|
1537
1537
|
}
|
|
1538
1538
|
]),
|
|
1539
1539
|
onScroll: onTableScroll,
|
package/lib/style.css
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
--bg-border-left:linear-gradient(90deg, var(--border-color) var(--border-width), transparent var(--border-width));
|
|
22
22
|
--highlight-color:#71a2fd;
|
|
23
23
|
--highlight-duration:2s;
|
|
24
|
-
--highlight-
|
|
24
|
+
--highlight-timing-function:linear;
|
|
25
25
|
--stripe-bgc:#fafafc;
|
|
26
26
|
--sort-arrow-color:#757699;
|
|
27
27
|
--sort-arrow-hover-color:#8f90b5;
|
|
@@ -150,7 +150,8 @@
|
|
|
150
150
|
background-color:inherit;
|
|
151
151
|
}
|
|
152
152
|
.stk-table .stk-table-main td.highlight-cell{
|
|
153
|
-
animation:stk-table-dim var(--highlight-duration)
|
|
153
|
+
animation:stk-table-dim var(--highlight-duration);
|
|
154
|
+
animation-timing-function:var(--highlight-timing-function);
|
|
154
155
|
}
|
|
155
156
|
.stk-table .stk-table-main td.text-overflow .table-cell-wrapper{
|
|
156
157
|
white-space:nowrap;
|
|
@@ -253,7 +254,8 @@
|
|
|
253
254
|
transform:translateZ(0);
|
|
254
255
|
}
|
|
255
256
|
.stk-table .stk-table-main tbody tr.highlight-row{
|
|
256
|
-
animation:stk-table-dim var(--highlight-duration)
|
|
257
|
+
animation:stk-table-dim var(--highlight-duration);
|
|
258
|
+
animation-timing-function:var(--highlight-timing-function);
|
|
257
259
|
}
|
|
258
260
|
.stk-table .stk-table-main tbody tr.hover,
|
|
259
261
|
.stk-table .stk-table-main tbody tr:hover{
|
package/package.json
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
'--highlight-duration': props.highlightConfig.duration && props.highlightConfig.duration + 's',
|
|
25
|
-
'--highlight-
|
|
25
|
+
'--highlight-timing-function': highlightSteps ? `steps(${highlightSteps})` : '',
|
|
26
26
|
},
|
|
27
27
|
]"
|
|
28
28
|
@scroll="onTableScroll"
|
package/src/StkTable/style.less
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
--bg-border-left: linear-gradient(90deg, var(--border-color) var(--border-width), transparent var(--border-width));
|
|
25
25
|
--highlight-color: #71a2fd;
|
|
26
26
|
--highlight-duration: 2s;
|
|
27
|
-
--highlight-
|
|
27
|
+
--highlight-timing-function: linear;
|
|
28
28
|
/* 斑马纹颜色*/
|
|
29
29
|
--stripe-bgc: #fafafc;
|
|
30
30
|
|
|
@@ -213,7 +213,8 @@
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
&.highlight-cell {
|
|
216
|
-
animation: stk-table-dim var(--highlight-duration)
|
|
216
|
+
animation: stk-table-dim var(--highlight-duration);
|
|
217
|
+
animation-timing-function: var(--highlight-timing-function); /* 必须分开些,否则var(step(x))不兼容旧浏览器*/
|
|
217
218
|
}
|
|
218
219
|
|
|
219
220
|
&.text-overflow {
|
|
@@ -359,7 +360,8 @@
|
|
|
359
360
|
|
|
360
361
|
/* td inherit tr bgc*/
|
|
361
362
|
&.highlight-row {
|
|
362
|
-
animation: stk-table-dim var(--highlight-duration)
|
|
363
|
+
animation: stk-table-dim var(--highlight-duration);
|
|
364
|
+
animation-timing-function: var(--highlight-timing-function); /* 必须分开些,否则var(step(x))不兼容旧浏览器*/
|
|
363
365
|
}
|
|
364
366
|
|
|
365
367
|
|
|
@@ -200,9 +200,9 @@ export function useVirtualScroll<DT extends Record<string, any>>({
|
|
|
200
200
|
startIndex -= 1; // 奇数-1变成偶数
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
let endIndex = startIndex + pageSize;
|
|
203
|
+
let endIndex = startIndex + pageSize + 1; //预渲染一行 TODO: 是否需要预渲染一行
|
|
204
204
|
if (props.stripe) {
|
|
205
|
-
//
|
|
205
|
+
// 由于stripe上方预渲染-1行,这里也要预渲染1+1行
|
|
206
206
|
endIndex += 2;
|
|
207
207
|
}
|
|
208
208
|
const offsetTop = startIndex * rowHeight; // startIndex之前的高度
|