@vtx/components 4.0.0-beta.15 → 4.0.0-beta.16
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.
|
@@ -15,7 +15,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
15
15
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
16
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
17
|
import { useMergedState } from '@rc-component/util';
|
|
18
|
-
import
|
|
18
|
+
import request from '@vtx/utils/lib/request';
|
|
19
19
|
import getSignature from '@vtx/utils/lib/getSignature';
|
|
20
20
|
import { createContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
21
21
|
import { useIntl } from "../../vtx-provider";
|
package/es/vtx-datagrid/index.js
CHANGED
|
@@ -116,9 +116,20 @@ function VtxTable(props) {
|
|
|
116
116
|
var bodyDiv = Array.prototype.filter.call(divs, function (dom) {
|
|
117
117
|
return dom.className.includes('ant-table-body') || dom.className.includes('ant-table-content');
|
|
118
118
|
})[0];
|
|
119
|
+
var tablePlaceholder = Array.prototype.filter.call(rootDomRef.current.getElementsByTagName('tr'), function (dom) {
|
|
120
|
+
return dom.className.includes('ant-table-placeholder');
|
|
121
|
+
})[0];
|
|
119
122
|
if (bodyDiv) {
|
|
120
123
|
bodyDiv.style.minHeight = "".concat(bodyHeight - (rest.scrollY || 0), "px");
|
|
121
124
|
}
|
|
125
|
+
console.log('tablePlaceholder', tablePlaceholder);
|
|
126
|
+
if (tablePlaceholder) {
|
|
127
|
+
tablePlaceholder.style.height = "".concat(bodyHeight - (rest.scrollY || 0), "px");
|
|
128
|
+
var tableCell = Array.prototype.filter.call(tablePlaceholder.getElementsByTagName('td'), function (dom) {
|
|
129
|
+
return dom.className.includes('ant-table-cell');
|
|
130
|
+
})[0];
|
|
131
|
+
tableCell.style.height = "".concat(bodyHeight - (rest.scrollY || 0), "px");
|
|
132
|
+
}
|
|
122
133
|
setState({
|
|
123
134
|
scrollY: bodyHeight
|
|
124
135
|
});
|
|
@@ -181,9 +192,6 @@ function VtxTable(props) {
|
|
|
181
192
|
});
|
|
182
193
|
};
|
|
183
194
|
var _tableColumn = loopFilter(counter.tableColumn);
|
|
184
|
-
if (!columnsMap['_serialNum']) {
|
|
185
|
-
return [];
|
|
186
|
-
}
|
|
187
195
|
return sortByKeyArrayExtract(_tableColumn, sortKeyColumns, columnsMap, 'key');
|
|
188
196
|
}, [columnsMap, counter.tableColumn, sortKeyColumns]);
|
|
189
197
|
|
|
@@ -20,18 +20,29 @@ 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
|
-
|
|
23
|
+
bottom: 0,
|
|
24
24
|
right: 0,
|
|
25
25
|
left: 0,
|
|
26
26
|
backgroundColor: 'transparent',
|
|
27
27
|
borderTop: 'none',
|
|
28
|
+
height: '100%',
|
|
29
|
+
borderInlineEnd: "var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)",
|
|
30
|
+
borderBottom: "var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)",
|
|
28
31
|
'>td.ant-table-cell': {
|
|
29
|
-
|
|
30
|
-
alignItems: 'center',
|
|
31
|
-
justifyContent: 'center',
|
|
32
|
+
padding: 0,
|
|
32
33
|
width: '100%',
|
|
33
34
|
height: '100%',
|
|
34
|
-
border: 'none'
|
|
35
|
+
border: 'none',
|
|
36
|
+
'.ant-table-expanded-row-fixed': {
|
|
37
|
+
display: 'flex',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
justifyContent: 'center',
|
|
40
|
+
height: '100%',
|
|
41
|
+
width: '100%',
|
|
42
|
+
'&:after': {
|
|
43
|
+
borderInlineEnd: 'none'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
35
46
|
}
|
|
36
47
|
}
|
|
37
48
|
}))), '.ant-pagination', _defineProperty({}, '.ant-pagination-item', {
|
|
@@ -47,6 +58,10 @@ var genVtxStyle = function genVtxStyle(token) {
|
|
|
47
58
|
}), '.ant-table-body', {
|
|
48
59
|
'>table >tbody>tr>td': {
|
|
49
60
|
borderInlineColor: 'transparent !important'
|
|
61
|
+
},
|
|
62
|
+
'>table >tbody>tr.ant-table-placeholder': {
|
|
63
|
+
borderInlineColor: 'transparent !important',
|
|
64
|
+
borderBottomColor: 'transparent !important'
|
|
50
65
|
}
|
|
51
66
|
}))))), "&.vtx-datagrid-striped", _defineProperty({}, "".concat(antCls, "-table-wrapper"), _defineProperty({}, "".concat(antCls, "-table"), _defineProperty({}, '>.ant-table-container', _defineProperty({}, '.ant-table-body', {
|
|
52
67
|
'>table >tbody>tr:nth-child(odd)>td': {
|
|
@@ -5,13 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.indexColumnKey = exports.TableContext = exports.Container = void 0;
|
|
7
7
|
var _util = require("@rc-component/util");
|
|
8
|
-
var
|
|
8
|
+
var _request = _interopRequireDefault(require("@vtx/utils/lib/request"));
|
|
9
9
|
var _getSignature = _interopRequireDefault(require("@vtx/utils/lib/getSignature"));
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _vtxProvider = require("../../vtx-provider");
|
|
12
12
|
var _antd = require("antd");
|
|
13
|
-
var
|
|
13
|
+
var _utils = require("../../utils");
|
|
14
14
|
var _renderColumnButtons = _interopRequireDefault(require("../renderColumnButtons"));
|
|
15
|
+
var _utils2 = require("@vtx/utils");
|
|
15
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
18
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
@@ -33,7 +34,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
33
34
|
var indexColumnKey = exports.indexColumnKey = '_serialNum';
|
|
34
35
|
function useContainer() {
|
|
35
36
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
36
|
-
var _ref = (0,
|
|
37
|
+
var _ref = (0, _utils2.getVtxToken)() || {},
|
|
37
38
|
_ref$userId = _ref.userId,
|
|
38
39
|
userId = _ref$userId === void 0 ? '' : _ref$userId,
|
|
39
40
|
_ref$tenantId = _ref.tenantId,
|
|
@@ -175,7 +176,7 @@ function useContainer() {
|
|
|
175
176
|
return _objectSpread(_objectSpread({}, newColumn), {}, {
|
|
176
177
|
key: newColumn.key || newColumn.dataIndex,
|
|
177
178
|
disable: disabledColumnKeys === null || disabledColumnKeys === void 0 ? void 0 : disabledColumnKeys.includes(column.dataIndex || column.key),
|
|
178
|
-
render: (0,
|
|
179
|
+
render: (0, _utils.isFunction)(column.renderButtons) ? function (text, record, index) {
|
|
179
180
|
return (0, _renderColumnButtons.default)({
|
|
180
181
|
renderButtons: column.renderButtons,
|
|
181
182
|
visible: column.renderButtonsVisibleNum,
|
|
@@ -207,7 +208,7 @@ function useContainer() {
|
|
|
207
208
|
fixed = _ref2.fixed,
|
|
208
209
|
disable = _ref2.disable,
|
|
209
210
|
width = _ref2.width;
|
|
210
|
-
var columnKey = (0,
|
|
211
|
+
var columnKey = (0, _utils.genColumnKey)(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
211
212
|
columnKeyMap[columnKey] = {
|
|
212
213
|
show: indexColumn && indexColumnKey == columnKey ? true : (_ref3 = _toConsumableArray(props.defaultVisibleColumnKeys)) === null || _ref3 === void 0 ? void 0 : _ref3.includes(columnKey),
|
|
213
214
|
fixed: fixed,
|
|
@@ -222,7 +223,7 @@ function useContainer() {
|
|
|
222
223
|
fixed = _ref4.fixed,
|
|
223
224
|
disable = _ref4.disable,
|
|
224
225
|
width = _ref4.width;
|
|
225
|
-
var columnKey = (0,
|
|
226
|
+
var columnKey = (0, _utils.genColumnKey)(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
226
227
|
columnKeyMap[columnKey] = {
|
|
227
228
|
show: true,
|
|
228
229
|
fixed: fixed,
|
|
@@ -235,7 +236,7 @@ function useContainer() {
|
|
|
235
236
|
}, [tableColumn, props.defaultVisibleColumnKeys, tableConfig, uniqueKey]);
|
|
236
237
|
|
|
237
238
|
// 深度比较 + 防抖 + 忽略这render函数引用变化
|
|
238
|
-
(0,
|
|
239
|
+
(0, _utils.useDeepCompareEffectDebounce)(function () {
|
|
239
240
|
var columnKeyMap = {};
|
|
240
241
|
if (Array.isArray(visibleColumnKeys)) {
|
|
241
242
|
tableColumn === null || tableColumn === void 0 || tableColumn.forEach(function (_ref5, index) {
|
|
@@ -245,7 +246,7 @@ function useContainer() {
|
|
|
245
246
|
fixed = _ref5.fixed,
|
|
246
247
|
disable = _ref5.disable,
|
|
247
248
|
width = _ref5.width;
|
|
248
|
-
var columnKey = (0,
|
|
249
|
+
var columnKey = (0, _utils.genColumnKey)(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
249
250
|
columnKeyMap[columnKey] = {
|
|
250
251
|
show: isFirst.current && indexColumn && indexColumnKey == columnKey ? true : (_ref6 = _toConsumableArray(visibleColumnKeys)) === null || _ref6 === void 0 ? void 0 : _ref6.includes(columnKey),
|
|
251
252
|
fixed: fixed,
|
|
@@ -261,7 +262,7 @@ function useContainer() {
|
|
|
261
262
|
fixed = _ref7.fixed,
|
|
262
263
|
disable = _ref7.disable,
|
|
263
264
|
width = _ref7.width;
|
|
264
|
-
var columnKey = (0,
|
|
265
|
+
var columnKey = (0, _utils.genColumnKey)(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
265
266
|
columnKeyMap[columnKey] = {
|
|
266
267
|
show: isFirst.current && indexColumn && indexColumnKey == columnKey ? true : (_ref8 = _toConsumableArray(props.defaultVisibleColumnKeys)) === null || _ref8 === void 0 ? void 0 : _ref8.includes(columnKey),
|
|
267
268
|
fixed: fixed,
|
|
@@ -276,7 +277,7 @@ function useContainer() {
|
|
|
276
277
|
fixed = _ref9.fixed,
|
|
277
278
|
disable = _ref9.disable,
|
|
278
279
|
width = _ref9.width;
|
|
279
|
-
var columnKey = (0,
|
|
280
|
+
var columnKey = (0, _utils.genColumnKey)(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
280
281
|
columnKeyMap[columnKey] = {
|
|
281
282
|
show: true,
|
|
282
283
|
fixed: fixed,
|
|
@@ -292,14 +293,14 @@ function useContainer() {
|
|
|
292
293
|
return key;
|
|
293
294
|
});
|
|
294
295
|
if ((sortKeys === null || sortKeys === void 0 ? void 0 : sortKeys.length) > 0) {
|
|
295
|
-
sortKeyColumns.current = (0,
|
|
296
|
+
sortKeyColumns.current = (0, _utils.sortByGivenOrder)(sortKeyColumns.current, sortKeys);
|
|
296
297
|
}
|
|
297
298
|
setColumnsMap(columnKeyMap);
|
|
298
299
|
if (isFirst.current) {
|
|
299
300
|
isFirst.current = false;
|
|
300
301
|
}
|
|
301
302
|
}, [visibleColumnKeys], ['render'], 100);
|
|
302
|
-
(0,
|
|
303
|
+
(0, _utils.useDeepCompareEffectDebounce)(function () {
|
|
303
304
|
var _sortKeyColumns$curre, _props$onVisibleColum;
|
|
304
305
|
var visibleColumnKeys = [];
|
|
305
306
|
(_sortKeyColumns$curre = sortKeyColumns.current) === null || _sortKeyColumns$curre === void 0 || _sortKeyColumns$curre.map(function (columnKey) {
|
|
@@ -319,7 +320,7 @@ function useContainer() {
|
|
|
319
320
|
var params = {
|
|
320
321
|
tableCode: uniqueKey
|
|
321
322
|
};
|
|
322
|
-
|
|
323
|
+
_request.default.get("".concat(location.origin, "/cloud/management/api/v101/user/config/table/page"), {
|
|
323
324
|
body: params
|
|
324
325
|
}).then(function (res) {
|
|
325
326
|
var _res$data;
|
|
@@ -346,7 +347,7 @@ function useContainer() {
|
|
|
346
347
|
var getUniqueKey = function getUniqueKey() {
|
|
347
348
|
var route = location.href.match(/#\/(\S*)\?/);
|
|
348
349
|
if (route) {
|
|
349
|
-
|
|
350
|
+
_request.default.get("".concat(location.pathname, "resources/json/menu.json"), {
|
|
350
351
|
headers: _objectSpread({}, (0, _getSignature.default)({}))
|
|
351
352
|
}).then(function (res) {
|
|
352
353
|
var _res$data2;
|
|
@@ -358,7 +359,7 @@ function useContainer() {
|
|
|
358
359
|
// setUniqueKey('test_demo_7')
|
|
359
360
|
};
|
|
360
361
|
var saveColumns = function saveColumns() {
|
|
361
|
-
|
|
362
|
+
_request.default.post("/cloud/management/api/v101/user/config/table/save", {
|
|
362
363
|
body: JSON.stringify({
|
|
363
364
|
showColumns: "".concat(sortKeyColumns.current.join(','), ";").concat(JSON.stringify(columnsMap)),
|
|
364
365
|
tableCode: uniqueKey,
|
|
@@ -126,9 +126,20 @@ function VtxTable(props) {
|
|
|
126
126
|
var bodyDiv = Array.prototype.filter.call(divs, function (dom) {
|
|
127
127
|
return dom.className.includes('ant-table-body') || dom.className.includes('ant-table-content');
|
|
128
128
|
})[0];
|
|
129
|
+
var tablePlaceholder = Array.prototype.filter.call(rootDomRef.current.getElementsByTagName('tr'), function (dom) {
|
|
130
|
+
return dom.className.includes('ant-table-placeholder');
|
|
131
|
+
})[0];
|
|
129
132
|
if (bodyDiv) {
|
|
130
133
|
bodyDiv.style.minHeight = "".concat(bodyHeight - (rest.scrollY || 0), "px");
|
|
131
134
|
}
|
|
135
|
+
console.log('tablePlaceholder', tablePlaceholder);
|
|
136
|
+
if (tablePlaceholder) {
|
|
137
|
+
tablePlaceholder.style.height = "".concat(bodyHeight - (rest.scrollY || 0), "px");
|
|
138
|
+
var tableCell = Array.prototype.filter.call(tablePlaceholder.getElementsByTagName('td'), function (dom) {
|
|
139
|
+
return dom.className.includes('ant-table-cell');
|
|
140
|
+
})[0];
|
|
141
|
+
tableCell.style.height = "".concat(bodyHeight - (rest.scrollY || 0), "px");
|
|
142
|
+
}
|
|
132
143
|
setState({
|
|
133
144
|
scrollY: bodyHeight
|
|
134
145
|
});
|
|
@@ -191,9 +202,6 @@ function VtxTable(props) {
|
|
|
191
202
|
});
|
|
192
203
|
};
|
|
193
204
|
var _tableColumn = loopFilter(counter.tableColumn);
|
|
194
|
-
if (!columnsMap['_serialNum']) {
|
|
195
|
-
return [];
|
|
196
|
-
}
|
|
197
205
|
return (0, _utils.sortByKeyArrayExtract)(_tableColumn, sortKeyColumns, columnsMap, 'key');
|
|
198
206
|
}, [columnsMap, counter.tableColumn, sortKeyColumns]);
|
|
199
207
|
|
|
@@ -26,18 +26,29 @@ 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
|
-
|
|
29
|
+
bottom: 0,
|
|
30
30
|
right: 0,
|
|
31
31
|
left: 0,
|
|
32
32
|
backgroundColor: 'transparent',
|
|
33
33
|
borderTop: 'none',
|
|
34
|
+
height: '100%',
|
|
35
|
+
borderInlineEnd: "var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)",
|
|
36
|
+
borderBottom: "var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)",
|
|
34
37
|
'>td.ant-table-cell': {
|
|
35
|
-
|
|
36
|
-
alignItems: 'center',
|
|
37
|
-
justifyContent: 'center',
|
|
38
|
+
padding: 0,
|
|
38
39
|
width: '100%',
|
|
39
40
|
height: '100%',
|
|
40
|
-
border: 'none'
|
|
41
|
+
border: 'none',
|
|
42
|
+
'.ant-table-expanded-row-fixed': {
|
|
43
|
+
display: 'flex',
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
justifyContent: 'center',
|
|
46
|
+
height: '100%',
|
|
47
|
+
width: '100%',
|
|
48
|
+
'&:after': {
|
|
49
|
+
borderInlineEnd: 'none'
|
|
50
|
+
}
|
|
51
|
+
}
|
|
41
52
|
}
|
|
42
53
|
}
|
|
43
54
|
}))), '.ant-pagination', _defineProperty({}, '.ant-pagination-item', {
|
|
@@ -53,6 +64,10 @@ var genVtxStyle = function genVtxStyle(token) {
|
|
|
53
64
|
}), '.ant-table-body', {
|
|
54
65
|
'>table >tbody>tr>td': {
|
|
55
66
|
borderInlineColor: 'transparent !important'
|
|
67
|
+
},
|
|
68
|
+
'>table >tbody>tr.ant-table-placeholder': {
|
|
69
|
+
borderInlineColor: 'transparent !important',
|
|
70
|
+
borderBottomColor: 'transparent !important'
|
|
56
71
|
}
|
|
57
72
|
}))))), "&.vtx-datagrid-striped", _defineProperty({}, "".concat(antCls, "-table-wrapper"), _defineProperty({}, "".concat(antCls, "-table"), _defineProperty({}, '>.ant-table-container', _defineProperty({}, '.ant-table-body', {
|
|
58
73
|
'>table >tbody>tr:nth-child(odd)>td': {
|
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.16",
|
|
4
4
|
"description": "React components for Vortex",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -87,7 +87,6 @@
|
|
|
87
87
|
"@emotion/serialize": "^1.3.3",
|
|
88
88
|
"@rc-component/util": "1.3.0",
|
|
89
89
|
"@types/react": "^18.0.0",
|
|
90
|
-
"@vtx/utils": "^1.0.20",
|
|
91
90
|
"@wangeditor/editor": "^5.1.23",
|
|
92
91
|
"@wangeditor/editor-for-react": "^1.0.6",
|
|
93
92
|
"@wangeditor/plugin-upload-attachment": "^1.1.0",
|
|
@@ -216,7 +215,8 @@
|
|
|
216
215
|
"write-pkg": "^4.0.0",
|
|
217
216
|
"xhr-mock": "^2.5.1",
|
|
218
217
|
"yorkie": "^2.0.0",
|
|
219
|
-
"zustand": "^4.5.7"
|
|
218
|
+
"zustand": "^4.5.7",
|
|
219
|
+
"@vtx/utils": "^1.0.20"
|
|
220
220
|
},
|
|
221
221
|
"peerDependencies": {
|
|
222
222
|
"@ant-design/icons": "^6.0.0",
|
|
@@ -224,9 +224,10 @@
|
|
|
224
224
|
"lodash-es": "^4.17.21",
|
|
225
225
|
"react": ">=18.0.0",
|
|
226
226
|
"react-dom": ">=18.0.0",
|
|
227
|
-
"dayjs": "^1.11.18"
|
|
227
|
+
"dayjs": "^1.11.18",
|
|
228
|
+
"@vtx/utils": "^1.0.20"
|
|
228
229
|
},
|
|
229
|
-
"peerDependenciesName":"声明宿主依赖",
|
|
230
|
+
"peerDependenciesName": "声明宿主依赖",
|
|
230
231
|
"packageManager": "pnpm@9.6.0",
|
|
231
232
|
"publishConfig": {
|
|
232
233
|
"access": "public"
|