@@ -57,16 +57,9 @@ export default class ConfigValidator implements IConfigValidator {
5757 }
5858 injections . forEach ( ( target , i ) => {
5959 injections [ i ] = this . validateComponent ( target , errors ) ;
60- injections [ i ] . meta . afInitialOrder = injections . length - i ; // to keep initial order for sorting later
6160 } ) ;
62- // sort by (injection.meta?.afOrder || 0) * 1000 desc, fallback to initial order in array
63- return injections . sort (
64- ( a , b ) => (
65- ( b . meta ?. afOrder ?? 0 ) * 1000 || b . meta ?. afInitialOrder
66- ) - (
67- ( a . meta ?. afOrder ?? 0 ) * 1000 || a . meta ?. afInitialOrder
68- )
69- ) ;
61+ // sort by injection.meta?.afOrder || 0 desc
62+ return injections ;
7063 }
7164
7265 checkCustomFileExists ( filePath : string ) : Array < string > {
@@ -122,11 +115,12 @@ export default class ConfigValidator implements IConfigValidator {
122115
123116 const loginPageInjections : AdminForthConfigCustomization [ 'loginPageInjections' ] = {
124117 underInputs : [ ] ,
118+ underLoginButton : [ ] ,
125119 panelHeader : [ ] ,
126120 } ;
127121
128122 if ( this . inputConfig . customization ?. loginPageInjections ) {
129- const ALLOWED_LOGIN_INJECTIONS = [ 'underInputs' , 'panelHeader' ]
123+ const ALLOWED_LOGIN_INJECTIONS = [ 'underInputs' , 'underLoginButton' , ' panelHeader']
130124 Object . keys ( this . inputConfig . customization . loginPageInjections ) . forEach ( ( injection ) => {
131125 if ( ALLOWED_LOGIN_INJECTIONS . includes ( injection ) ) {
132126 loginPageInjections [ injection ] = this . validateAndListifyInjectionNew ( this . inputConfig . customization . loginPageInjections , injection , errors ) ;
@@ -136,7 +130,6 @@ export default class ConfigValidator implements IConfigValidator {
136130 }
137131 } ) ;
138132 }
139-
140133 const globalInjections : AdminForthConfigCustomization [ 'globalInjections' ] = {
141134 userMenu : [ ] ,
142135 header : [ ] ,
@@ -814,7 +807,7 @@ export default class ConfigValidator implements IConfigValidator {
814807 } ) ;
815808
816809 // if pageInjection is a string, make array with one element. Also check file exists
817- const possibleInjections = [ 'beforeBreadcrumbs' , 'beforeActionButtons' , 'afterBreadcrumbs' , 'bottom' , 'threeDotsDropdownItems' , 'customActionIcons' ] ;
810+ const possibleInjections = [ 'beforeBreadcrumbs' , 'beforeActionButtons' , 'afterBreadcrumbs' , 'bottom' , 'threeDotsDropdownItems' , 'customActionIcons' ] ;
818811 const possiblePages = [ 'list' , 'show' , 'create' , 'edit' ] ;
819812
820813 if ( options . pageInjections ) {
@@ -904,6 +897,17 @@ export default class ConfigValidator implements IConfigValidator {
904897
905898 }
906899
900+ validateAfterPluginsActivation ( ) {
901+ const ALLOWED_LOGIN_INJECTIONS = [ 'underInputs' , 'underLoginButton' , 'panelHeader' ]
902+ Object . entries ( this . adminforth . config . customization ) . map ( ( [ key , value ] ) => {
903+ Object . entries ( value ) . map ( ( [ injection , target ] ) => {
904+ if ( ALLOWED_LOGIN_INJECTIONS . includes ( injection ) ) {
905+ ( target as Array < AdminForthComponentDeclarationFull > ) . sort ( ( a , b ) => ( b . meta ?. afOrder ?? 0 ) - ( a . meta ?. afOrder ?? 0 ) ) ;
906+ }
907+ } ) ;
908+ } )
909+ }
910+
907911 validateConfig ( ) {
908912 const errors = [ ] ;
909913 const warnings = [ ] ;
0 commit comments