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

🙏 在明细表下因合并单元格而产生的三个业务需求(缩略图/合并单元格选中/文字换行) #2456

Closed
1 task
ShiXinClearBoth opened this issue Dec 7, 2023 · 1 comment
Labels
🙏feature request 新需求支持

Comments

@ShiXinClearBoth
Copy link

🏷 Version

Package Version
@antv/s2 1.51.2
@antv/s2-vue 1.5.0

Sheet Type

  • TableSheet

🖋 Description

1:业务中有需求想要实现在cell中可以插入缩略图,我从两个方面入手想要解决这个问题:
a. conditions配置中只有四种可以定义的类型,并不满足;
b.自定义单元格(合并单元格),我在自定义cell中只找到了背景跟Text的相关类重写,根据案例我目前把缩略图放在了背景图片中;
代码如下:

 `drawBackgroundShape() {

     // 缩略图列判断

    if (this.meta.valueField == "22feae38-603c-44f9-b664-2491e8f8drt3") {
      super.drawBackgroundShape();
      this.backgroundShape = this.addShape("image", {
        attrs: {
          ...this.getCellArea(),
          img:
            this.meta.fieldValue.length > 0
              ? this.meta.fieldValue[0].url
              : "https://www.antdv.com/#error",
          // 计算图片显示高度 bug:可视区域高度随滚动变化
          height: this.cells.length * 60,
        },
      });
    } else {
      return super.drawBackgroundShape();
    }
  }`

但是又遇到了以下问题:
b1: 图片大小不能自定义,会有拉伸的情况;
b2: 在合并单元格中滚动可视窗口,图片会跟着一起滚动,可能是因为我计算高度的问题。

  1. 我看过别的issue,说是合并单元格是独立于cell之上的图层,那么我现在想要把合并单元格跟普通单元格的hover、刷选、select等样式统一的话,有什么办法能解决呢?

3.合并单元格的时候,还是希望多余的文字可以配置一下换行。

🏞 What problem does this feature solve

以上的这三个问题,大部分都是在业务中属于对于用户体验来说比较重要的功能,希望可以解答或者交流一下替代方案等。

🧐 Suggest the API

name type default description
- - - -
@firmianaQ
Copy link

解决了吗大佬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙏feature request 新需求支持
Projects
None yet
Development

No branches or pull requests

2 participants