@@ -119,6 +119,7 @@ export class CascaderComponent implements OnInit, OnDestroy, OnChanges, ControlV
119119 this . cascaderSrv . initOptions ( this . options ) ;
120120 this . cascaderSrv . isMultiple = this . multiple ;
121121 this . cascaderSrv . isLazyLoad = this . isLazyLoad ;
122+ this . cascaderSrv . checkboxRelation = this . checkboxRelation ;
122123 this . initObservale ( ) ;
123124 this . initI18n ( ) ;
124125 }
@@ -247,6 +248,7 @@ export class CascaderComponent implements OnInit, OnDestroy, OnChanges, ControlV
247248 tagEvent . event . stopPropagation ( ) ;
248249 this . cascaderSrv . updateOptionCheckedStatus ( option . value , false , this . checkboxRelation . upward , this . checkboxRelation . downward ) ;
249250 this . multipleValueList = this . multipleValueList . filter ( t => t . value !== option . value ) ;
251+ this . onChange ( this . cascaderSrv . currentMultipleValue ) ;
250252 // 当taglist变化导致input高度变化时,更新相对位置
251253 setTimeout ( ( ) => {
252254 this . mainDropdown . updateCdkConnectedOverlayOrigin ( ) ;
@@ -287,9 +289,11 @@ export class CascaderComponent implements OnInit, OnDestroy, OnChanges, ControlV
287289 const targetList = [ ] ;
288290 valueList . forEach ( value => {
289291 let cur : CascaderItem ;
292+ let cacheTarget : CascaderItem ;
290293 let list = this . cascaderSrv . options ;
291294 for ( let i = 0 ; i < value . length ; i ++ ) {
292295 cur = list . find ( l => l . value === value [ i ] ) ;
296+ cacheTarget = cur ;
293297 if ( this . isLazyLoad && cur && ! cur . children ?. length && ! cur . isLeaf ) {
294298 this . cascaderSrv . lazyloadMultipleChild ( cur , i ) ;
295299 break ;
@@ -299,17 +303,24 @@ export class CascaderComponent implements OnInit, OnDestroy, OnChanges, ControlV
299303 }
300304 if ( cur && cur . isLeaf ) {
301305 targetList . push ( cur ) ;
306+ cacheTarget = null ;
302307 this . cascaderSrv . updateOptionCheckedStatus ( cur . value , true , this . checkboxRelation . upward , this . checkboxRelation . downward ) ;
303308 }
309+
310+ if ( cacheTarget ) {
311+ targetList . push ( cacheTarget ) ;
312+ this . cascaderSrv . updateOptionCheckedStatus ( cacheTarget . value , true , this . checkboxRelation . upward , this . checkboxRelation . downward ) ;
313+ }
304314 } ) ;
315+
305316 return targetList ;
306317 }
307318
308319 // 获取路径末的label
309320 getLabelFromValue ( value : Array < number | string > ) : string {
310321 let cur ;
311322 let list = this . cascaderSrv . options ;
312- value . map ( item => {
323+ value . forEach ( item => {
313324 cur = list . find ( t => t . value === item ) || '' ;
314325 list = cur . children || [ ] ;
315326 } ) ;
@@ -323,7 +334,7 @@ export class CascaderComponent implements OnInit, OnDestroy, OnChanges, ControlV
323334 let cur ;
324335 let list = this . cascaderSrv . options ;
325336
326- value . map ( ( item , index ) => {
337+ value . forEach ( ( item , index ) => {
327338 cur = list . find ( t => t . value === item ) || '' ;
328339 if ( cur ) {
329340 path = path === '' ? path + cur . label : path + ' / ' + cur . label ;
@@ -385,7 +396,7 @@ export class CascaderComponent implements OnInit, OnDestroy, OnChanges, ControlV
385396 const width = this . dropdownComp . overlay . overlayRef ?. overlayElement . clientWidth ;
386397 const offsetX = this . dropdownComp . overlay . overlayRef ?. overlayElement . offsetLeft ;
387398 const offsetRight = window . innerWidth - width - offsetX - 20 ;
388- this . subMenuDirections . map ( t => { t . offsetX = offsetRight < 0 ? offsetRight : 0 ; } ) ;
399+ this . subMenuDirections . forEach ( t => { t . offsetX = offsetRight < 0 ? offsetRight : 0 ; } ) ;
389400 this . dropdownComp . reposition ( ) ;
390401 } , 0 ) ;
391402 }
0 commit comments