@@ -31,31 +31,60 @@ export default component$(
3131 tData : tData ,
3232 tHeadings : {
3333 headingList : Object . keys ( tData [ 0 ] ) ,
34+ classList : tHeadings ?. classList || "table-heading" ,
3435 customHeadings : { ...tHeadings ?. customHeadings } ,
35- ...tHeadings ! ,
36+ ...tHeadings ,
3637 } ,
3738 tColumns : {
39+ classList : tColumns ?. classList || "table-column" ,
3840 ...tColumns ,
3941 } ,
4042 tRows : {
43+ classList : tRows ?. classList || "table-row" ,
4144 ...tRows ,
4245 } ,
4346 tableOptions : {
47+ classList : {
48+ table : tableOptions ?. classList ?. table || "table" ,
49+ thead : tableOptions ?. classList ?. thead || "table-head" ,
50+ theadWrapper :
51+ tableOptions ?. classList ?. theadWrapper ||
52+ "table-head-wrapper flex flex-col" ,
53+ headArrowWrapper :
54+ tableOptions ?. classList ?. headArrowWrapper ||
55+ "head-arrow-wrapper flex flex-row items-center justify-between gap-[10px]" ,
56+ sortArrows : {
57+ container :
58+ tableOptions ?. classList ?. sortArrows ?. container ||
59+ "sort-arrow-container flex flex-col select-none cursor-pointer" ,
60+ arrowUp :
61+ tableOptions ?. classList ?. sortArrows ?. arrowUp ||
62+ "sort-arrow-up mb-[-8.5px]" ,
63+ arrowDown :
64+ tableOptions ?. classList ?. sortArrows ?. arrowDown ||
65+ "ort-arrow-down mb-[-8.5px]" ,
66+ } ,
67+ filterInput : {
68+ container :
69+ tableOptions ?. classList ?. filterInput ?. container ||
70+ "filter-input-container relative min-h-[30px] flex items-center" ,
71+ input :
72+ tableOptions ?. classList ?. filterInput ?. input ||
73+ "filter-input w-full bg-white font-normal text-black text-[14px] border rounded-md p-1" ,
74+ } ,
75+ tbody : tableOptions ?. classList ?. tbody || "table-body" ,
76+ } ,
4477 ...tableOptions ,
4578 } ,
4679 sortOptions : {
4780 defaultColor : sortOptions ?. defaultColor || "#aaa" ,
4881 highlightColor : sortOptions ?. highlightColor || "#484848" ,
4982 ...sortOptions ,
5083 } ,
51- filterOptions : {
52- ...filterOptions ,
53- } ,
84+ filterOptions : filterOptions ,
5485 } )
55-
5686 useTask$ ( async ( { track } ) => {
5787 track ( ( ) => [ sortConfigs . param , sortConfigs . order , filterConfigs . params ] )
58-
5988 const filteredData = tData . filter ( ( record : TableRecord ) => {
6089 let i = 0
6190 tableData . tHeadings . headingList . map ( ( param : string ) => {
@@ -82,8 +111,8 @@ export default component$(
82111 } )
83112
84113 return (
85- < table class = { tableData . tableOptions ?. classList } >
86- < thead >
114+ < table class = { tableData . tableOptions ?. classList ?. table } >
115+ < thead class = { tableData . tableOptions ?. classList ?. thead } >
87116 < tr >
88117 { tableData . tHeadings . headingList . map (
89118 ( heading : string , index : number ) => (
@@ -95,8 +124,12 @@ export default component$(
95124 ${ tableData . tColumns ?. columnClassList ?. [ heading ] }
96125 ` }
97126 >
98- < div class = "flex flex-col" >
99- < div class = "flex flex-row items-center justify-between gap-[10px]" >
127+ < div class = { tableData . tableOptions ?. classList ?. theadWrapper } >
128+ < div
129+ class = {
130+ tableData . tableOptions ?. classList ?. headArrowWrapper
131+ }
132+ >
100133 { Object . keys (
101134 tableData . tHeadings . customHeadings || [ ]
102135 ) . includes ( heading )
@@ -109,17 +142,9 @@ export default component$(
109142 { tableData . sortOptions ?. params ?. includes ( heading ) && (
110143 < SortArrows
111144 heading = { heading }
112- classList = { {
113- container :
114- tableData . tableOptions ?. sortArrowsClassList
115- ?. container ,
116- arrowUp :
117- tableData . tableOptions ?. sortArrowsClassList
118- ?. arrowUp ,
119- arrowDown :
120- tableData . tableOptions ?. sortArrowsClassList
121- ?. arrowDown ,
122- } }
145+ classList = {
146+ tableData . tableOptions ?. classList ?. sortArrows
147+ }
123148 sortConfigs = { sortConfigs }
124149 highlightColor = { tableData . sortOptions . highlightColor }
125150 defaultColor = { tableData . sortOptions . defaultColor }
@@ -128,19 +153,25 @@ export default component$(
128153 </ div >
129154 { Object . keys ( tableData . filterOptions ?. params || [ ] ) . length >
130155 0 && (
131- < div class = "relative min-h-[30px] flex items-center" >
156+ < div
157+ class = {
158+ tableData . tableOptions ?. classList ?. filterInput
159+ ?. container
160+ }
161+ >
132162 { tableData . filterOptions ?. params ?. [ heading ] ===
133163 "search" ? (
134164 < FilterInput
135165 classList = {
136- tableData . tableOptions ?. filterInputClassList
166+ tableData . tableOptions ?. classList ?. filterInput
167+ ?. input
137168 }
138169 heading = { heading }
139170 filterConfigs = { filterConfigs }
140171 />
141172 ) : tableData . filterOptions ?. params ?. [ heading ] ===
142173 "options" ? (
143- < > </ >
174+ < > </ > // "options" filter feature (tba)
144175 ) : (
145176 < > </ >
146177 ) }
@@ -152,7 +183,7 @@ export default component$(
152183 ) }
153184 </ tr >
154185 </ thead >
155- < tbody >
186+ < tbody class = { tableData . tableOptions ?. classList ?. tbody } >
156187 { tableData . tData . map ( ( record : TableRecord , index : number ) => {
157188 return (
158189 < tr key = { index } >
@@ -161,10 +192,10 @@ export default component$(
161192 < td
162193 key = { index }
163194 class = { `
164- ${ tableData . tRows ?. classList }
165- ${ tableData . tColumns ?. classList }
166- ${ tableData . tColumns ?. columnClassList ?. [ param ] }
167- ` }
195+ ${ tableData . tRows ?. classList }
196+ ${ tableData . tColumns ?. classList }
197+ ${ tableData . tColumns ?. columnClassList ?. [ param ] }
198+ ` }
168199 >
169200 { tableData . tColumns ?. element$ ?. [ param ] ?.( record , param ) ||
170201 tableData . tColumns ?. customColumns ?. [ param ] ?.(
0 commit comments