@@ -499,19 +499,18 @@ window.ComponentCascadeDot = class {
499
499
data . forEach ( ( v , k ) => {
500
500
if ( Array . isArray ( v . nodes ) && v . nodes . length !== 0 ) {
501
501
v . nodes = v . nodes . map ( ( N ) => N . key ) ;
502
- v . expand = false ;
503
502
} else {
504
503
v . nodes = null ;
505
504
v . checked = false ;
506
505
}
507
506
let div = document . createElement ( 'div' ) ;
508
507
div . className = 'dlp dlp-text dlp-label' ;
509
- div . insertAdjacentHTML ( 'afterbegin' , `<span>${ v . val } </span>` ) ;
508
+ div . insertAdjacentHTML ( 'afterbegin' , `<i class="left"></i>< span>${ v . val } </span><i class="right"></i >` ) ;
510
509
div . setAttribute ( 'data-id' , v . key ) ;
511
510
div . setAttribute ( 'data-k' , k ) ;
512
511
div . addEventListener ( 'click' , this . select . bind ( this , div , stack ) ) ;
513
512
if ( v . nodes !== null ) {
514
- div . insertAdjacentHTML ( 'afterbegin' , `<i class="left"> ${ _component . caret_right } </i> ` ) ;
513
+ div . querySelector ( 'i.left' ) . insertAdjacentHTML ( 'afterbegin' , `${ _component . caret_right } ` ) ;
515
514
div . addEventListener ( "contextmenu" , ( e ) => {
516
515
if ( e . target instanceof HTMLElement ) e . target . click ( ) ;
517
516
e . preventDefault ( ) ;
@@ -563,7 +562,7 @@ window.ComponentCascadeDot = class {
563
562
if ( data . checked === true ) {
564
563
data . checked = false ;
565
564
this . tagCal ( id , this . MODE . delete ) ;
566
- element . querySelector ( 'i.right' ) !== null && element . removeChild ( element . querySelector ( 'i.right' ) ) ;
565
+ if ( data . nodes === null ) element . querySelector ( 'i.right' ) . innerHTML = '' ;
567
566
for ( let D of this . SELECTED_DOM . childNodes ) {
568
567
if ( parseInt ( D . getAttribute ( 'data-id' ) ) === id ) {
569
568
D . remove ( ) ;
@@ -577,7 +576,6 @@ window.ComponentCascadeDot = class {
577
576
} else {
578
577
currentStackDocuments [ index ] . classList . add ( 'dlp-label-silence' ) ;
579
578
}
580
- this . expand ( data , currentStackDocuments [ index ] , false ) ;
581
579
} ) ;
582
580
if ( data . checked === false ) {
583
581
if ( this . limit > 0 && this . select_data . length >= this . limit && ( this . SELECTED_DOM . firstChild instanceof HTMLElement ) ) {
@@ -586,13 +584,12 @@ window.ComponentCascadeDot = class {
586
584
data . checked = true ;
587
585
this . tagCal ( id , this . MODE . insert ) ;
588
586
element . classList . remove ( 'dlp-label-silence' ) ;
589
- if ( element . querySelector ( 'i.right' ) === null ) element . insertAdjacentHTML ( 'beforeend' , `<i class="right"> ${ _component . check } </i>` ) ;
587
+ element . querySelector ( 'i.right' ) . insertAdjacentHTML ( 'afterbegin' , _component . check ) ;
590
588
this . selectToChildren ( stack + 1 , data . nodes ) ;
591
589
this . selectToSelected ( element , stack ) ;
592
590
this . SELECTED_DOM . scrollTop = this . SELECTED_DOM . scrollHeight ;
593
591
} else {
594
592
element . classList . remove ( 'dlp-label-silence' ) ;
595
- this . expand ( data , element , true ) ;
596
593
this . selectToChildren ( stack + 1 , data . nodes ) ;
597
594
}
598
595
}
@@ -626,23 +623,19 @@ window.ComponentCascadeDot = class {
626
623
if ( checked === true || checked === undefined ) {
627
624
if ( parents . length > 0 && ( parents [ stack - 1 ] !== parentNode ) ) {
628
625
D . classList . add ( 'dlp-label-silence' ) ;
629
- this . expand ( data , D , false ) ;
630
626
} else if ( parents . length === 0 && parseInt ( D . getAttribute ( 'data-id' ) ) !== node ) {
631
627
D . classList . add ( 'dlp-label-silence' ) ;
632
- this . expand ( data , D , false ) ;
633
628
} else {
634
629
D . classList . remove ( 'dlp-label-silence' ) ;
635
630
if ( parseInt ( D . getAttribute ( 'data-id' ) ) === node ) {
636
631
if ( to_first_index === null ) to_first_index = index ;
637
- this . expand ( data , D , true ) ;
638
632
} else {
639
- this . expand ( data , D , false ) ;
640
633
}
641
634
}
642
635
}
643
636
if ( checked === true && node === data . key && data . mark !== true ) {
644
637
data . mark = true ;
645
- D . insertAdjacentHTML ( 'beforeend' , `<i class="right"> ${ _component . check_circle } </i>` ) ;
638
+ D . querySelector ( '.right' ) . insertAdjacentHTML ( 'afterbegin' , _component . check_circle ) ;
646
639
}
647
640
if ( checked === false && node === data . key ) {
648
641
let nodes = this . dimensional_data [ stack ] [ index ] . nodes ;
@@ -653,9 +646,9 @@ window.ComponentCascadeDot = class {
653
646
break ;
654
647
}
655
648
}
656
- if ( cancel && ( D . querySelector ( 'i.right' ) instanceof HTMLElement ) ) {
649
+ if ( cancel ) {
657
650
data . mark = false ;
658
- D . querySelector ( 'i.right' ) . remove ( ) ;
651
+ D . querySelector ( 'i.right' ) . innerHTML = '' ;
659
652
}
660
653
}
661
654
} ) ;
@@ -685,28 +678,14 @@ window.ComponentCascadeDot = class {
685
678
} ) ;
686
679
}
687
680
if ( to_first_index === null ) to_first_index = index ;
688
- this . expand ( data , D , true ) ;
689
681
} else {
690
682
D . classList . add ( 'dlp-label-silence' ) ;
691
- this . expand ( data , D , false ) ;
692
683
}
693
684
} ) ;
694
685
if ( to_first_index !== null ) this . STACKS [ stack ] . scrollTo ( 0 , to_first_index * 27 ) ;
695
686
this . selectToChildren ( stack + 1 , children ) ;
696
687
}
697
688
698
- expand ( data , dom , open = true ) {
699
- if ( data . expand === open ) return ;
700
- data . expand = open ;
701
- let left_mark = dom . querySelector ( 'i.left' ) ;
702
- if ( ! ( left_mark instanceof HTMLElement ) ) return ;
703
- if ( open ) {
704
- left_mark . innerHTML = _component . caret_right_circle ;
705
- return ;
706
- }
707
- left_mark . innerHTML = _component . caret_right ;
708
- }
709
-
710
689
tagCal ( id , operate ) {
711
690
if ( operate === this . MODE . insert ) {
712
691
if ( this . select_data . indexOf ( id ) === - 1 ) {
@@ -786,8 +765,10 @@ window.ComponentCascadeDot = class {
786
765
if ( Array . isArray ( this . COVER_STACK_HASH_DOM [ stack ] ) && this . COVER_STACK_HASH_DOM [ stack ] . indexOf ( d . key ) !== - 1 ) return ;
787
766
let div = document . createElement ( 'div' ) ;
788
767
div . className = 'dlp dlp-text dlp-label' ;
768
+ div . insertAdjacentHTML ( 'afterbegin' , '<i class="left"></i>' ) ;
789
769
div . textContent = d . val ;
790
- if ( d . nodes !== null ) div . insertAdjacentHTML ( 'afterbegin' , `<i class="left">${ _component . caret_right } </i>` ) ;
770
+ div . insertAdjacentHTML ( 'beforeend' , '<i class="right"></i>' ) ;
771
+ if ( d . nodes !== null ) div . querySelector ( 'i.left' ) . insertAdjacentHTML ( 'afterbegin' , _component . caret_right ) ;
791
772
div . addEventListener ( 'click' , ( ) => this . searchCoverClick ( stack , d , this . STACKS [ stack ] . childNodes [ k ] ) ) ;
792
773
this . SELECT_COVER_DOM . childNodes [ stack ] . prepend ( div ) ;
793
774
if ( ! Array . isArray ( this . COVER_STACK_HASH_DOM [ stack ] ) ) {
0 commit comments