Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🤔想增加多行文本功能,版本从1.0.0升级到2.0.0-next.28后,高度及换行都不生效 #2906

Open
3 tasks
Chen-hah opened this issue Sep 20, 2024 · 1 comment
Labels
next 2.0-next 版本的问题 ❔question 疑问/使用问题

Comments

@Chen-hah
Copy link

🏷 Version 2.0.0-next.28

Package Version
@antv/s2 2.0.0-next.28
@antv/s2-react
@antv/s2-vue

Sheet Type

PivotSheet、TableSheet这两个都有使用到

  • [ 1] PivotSheet
  • [1 ] TableSheet
  • GridAnalysisSheet
  • StrategySheet
  • EditableSheet

🖋 Description

想增加多行文本功能,版本从1.0.0升级到2.0.0-next.28后,卸载依赖后又重新安装的版本,也重新启动项目了,但是在原始项目里面依然只能只用1.X版本里面的s2Options设置style的colCfg、cellCfg才能设置高度、宽度(之前也只设置了高度、宽度相关的东西),版本升级换成了rowCell、colCell等都不生效,高度也不生效了

关键代码如下:
export function getSize(chart) {
const size = {};
let customAttr = {};
if (chart.customAttr) {
customAttr = JSON.parse(chart.customAttr);
console.log(chart.type,customAttr,'customAttr');

if (customAttr.size) {
  const s = JSON.parse(JSON.stringify(customAttr.size));
  if (chart.type !== 'table-pivot') {
    size.rowCell = {
      height: s.tableTitleHeight,
      ...cellTextWordWrapStyle
    }
    size.cornerCell = {
      height: s.tableTitleHeight,
      ...cellTextWordWrapStyle
    }
  }
  size.colCell = {
    height: s.tableTitleHeight,
    ...cellTextWordWrapStyle
  };
  size.dataCell = {
    height: s.tableItemHeight,
  };
  if (s.tableColumnMode && s.tableColumnMode === 'adapt') {
    delete size.dataCell.width;
    size.layoutWidthType = 'compact';
  } else {
    delete size.layoutWidthType;
    size.dataCell.width = s.tableColumnWidth;
  }
}

}

return size;
}

const s2Options = {
width: containerDom.offsetWidth,
height: containerDom.offsetHeight,
// showSeriesNumber: true
style: getSize(chart),
};

// 开始渲染
if (s2) {
s2.destroy();
}
s2 = new TableSheet(containerDom, s2DataConfig, s2Options);

🔗 Reproduce Link

😊 Expected Behavior

😅 Current Behavior

@Chen-hah Chen-hah added the ❔question 疑问/使用问题 label Sep 20, 2024
@github-actions github-actions bot added the next 2.0-next 版本的问题 label Sep 20, 2024
@Chen-hah
Copy link
Author

单独新建的项目直接使用又是可以的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next 2.0-next 版本的问题 ❔question 疑问/使用问题
Projects
None yet
Development

No branches or pull requests

1 participant