Skip to content

Commit

Permalink
fix: field 存在时才添加占位符
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinke666 committed Nov 29, 2023
1 parent 69bd47a commit 6d9e2b1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/s2-core/src/facet/layout/build-gird-hierarchy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ const buildTotalGridHierarchy = (params: GridHeaderParams) => {

const { dataSet, values, spreadsheet } = facetCfg;
const fieldValues: FieldValue[] = [];
const fieldName = dataSet.getFieldName(currentField);

let query = {};
let query: Record<string, unknown> = {};
const totalsConfig = spreadsheet.getTotalsConfig(currentField);
const dimensionGroup = parentNode.isGrandTotals
? totalsConfig.totalsGroupDimensions
Expand All @@ -44,8 +43,8 @@ const buildTotalGridHierarchy = (params: GridHeaderParams) => {
}),
),
);
if (isEmpty(fieldValues)) {
fieldValues.push(fieldName);
if (isEmpty(fieldValues) && currentField) {
fieldValues.push(EMPTY_FIELD_VALUE);
}
} else if (addTotalMeasureInTotal && currentField === EXTRA_FIELD) {
// add total measures
Expand Down Expand Up @@ -98,7 +97,7 @@ const buildNormalGridHierarchy = (params: GridHeaderParams) => {

// add skeleton for empty data

if (isEmpty(fieldValues)) {
if (isEmpty(fieldValues) && currentField) {
if (currentField === EXTRA_FIELD) {
fieldValues.push(...dataSet.fields?.values);
} else {
Expand Down

0 comments on commit 6d9e2b1

Please sign in to comment.