@vtx/components 4.0.0-beta.24 → 4.0.0-beta.25
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/vtx-datagrid/index.js +12 -5
- package/lib/vtx-datagrid/index.js +12 -5
- package/package.json +2 -2
package/es/vtx-datagrid/index.js
CHANGED
|
@@ -107,7 +107,7 @@ function VtxTable(props) {
|
|
|
107
107
|
|
|
108
108
|
// 高度计算
|
|
109
109
|
var _useThrottleFn = useThrottleFn(function () {
|
|
110
|
-
var _rootDomRef$current;
|
|
110
|
+
var _rootDomRef$current, _bodyDiv$getElementsB;
|
|
111
111
|
if (!rootDomRef.current) {
|
|
112
112
|
return null;
|
|
113
113
|
}
|
|
@@ -121,8 +121,8 @@ function VtxTable(props) {
|
|
|
121
121
|
})[0];
|
|
122
122
|
if (bodyDiv) {
|
|
123
123
|
bodyDiv.style.minHeight = "".concat(bodyHeight - (rest.scrollY || 0), "px");
|
|
124
|
-
bodyDiv.style.overflowY = 'auto';
|
|
125
124
|
}
|
|
125
|
+
var tableHeight = (_bodyDiv$getElementsB = bodyDiv.getElementsByTagName('table')) === null || _bodyDiv$getElementsB === void 0 || (_bodyDiv$getElementsB = _bodyDiv$getElementsB[0]) === null || _bodyDiv$getElementsB === void 0 ? void 0 : _bodyDiv$getElementsB.clientHeight;
|
|
126
126
|
if (tablePlaceholder) {
|
|
127
127
|
tablePlaceholder.style.height = "".concat(bodyHeight - (rest.scrollY || 0) - 12, "px");
|
|
128
128
|
var tableCell = Array.prototype.filter.call(tablePlaceholder.getElementsByTagName('td'), function (dom) {
|
|
@@ -130,8 +130,10 @@ function VtxTable(props) {
|
|
|
130
130
|
})[0];
|
|
131
131
|
tableCell.style.height = "".concat(bodyHeight - (rest.scrollY || 0) - 12, "px");
|
|
132
132
|
}
|
|
133
|
+
// antd6.x 的bug 如果table的高度 没有body 高 则没有滚动条
|
|
134
|
+
|
|
133
135
|
setState({
|
|
134
|
-
scrollY: bodyHeight
|
|
136
|
+
scrollY: tableHeight > bodyHeight ? bodyHeight : undefined
|
|
135
137
|
});
|
|
136
138
|
}, {
|
|
137
139
|
wait: 350
|
|
@@ -229,9 +231,12 @@ function VtxTable(props) {
|
|
|
229
231
|
result = _objectSpread(_objectSpread({}, result), {}, {
|
|
230
232
|
y: scrollY - (rest.scrollY || 0)
|
|
231
233
|
});
|
|
234
|
+
if (scrollY == undefined) {
|
|
235
|
+
result.y = undefined;
|
|
236
|
+
}
|
|
232
237
|
}
|
|
233
238
|
return result;
|
|
234
|
-
}, [rest.scroll, rest.scrollY, autoFit]);
|
|
239
|
+
}, [rest.scroll, rest.scrollY, scrollY, autoFit]);
|
|
235
240
|
var hasAlert = useMemo(function () {
|
|
236
241
|
var _rest$rowSelection2;
|
|
237
242
|
return (((_rest$rowSelection2 = rest.rowSelection) === null || _rest$rowSelection2 === void 0 ? void 0 : _rest$rowSelection2.selectedRowKeys) || []).length > 0;
|
|
@@ -346,6 +351,7 @@ function VtxTable(props) {
|
|
|
346
351
|
children: [toolbarRender, alertRender, /*#__PURE__*/_jsx(Table, _objectSpread(_objectSpread({
|
|
347
352
|
size: counter.tableSize,
|
|
348
353
|
bordered: true
|
|
354
|
+
// virtual
|
|
349
355
|
}, rest), {}, {
|
|
350
356
|
dataSource: dataSource,
|
|
351
357
|
scroll: _objectSpread({
|
|
@@ -361,7 +367,8 @@ function VtxTable(props) {
|
|
|
361
367
|
})
|
|
362
368
|
}, rest.locale),
|
|
363
369
|
components: _components,
|
|
364
|
-
columns: _columns
|
|
370
|
+
columns: _columns,
|
|
371
|
+
tableLayout: 'auto'
|
|
365
372
|
}))]
|
|
366
373
|
}));
|
|
367
374
|
}
|
|
@@ -117,7 +117,7 @@ function VtxTable(props) {
|
|
|
117
117
|
|
|
118
118
|
// 高度计算
|
|
119
119
|
var _useThrottleFn = (0, _ahooks.useThrottleFn)(function () {
|
|
120
|
-
var _rootDomRef$current;
|
|
120
|
+
var _rootDomRef$current, _bodyDiv$getElementsB;
|
|
121
121
|
if (!rootDomRef.current) {
|
|
122
122
|
return null;
|
|
123
123
|
}
|
|
@@ -131,8 +131,8 @@ function VtxTable(props) {
|
|
|
131
131
|
})[0];
|
|
132
132
|
if (bodyDiv) {
|
|
133
133
|
bodyDiv.style.minHeight = "".concat(bodyHeight - (rest.scrollY || 0), "px");
|
|
134
|
-
bodyDiv.style.overflowY = 'auto';
|
|
135
134
|
}
|
|
135
|
+
var tableHeight = (_bodyDiv$getElementsB = bodyDiv.getElementsByTagName('table')) === null || _bodyDiv$getElementsB === void 0 || (_bodyDiv$getElementsB = _bodyDiv$getElementsB[0]) === null || _bodyDiv$getElementsB === void 0 ? void 0 : _bodyDiv$getElementsB.clientHeight;
|
|
136
136
|
if (tablePlaceholder) {
|
|
137
137
|
tablePlaceholder.style.height = "".concat(bodyHeight - (rest.scrollY || 0) - 12, "px");
|
|
138
138
|
var tableCell = Array.prototype.filter.call(tablePlaceholder.getElementsByTagName('td'), function (dom) {
|
|
@@ -140,8 +140,10 @@ function VtxTable(props) {
|
|
|
140
140
|
})[0];
|
|
141
141
|
tableCell.style.height = "".concat(bodyHeight - (rest.scrollY || 0) - 12, "px");
|
|
142
142
|
}
|
|
143
|
+
// antd6.x 的bug 如果table的高度 没有body 高 则没有滚动条
|
|
144
|
+
|
|
143
145
|
setState({
|
|
144
|
-
scrollY: bodyHeight
|
|
146
|
+
scrollY: tableHeight > bodyHeight ? bodyHeight : undefined
|
|
145
147
|
});
|
|
146
148
|
}, {
|
|
147
149
|
wait: 350
|
|
@@ -239,9 +241,12 @@ function VtxTable(props) {
|
|
|
239
241
|
result = _objectSpread(_objectSpread({}, result), {}, {
|
|
240
242
|
y: scrollY - (rest.scrollY || 0)
|
|
241
243
|
});
|
|
244
|
+
if (scrollY == undefined) {
|
|
245
|
+
result.y = undefined;
|
|
246
|
+
}
|
|
242
247
|
}
|
|
243
248
|
return result;
|
|
244
|
-
}, [rest.scroll, rest.scrollY, autoFit]);
|
|
249
|
+
}, [rest.scroll, rest.scrollY, scrollY, autoFit]);
|
|
245
250
|
var hasAlert = (0, _react.useMemo)(function () {
|
|
246
251
|
var _rest$rowSelection2;
|
|
247
252
|
return (((_rest$rowSelection2 = rest.rowSelection) === null || _rest$rowSelection2 === void 0 ? void 0 : _rest$rowSelection2.selectedRowKeys) || []).length > 0;
|
|
@@ -356,6 +361,7 @@ function VtxTable(props) {
|
|
|
356
361
|
children: [toolbarRender, alertRender, /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Table, _objectSpread(_objectSpread({
|
|
357
362
|
size: counter.tableSize,
|
|
358
363
|
bordered: true
|
|
364
|
+
// virtual
|
|
359
365
|
}, rest), {}, {
|
|
360
366
|
dataSource: dataSource,
|
|
361
367
|
scroll: _objectSpread({
|
|
@@ -371,7 +377,8 @@ function VtxTable(props) {
|
|
|
371
377
|
})
|
|
372
378
|
}, rest.locale),
|
|
373
379
|
components: _components,
|
|
374
|
-
columns: _columns
|
|
380
|
+
columns: _columns,
|
|
381
|
+
tableLayout: 'auto'
|
|
375
382
|
}))]
|
|
376
383
|
}));
|
|
377
384
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtx/components",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.25",
|
|
4
4
|
"description": "React components for Vortex",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
"@vitest/coverage-istanbul": "^3.2.4",
|
|
156
156
|
"@vitest/ui": "^3.2.4",
|
|
157
157
|
"animated-scroll-to": "^2.3.2",
|
|
158
|
-
"antd": "^6.
|
|
158
|
+
"antd": "^6.3.1",
|
|
159
159
|
"chalk": "^4.1.2",
|
|
160
160
|
"copy-to-clipboard": "^3.3.3",
|
|
161
161
|
"cross-env": "^7.0.3",
|