File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -581,6 +581,9 @@ const ZenstackFormInputInternal = (props: ZenstackFormInputProps) => {
581
581
const handleChange = ( event : any ) => {
582
582
const fieldName = props . field . name ;
583
583
584
+ // Call custom element's onChange if it exists
585
+ if ( props . customElement ?. props . onChange ) props . customElement . props . onChange ( event ) ;
586
+
584
587
// Call original onChange
585
588
props . form . getInputProps ( fieldName ) . onChange ( event ) ;
586
589
@@ -619,9 +622,10 @@ const ZenstackFormInputInternal = (props: ZenstackFormInputProps) => {
619
622
620
623
// Filter out props that are already defined in customElement
621
624
const finalProps = Object . fromEntries (
622
- Object . entries ( baseProps ) . filter ( ( [ key ] ) =>
623
- props . customElement ! . props [ key ] === undefined ,
624
- ) ,
625
+ Object . entries ( baseProps ) . filter ( ( [ key ] ) => {
626
+ if ( key === 'onChange' ) return true ; // Don't override onChange
627
+ return props . customElement ! . props [ key ] === undefined ;
628
+ } ) ,
625
629
) ;
626
630
// For custom elements, we need to prioritize the loading placeholder
627
631
if ( props . isLoadingInitialData ) finalProps . placeholder = LOADING_PLACEHOLDER ;
You can’t perform that action at this time.
0 commit comments