Determines the flex-shrink, flex-grow, and width values for a cell (header or column).
(
column: ColumnPropsWithDefaults,
customStyle: CSSProperties = {}
)
| 67 | |
| 68 | /** Determines the flex-shrink, flex-grow, and width values for a cell (header or column). */ |
| 69 | function getFlexStyleForColumn( |
| 70 | column: ColumnPropsWithDefaults, |
| 71 | customStyle: CSSProperties = {} |
| 72 | ): CSSProperties { |
| 73 | const flexValue = `${column.flexGrow} ${column.flexShrink} ${column.width}px`; |
| 74 | |
| 75 | const style: CSSProperties = { |
| 76 | ...customStyle, |
| 77 | flex: flexValue, |
| 78 | msFlex: flexValue, |
| 79 | WebkitFlex: flexValue |
| 80 | }; |
| 81 | |
| 82 | if (column.maxWidth) { |
| 83 | style.maxWidth = column.maxWidth; |
| 84 | } |
| 85 | |
| 86 | if (column.minWidth) { |
| 87 | style.minWidth = column.minWidth; |
| 88 | } |
| 89 | |
| 90 | return style; |
| 91 | } |
| 92 | |
| 93 | // Callbacks read by the (stable) Grid event handlers. |
| 94 | // They are updated in an insertion effect, so they are current when the Grid calls them during its commit phase. |
no outgoing calls
no test coverage detected