@@ -551,7 +551,6 @@ class ComponentCascadeDot {
551
551
class ComponentLine {
552
552
constructor ( name , columns , data , options = { } ) {
553
553
this . DOM = document . getElementById ( name ) ;
554
- this . NAME = name ;
555
554
this . COLUMNS = columns ;
556
555
this . DATA = data ;
557
556
this . OPTIONS = Object . assign ( {
@@ -579,7 +578,7 @@ class ComponentLine {
579
578
let foot = head ;
580
579
let columns = this . COLUMNS ;
581
580
for ( let column in columns ) {
582
- if ( columns [ column ] . type == 'hidden' ) {
581
+ if ( columns [ column ] . type === 'hidden' ) {
583
582
continue ;
584
583
}
585
584
if ( columns [ column ] . style ) {
@@ -603,13 +602,13 @@ class ComponentLine {
603
602
var tbody = document . createElement ( 'tbody' ) ;
604
603
var object = this ;
605
604
var columns = this . COLUMNS ;
606
- if ( Array . isArray ( this . DATA ) == false ) return ;
605
+ if ( Array . isArray ( this . DATA ) === false ) return ;
607
606
this . DATA . forEach ( function ( value , key ) {
608
607
let tr = document . createElement ( 'tr' ) ;
609
608
tr . setAttribute ( 'sortable-item' , 'sortable-item' ) ;
610
609
let record = { } ;
611
610
for ( let column in columns ) {
612
- if ( columns [ column ] . type == 'hidden' ) {
611
+ if ( columns [ column ] . type === 'hidden' ) {
613
612
if ( value [ column ] ) {
614
613
record [ column ] = value [ column ] ;
615
614
}
@@ -779,7 +778,7 @@ class ComponentPlane {
779
778
}
780
779
781
780
makeModal ( ) {
782
- let html = `<div id="dlp-plane" class="dlp-plane-gauze"><div class="dlp-plane" style="width: ${ window . innerWidth * this . OPTIONS . W } px;"><div class="dlp plane-header"></div><div class="plane-body dlp-scroll" style="max-height:${ window . innerHeight * this . OPTIONS . H } px; min-height: ${ window . innerHeight * this . OPTIONS . H / 2 } px;"></div></div></div>` ;
781
+ let html = `<div id="dlp-plane" class="dlp-plane-gauze"><div class="dlp-plane" style="width: ${ window . innerWidth * this . OPTIONS . W } px;"><div class="dlp plane-header"></div><div class="plane-body dlp-scroll" style="max-height:${ window . innerHeight * this . OPTIONS . H } px;min-height:${ window . innerHeight * this . OPTIONS . H / 2 } px;"></div></div></div>` ;
783
782
document . body . insertAdjacentHTML ( 'beforeEnd' , html ) ;
784
783
this . DOM = document . getElementById ( 'dlp-plane' ) ;
785
784
/*X*/
@@ -800,11 +799,11 @@ class ComponentPlane {
800
799
801
800
makeContent ( ) {
802
801
this . loading ( ) ;
803
- var object = this ;
802
+ let object = this ;
804
803
_component . request ( this . URL , 'GET' , { } , function ( response ) {
805
804
object . loading ( true ) ;
806
- /*object.MODEL_BODY_DOM.innerHTML = response;*/
807
- $ ( '#dlp-plane .plane-body' ) . append ( response ) ;
805
+ let fragment = document . createRange ( ) . createContextualFragment ( response ) ;
806
+ document . querySelector ( '#dlp-plane .plane-body' ) . appendChild ( fragment ) ;
808
807
let submit = object . MODEL_BODY_DOM . querySelector ( 'button[type="submit"]' ) ;
809
808
if ( submit instanceof HTMLElement ) {
810
809
submit . addEventListener ( 'click' , object . submitEvent . bind ( object , submit ) , false ) ;
@@ -817,15 +816,14 @@ class ComponentPlane {
817
816
element . innerText = '提交中...' ;
818
817
let form = this . MODEL_BODY_DOM . getElementsByTagName ( 'form' ) [ 0 ] ;
819
818
let formdata = new FormData ( form ) ;
820
- var object = this ;
819
+ let object = this ;
821
820
_component . request ( this . XHR_URL , this . METHOD , formdata , function ( response ) {
822
821
if ( typeof object . CALLBACK == 'function' ) {
823
822
object . CALLBACK ( response ) ;
824
823
return ;
825
824
}
826
- if ( response . code == 0 ) {
825
+ if ( response . code === 0 ) {
827
826
window . location . reload ( ) ;
828
- return ;
829
827
} else {
830
828
_component . alert ( response . message , 3 , function ( ) {
831
829
element . removeAttribute ( 'disabled' ) ;
@@ -892,7 +890,7 @@ class ComponentSortable {
892
890
893
891
if ( ! this . handle ) return ;
894
892
this . list . style . position = 'relative' ;
895
- this . item . classList . add ( 'is-dragging' )
893
+ this . item . classList . add ( 'is-dragging' ) ;
896
894
this . itemHeight = this . items [ 1 ] . offsetTop ;
897
895
this . startTouchY = this . getDragY ( e ) ;
898
896
this . startTop = this . item . offsetTop ;
@@ -904,13 +902,13 @@ class ComponentSortable {
904
902
item . style . top = 0 ;
905
903
item . style . left = 0 ;
906
904
item . style . transform = `translateY(${ offsetsTop [ index ] } px)` ;
907
- item . style . zIndex = ( item == this . item ) ? 2 : 1 ;
905
+ item . style . zIndex = ( item === this . item ) ? 2 : 1 ;
908
906
} ) ;
909
907
910
908
this . positions = this . items . map ( ( item , index ) => index ) ;
911
909
this . position = Math . round ( ( this . startTop / this . listHeight ) * this . items . length ) ;
912
910
913
- this . touch = e . type == 'touchstart' ;
911
+ this . touch = e . type === 'touchstart' ;
914
912
window . addEventListener ( ( this . touch ? 'touchmove' : 'mousemove' ) , this . dragMove ) ;
915
913
window . addEventListener ( ( this . touch ? 'touchend' : 'mouseup' ) , this . dragEnd , false ) ;
916
914
}
@@ -924,12 +922,12 @@ class ComponentSortable {
924
922
this . item . style . transform = `translateY(${ top } px)` ;
925
923
926
924
this . positions . forEach ( index => {
927
- if ( index == this . position || index != newPosition ) return ;
925
+ if ( index === this . position || index != = newPosition ) return ;
928
926
this . swapElements ( this . positions , this . position , index ) ;
929
927
this . position = index ;
930
928
} ) ;
931
929
this . items . forEach ( ( item , index ) => {
932
- if ( item == this . item ) return ;
930
+ if ( item === this . item ) return ;
933
931
item . style . transform = `translateY(${ this . positions . indexOf ( index ) * this . itemHeight } px)` ;
934
932
item . style . transition = `transform ${ this . options . animationSpeed } ms ${ this . options . animationEasing } ` ;
935
933
} ) ;
0 commit comments