SAP / fundamental-ngx

Fundamental Library for Angular is SAP Design System Angular component library
https://sap.github.io/fundamental-ngx
Apache License 2.0
267 stars 127 forks source link

[sourcing][Low][Aug] fdp-table support custom table style #9321

Closed oscargong closed 1 year ago

oscargong commented 1 year ago

Is this a bug, enhancement, or feature request?

feature request

Briefly describe your proposal.

Right now, <fdp-table> supports the bodyHeight input, and it will be used as

[style.height]="bodyHeight"

This is not enough if we want to make more adjustments to the table style without using ::ng-deep.

For example, we want to set the table style to

height: max-content
max-height: 30rem

This way, the table height will adjust to the content height when there are not many rows, and it will not take up too much page space when there are a lot of rows.

If <fdp-table> could support a new @Input, such as tableStyle, it would be helpful.

fdp-table: https://github.com/SAP/fundamental-ngx/blob/main/libs/platform/src/lib/table/table.component.ts

Which versions of Angular and Fundamental Library for Angular are affected? (If this is a feature request, use current version.)

0.38

If this is a bug, please provide steps for reproducing it.

N/A

Please provide relevant source code if applicable.

fdp-table: https://github.com/SAP/fundamental-ngx/blob/main/libs/platform/src/lib/table/table.component.ts

Is there anything else we should know?

droshev commented 1 year ago

can't you define a parent element and set the height on it instead?

oscargong commented 1 year ago

Hi @droshev ,

Sure, I can define an outer wrapper div and set its style. But I will lose fdp-table's sticky header. Oscar ScreenCapture 2023-02-02 at 14 00

This feature request is nice-to-have, I still can adjust the inner table style with ::ng-deep

I543348 commented 1 year ago

This is creating an issue for infinite scroll and expected to be fixed from NGX , workaround doesnt work properly

CSENoni commented 1 year ago

One note for this issue is virtualScroll. if we don't define bodyHeight,virtualScrollwill not be working. With bodyHeight like this, it will create a whitespace if there is not many items.

 /**
     * Calculates rows in viewport.
     */
    calculateVirtualScrollRows(): void {
        if (!this.virtualScroll || !this.bodyHeight) {
            return;
        }
    ....

Some scenarios here should be considered:

oscargong commented 1 year ago

We have found workarounds for both the original scenario and the virtual scrolling scenario.

Close this issue.