stk-table-vue 0.2.7 → 0.2.8
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.
|
@@ -3,6 +3,7 @@ import { StkTableColumn } from './types';
|
|
|
3
3
|
type Params<T extends Record<string, any>> = {
|
|
4
4
|
props: any;
|
|
5
5
|
colKeyGen: (col: StkTableColumn<T>) => string;
|
|
6
|
+
tableHeaders: Ref<StkTableColumn<T>[][]>;
|
|
6
7
|
tableHeaderLast: Ref<StkTableColumn<T>[]>;
|
|
7
8
|
tableContainer: Ref<HTMLDivElement | undefined>;
|
|
8
9
|
};
|
|
@@ -10,7 +11,7 @@ type Params<T extends Record<string, any>> = {
|
|
|
10
11
|
* 固定列处理
|
|
11
12
|
* @returns
|
|
12
13
|
*/
|
|
13
|
-
export declare function useFixedCol<DT extends Record<string, any>>({ props, colKeyGen, tableHeaderLast, tableContainer }: Params<DT>): {
|
|
14
|
+
export declare function useFixedCol<DT extends Record<string, any>>({ props, colKeyGen, tableHeaders, tableHeaderLast, tableContainer }: Params<DT>): {
|
|
14
15
|
/** 固定列class */
|
|
15
16
|
fixedColClassMap: import("vue").ComputedRef<Map<any, any>>;
|
|
16
17
|
/** 处理固定列阴影 */
|
package/lib/stk-table-vue.js
CHANGED
|
@@ -330,7 +330,7 @@ function useColResize({
|
|
|
330
330
|
onThResizeMouseUp
|
|
331
331
|
};
|
|
332
332
|
}
|
|
333
|
-
function useFixedCol({ props, colKeyGen, tableHeaderLast, tableContainer }) {
|
|
333
|
+
function useFixedCol({ props, colKeyGen, tableHeaders, tableHeaderLast, tableContainer }) {
|
|
334
334
|
const fixedShadow = ref({
|
|
335
335
|
showL: false,
|
|
336
336
|
showR: false
|
|
@@ -338,15 +338,17 @@ function useFixedCol({ props, colKeyGen, tableHeaderLast, tableContainer }) {
|
|
|
338
338
|
const fixedShadowCols = shallowRef([]);
|
|
339
339
|
const fixedColClassMap = computed(() => {
|
|
340
340
|
const colMap = /* @__PURE__ */ new Map();
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
341
|
+
tableHeaders.value.forEach((cols) => {
|
|
342
|
+
cols.forEach((col) => {
|
|
343
|
+
const { showR, showL } = fixedShadow.value;
|
|
344
|
+
const showShadow = props.fixedColShadow && col.fixed && (showL && col.fixed === "left" || showR && col.fixed === "right") && fixedShadowCols.value.includes(col);
|
|
345
|
+
const classObj = {
|
|
346
|
+
"fixed-cell": col.fixed,
|
|
347
|
+
["fixed-cell--" + col.fixed]: col.fixed,
|
|
348
|
+
"fixed-cell--shadow": showShadow
|
|
349
|
+
};
|
|
350
|
+
colMap.set(colKeyGen(col), classObj);
|
|
351
|
+
});
|
|
350
352
|
});
|
|
351
353
|
return colMap;
|
|
352
354
|
});
|
|
@@ -1055,6 +1057,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1055
1057
|
props,
|
|
1056
1058
|
colKeyGen,
|
|
1057
1059
|
tableContainer,
|
|
1060
|
+
tableHeaders,
|
|
1058
1061
|
tableHeaderLast
|
|
1059
1062
|
});
|
|
1060
1063
|
watch(
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import { StkTableColumn } from './types';
|
|
|
4
4
|
type Params<T extends Record<string, any>> = {
|
|
5
5
|
props: any;
|
|
6
6
|
colKeyGen: (col: StkTableColumn<T>) => string;
|
|
7
|
+
tableHeaders: Ref<StkTableColumn<T>[][]>;
|
|
7
8
|
tableHeaderLast: Ref<StkTableColumn<T>[]>;
|
|
8
9
|
tableContainer: Ref<HTMLDivElement | undefined>;
|
|
9
10
|
};
|
|
@@ -12,7 +13,7 @@ type Params<T extends Record<string, any>> = {
|
|
|
12
13
|
* 固定列处理
|
|
13
14
|
* @returns
|
|
14
15
|
*/
|
|
15
|
-
export function useFixedCol<DT extends Record<string, any>>({ props, colKeyGen, tableHeaderLast, tableContainer }: Params<DT>) {
|
|
16
|
+
export function useFixedCol<DT extends Record<string, any>>({ props, colKeyGen, tableHeaders, tableHeaderLast, tableContainer }: Params<DT>) {
|
|
16
17
|
/** 固定列阴影 */
|
|
17
18
|
const fixedShadow = ref<{
|
|
18
19
|
/** 是否展示左侧固定列阴影 */
|
|
@@ -28,19 +29,21 @@ export function useFixedCol<DT extends Record<string, any>>({ props, colKeyGen,
|
|
|
28
29
|
|
|
29
30
|
const fixedColClassMap = computed(() => {
|
|
30
31
|
const colMap = new Map();
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
tableHeaders.value.forEach(cols => {
|
|
33
|
+
cols.forEach(col => {
|
|
34
|
+
const { showR, showL } = fixedShadow.value;
|
|
35
|
+
const showShadow =
|
|
36
|
+
props.fixedColShadow &&
|
|
37
|
+
col.fixed &&
|
|
38
|
+
((showL && col.fixed === 'left') || (showR && col.fixed === 'right')) &&
|
|
39
|
+
fixedShadowCols.value.includes(col);
|
|
40
|
+
const classObj = {
|
|
41
|
+
'fixed-cell': col.fixed,
|
|
42
|
+
['fixed-cell--' + col.fixed]: col.fixed,
|
|
43
|
+
'fixed-cell--shadow': showShadow,
|
|
44
|
+
};
|
|
45
|
+
colMap.set(colKeyGen(col), classObj);
|
|
46
|
+
});
|
|
44
47
|
});
|
|
45
48
|
return colMap;
|
|
46
49
|
});
|