File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,31 +77,35 @@ export const handlersTable: ComponentProps = {
7777} ;
7878
7979export const getHandlersTable = ( ) : ControlsFnOptionsType [ ] => {
80- return Object . keys ( handlersTable ) . reduce < ControlsFnOptionsType [ ] > (
81- ( acc , key ) => {
82- if ( Array . isArray ( handlersTable [ key ] ?. type ) ) {
80+ return ( Object . keys ( handlersTable ) as ( keyof ComponentProps ) [ ] ) . reduce <
81+ ControlsFnOptionsType [ ]
82+ > ( ( acc , key ) => {
83+ const entry = handlersTable [ key ] ;
84+ if ( "type" in entry && Array . isArray ( entry . type ) ) {
85+ acc . push ( {
86+ ...( entry as Omit < ControlsFnOptionsType , "name" | "isObjectRow" > ) ,
87+ name : key ,
88+ } ) ;
89+ } else {
90+ const nested = entry as Record <
91+ string ,
92+ Omit < ControlsFnOptionsType , "name" | "isObjectRow" >
93+ > ;
94+ Object . keys ( nested ) . forEach ( ( prop ) => {
8395 acc . push ( {
84- ...handlersTable [ key ] ,
85- name : key ,
96+ ...nested [ prop ] ,
97+ isObjectRow : key === prop ,
98+ name :
99+ key === prop ? (
100+ < b > { prop } </ b >
101+ ) : (
102+ < >
103+ { key } .< b > { prop } </ b >
104+ </ >
105+ ) ,
86106 } ) ;
87- } else {
88- Object . keys ( handlersTable [ key ] ) . forEach ( ( prop ) => {
89- acc . push ( {
90- ...handlersTable [ key ] [ prop ] ,
91- isObjectRow : key === prop ,
92- name :
93- key === prop ? (
94- < b > { prop } </ b >
95- ) : (
96- < >
97- { key } .< b > { prop } </ b >
98- </ >
99- ) ,
100- } ) ;
101- } ) ;
102- }
103- return acc ;
104- } ,
105- [ ] ,
106- ) ;
107+ } ) ;
108+ }
109+ return acc ;
110+ } , [ ] ) ;
107111} ;
Original file line number Diff line number Diff line change 11export const normalizeArgs = ( args : { [ key : string ] : any } ) : any => {
2- const newArgs = { } ;
2+ const newArgs : Record < string , any > = { } ;
33
44 Object . keys ( args ) . forEach ( ( key ) => {
55 const normalizedKey = key . split ( "." ) ;
You can’t perform that action at this time.
0 commit comments