Skip to content

Commit e2dc759

Browse files
authored
Merge pull request #3778 from VisActor/fix/vtable-hide-rowSeriesNumber-checkbox
Fix/vtable hide row series number checkbox
2 parents a952087 + ff37cb7 commit e2dc759

File tree

3 files changed

+66
-23
lines changed

3 files changed

+66
-23
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "fix: hide rowSeriesNumber and checkbox in aggregation #2173\n\n",
5+
"type": "none",
6+
"packageName": "@visactor/vtable"
7+
}
8+
],
9+
"packageName": "@visactor/vtable",
10+
"email": "zzh7498624@163.com"
11+
}

packages/vtable/src/scenegraph/group-creater/cell-helper.ts

Lines changed: 49 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -349,27 +349,55 @@ export function createCell(
349349
isAsync
350350
);
351351
} else if (type === 'checkbox') {
352-
const createCheckboxCellGroup = Factory.getFunction('createCheckboxCellGroup') as CreateCheckboxCellGroup;
353-
cellGroup = createCheckboxCellGroup(
354-
null,
355-
columnGroup,
356-
0,
357-
y,
358-
col,
359-
row,
360-
colWidth,
361-
cellWidth,
362-
cellHeight,
363-
padding,
364-
textAlign,
365-
textBaseline,
366-
mayHaveIcon,
367-
table,
368-
cellTheme,
369-
define as CheckboxColumnDefine,
370-
range,
371-
isAsync
372-
);
352+
const isAggregation =
353+
'isAggregation' in table.internalProps.layoutMap && table.internalProps.layoutMap.isAggregation(col, row);
354+
const isSeriesNumber = table.internalProps.layoutMap.isSeriesNumber(col, row);
355+
if (isAggregation && isSeriesNumber) {
356+
const createTextCellGroup = Factory.getFunction('createTextCellGroup') as CreateTextCellGroup;
357+
cellGroup = createTextCellGroup(
358+
table,
359+
value,
360+
columnGroup,
361+
0,
362+
y,
363+
col,
364+
row,
365+
colWidth,
366+
cellWidth,
367+
cellHeight,
368+
padding,
369+
textAlign,
370+
textBaseline,
371+
false,
372+
undefined,
373+
true,
374+
cellTheme,
375+
range,
376+
isAsync
377+
);
378+
} else {
379+
const createCheckboxCellGroup = Factory.getFunction('createCheckboxCellGroup') as CreateCheckboxCellGroup;
380+
cellGroup = createCheckboxCellGroup(
381+
null,
382+
columnGroup,
383+
0,
384+
y,
385+
col,
386+
row,
387+
colWidth,
388+
cellWidth,
389+
cellHeight,
390+
padding,
391+
textAlign,
392+
textBaseline,
393+
mayHaveIcon,
394+
table,
395+
cellTheme,
396+
define as CheckboxColumnDefine,
397+
range,
398+
isAsync
399+
);
400+
}
373401
} else if (type === 'radio') {
374402
const createRadioCellGroup = Factory.getFunction('createRadioCellGroup') as CreateRadioCellGroup;
375403
cellGroup = createRadioCellGroup(

packages/vtable/src/scenegraph/group-creater/column-helper.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,15 @@ export function createComplexColumn(
141141
? table.getHeaderDefine(colForDefine, rowForDefine)
142142
: table.getBodyColumnDefine(colForDefine, rowForDefine);
143143
}
144+
const isAggregation =
145+
'isAggregation' in table.internalProps.layoutMap && table.internalProps.layoutMap.isAggregation(col, row);
146+
const isSeriesNumber = table.internalProps.layoutMap.isSeriesNumber(col, row);
147+
144148
let mayHaveIcon =
145149
cellLocation !== 'body'
146150
? true
147-
: (define as IRowSeriesNumber)?.dragOrder || !!define?.icon || !!(define as ColumnDefine)?.tree;
148-
151+
: ((define as IRowSeriesNumber)?.dragOrder || !!define?.icon || !!(define as ColumnDefine)?.tree) &&
152+
!(isAggregation && isSeriesNumber);
149153
if (
150154
!range &&
151155
(table.internalProps.enableTreeNodeMerge || cellLocation !== 'body' || (define as TextColumnDefine)?.mergeCell)

0 commit comments

Comments
 (0)