@v-c/table 1.1.1 → 1.1.2
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.
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
import { ColumnType, StickyOffsets } from '../interface';
|
|
3
|
-
export default function useFixedInfo<RecordType>(flattenColumns: Ref<readonly ColumnType<RecordType>[]> | readonly ColumnType<RecordType>[], stickyOffsets: Ref<StickyOffsets> | StickyOffsets):
|
|
3
|
+
export default function useFixedInfo<RecordType>(flattenColumns: Ref<readonly ColumnType<RecordType>[]> | readonly ColumnType<RecordType>[], stickyOffsets: Ref<StickyOffsets> | StickyOffsets): any;
|
|
@@ -8,7 +8,7 @@ export default function useRowInfo<RecordType>(record: Ref<RecordType> | RecordT
|
|
|
8
8
|
rowSupportExpand: import('vue').ComputedRef<boolean>;
|
|
9
9
|
expandable: import('vue').ComputedRef<boolean>;
|
|
10
10
|
rowProps: import('vue').ComputedRef<{
|
|
11
|
-
className:
|
|
11
|
+
className: any;
|
|
12
12
|
onClick: (event: MouseEvent) => void;
|
|
13
13
|
innerHTML?: string | undefined | undefined;
|
|
14
14
|
class?: any;
|
package/dist/stickyScrollBar.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useInjectTableContext } from "./context/TableContext.js";
|
|
2
2
|
import { useLayoutState } from "./hooks/useFrame.js";
|
|
3
3
|
import { getOffset } from "./utils/offsetUtil.js";
|
|
4
|
-
import { computed, createVNode, defineComponent, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
|
4
|
+
import { computed, createVNode, defineComponent, nextTick, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
|
5
5
|
import { clsx } from "@v-c/util";
|
|
6
6
|
import { getDOM } from "@v-c/util/dist/Dom/findDOMNode";
|
|
7
7
|
import getScrollBarSize from "@v-c/util/dist/getScrollBarSize";
|
|
@@ -33,8 +33,13 @@ var StickyScrollBar = /* @__PURE__ */ defineComponent({
|
|
|
33
33
|
});
|
|
34
34
|
const isActive = ref(false);
|
|
35
35
|
const rafRef = ref(null);
|
|
36
|
-
const bodyScrollWidth =
|
|
37
|
-
const bodyWidth =
|
|
36
|
+
const bodyScrollWidth = ref(0);
|
|
37
|
+
const bodyWidth = ref(0);
|
|
38
|
+
const syncBodySize = () => {
|
|
39
|
+
const bodyNode = props.scrollBodyRef.value;
|
|
40
|
+
bodyScrollWidth.value = bodyNode?.scrollWidth || 0;
|
|
41
|
+
bodyWidth.value = bodyNode?.clientWidth || 0;
|
|
42
|
+
};
|
|
38
43
|
const scrollBarWidth = computed(() => {
|
|
39
44
|
const totalWidth = bodyScrollWidth.value;
|
|
40
45
|
const clientWidth = bodyWidth.value;
|
|
@@ -66,6 +71,7 @@ var StickyScrollBar = /* @__PURE__ */ defineComponent({
|
|
|
66
71
|
const checkScrollBarVisible = () => {
|
|
67
72
|
raf.cancel(rafRef.value);
|
|
68
73
|
rafRef.value = raf(() => {
|
|
74
|
+
syncBodySize();
|
|
69
75
|
if (!props.scrollBodyRef.value || !props.container) return;
|
|
70
76
|
const container = props.container;
|
|
71
77
|
const tableOffsetTop = getOffset(props.scrollBodyRef.value).top;
|
|
@@ -94,7 +100,7 @@ var StickyScrollBar = /* @__PURE__ */ defineComponent({
|
|
|
94
100
|
onMounted(() => {
|
|
95
101
|
document.body.addEventListener(MOUSEUP_EVENT, onMouseUp, false);
|
|
96
102
|
document.body.addEventListener(MOUSEMOVE_EVENT, onMouseMove, false);
|
|
97
|
-
checkScrollBarVisible
|
|
103
|
+
nextTick(checkScrollBarVisible);
|
|
98
104
|
});
|
|
99
105
|
const removeScrollListeners = ref(null);
|
|
100
106
|
onBeforeUnmount(() => {
|
|
@@ -103,6 +109,12 @@ var StickyScrollBar = /* @__PURE__ */ defineComponent({
|
|
|
103
109
|
raf.cancel(rafRef.value);
|
|
104
110
|
removeScrollListeners.value?.();
|
|
105
111
|
});
|
|
112
|
+
watch(() => props.scrollBodyRef.value, () => {
|
|
113
|
+
nextTick(checkScrollBarVisible);
|
|
114
|
+
}, {
|
|
115
|
+
immediate: true,
|
|
116
|
+
flush: "post"
|
|
117
|
+
});
|
|
106
118
|
watch(() => [scrollBarWidth.value, isActive.value], () => {
|
|
107
119
|
checkScrollBarVisible();
|
|
108
120
|
});
|
package/dist/sugar/Column.js
CHANGED