stk-table-vue 0.7.2 → 0.8.0
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/lib/src/StkTable/StkTable.vue.d.ts +10 -7
- package/lib/src/StkTable/types/index.d.ts +22 -5
- package/lib/src/StkTable/useMergeCells.d.ts +20 -0
- package/lib/src/StkTable/useRowExpand.d.ts +2 -2
- package/lib/src/StkTable/useThDrag.d.ts +5 -6
- package/lib/src/StkTable/useTree.d.ts +2 -2
- package/lib/src/StkTable/useVirtualScroll.d.ts +5 -5
- package/lib/src/StkTable/utils/index.d.ts +2 -1
- package/lib/{style.css → stk-table-vue.css} +6 -0
- package/lib/stk-table-vue.js +209 -101
- package/package.json +5 -5
- package/src/StkTable/StkTable.vue +118 -81
- package/src/StkTable/style.less +11 -6
- package/src/StkTable/types/index.ts +24 -5
- package/src/StkTable/useHighlight.ts +2 -2
- package/src/StkTable/useMergeCells.ts +125 -0
- package/src/StkTable/useRowExpand.ts +2 -2
- package/src/StkTable/useScrollRowByRow.ts +17 -14
- package/src/StkTable/useThDrag.ts +6 -6
- package/src/StkTable/useTree.ts +2 -2
- package/src/StkTable/useVirtualScroll.ts +6 -6
- package/src/StkTable/utils/index.ts +6 -1
package/src/StkTable/useTree.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ShallowRef } from 'vue';
|
|
2
|
-
import { PrivateRowDT, TreeConfig, UniqKey } from './types';
|
|
2
|
+
import { PrivateRowDT, RowKeyGen, TreeConfig, UniqKey } from './types';
|
|
3
3
|
|
|
4
4
|
type DT = PrivateRowDT & { children?: DT[] };
|
|
5
5
|
type Option<DT extends Record<string, any>> = {
|
|
6
6
|
props: any;
|
|
7
|
-
rowKeyGen:
|
|
7
|
+
rowKeyGen: RowKeyGen;
|
|
8
8
|
dataSourceCopy: ShallowRef<DT[]>;
|
|
9
9
|
emits: any;
|
|
10
10
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ref, ShallowRef, computed, ref } from 'vue';
|
|
2
2
|
import { DEFAULT_ROW_HEIGHT, DEFAULT_TABLE_HEIGHT, DEFAULT_TABLE_WIDTH } from './const';
|
|
3
|
-
import { AutoRowHeightConfig, StkTableColumn, UniqKey } from './types';
|
|
3
|
+
import { AutoRowHeightConfig, PrivateStkTableColumn, RowKeyGen, StkTableColumn, UniqKey } from './types';
|
|
4
4
|
import { getCalculatedColWidth } from './utils/constRefUtils';
|
|
5
5
|
|
|
6
6
|
type Option<DT extends Record<string, any>> = {
|
|
@@ -8,9 +8,9 @@ type Option<DT extends Record<string, any>> = {
|
|
|
8
8
|
tableContainerRef: Ref<HTMLElement | undefined>;
|
|
9
9
|
trRef: Ref<HTMLTableRowElement[] | undefined>;
|
|
10
10
|
dataSourceCopy: ShallowRef<DT[]>;
|
|
11
|
-
tableHeaderLast: ShallowRef<
|
|
12
|
-
tableHeaders: ShallowRef<
|
|
13
|
-
rowKeyGen:
|
|
11
|
+
tableHeaderLast: ShallowRef<PrivateStkTableColumn<DT>[]>;
|
|
12
|
+
tableHeaders: ShallowRef<PrivateStkTableColumn<DT>[][]>;
|
|
13
|
+
rowKeyGen: RowKeyGen;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
/** 暂存纵向虚拟滚动的数据 */
|
|
@@ -133,8 +133,8 @@ export function useVirtualScroll<DT extends Record<string, any>>({
|
|
|
133
133
|
const tableHeaderLastValue = tableHeaderLast.value;
|
|
134
134
|
if (virtualX_on.value) {
|
|
135
135
|
// 虚拟横向滚动,固定列要一直保持存在
|
|
136
|
-
const leftCols:
|
|
137
|
-
const rightCols:
|
|
136
|
+
const leftCols: PrivateStkTableColumn<DT>[] = [];
|
|
137
|
+
const rightCols: PrivateStkTableColumn<DT>[] = [];
|
|
138
138
|
/**
|
|
139
139
|
* 存在问题:
|
|
140
140
|
* table columns 从多到少时。比方原来的start=5,end=10,现在start=4,end=8。这时候endIndex就超出数组范围了。
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CELL_KEY_SEPARATE } from '../const';
|
|
2
|
+
import { Order, SortConfig, SortOption, SortState, StkTableColumn, UniqKey } from '../types';
|
|
2
3
|
|
|
3
4
|
/** 是否空值 */
|
|
4
5
|
export function isEmptyValue(val: any, isNumber?: boolean) {
|
|
@@ -222,3 +223,7 @@ export function getBrowsersVersion(browserName: string) {
|
|
|
222
223
|
}
|
|
223
224
|
return 100;
|
|
224
225
|
}
|
|
226
|
+
|
|
227
|
+
export function pureCellKeyGen(rowKey: UniqKey, colKey: UniqKey) {
|
|
228
|
+
return rowKey + CELL_KEY_SEPARATE + colKey;
|
|
229
|
+
}
|