@v-c/table 1.1.6 → 1.1.7
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/dist/Table.js +22 -19
- package/dist/VirtualTable/BodyGrid.js +2 -1
- package/dist/hooks/useFixedInfo.d.ts +1 -1
- package/dist/hooks/useRowInfo.d.ts +1 -1
- package/package.json +10 -4
package/dist/Table.js
CHANGED
|
@@ -61,12 +61,6 @@ var EMPTY_SCROLL_TARGET = {};
|
|
|
61
61
|
function defaultEmpty() {
|
|
62
62
|
return "No Data";
|
|
63
63
|
}
|
|
64
|
-
var defaults = {
|
|
65
|
-
rowKey: "key",
|
|
66
|
-
prefixCls: DEFAULT_PREFIX,
|
|
67
|
-
emptyText: defaultEmpty,
|
|
68
|
-
rowHoverable: true
|
|
69
|
-
};
|
|
70
64
|
var ImmutableTable = /* @__PURE__ */ defineComponent((props, { attrs, slots, expose }) => {
|
|
71
65
|
const mergedData = shallowRef(props.data || EMPTY_DATA);
|
|
72
66
|
watch(() => props.data, () => {
|
|
@@ -189,26 +183,30 @@ var ImmutableTable = /* @__PURE__ */ defineComponent((props, { attrs, slots, exp
|
|
|
189
183
|
}
|
|
190
184
|
};
|
|
191
185
|
const [setScrollTarget, getScrollTarget] = useTimeoutLock(null);
|
|
186
|
+
const scrollRetryTimeoutMap = /* @__PURE__ */ new WeakMap();
|
|
187
|
+
function syncScrollLeft(target, scrollLeft) {
|
|
188
|
+
const scrollRetryTimeout = scrollRetryTimeoutMap.get(target);
|
|
189
|
+
if (scrollRetryTimeout) clearTimeout(scrollRetryTimeout);
|
|
190
|
+
if (target.scrollLeft !== scrollLeft) {
|
|
191
|
+
target.scrollLeft = scrollLeft;
|
|
192
|
+
const retryTimeout = setTimeout(() => {
|
|
193
|
+
if (target.scrollLeft !== scrollLeft) target.scrollLeft = scrollLeft;
|
|
194
|
+
}, 0);
|
|
195
|
+
scrollRetryTimeoutMap.set(target, retryTimeout);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
192
198
|
function forceScroll(scrollLeft, target) {
|
|
193
199
|
if (!target) return;
|
|
194
200
|
if (typeof target === "function") {
|
|
195
201
|
target(scrollLeft);
|
|
196
202
|
return;
|
|
197
203
|
}
|
|
198
|
-
if ("scrollLeft" in target
|
|
199
|
-
target
|
|
200
|
-
if (target.scrollLeft !== scrollLeft) setTimeout(() => {
|
|
201
|
-
target.scrollLeft = scrollLeft;
|
|
202
|
-
}, 0);
|
|
204
|
+
if ("scrollLeft" in target) {
|
|
205
|
+
syncScrollLeft(target, scrollLeft);
|
|
203
206
|
return;
|
|
204
207
|
}
|
|
205
208
|
const element = target.nativeElement ? getDOM(target.nativeElement) : getDOM(target);
|
|
206
|
-
if (element
|
|
207
|
-
element.scrollLeft = scrollLeft;
|
|
208
|
-
if (element.scrollLeft !== scrollLeft) setTimeout(() => {
|
|
209
|
-
element.scrollLeft = scrollLeft;
|
|
210
|
-
}, 0);
|
|
211
|
-
}
|
|
209
|
+
if (element) syncScrollLeft(element, scrollLeft);
|
|
212
210
|
}
|
|
213
211
|
const scrollInfo = ref([0, 0]);
|
|
214
212
|
const onInternalScroll = (info) => {
|
|
@@ -514,7 +512,7 @@ var ImmutableTable = /* @__PURE__ */ defineComponent((props, { attrs, slots, exp
|
|
|
514
512
|
return fullTable;
|
|
515
513
|
};
|
|
516
514
|
}, {
|
|
517
|
-
props:
|
|
515
|
+
props: /*@__PURE__*/ mergeDefaults({
|
|
518
516
|
prefixCls: {
|
|
519
517
|
type: String,
|
|
520
518
|
required: false,
|
|
@@ -755,7 +753,12 @@ var ImmutableTable = /* @__PURE__ */ defineComponent((props, { attrs, slots, exp
|
|
|
755
753
|
required: false,
|
|
756
754
|
default: void 0
|
|
757
755
|
}
|
|
758
|
-
},
|
|
756
|
+
}, {
|
|
757
|
+
rowKey: "key",
|
|
758
|
+
prefixCls: DEFAULT_PREFIX,
|
|
759
|
+
emptyText: defaultEmpty,
|
|
760
|
+
rowHoverable: true
|
|
761
|
+
}),
|
|
759
762
|
inheritAttrs: false
|
|
760
763
|
});
|
|
761
764
|
ImmutableTable.EXPAND_COLUMN = EXPAND_COLUMN;
|
|
@@ -85,7 +85,8 @@ var BodyGrid = /* @__PURE__ */ defineComponent({
|
|
|
85
85
|
const endItemIndex = index + rowSpan - 1;
|
|
86
86
|
const endItem = rawData[endItemIndex];
|
|
87
87
|
if (!endItem || !endItem.record) {
|
|
88
|
-
const
|
|
88
|
+
const safeEndIndex = Math.min(endItemIndex, rawData.length - 1);
|
|
89
|
+
const endItemKey = rawData[safeEndIndex].rowKey;
|
|
89
90
|
const sizeInfo = getSize(rowKey, endItemKey);
|
|
90
91
|
return sizeInfo.bottom - sizeInfo.top;
|
|
91
92
|
}
|
|
@@ -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): Ref<import('../utils/fixUtil').FixedInfo[], import('../utils/fixUtil').FixedInfo[]>;
|
|
@@ -11,7 +11,7 @@ export default function useRowInfo<RecordType>(record: Ref<RecordType> | RecordT
|
|
|
11
11
|
className: string;
|
|
12
12
|
onClick: (event: MouseEvent) => void;
|
|
13
13
|
innerHTML?: string | undefined | undefined;
|
|
14
|
-
class?:
|
|
14
|
+
class?: import('vue').ClassValue;
|
|
15
15
|
style?: import('vue').StyleValue;
|
|
16
16
|
accesskey?: string | undefined | undefined;
|
|
17
17
|
contenteditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
package/package.json
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/table",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.7",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/antdv-next/vue-components/tree/next/packages/table",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/antdv-next/vue-components.git"
|
|
10
|
+
},
|
|
5
11
|
"exports": {
|
|
6
12
|
".": {
|
|
7
13
|
"types": "./dist/index.d.ts",
|
|
@@ -20,9 +26,9 @@
|
|
|
20
26
|
"vue": "^3.0.0"
|
|
21
27
|
},
|
|
22
28
|
"dependencies": {
|
|
23
|
-
"@v-c/resize-observer": "^1.1.
|
|
24
|
-
"@v-c/
|
|
25
|
-
"@v-c/
|
|
29
|
+
"@v-c/resize-observer": "^1.1.3",
|
|
30
|
+
"@v-c/virtual-list": "^1.1.0",
|
|
31
|
+
"@v-c/util": "^1.0.21"
|
|
26
32
|
},
|
|
27
33
|
"publishConfig": {
|
|
28
34
|
"access": "public"
|