@vtx/components 4.0.0-beta.20 → 4.0.0-beta.22
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 +48 -10
- package/es/vtx-datagrid/style/index.js +1 -2
- package/es/vtx-export-async/History.js +7 -3
- package/es/vtx-export-async/index.js +6 -3
- package/lib/vtx-datagrid/index.js +48 -10
- package/lib/vtx-datagrid/style/index.js +1 -2
- package/lib/vtx-export-async/History.js +7 -3
- package/lib/vtx-export-async/index.js +6 -3
- package/package.json +3 -3
package/es/vtx-datagrid/index.js
CHANGED
|
@@ -122,13 +122,12 @@ function VtxTable(props) {
|
|
|
122
122
|
if (bodyDiv) {
|
|
123
123
|
bodyDiv.style.minHeight = "".concat(bodyHeight - (rest.scrollY || 0), "px");
|
|
124
124
|
}
|
|
125
|
-
console.log('tablePlaceholder', tablePlaceholder);
|
|
126
125
|
if (tablePlaceholder) {
|
|
127
|
-
tablePlaceholder.style.height = "".concat(bodyHeight - (rest.scrollY || 0), "px");
|
|
126
|
+
tablePlaceholder.style.height = "".concat(bodyHeight - (rest.scrollY || 0) - 12, "px");
|
|
128
127
|
var tableCell = Array.prototype.filter.call(tablePlaceholder.getElementsByTagName('td'), function (dom) {
|
|
129
128
|
return dom.className.includes('ant-table-cell');
|
|
130
129
|
})[0];
|
|
131
|
-
tableCell.style.height = "".concat(bodyHeight - (rest.scrollY || 0), "px");
|
|
130
|
+
tableCell.style.height = "".concat(bodyHeight - (rest.scrollY || 0) - 12, "px");
|
|
132
131
|
}
|
|
133
132
|
setState({
|
|
134
133
|
scrollY: bodyHeight
|
|
@@ -252,8 +251,37 @@ function VtxTable(props) {
|
|
|
252
251
|
resizeComponents = _useAntdColumnResize.components,
|
|
253
252
|
tableWidth = _useAntdColumnResize.tableWidth,
|
|
254
253
|
resetColumns = _useAntdColumnResize.resetColumns;
|
|
254
|
+
|
|
255
|
+
// const _columns = useMemo(() => {
|
|
256
|
+
// let result = [];
|
|
257
|
+
// if (!showTable) {
|
|
258
|
+
// result = []
|
|
259
|
+
// } else if (isDragRef) {
|
|
260
|
+
// result = resizableColumns
|
|
261
|
+
// } else {
|
|
262
|
+
// result = columns
|
|
263
|
+
// }
|
|
264
|
+
// let flag = false;
|
|
265
|
+
// result?.map((v) => {
|
|
266
|
+
// if (columnsMap[v.key].width !== v.width) {
|
|
267
|
+
// flag = true;
|
|
268
|
+
// columnsMap[v.key] = {
|
|
269
|
+
// ...columnsMap[v.key],
|
|
270
|
+
// width: v.width
|
|
271
|
+
// };
|
|
272
|
+
// }
|
|
273
|
+
// })
|
|
274
|
+
// if (flag) {
|
|
275
|
+
// counter.setColumnsMap(
|
|
276
|
+
// columnsMap
|
|
277
|
+
// )
|
|
278
|
+
// }
|
|
279
|
+
// return result;
|
|
280
|
+
|
|
281
|
+
// }, [isDragRef, resizableColumns, showTable, columns, columnsMap])
|
|
282
|
+
|
|
283
|
+
// 1. 先计算列配置
|
|
255
284
|
var _columns = useMemo(function () {
|
|
256
|
-
var _result;
|
|
257
285
|
var result = [];
|
|
258
286
|
if (!showTable) {
|
|
259
287
|
result = [];
|
|
@@ -262,18 +290,28 @@ function VtxTable(props) {
|
|
|
262
290
|
} else {
|
|
263
291
|
result = columns;
|
|
264
292
|
}
|
|
293
|
+
return result;
|
|
294
|
+
}, [isDragRef, resizableColumns, showTable, columns]);
|
|
295
|
+
|
|
296
|
+
// 2. 在 effect 中同步列宽到 columnsMap
|
|
297
|
+
useEffect(function () {
|
|
298
|
+
if (!showTable || !_columns.length) return;
|
|
265
299
|
var flag = false;
|
|
266
|
-
|
|
267
|
-
|
|
300
|
+
var newColumnsMap = _objectSpread({}, columnsMap); // 创建副本避免直接修改
|
|
301
|
+
|
|
302
|
+
_columns.forEach(function (v) {
|
|
303
|
+
var _columnsMap$v$key;
|
|
304
|
+
if (((_columnsMap$v$key = columnsMap[v.key]) === null || _columnsMap$v$key === void 0 ? void 0 : _columnsMap$v$key.width) !== v.width) {
|
|
268
305
|
flag = true;
|
|
269
|
-
|
|
306
|
+
newColumnsMap[v.key] = _objectSpread(_objectSpread({}, newColumnsMap[v.key]), {}, {
|
|
307
|
+
width: v.width
|
|
308
|
+
});
|
|
270
309
|
}
|
|
271
310
|
});
|
|
272
311
|
if (flag) {
|
|
273
|
-
counter.setColumnsMap(
|
|
312
|
+
counter.setColumnsMap(newColumnsMap);
|
|
274
313
|
}
|
|
275
|
-
|
|
276
|
-
}, [isDragRef, resizableColumns, showTable, columns, columnsMap]);
|
|
314
|
+
}, [_columns, columnsMap, counter, showTable]);
|
|
277
315
|
var _components = useMemo(function () {
|
|
278
316
|
if (isDragRef) {
|
|
279
317
|
return resizeComponents;
|
|
@@ -20,12 +20,11 @@ var genVtxStyle = function genVtxStyle(token) {
|
|
|
20
20
|
}), '.ant-table-body', _defineProperty({}, '.ant-table-tbody', {
|
|
21
21
|
'>tr.ant-table-placeholder': {
|
|
22
22
|
position: 'absolute',
|
|
23
|
-
bottom:
|
|
23
|
+
bottom: 12,
|
|
24
24
|
right: 0,
|
|
25
25
|
left: 0,
|
|
26
26
|
backgroundColor: 'transparent',
|
|
27
27
|
borderTop: 'none',
|
|
28
|
-
height: '100%',
|
|
29
28
|
borderInlineEnd: "var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)",
|
|
30
29
|
borderBottom: "var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)",
|
|
31
30
|
'>td.ant-table-cell': {
|
|
@@ -38,7 +38,9 @@ function History(props) {
|
|
|
38
38
|
_props$customTablePro = props.customTableProps,
|
|
39
39
|
customTableProps = _props$customTablePro === void 0 ? {} : _props$customTablePro,
|
|
40
40
|
refreshTime = props.refreshTime,
|
|
41
|
-
downloadInNewTab = props.downloadInNewTab
|
|
41
|
+
downloadInNewTab = props.downloadInNewTab,
|
|
42
|
+
_props$headers = props.headers,
|
|
43
|
+
headers = _props$headers === void 0 ? {} : _props$headers;
|
|
42
44
|
var _Form$useForm = Form.useForm(),
|
|
43
45
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
44
46
|
form = _Form$useForm2[0];
|
|
@@ -151,7 +153,8 @@ function History(props) {
|
|
|
151
153
|
downloadFile(downFileUrl, {
|
|
152
154
|
data: {
|
|
153
155
|
id: record.id
|
|
154
|
-
}
|
|
156
|
+
},
|
|
157
|
+
extraHeader: headers
|
|
155
158
|
}, 'blob');
|
|
156
159
|
}
|
|
157
160
|
},
|
|
@@ -251,6 +254,7 @@ History.propTypes = {
|
|
|
251
254
|
TextEnum: PropTypes.object,
|
|
252
255
|
customTableProps: PropTypes.object,
|
|
253
256
|
refreshTime: PropTypes.number,
|
|
254
|
-
downloadInNewTab: PropTypes.bool
|
|
257
|
+
downloadInNewTab: PropTypes.bool,
|
|
258
|
+
headers: PropTypes.object
|
|
255
259
|
};
|
|
256
260
|
export default History;
|
|
@@ -79,9 +79,11 @@ var VtxExportAsync = function VtxExportAsync(props) {
|
|
|
79
79
|
downloadInNewTab = _props$downloadInNewT === void 0 ? false : _props$downloadInNewT,
|
|
80
80
|
_props$enableCustomSe = props.enableCustomSelect,
|
|
81
81
|
enableCustomSelect = _props$enableCustomSe === void 0 ? false : _props$enableCustomSe,
|
|
82
|
-
beforeExport = props.beforeExport,
|
|
83
82
|
_props$headers = props.headers,
|
|
84
|
-
headers = _props$headers === void 0 ? {} : _props$headers
|
|
83
|
+
headers = _props$headers === void 0 ? {} : _props$headers,
|
|
84
|
+
beforeExport = props.beforeExport,
|
|
85
|
+
_props$historyHeaders = props.historyHeaders,
|
|
86
|
+
historyHeaders = _props$historyHeaders === void 0 ? {} : _props$historyHeaders;
|
|
85
87
|
var _Form$useForm = Form.useForm(),
|
|
86
88
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
87
89
|
form = _Form$useForm2[0];
|
|
@@ -386,7 +388,8 @@ var VtxExportAsync = function VtxExportAsync(props) {
|
|
|
386
388
|
TextEnum: TextEnum,
|
|
387
389
|
customTableProps: customTableProps,
|
|
388
390
|
refreshTime: refreshTime,
|
|
389
|
-
downloadInNewTab: downloadInNewTab
|
|
391
|
+
downloadInNewTab: downloadInNewTab,
|
|
392
|
+
headers: historyHeaders
|
|
390
393
|
})]
|
|
391
394
|
}));
|
|
392
395
|
};
|
|
@@ -132,13 +132,12 @@ function VtxTable(props) {
|
|
|
132
132
|
if (bodyDiv) {
|
|
133
133
|
bodyDiv.style.minHeight = "".concat(bodyHeight - (rest.scrollY || 0), "px");
|
|
134
134
|
}
|
|
135
|
-
console.log('tablePlaceholder', tablePlaceholder);
|
|
136
135
|
if (tablePlaceholder) {
|
|
137
|
-
tablePlaceholder.style.height = "".concat(bodyHeight - (rest.scrollY || 0), "px");
|
|
136
|
+
tablePlaceholder.style.height = "".concat(bodyHeight - (rest.scrollY || 0) - 12, "px");
|
|
138
137
|
var tableCell = Array.prototype.filter.call(tablePlaceholder.getElementsByTagName('td'), function (dom) {
|
|
139
138
|
return dom.className.includes('ant-table-cell');
|
|
140
139
|
})[0];
|
|
141
|
-
tableCell.style.height = "".concat(bodyHeight - (rest.scrollY || 0), "px");
|
|
140
|
+
tableCell.style.height = "".concat(bodyHeight - (rest.scrollY || 0) - 12, "px");
|
|
142
141
|
}
|
|
143
142
|
setState({
|
|
144
143
|
scrollY: bodyHeight
|
|
@@ -262,8 +261,37 @@ function VtxTable(props) {
|
|
|
262
261
|
resizeComponents = _useAntdColumnResize.components,
|
|
263
262
|
tableWidth = _useAntdColumnResize.tableWidth,
|
|
264
263
|
resetColumns = _useAntdColumnResize.resetColumns;
|
|
264
|
+
|
|
265
|
+
// const _columns = useMemo(() => {
|
|
266
|
+
// let result = [];
|
|
267
|
+
// if (!showTable) {
|
|
268
|
+
// result = []
|
|
269
|
+
// } else if (isDragRef) {
|
|
270
|
+
// result = resizableColumns
|
|
271
|
+
// } else {
|
|
272
|
+
// result = columns
|
|
273
|
+
// }
|
|
274
|
+
// let flag = false;
|
|
275
|
+
// result?.map((v) => {
|
|
276
|
+
// if (columnsMap[v.key].width !== v.width) {
|
|
277
|
+
// flag = true;
|
|
278
|
+
// columnsMap[v.key] = {
|
|
279
|
+
// ...columnsMap[v.key],
|
|
280
|
+
// width: v.width
|
|
281
|
+
// };
|
|
282
|
+
// }
|
|
283
|
+
// })
|
|
284
|
+
// if (flag) {
|
|
285
|
+
// counter.setColumnsMap(
|
|
286
|
+
// columnsMap
|
|
287
|
+
// )
|
|
288
|
+
// }
|
|
289
|
+
// return result;
|
|
290
|
+
|
|
291
|
+
// }, [isDragRef, resizableColumns, showTable, columns, columnsMap])
|
|
292
|
+
|
|
293
|
+
// 1. 先计算列配置
|
|
265
294
|
var _columns = (0, _react.useMemo)(function () {
|
|
266
|
-
var _result;
|
|
267
295
|
var result = [];
|
|
268
296
|
if (!showTable) {
|
|
269
297
|
result = [];
|
|
@@ -272,18 +300,28 @@ function VtxTable(props) {
|
|
|
272
300
|
} else {
|
|
273
301
|
result = columns;
|
|
274
302
|
}
|
|
303
|
+
return result;
|
|
304
|
+
}, [isDragRef, resizableColumns, showTable, columns]);
|
|
305
|
+
|
|
306
|
+
// 2. 在 effect 中同步列宽到 columnsMap
|
|
307
|
+
(0, _react.useEffect)(function () {
|
|
308
|
+
if (!showTable || !_columns.length) return;
|
|
275
309
|
var flag = false;
|
|
276
|
-
|
|
277
|
-
|
|
310
|
+
var newColumnsMap = _objectSpread({}, columnsMap); // 创建副本避免直接修改
|
|
311
|
+
|
|
312
|
+
_columns.forEach(function (v) {
|
|
313
|
+
var _columnsMap$v$key;
|
|
314
|
+
if (((_columnsMap$v$key = columnsMap[v.key]) === null || _columnsMap$v$key === void 0 ? void 0 : _columnsMap$v$key.width) !== v.width) {
|
|
278
315
|
flag = true;
|
|
279
|
-
|
|
316
|
+
newColumnsMap[v.key] = _objectSpread(_objectSpread({}, newColumnsMap[v.key]), {}, {
|
|
317
|
+
width: v.width
|
|
318
|
+
});
|
|
280
319
|
}
|
|
281
320
|
});
|
|
282
321
|
if (flag) {
|
|
283
|
-
counter.setColumnsMap(
|
|
322
|
+
counter.setColumnsMap(newColumnsMap);
|
|
284
323
|
}
|
|
285
|
-
|
|
286
|
-
}, [isDragRef, resizableColumns, showTable, columns, columnsMap]);
|
|
324
|
+
}, [_columns, columnsMap, counter, showTable]);
|
|
287
325
|
var _components = (0, _react.useMemo)(function () {
|
|
288
326
|
if (isDragRef) {
|
|
289
327
|
return resizeComponents;
|
|
@@ -26,12 +26,11 @@ var genVtxStyle = function genVtxStyle(token) {
|
|
|
26
26
|
}), '.ant-table-body', _defineProperty({}, '.ant-table-tbody', {
|
|
27
27
|
'>tr.ant-table-placeholder': {
|
|
28
28
|
position: 'absolute',
|
|
29
|
-
bottom:
|
|
29
|
+
bottom: 12,
|
|
30
30
|
right: 0,
|
|
31
31
|
left: 0,
|
|
32
32
|
backgroundColor: 'transparent',
|
|
33
33
|
borderTop: 'none',
|
|
34
|
-
height: '100%',
|
|
35
34
|
borderInlineEnd: "var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)",
|
|
36
35
|
borderBottom: "var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)",
|
|
37
36
|
'>td.ant-table-cell': {
|
|
@@ -46,7 +46,9 @@ function History(props) {
|
|
|
46
46
|
_props$customTablePro = props.customTableProps,
|
|
47
47
|
customTableProps = _props$customTablePro === void 0 ? {} : _props$customTablePro,
|
|
48
48
|
refreshTime = props.refreshTime,
|
|
49
|
-
downloadInNewTab = props.downloadInNewTab
|
|
49
|
+
downloadInNewTab = props.downloadInNewTab,
|
|
50
|
+
_props$headers = props.headers,
|
|
51
|
+
headers = _props$headers === void 0 ? {} : _props$headers;
|
|
50
52
|
var _Form$useForm = _antd.Form.useForm(),
|
|
51
53
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
52
54
|
form = _Form$useForm2[0];
|
|
@@ -159,7 +161,8 @@ function History(props) {
|
|
|
159
161
|
(0, _utils.downloadFile)(downFileUrl, {
|
|
160
162
|
data: {
|
|
161
163
|
id: record.id
|
|
162
|
-
}
|
|
164
|
+
},
|
|
165
|
+
extraHeader: headers
|
|
163
166
|
}, 'blob');
|
|
164
167
|
}
|
|
165
168
|
},
|
|
@@ -259,6 +262,7 @@ History.propTypes = {
|
|
|
259
262
|
TextEnum: _propTypes.default.object,
|
|
260
263
|
customTableProps: _propTypes.default.object,
|
|
261
264
|
refreshTime: _propTypes.default.number,
|
|
262
|
-
downloadInNewTab: _propTypes.default.bool
|
|
265
|
+
downloadInNewTab: _propTypes.default.bool,
|
|
266
|
+
headers: _propTypes.default.object
|
|
263
267
|
};
|
|
264
268
|
var _default = exports.default = History;
|
|
@@ -87,9 +87,11 @@ var VtxExportAsync = exports.VtxExportAsync = function VtxExportAsync(props) {
|
|
|
87
87
|
downloadInNewTab = _props$downloadInNewT === void 0 ? false : _props$downloadInNewT,
|
|
88
88
|
_props$enableCustomSe = props.enableCustomSelect,
|
|
89
89
|
enableCustomSelect = _props$enableCustomSe === void 0 ? false : _props$enableCustomSe,
|
|
90
|
-
beforeExport = props.beforeExport,
|
|
91
90
|
_props$headers = props.headers,
|
|
92
|
-
headers = _props$headers === void 0 ? {} : _props$headers
|
|
91
|
+
headers = _props$headers === void 0 ? {} : _props$headers,
|
|
92
|
+
beforeExport = props.beforeExport,
|
|
93
|
+
_props$historyHeaders = props.historyHeaders,
|
|
94
|
+
historyHeaders = _props$historyHeaders === void 0 ? {} : _props$historyHeaders;
|
|
93
95
|
var _Form$useForm = _antd.Form.useForm(),
|
|
94
96
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
95
97
|
form = _Form$useForm2[0];
|
|
@@ -394,7 +396,8 @@ var VtxExportAsync = exports.VtxExportAsync = function VtxExportAsync(props) {
|
|
|
394
396
|
TextEnum: TextEnum,
|
|
395
397
|
customTableProps: customTableProps,
|
|
396
398
|
refreshTime: refreshTime,
|
|
397
|
-
downloadInNewTab: downloadInNewTab
|
|
399
|
+
downloadInNewTab: downloadInNewTab,
|
|
400
|
+
headers: historyHeaders
|
|
398
401
|
})]
|
|
399
402
|
}));
|
|
400
403
|
};
|
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.22",
|
|
4
4
|
"description": "React components for Vortex",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -216,7 +216,7 @@
|
|
|
216
216
|
"xhr-mock": "^2.5.1",
|
|
217
217
|
"yorkie": "^2.0.0",
|
|
218
218
|
"zustand": "^4.5.7",
|
|
219
|
-
"@vtx/utils": "^1.0.
|
|
219
|
+
"@vtx/utils": "^1.0.25"
|
|
220
220
|
},
|
|
221
221
|
"peerDependencies": {
|
|
222
222
|
"@ant-design/icons": "^6.0.0",
|
|
@@ -225,7 +225,7 @@
|
|
|
225
225
|
"react": ">=18.0.0",
|
|
226
226
|
"react-dom": ">=18.0.0",
|
|
227
227
|
"dayjs": "^1.11.18",
|
|
228
|
-
"@vtx/utils": "^1.0.
|
|
228
|
+
"@vtx/utils": "^1.0.25"
|
|
229
229
|
},
|
|
230
230
|
"peerDependenciesName": "声明宿主依赖",
|
|
231
231
|
"packageManager": "pnpm@9.6.0",
|