@@ -106,19 +106,29 @@ export function registerSubModules(config: RegistrableModule | RegistrableModule
106106
107107 formatModules ( config ) . map ( ( config ) => {
108108 let activeRule : InnerRegisterSubModule [ 'activeRule' ] = undefined ;
109- if ( ! isFunction ( config ) && ! isUndef ( config . activeRule ) ) {
110- const activeRules = isArray ( config . activeRule ) ? config . activeRule : [ config . activeRule ! ] ;
111- activeRule = activeRules . map ( ( rule ) => {
112- if ( isFunction ( rule ) ) {
113- return rule ;
114- } else {
115- return ( location : Location ) => {
116- const path = getLocation ( location ) ;
117- const regex = compilePathRegex ( rule , { } ) ;
118- return ! ! path . match ( regex ) ;
119- } ;
120- }
121- } ) ;
109+
110+ if ( ! isFunction ( config ) ) {
111+ // merge global props
112+ if ( ! isUndef ( loaderOptions . props ) ) {
113+ const globalProps = typeof loaderOptions . props === 'function' ? loaderOptions . props ( ) : loaderOptions . props ;
114+ config . props = { ...globalProps , ...config . props } ;
115+ }
116+
117+ // format activeRule
118+ if ( ! isUndef ( config . activeRule ) ) {
119+ const activeRules = isArray ( config . activeRule ) ? config . activeRule : [ config . activeRule ! ] ;
120+ activeRule = activeRules . map ( ( rule ) => {
121+ if ( isFunction ( rule ) ) {
122+ return rule ;
123+ } else {
124+ return ( location : Location ) => {
125+ const path = getLocation ( location ) ;
126+ const regex = compilePathRegex ( rule , { } ) ;
127+ return ! ! path . match ( regex ) ;
128+ } ;
129+ }
130+ } ) ;
131+ }
122132 }
123133 subModuleConfigs . push ( { config, lifecycles : innerLifecycles , activeRule, activated : false } ) ;
124134 } ) ;
@@ -141,7 +151,10 @@ export function registerSubModules(config: RegistrableModule | RegistrableModule
141151 loader = activeLoader ! ;
142152
143153 return {
144- start : ( options ?: ModuleLoaderOptions & { router ?: Router } ) =>
154+ /**
155+ * Start module loader
156+ */
157+ start : ( options ?: Pick < ModuleLoaderOptions , 'loading' | 'register' > & { router ?: Router } ) =>
145158 execute ( loader ! . _moduleLoader , subModuleConfigs , Object . assign ( { } , loaderOptions , options ) , loader ! . _a ) ,
146159 } ;
147160
0 commit comments