@meethive/components 0.0.3 → 0.0.5
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/es/AutoComplete/AutoComplete.js +71 -80
- package/es/BadgeStatus/Badge.js +38 -47
- package/es/CardSelect/CardSelect.js +115 -137
- package/es/CheckButton/CheckButton.js +102 -118
- package/es/ConfigProvider/ConfigProvider.js +44 -68
- package/es/DragModal/DragModal.js +191 -212
- package/es/EditTable/Body.js +158 -189
- package/es/EditTable/CellRender.js +10 -12
- package/es/EditTable/EditTable.js +385 -434
- package/es/EditTable/FormItem.js +140 -169
- package/es/EditTable/Group.js +171 -204
- package/es/EditTable/Header.js +57 -63
- package/es/EditTable/HeaderRender.js +10 -12
- package/es/EditTable/components/ContextMenu/Menu.js +78 -86
- package/es/EditTable/components/Search/Search.js +151 -163
- package/es/EditTable/components/Search/Sort.js +104 -119
- package/es/Ellipsis/Ellipsis.js +144 -148
- package/es/Empty/Empty.js +51 -57
- package/es/FullPage/FullPage.js +20 -19
- package/es/Icon/Icon.js +42 -49
- package/es/LocaleProvider/LocaleProvider.js +32 -38
- package/es/Markdown/Markdown.js +101 -118
- package/es/PermissionButton/PermissionButton.js +118 -118
- package/es/ProLayout/Basic/BasicLayout.js +361 -418
- package/es/ProLayout/Basic/Header.js +97 -111
- package/es/ProLayout/PageContainer/index.js +298 -344
- package/es/ProLayout/SiderMenu/BaseMenu.js +233 -240
- package/es/ProTable/Alert.js +39 -40
- package/es/ProTable/Content.js +84 -97
- package/es/ProTable/Header.js +32 -33
- package/es/ProTable/Pagination.js +56 -55
- package/es/ProTable/ProTable.js +256 -276
- package/es/RadioButton/RadioButton.js +48 -53
- package/es/Scrollbar/Bar.js +65 -76
- package/es/Scrollbar/Scrollbar.js +129 -161
- package/es/Scrollbar/Thumb.js +101 -150
- package/es/Search/Item.js +208 -236
- package/es/Search/Search.js +90 -90
- package/es/Skeleton/Skeleton.js +26 -27
- package/es/Skeleton/components/DashBoardCard.js +26 -27
- package/es/Skeleton/components/DashBoardChart.js +26 -27
- package/es/Skeleton/components/Detail.js +26 -27
- package/es/Skeleton/components/Drawer.js +26 -27
- package/es/Skeleton/components/Item.js +55 -54
- package/es/Skeleton/components/List.js +29 -27
- package/es/Skeleton/components/ListCard.js +28 -28
- package/es/Skeleton/components/ListCardItem.js +20 -20
- package/es/Skeleton/components/ListTable.js +26 -27
- package/es/Skeleton/components/Page.js +27 -26
- package/es/Skeleton/components/Search.js +16 -16
- package/es/Skeleton/components/Tree.js +26 -27
- package/es/TimeFormat/TimeFormat.js +32 -36
- package/es/Title/Title.js +23 -26
- package/es/ValueItem/ValueItem.js +100 -113
- package/es/VirtualTable/VirtualTable.js +235 -271
- package/lib/AutoComplete/AutoComplete.js +71 -80
- package/lib/BadgeStatus/Badge.js +38 -47
- package/lib/CardSelect/CardSelect.js +115 -137
- package/lib/CheckButton/CheckButton.js +102 -118
- package/lib/ConfigProvider/ConfigProvider.js +44 -68
- package/lib/DragModal/DragModal.js +191 -212
- package/lib/EditTable/Body.js +158 -189
- package/lib/EditTable/CellRender.js +10 -12
- package/lib/EditTable/EditTable.js +385 -434
- package/lib/EditTable/FormItem.js +140 -169
- package/lib/EditTable/Group.js +171 -204
- package/lib/EditTable/Header.js +57 -63
- package/lib/EditTable/HeaderRender.js +10 -12
- package/lib/EditTable/components/ContextMenu/Menu.js +78 -86
- package/lib/EditTable/components/Search/Search.js +151 -163
- package/lib/EditTable/components/Search/Sort.js +104 -119
- package/lib/Ellipsis/Ellipsis.js +144 -148
- package/lib/Empty/Empty.js +51 -57
- package/lib/FullPage/FullPage.js +20 -19
- package/lib/Icon/Icon.js +42 -49
- package/lib/LocaleProvider/LocaleProvider.js +32 -38
- package/lib/Markdown/Markdown.js +101 -118
- package/lib/PermissionButton/PermissionButton.js +118 -118
- package/lib/ProLayout/Basic/BasicLayout.js +361 -418
- package/lib/ProLayout/Basic/Header.js +97 -111
- package/lib/ProLayout/PageContainer/index.js +298 -344
- package/lib/ProLayout/SiderMenu/BaseMenu.js +233 -240
- package/lib/ProTable/Alert.js +39 -40
- package/lib/ProTable/Content.js +84 -97
- package/lib/ProTable/Header.js +32 -33
- package/lib/ProTable/Pagination.js +56 -55
- package/lib/ProTable/ProTable.js +256 -276
- package/lib/RadioButton/RadioButton.js +48 -53
- package/lib/Scrollbar/Bar.js +65 -76
- package/lib/Scrollbar/Scrollbar.js +129 -161
- package/lib/Scrollbar/Thumb.js +101 -150
- package/lib/Search/Item.js +208 -236
- package/lib/Search/Search.js +90 -90
- package/lib/Skeleton/Skeleton.js +26 -27
- package/lib/Skeleton/components/DashBoardCard.js +26 -27
- package/lib/Skeleton/components/DashBoardChart.js +26 -27
- package/lib/Skeleton/components/Detail.js +26 -27
- package/lib/Skeleton/components/Drawer.js +26 -27
- package/lib/Skeleton/components/Item.js +55 -54
- package/lib/Skeleton/components/List.js +29 -27
- package/lib/Skeleton/components/ListCard.js +28 -28
- package/lib/Skeleton/components/ListCardItem.js +20 -20
- package/lib/Skeleton/components/ListTable.js +26 -27
- package/lib/Skeleton/components/Page.js +27 -26
- package/lib/Skeleton/components/Search.js +16 -16
- package/lib/Skeleton/components/Tree.js +26 -27
- package/lib/TimeFormat/TimeFormat.js +32 -36
- package/lib/Title/Title.js +23 -26
- package/lib/ValueItem/ValueItem.js +100 -113
- package/lib/VirtualTable/VirtualTable.js +235 -271
- package/package.json +1 -1
|
@@ -1,271 +1,235 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
type:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
const [
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
while (
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
watch(
|
|
238
|
-
() => _optionalChain([props, 'access', _4 => _4.rowSelection, 'optionalAccess', _5 => _5.selectedRowKeys]),
|
|
239
|
-
(val) => {
|
|
240
|
-
if (val) {
|
|
241
|
-
selectedAll.value = val.length > 0 && flattenData.value.length === val.length
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
immediate: true
|
|
246
|
-
}
|
|
247
|
-
)
|
|
248
|
-
|
|
249
|
-
onMounted(() => {
|
|
250
|
-
updateVisibleNodes()
|
|
251
|
-
})
|
|
252
|
-
|
|
253
|
-
return {
|
|
254
|
-
h,
|
|
255
|
-
hashId,
|
|
256
|
-
container,
|
|
257
|
-
selectedAll,
|
|
258
|
-
visibleRows,
|
|
259
|
-
_indeterminate,
|
|
260
|
-
viewportHeight,
|
|
261
|
-
_columns,
|
|
262
|
-
_rowSelection,
|
|
263
|
-
totalHeight,
|
|
264
|
-
offsetY,
|
|
265
|
-
firstColumn,
|
|
266
|
-
onSelectedAllChange,
|
|
267
|
-
onScroll,
|
|
268
|
-
toggleExpand
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
})
|
|
1
|
+
import { defineComponent, computed, ref, watch, onMounted, nextTick, h } from 'vue';
|
|
2
|
+
import { Table, Checkbox } from 'ant-design-vue';
|
|
3
|
+
import { isNumber, map, omit } from 'lodash-es';
|
|
4
|
+
import AIcon from '../Icon';
|
|
5
|
+
import useVirtualTableStyle from './style';
|
|
6
|
+
import { useLocaleReceiver } from '../LocaleReciver';
|
|
7
|
+
import { findAllChildren, flattenTree } from './data';
|
|
8
|
+
const buffer = 5;
|
|
9
|
+
export default defineComponent({
|
|
10
|
+
name: 'JVirtualTable',
|
|
11
|
+
components: {
|
|
12
|
+
Table,
|
|
13
|
+
Checkbox,
|
|
14
|
+
AIcon
|
|
15
|
+
},
|
|
16
|
+
props: {
|
|
17
|
+
dataSource: {
|
|
18
|
+
type: Array,
|
|
19
|
+
default: () => []
|
|
20
|
+
},
|
|
21
|
+
columns: {
|
|
22
|
+
type: Array,
|
|
23
|
+
default: () => []
|
|
24
|
+
},
|
|
25
|
+
expandedRowKeys: {
|
|
26
|
+
type: Array,
|
|
27
|
+
default: () => []
|
|
28
|
+
},
|
|
29
|
+
rowSelection: {
|
|
30
|
+
type: Object
|
|
31
|
+
},
|
|
32
|
+
rowKey: {
|
|
33
|
+
type: [String, Function],
|
|
34
|
+
default: 'id'
|
|
35
|
+
},
|
|
36
|
+
height: {
|
|
37
|
+
type: Number,
|
|
38
|
+
default: 500
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
emits: ['update:expandedRowKeys'],
|
|
42
|
+
setup(props, {
|
|
43
|
+
emit
|
|
44
|
+
}) {
|
|
45
|
+
const prefixCls = computed(() => 'virtual-table');
|
|
46
|
+
const [wrapSSR, hashId] = useVirtualTableStyle(prefixCls);
|
|
47
|
+
const [contextLocale] = useLocaleReceiver('ProTable');
|
|
48
|
+
const container = ref(null);
|
|
49
|
+
const rowHeights = ref([]);
|
|
50
|
+
const prefixSum = ref([]);
|
|
51
|
+
const start = ref(0);
|
|
52
|
+
const end = ref(15);
|
|
53
|
+
const offsetY = ref(0);
|
|
54
|
+
const selectedAll = ref(false);
|
|
55
|
+
// 被展开的所有数据
|
|
56
|
+
const visibleNodes = ref([]);
|
|
57
|
+
const flattenData = ref([]);
|
|
58
|
+
const firstColumn = computed(() => props.columns[0]);
|
|
59
|
+
const totalHeight = computed(() => prefixSum.value.length ? prefixSum.value[prefixSum.value.length - 1] : 0);
|
|
60
|
+
const visibleRows = computed(() => visibleNodes.value.slice(start.value, end.value));
|
|
61
|
+
const _indeterminate = computed(() => !selectedAll.value && (props.rowSelection?.selectedRowKeys?.length ?? 0) > 0);
|
|
62
|
+
const viewportHeight = computed(() => props.height || 500);
|
|
63
|
+
const _columns = computed(() => {
|
|
64
|
+
const arr = [];
|
|
65
|
+
if (props.rowSelection) {
|
|
66
|
+
const _width = props.rowSelection.columnWidth || 32;
|
|
67
|
+
arr.push({
|
|
68
|
+
key: '__selection__',
|
|
69
|
+
title: contextLocale.value.select.all,
|
|
70
|
+
dataIndex: '__selection__',
|
|
71
|
+
width: isNumber(_width) ? `${_width}px` : _width,
|
|
72
|
+
customHeaderCell: props => {
|
|
73
|
+
return {
|
|
74
|
+
class: 'ant-table-selection-column'
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
arr.push(...props.columns);
|
|
80
|
+
return arr;
|
|
81
|
+
});
|
|
82
|
+
const _rowSelection = computed(() => {
|
|
83
|
+
return props.rowSelection ? {
|
|
84
|
+
...props.rowSelection,
|
|
85
|
+
onSelect: (record, selected, selectedRows, nativeEvent) => {
|
|
86
|
+
const _selectedRowKeys = props.rowSelection.selectedRowKeys || [];
|
|
87
|
+
const _set = new Set([..._selectedRowKeys]);
|
|
88
|
+
if (props.rowSelection.type === 'radio') {
|
|
89
|
+
_set.clear();
|
|
90
|
+
_set.add(record[props.rowKey]);
|
|
91
|
+
} else {
|
|
92
|
+
const _checkStrictly = props.rowSelection.checkStrictly !== undefined ? props.rowSelection.checkStrictly : true;
|
|
93
|
+
let __arr = [];
|
|
94
|
+
if (_checkStrictly) {
|
|
95
|
+
// 需要获取子
|
|
96
|
+
__arr = [record[props.rowKey]];
|
|
97
|
+
} else {
|
|
98
|
+
__arr = map(findAllChildren(flattenData.value, record[props.rowKey]), props.rowKey);
|
|
99
|
+
__arr.push(record[props.rowKey]);
|
|
100
|
+
}
|
|
101
|
+
if (selected) {
|
|
102
|
+
__arr.forEach(i => _set.add(i));
|
|
103
|
+
} else {
|
|
104
|
+
__arr.forEach(i => _set.delete(i));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const _selectedRows = flattenData.value.filter(i => _set.has(i[props.rowKey])).map(item => omit(item, ['expanded', 'hasChildren', 'visible']));
|
|
108
|
+
if (props.rowSelection.onSelect) {
|
|
109
|
+
props.rowSelection.onSelect(record, selected, _selectedRows, nativeEvent);
|
|
110
|
+
}
|
|
111
|
+
if (props.rowSelection.onChange) {
|
|
112
|
+
props.rowSelection.onChange([..._set], _selectedRows);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
onChange: () => {},
|
|
116
|
+
onSelectAll: () => {},
|
|
117
|
+
onSelectNone: () => {
|
|
118
|
+
if (props.rowSelection.onSelectNone) {
|
|
119
|
+
props.rowSelection.onSelectNone();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
} : undefined;
|
|
123
|
+
});
|
|
124
|
+
const onSelectedAllChange = e => {
|
|
125
|
+
const selected = e.target.checked;
|
|
126
|
+
const arr = flattenData.value.map(i => omit(i, ['expanded', 'hasChildren', 'visible']));
|
|
127
|
+
const _checked = selected;
|
|
128
|
+
const _selectedRowKeys = _checked ? map(arr, props.rowKey) : [];
|
|
129
|
+
if (props.rowSelection.onSelectAll) {
|
|
130
|
+
props.rowSelection.onSelectAll(_checked, _checked ? arr : []);
|
|
131
|
+
}
|
|
132
|
+
if (props.rowSelection.onChange) {
|
|
133
|
+
props.rowSelection.onChange(_selectedRowKeys, _checked ? arr : []);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const onScroll = e => {
|
|
137
|
+
const scrollTop = e.target.scrollTop;
|
|
138
|
+
const vh = viewportHeight.value || 500;
|
|
139
|
+
const total = totalHeight.value;
|
|
140
|
+
// 防止 scrollTop 超出范围
|
|
141
|
+
const clampedScrollTop = Math.min(scrollTop, total - vh);
|
|
142
|
+
// 二分查找
|
|
143
|
+
let low = 0,
|
|
144
|
+
high = prefixSum.value.length - 1;
|
|
145
|
+
while (low < high) {
|
|
146
|
+
const mid = Math.floor((low + high) / 2);
|
|
147
|
+
if (prefixSum.value[mid] <= clampedScrollTop) low = mid + 1;else high = mid;
|
|
148
|
+
}
|
|
149
|
+
const newStart = Math.max(0, low - 1);
|
|
150
|
+
// 如果 start 没变化,直接跳过,避免重复计算导致闪动
|
|
151
|
+
if (newStart === start.value) return;
|
|
152
|
+
start.value = newStart;
|
|
153
|
+
// 计算 end
|
|
154
|
+
let y = prefixSum.value[start.value] || 0;
|
|
155
|
+
let i = start.value;
|
|
156
|
+
while (i < visibleNodes.value.length && y < clampedScrollTop + vh) {
|
|
157
|
+
y += rowHeights.value[i] || 40;
|
|
158
|
+
i++;
|
|
159
|
+
}
|
|
160
|
+
end.value = Math.min(i + buffer, visibleNodes.value.length);
|
|
161
|
+
// 防止 offsetY 波动
|
|
162
|
+
offsetY.value = prefixSum.value[start.value - 1] || 0;
|
|
163
|
+
};
|
|
164
|
+
const toggleExpand = row => {
|
|
165
|
+
row.expanded = !row.expanded;
|
|
166
|
+
const stack = [...flattenData.value.filter(n => n.parentId === row[props.rowKey])];
|
|
167
|
+
while (stack.length) {
|
|
168
|
+
const child = stack.pop();
|
|
169
|
+
child.visible = row.expanded;
|
|
170
|
+
if (!child.visible) {
|
|
171
|
+
child.expanded = false;
|
|
172
|
+
}
|
|
173
|
+
if (!row.expanded && child.hasChildren) {
|
|
174
|
+
stack.push(...flattenData.value.filter(n => n.parentId === child[props.rowKey]));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
updateVisibleNodes();
|
|
178
|
+
};
|
|
179
|
+
const updatePrefixSum = () => {
|
|
180
|
+
rowHeights.value = visibleNodes.value.map(() => 40); // 默认行高
|
|
181
|
+
prefixSum.value = [];
|
|
182
|
+
let sum = 0;
|
|
183
|
+
for (let h of rowHeights.value) {
|
|
184
|
+
sum += h;
|
|
185
|
+
prefixSum.value.push(sum);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
const updateVisibleNodes = () => {
|
|
189
|
+
visibleNodes.value = flattenData.value.filter(i => i.visible);
|
|
190
|
+
updatePrefixSum();
|
|
191
|
+
console.log('123');
|
|
192
|
+
nextTick(() => onScroll({
|
|
193
|
+
target: container.value
|
|
194
|
+
}));
|
|
195
|
+
};
|
|
196
|
+
watch(() => [JSON.stringify(props.dataSource), JSON.stringify(props.expandedRowKeys)], () => {
|
|
197
|
+
flattenData.value = flattenTree(props.dataSource, 0, null);
|
|
198
|
+
flattenData.value.forEach(i => {
|
|
199
|
+
if (props.expandedRowKeys.includes(i[props.rowKey])) {
|
|
200
|
+
toggleExpand(i);
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
updateVisibleNodes();
|
|
204
|
+
}, {
|
|
205
|
+
immediate: true
|
|
206
|
+
});
|
|
207
|
+
watch(() => props.rowSelection?.selectedRowKeys, val => {
|
|
208
|
+
if (val) {
|
|
209
|
+
selectedAll.value = val.length > 0 && flattenData.value.length === val.length;
|
|
210
|
+
}
|
|
211
|
+
}, {
|
|
212
|
+
immediate: true
|
|
213
|
+
});
|
|
214
|
+
onMounted(() => {
|
|
215
|
+
updateVisibleNodes();
|
|
216
|
+
});
|
|
217
|
+
return {
|
|
218
|
+
h,
|
|
219
|
+
hashId,
|
|
220
|
+
container,
|
|
221
|
+
selectedAll,
|
|
222
|
+
visibleRows,
|
|
223
|
+
_indeterminate,
|
|
224
|
+
viewportHeight,
|
|
225
|
+
_columns,
|
|
226
|
+
_rowSelection,
|
|
227
|
+
totalHeight,
|
|
228
|
+
offsetY,
|
|
229
|
+
firstColumn,
|
|
230
|
+
onSelectedAllChange,
|
|
231
|
+
onScroll,
|
|
232
|
+
toggleExpand
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
});
|