-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
feat: added column freeze and unfreeze functionality to table widget #18757
Changes from 7 commits
cf4ab0d
d5a7286
0490545
62ccbe5
5f21cff
2482a74
34dfa7f
c32243f
e527e92
5befba8
ab57889
72726b9
9029fe4
2578403
255b91c
cb4997f
85bd5e3
206c4b8
aec5d09
1082ac0
d895ae6
1ca031d
263c8bd
e2dc3d6
09e9e9d
27cd90f
90e8bf5
3b2c62c
d3a0bcb
70b083c
8528318
7922baf
daef34f
f8f7694
80be4eb
9ed9214
7864cf6
513d0b1
f21b6be
aea9723
098cf6d
6dd4485
e8edc52
48aad05
2aae332
6812c64
92c7f4e
a893584
58d9787
c45b5c9
928a61f
ae0e705
33ba1de
6f4942d
6ae9bf2
b3e21f5
ae2ce47
4fde51b
9f96e6c
2c4aa6c
0b5b255
bc3e931
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ | |
"cypress-log-to-output": "^1.1.2", | ||
"dayjs": "^1.10.6", | ||
"deep-diff": "^1.0.2", | ||
"design-system": "npm:@appsmithorg/[email protected].37", | ||
"design-system": "npm:@appsmithorg/[email protected].40-alpha.0", | ||
"downloadjs": "^1.4.7", | ||
"draft-js": "^0.11.7", | ||
"exceljs-lightweight": "^1.14.0", | ||
|
@@ -129,6 +129,7 @@ | |
"react-spring": "^9.4.0", | ||
"react-syntax-highlighter": "^15.5.0", | ||
"react-table": "^7.0.0", | ||
"react-table-sticky": "^1.1.3", | ||
"react-tabs": "^3.0.0", | ||
"react-timer-hook": "^3.0.4", | ||
"react-toastify": "^5.5.0", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,33 +73,37 @@ type BodyPropsType = { | |
const TableVirtualBodyComponent = React.forwardRef( | ||
(props: BodyPropsType, ref: Ref<HTMLDivElement>) => { | ||
return ( | ||
<div {...props.getTableBodyProps()} className="tbody no-scroll"> | ||
<FixedSizeList | ||
height={ | ||
props.height - | ||
props.tableSizes.TABLE_HEADER_HEIGHT - | ||
props.tableSizes.COLUMN_HEADER_HEIGHT - | ||
2 * WIDGET_PADDING // Top and bottom padding | ||
} | ||
itemCount={Math.max(props.rows.length, props.pageSize)} | ||
itemData={props.rows} | ||
itemSize={ | ||
props.tableSizes.ROW_HEIGHT + props.tableSizes.ROW_VIRTUAL_OFFSET | ||
} | ||
outerRef={ref} | ||
width={`calc(100% + ${2 * WIDGET_PADDING}px`} | ||
> | ||
{rowRenderer} | ||
</FixedSizeList> | ||
</div> | ||
<FixedSizeList | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is the outer div removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This outer div is actually moved inside the |
||
className="tbody no-scroll body" | ||
height={ | ||
props.height - | ||
props.tableSizes.TABLE_HEADER_HEIGHT - | ||
props.tableSizes.COLUMN_HEADER_HEIGHT - | ||
2 * WIDGET_PADDING // Top and bottom padding | ||
} | ||
innerElementType={({ children, style, ...rest }: any) => ( | ||
<div {...props.getTableBodyProps()} style={style} {...rest}> | ||
{children} | ||
</div> | ||
)} | ||
itemCount={Math.max(props.rows.length, props.pageSize)} | ||
itemData={props.rows} | ||
itemSize={ | ||
props.tableSizes.ROW_HEIGHT + props.tableSizes.ROW_VIRTUAL_OFFSET | ||
} | ||
outerRef={ref} | ||
width={`calc(100% + ${2 * WIDGET_PADDING}px`} | ||
> | ||
{rowRenderer} | ||
</FixedSizeList> | ||
); | ||
}, | ||
); | ||
|
||
const TableBodyComponent = React.forwardRef( | ||
(props: BodyPropsType, ref: Ref<HTMLDivElement>) => { | ||
return ( | ||
<div {...props.getTableBodyProps()} className="tbody" ref={ref}> | ||
<div {...props.getTableBodyProps()} className="tbody body" ref={ref}> | ||
{props.rows.map((row, index) => { | ||
return <Row index={index} key={index} row={row} />; | ||
})} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
enum
instead of string. Improves type safetyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have set the enum's value to lower-case since the underlying library expects the values in lower case.