File tree Expand file tree Collapse file tree 8 files changed +30
-25
lines changed
Expand file tree Collapse file tree 8 files changed +30
-25
lines changed Original file line number Diff line number Diff line change @@ -121,12 +121,12 @@ export const DEFAULT_CONFIGURATION = {
121121export const getTheme = ( options ?: Options , configuration ?: Configuration ) : Theme => {
122122 const mergedOptions = {
123123 ...DEFAULT_OPTIONS ,
124- ...( options ? options : { } ) ,
124+ ...( options ?? { } ) ,
125125 } ;
126126
127127 const mergedConfiguration = {
128128 ...DEFAULT_CONFIGURATION ,
129- ...( configuration ? configuration : { } ) ,
129+ ...( configuration ?? { } ) ,
130130 } ;
131131
132132 return getZipTheme ( mergedOptions , mergedConfiguration ) ;
Original file line number Diff line number Diff line change @@ -150,12 +150,12 @@ export const DEFAULT_CONFIGURATION: ConfigurationSound = {
150150export const getTheme = ( options ?: Options , configuration ?: Configuration ) : Theme => {
151151 const mergedOptions = {
152152 ...DEFAULT_OPTIONS ,
153- ...( options ? options : { } ) ,
153+ ...( options ?? { } ) ,
154154 } ;
155155
156156 const mergedConfiguration = {
157157 ...DEFAULT_CONFIGURATION ,
158- ...( configuration ? configuration : { } ) ,
158+ ...( configuration ?? { } ) ,
159159 } ;
160160
161161 return getZipTheme ( mergedOptions , mergedConfiguration ) ;
Original file line number Diff line number Diff line change @@ -149,12 +149,12 @@ export const DEFAULT_CONFIGURATION = {
149149export const getTheme = ( options ?: Options , configuration ?: Configuration ) : Theme => {
150150 const mergedOptions = {
151151 ...DEFAULT_OPTIONS ,
152- ...( options ? options : { } ) ,
152+ ...( options ?? { } ) ,
153153 } ;
154154
155155 const mergedConfiguration = {
156156 ...DEFAULT_CONFIGURATION ,
157- ...( configuration ? configuration : { } ) ,
157+ ...( configuration ?? { } ) ,
158158 } ;
159159
160160 return getZipTheme ( mergedOptions , mergedConfiguration ) ;
Original file line number Diff line number Diff line change @@ -44,9 +44,10 @@ const usePagination = <T extends TableNode>(
4444 options ?: PaginationOptions ,
4545 context ?: any ,
4646) : Pagination < T > => {
47- const controlledState : State = primary ?. state
48- ? { ...DEFAULT_STATE , ...primary . state }
49- : { ...DEFAULT_STATE } ;
47+ const controlledState : State = {
48+ ...DEFAULT_STATE ,
49+ ...( primary ?. state ?? { } ) ,
50+ } ;
5051
5152 const onChange = primary ?. onChange ? primary . onChange : ( ) => { } ;
5253
@@ -129,7 +130,7 @@ const usePagination = <T extends TableNode>(
129130
130131 const mergedOptions = {
131132 ...DEFAULT_OPTIONS ,
132- ...( options ? options : { } ) ,
133+ ...( options ?? { } ) ,
133134 } ;
134135
135136 const stateAndGetters = {
Original file line number Diff line number Diff line change @@ -110,9 +110,10 @@ const useRowSelect = <T extends TableNode>(
110110 options ?: SelectOptions ,
111111 context ?: any ,
112112) : Select < T > => {
113- const controlledState : State = primary ?. state
114- ? { ...DEFAULT_STATE , ...primary . state }
115- : { ...DEFAULT_STATE } ;
113+ const controlledState : State = {
114+ ...DEFAULT_STATE ,
115+ ...( primary ?. state ?? { } ) ,
116+ } ;
116117
117118 const onChange = primary ?. onChange ? primary . onChange : ( ) => { } ;
118119
@@ -122,7 +123,7 @@ const useRowSelect = <T extends TableNode>(
122123
123124 const mergedOptions = {
124125 ...DEFAULT_OPTIONS ,
125- ...( options ? options : { } ) ,
126+ ...( options ?? { } ) ,
126127 } ;
127128
128129 return {
Original file line number Diff line number Diff line change @@ -89,9 +89,10 @@ const useSort = <T extends TableNode>(
8989 options : SortOptions ,
9090 context ?: any ,
9191) : Sort < T > => {
92- const controlledState : State = primary ?. state
93- ? { ...DEFAULT_STATE , ...primary . state }
94- : { ...DEFAULT_STATE } ;
92+ const controlledState : State = {
93+ ...DEFAULT_STATE ,
94+ ...( primary . state ?? { } ) ,
95+ } ;
9596
9697 const onChange = primary ?. onChange ? primary . onChange : ( ) => { } ;
9798
Original file line number Diff line number Diff line change @@ -35,9 +35,10 @@ const useCustom = <T extends TableNode>(
3535 primary : StateAndChange | Nullish ,
3636 context ?: any ,
3737) => {
38- const controlledState : State = primary ?. state
39- ? { ...DEFAULT_STATE , ...primary . state }
40- : { ...DEFAULT_STATE } ;
38+ const controlledState : State = {
39+ ...DEFAULT_STATE ,
40+ ...( primary ?. state ?? { } ) ,
41+ } ;
4142
4243 const onChange = primary ?. onChange ? primary . onChange : ( ) => { } ;
4344
Original file line number Diff line number Diff line change @@ -105,9 +105,10 @@ const useTree = <T extends TableNode>(
105105 options ?: TreeOptions < T > ,
106106 context ?: any ,
107107) : Tree < T > => {
108- const controlledState : State = primary ?. state
109- ? { ...DEFAULT_STATE , ...primary . state }
110- : { ...DEFAULT_STATE } ;
108+ const controlledState : State = {
109+ ...DEFAULT_STATE ,
110+ ...( primary ?. state ?? { } ) ,
111+ } ;
111112
112113 const onChange = primary ?. onChange ? primary . onChange : ( ) => { } ;
113114
@@ -117,10 +118,10 @@ const useTree = <T extends TableNode>(
117118
118119 const mergedOptions = {
119120 ...DEFAULT_OPTIONS ,
120- ...( options ? options : { } ) ,
121+ ...( options ?? { } ) ,
121122 treeIcon : {
122123 ...DEFAULT_TREE_ICON ,
123- ...( options ? options . treeIcon : { } ) ,
124+ ...( options ? .treeIcon ?? { } ) ,
124125 } ,
125126 } ;
126127
You can’t perform that action at this time.
0 commit comments