-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added col, row & cell styles by its definitions
- Loading branch information
Showing
25 changed files
with
324 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/table/src/helpers/afterRow/addAfterRowToRowDefs.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { describe, test, expect } from 'vitest'; | ||
|
||
import { TRowDef } from '../../declarations'; | ||
import { addAfterRowToRowDefs } from './addAfterRowToRowDefs'; | ||
|
||
describe('Add afterrow to row defs', () => { | ||
describe('addAfterRowToRowDefs', () => { | ||
const cases: [string, TRowDef[], string, TRowDef[]][] = [ | ||
[ | ||
'add element with rowdefs empty', | ||
[], | ||
'1', | ||
[{ id: `afterRow-1`, hide: false }], | ||
], | ||
[ | ||
'add element with rowdefs > 0', | ||
[{ id: `afterRow-1`, hide: false }], | ||
'2', | ||
[ | ||
{ id: `afterRow-1`, hide: false }, | ||
{ id: `afterRow-2`, hide: false }, | ||
], | ||
], | ||
['add element with rowdefs empty', null, '1', undefined], | ||
]; | ||
|
||
test.each(cases)('%s', (_title, rowDefs, id, expected) => { | ||
expect(addAfterRowToRowDefs(rowDefs, id, () => null, 13)).toMatchObject( | ||
expected, | ||
); | ||
}); | ||
}); | ||
}); |
18 changes: 18 additions & 0 deletions
18
packages/table/src/helpers/afterRow/addAfterRowToRowDefs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import * as React from 'react'; | ||
|
||
import type { TCellRenderer, TRowDef } from '../../declarations'; | ||
|
||
export const addAfterRowToRowDefs = ( | ||
rowDefs: TRowDef[], | ||
id: string, | ||
afterRowRenderer: | ||
| React.FC<TCellRenderer> | ||
| (({ value, colDef, rowIndex, row }: TCellRenderer) => React.ReactNode), | ||
afterRowHeight: number, | ||
) => | ||
rowDefs?.concat({ | ||
id: `afterRow-${id}`, | ||
hide: false, | ||
cellRenderer: afterRowRenderer, | ||
height: afterRowHeight, | ||
}); |
Oops, something went wrong.