@kdcloudjs/table 1.2.2-canary.12 → 1.2.2-canary.12-hotfix.1
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/@kdcloudjs/table.css +1 -1
- package/dist/@kdcloudjs/table.js +15 -9
- package/dist/@kdcloudjs/table.js.map +1 -1
- package/dist/@kdcloudjs/table.min.css +1 -1
- package/dist/@kdcloudjs/table.min.js +2 -2
- package/dist/@kdcloudjs/table.min.js.map +1 -1
- package/es/table/base/header.js +11 -7
- package/es/table/interfaces.d.ts +2 -0
- package/es/table/transforms/sort.d.ts +1 -0
- package/es/table/utils/getTreeDepth.js +4 -1
- package/lib/table/base/header.js +11 -7
- package/lib/table/interfaces.d.ts +2 -0
- package/lib/table/transforms/sort.d.ts +1 -0
- package/lib/table/utils/getTreeDepth.js +4 -1
- package/package.json +3 -2
package/es/table/base/header.js
CHANGED
|
@@ -72,12 +72,13 @@ function calculateLeveledAndFlat(inputNested, rowCount) {
|
|
|
72
72
|
leveled.push([]);
|
|
73
73
|
}
|
|
74
74
|
var flat = [];
|
|
75
|
-
dfs(inputNested, 0);
|
|
75
|
+
dfs(inputNested, 0, false);
|
|
76
76
|
return {
|
|
77
77
|
flat: flat,
|
|
78
78
|
leveled: leveled
|
|
79
79
|
};
|
|
80
|
-
function dfs(input, depth) {
|
|
80
|
+
function dfs(input, depth, suppressLeveled) {
|
|
81
|
+
var _a;
|
|
81
82
|
var leafCount = 0;
|
|
82
83
|
for (var i = 0; i < input.length; i++) {
|
|
83
84
|
var indexedCol = input[i];
|
|
@@ -91,12 +92,15 @@ function calculateLeveledAndFlat(inputNested, rowCount) {
|
|
|
91
92
|
colSpan: 1,
|
|
92
93
|
isLeaf: true
|
|
93
94
|
};
|
|
94
|
-
|
|
95
|
+
if (!suppressLeveled) {
|
|
96
|
+
leveled[depth].push(wrapped);
|
|
97
|
+
}
|
|
95
98
|
flat.push(wrapped);
|
|
96
99
|
} else {
|
|
97
|
-
var
|
|
100
|
+
var mergeHeader = Boolean((_a = indexedCol.col) === null || _a === void 0 ? void 0 : _a.isHeaderMerge);
|
|
101
|
+
var dfsRes = dfs(indexedCol.children, depth + 1, suppressLeveled || mergeHeader);
|
|
98
102
|
leafCount += dfsRes.leafCount;
|
|
99
|
-
if (dfsRes.leafCount > 0) {
|
|
103
|
+
if (dfsRes.leafCount > 0 && !suppressLeveled) {
|
|
100
104
|
leveled[depth].push({
|
|
101
105
|
type: 'normal',
|
|
102
106
|
width: indexedCol.col.width,
|
|
@@ -243,9 +247,9 @@ export default function TableHeader(_ref2) {
|
|
|
243
247
|
var cell = /*#__PURE__*/React.createElement("th", _extends({
|
|
244
248
|
key: colIndex
|
|
245
249
|
}, headerCellProps, {
|
|
246
|
-
className: cx(Classes.tableHeaderCell, headerCellProps.className, (_cx = {}, _defineProperty(_cx, Classes.first, colIndex === 0), _defineProperty(_cx, Classes.last, colIndex + colSpan === fullFlatCount), _defineProperty(_cx, Classes.lockLeft, colIndex < leftFlatCount || theaderPosition === 'left'), _defineProperty(_cx, Classes.lockRight, colIndex >= fullFlatCount - rightFlatCount || theaderPosition === 'right'), _defineProperty(_cx, Classes.leaf, wrapped.isLeaf), _cx)),
|
|
250
|
+
className: cx(Classes.tableHeaderCell, headerCellProps.className, (_cx = {}, _defineProperty(_cx, Classes.first, colIndex === 0), _defineProperty(_cx, Classes.last, colIndex + colSpan === fullFlatCount), _defineProperty(_cx, Classes.lockLeft, colIndex < leftFlatCount || theaderPosition === 'left'), _defineProperty(_cx, Classes.lockRight, colIndex >= fullFlatCount - rightFlatCount || theaderPosition === 'right'), _defineProperty(_cx, Classes.leaf, wrapped.isLeaf || col.isHeaderMerge), _cx)),
|
|
247
251
|
colSpan: colSpan,
|
|
248
|
-
rowSpan: isLeaf ? rowCount - level : undefined,
|
|
252
|
+
rowSpan: isLeaf || col.isHeaderMerge ? rowCount - level : undefined,
|
|
249
253
|
style: _extends(_extends({
|
|
250
254
|
textAlign: col.align,
|
|
251
255
|
verticalAlign: (_b = col.verticalAlign) !== null && _b !== void 0 ? _b : 'middle'
|
package/es/table/interfaces.d.ts
CHANGED
|
@@ -12,12 +12,15 @@ export default function getTreeDepth(nodes) {
|
|
|
12
12
|
dfs(nodes, 0);
|
|
13
13
|
return maxDepth;
|
|
14
14
|
function dfs(columns, depth) {
|
|
15
|
+
var _a;
|
|
15
16
|
var _iterator = _createForOfIteratorHelper(columns),
|
|
16
17
|
_step;
|
|
17
18
|
try {
|
|
18
19
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
19
20
|
var column = _step.value;
|
|
20
|
-
|
|
21
|
+
var isHeaderMerge = ((_a = column) === null || _a === void 0 ? void 0 : _a.isHeaderMerge) === true;
|
|
22
|
+
// 当列配置了 isHeaderMerge 时,将其视作“可视叶子”,不再深入子层计算深度
|
|
23
|
+
if (isLeafNode(column) || isHeaderMerge) {
|
|
21
24
|
maxDepth = Math.max(maxDepth, depth);
|
|
22
25
|
} else {
|
|
23
26
|
dfs(column.children, depth + 1);
|
package/lib/table/base/header.js
CHANGED
|
@@ -79,12 +79,13 @@ function calculateLeveledAndFlat(inputNested, rowCount) {
|
|
|
79
79
|
leveled.push([]);
|
|
80
80
|
}
|
|
81
81
|
var flat = [];
|
|
82
|
-
dfs(inputNested, 0);
|
|
82
|
+
dfs(inputNested, 0, false);
|
|
83
83
|
return {
|
|
84
84
|
flat: flat,
|
|
85
85
|
leveled: leveled
|
|
86
86
|
};
|
|
87
|
-
function dfs(input, depth) {
|
|
87
|
+
function dfs(input, depth, suppressLeveled) {
|
|
88
|
+
var _a;
|
|
88
89
|
var leafCount = 0;
|
|
89
90
|
for (var i = 0; i < input.length; i++) {
|
|
90
91
|
var indexedCol = input[i];
|
|
@@ -98,12 +99,15 @@ function calculateLeveledAndFlat(inputNested, rowCount) {
|
|
|
98
99
|
colSpan: 1,
|
|
99
100
|
isLeaf: true
|
|
100
101
|
};
|
|
101
|
-
|
|
102
|
+
if (!suppressLeveled) {
|
|
103
|
+
leveled[depth].push(wrapped);
|
|
104
|
+
}
|
|
102
105
|
flat.push(wrapped);
|
|
103
106
|
} else {
|
|
104
|
-
var
|
|
107
|
+
var mergeHeader = Boolean((_a = indexedCol.col) === null || _a === void 0 ? void 0 : _a.isHeaderMerge);
|
|
108
|
+
var dfsRes = dfs(indexedCol.children, depth + 1, suppressLeveled || mergeHeader);
|
|
105
109
|
leafCount += dfsRes.leafCount;
|
|
106
|
-
if (dfsRes.leafCount > 0) {
|
|
110
|
+
if (dfsRes.leafCount > 0 && !suppressLeveled) {
|
|
107
111
|
leveled[depth].push({
|
|
108
112
|
type: 'normal',
|
|
109
113
|
width: indexedCol.col.width,
|
|
@@ -250,9 +254,9 @@ function TableHeader(_ref2) {
|
|
|
250
254
|
var cell = /*#__PURE__*/_react.default.createElement("th", (0, _extends2.default)({
|
|
251
255
|
key: colIndex
|
|
252
256
|
}, headerCellProps, {
|
|
253
|
-
className: (0, _classnames.default)(_styles.Classes.tableHeaderCell, headerCellProps.className, (_cx = {}, (0, _defineProperty2.default)(_cx, _styles.Classes.first, colIndex === 0), (0, _defineProperty2.default)(_cx, _styles.Classes.last, colIndex + colSpan === fullFlatCount), (0, _defineProperty2.default)(_cx, _styles.Classes.lockLeft, colIndex < leftFlatCount || theaderPosition === 'left'), (0, _defineProperty2.default)(_cx, _styles.Classes.lockRight, colIndex >= fullFlatCount - rightFlatCount || theaderPosition === 'right'), (0, _defineProperty2.default)(_cx, _styles.Classes.leaf, wrapped.isLeaf), _cx)),
|
|
257
|
+
className: (0, _classnames.default)(_styles.Classes.tableHeaderCell, headerCellProps.className, (_cx = {}, (0, _defineProperty2.default)(_cx, _styles.Classes.first, colIndex === 0), (0, _defineProperty2.default)(_cx, _styles.Classes.last, colIndex + colSpan === fullFlatCount), (0, _defineProperty2.default)(_cx, _styles.Classes.lockLeft, colIndex < leftFlatCount || theaderPosition === 'left'), (0, _defineProperty2.default)(_cx, _styles.Classes.lockRight, colIndex >= fullFlatCount - rightFlatCount || theaderPosition === 'right'), (0, _defineProperty2.default)(_cx, _styles.Classes.leaf, wrapped.isLeaf || col.isHeaderMerge), _cx)),
|
|
254
258
|
colSpan: colSpan,
|
|
255
|
-
rowSpan: isLeaf ? rowCount - level : undefined,
|
|
259
|
+
rowSpan: isLeaf || col.isHeaderMerge ? rowCount - level : undefined,
|
|
256
260
|
style: (0, _extends2.default)((0, _extends2.default)({
|
|
257
261
|
textAlign: col.align,
|
|
258
262
|
verticalAlign: (_b = col.verticalAlign) !== null && _b !== void 0 ? _b : 'middle'
|
|
@@ -19,12 +19,15 @@ function getTreeDepth(nodes) {
|
|
|
19
19
|
dfs(nodes, 0);
|
|
20
20
|
return maxDepth;
|
|
21
21
|
function dfs(columns, depth) {
|
|
22
|
+
var _a;
|
|
22
23
|
var _iterator = _createForOfIteratorHelper(columns),
|
|
23
24
|
_step;
|
|
24
25
|
try {
|
|
25
26
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
26
27
|
var column = _step.value;
|
|
27
|
-
|
|
28
|
+
var isHeaderMerge = ((_a = column) === null || _a === void 0 ? void 0 : _a.isHeaderMerge) === true;
|
|
29
|
+
// 当列配置了 isHeaderMerge 时,将其视作“可视叶子”,不再深入子层计算深度
|
|
30
|
+
if ((0, _isLeafNode.default)(column) || isHeaderMerge) {
|
|
28
31
|
maxDepth = Math.max(maxDepth, depth);
|
|
29
32
|
} else {
|
|
30
33
|
dfs(column.children, depth + 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kdcloudjs/table",
|
|
3
|
-
"version": "1.2.2-canary.12",
|
|
3
|
+
"version": "1.2.2-canary.12-hotfix.1",
|
|
4
4
|
"description": "金蝶 react table 组件",
|
|
5
5
|
"title": "table",
|
|
6
6
|
"keywords": [
|
|
@@ -57,7 +57,8 @@
|
|
|
57
57
|
"pub": "npm run test:all && npm run build && cross-env PUB_ENV=pub np --no-cleanup --no-tests",
|
|
58
58
|
"pub:canary": "npm run build && cross-env PUB_ENV=pub np --no-cleanup --anyBranch --no-tests --tag=canary",
|
|
59
59
|
"new": "node scripts/create-component.js",
|
|
60
|
-
"kd-ui": "npm install @kingdee-ui/kui --registry http://npm.kingdee.com/"
|
|
60
|
+
"kd-ui": "npm install @kingdee-ui/kui --registry http://npm.kingdee.com/",
|
|
61
|
+
"pub:canary-hotfix": "npm run build && cross-env PUB_ENV=pub np --no-cleanup --anyBranch --no-tests --tag=canaryHotFix"
|
|
61
62
|
},
|
|
62
63
|
"browserslist": [
|
|
63
64
|
"last 2 versions",
|