@@ -866,19 +866,29 @@ export class AppointmentForm {
866866 }
867867
868868 private alignIconsWithEditors ( ) : void {
869- const $groups = this . dxForm . $ element( ) . find ( `.${ CLASSES . groupWithIcon } ` ) ;
869+ const groupElements = this . dxForm . element ( ) . querySelectorAll ( `.${ CLASSES . groupWithIcon } ` ) ;
870870
871- $groups . toArray ( ) . forEach ( ( groupElement ) => {
872- const $group = $ ( groupElement ) ;
873- const $icon = $group . find ( `.${ CLASSES . formIcon } ` ) ;
874- const $items = $group . find ( `.${ CLASSES . formItem } :not(:has(.${ CLASSES . formIcon } ))` ) ;
875- const $firstSimpleItem = $items . filter ( `:not(:has(.${ CLASSES . formItem } ))` ) . first ( ) ;
871+ groupElements . forEach ( ( groupElement ) => {
872+ const iconElement = groupElement . querySelector ( `.${ CLASSES . formIcon } ` ) ;
876873
877- const hasTopLabel = $firstSimpleItem . find ( `.${ CLASSES . labelTop } ` ) . length > 0 ;
878- const hasInnerLabel = $firstSimpleItem . find ( `.${ CLASSES . label } ` ) . length > 0 ;
874+ const itemElements = groupElement . querySelectorAll ( `.${ CLASSES . fieldItemContent } ` ) ;
875+ const firstSimpleItemElement = Array . from ( itemElements )
876+ . find ( ( itemElement ) => {
877+ const isGroup = itemElement . querySelector ( `.${ CLASSES . formItem } ` ) !== null ;
878+ const isIcon = itemElement . querySelector ( `.${ CLASSES . formIcon } ` ) !== null ;
879879
880- $icon . toggleClass ( CLASSES . formIconTopLabelOffset , hasTopLabel ) ;
881- $icon . toggleClass ( CLASSES . formIconInnerLabelOffset , hasInnerLabel ) ;
880+ return ! isGroup && ! isIcon ;
881+ } ) ;
882+
883+ if ( ! firstSimpleItemElement || ! iconElement ) {
884+ return ;
885+ }
886+
887+ const hasTopLabel = firstSimpleItemElement . querySelector ( `.${ CLASSES . labelTop } ` ) !== null ;
888+ const hasInnerLabel = firstSimpleItemElement . querySelector ( `.${ CLASSES . label } ` ) !== null ;
889+
890+ iconElement . classList . toggle ( CLASSES . formIconTopLabelOffset , hasTopLabel ) ;
891+ iconElement . classList . toggle ( CLASSES . formIconInnerLabelOffset , hasInnerLabel ) ;
882892 } ) ;
883893 }
884894
0 commit comments