Refactored table body and footer with divs (#14346)
This PR refactors what is remaining of HTML table API to divs. It is mainly about the body and aggregate footer. Because a `position: sticky` creates a stacking context, and because a div wrapping other divs prevents those children divs from being sticky, it has been found that removing the wrapping container of both header and footer allows us to have all z-index in the same stacking context and create the right experience. Though the fine-tuning of z-index will be done in another PR. There are many fixes left that will be addressed very soon in subsequent PRs. This PR focuses on bringing a functional table both with and without RecordGroups. (Check Task views for that)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
export const filterOutByProperty = <T, K extends keyof T>(property: K, valueToExclude: T[K] | null | undefined) => {
|
||||
return (itemToFilter: T) => {
|
||||
return itemToFilter[property] !== valueToExclude
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
export const findByProperty = <T, K extends keyof T>(property: K, valueToMatch: T[K]) => {
|
||||
export const findByProperty = <T, K extends keyof T>(property: K, valueToMatch: T[K] | null | undefined) => {
|
||||
return (itemToFind: T) => {
|
||||
return itemToFind[property] === valueToMatch
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { isNumberOrNaN } from "@sniptt/guards";
|
||||
|
||||
export const sumByProperty = <T, K extends keyof T>(property: K) => {
|
||||
return (accumulator: number, nextItem: T) => {
|
||||
if(typeof accumulator !== "number") {
|
||||
accumulator = 0;
|
||||
}
|
||||
|
||||
if(!isNumberOrNaN(nextItem[property])) {
|
||||
return accumulator;
|
||||
}
|
||||
|
||||
accumulator += nextItem[property];
|
||||
|
||||
return accumulator
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user