@@ -17,11 +17,11 @@ function _componentRequest(url, method = "GET", data = {}, callback = function (
1717 xhr . onreadystatechange = function ( ) {
1818 if ( xhr . readyState == xhr . DONE && xhr . status == 200 ) {
1919 var response = xhr . response ;
20- callback ( response )
20+ callback ( response ) ;
2121 }
2222 } ;
2323 xhr . onerror = function ( e ) {
24- console . log ( e )
24+ console . log ( e ) ;
2525 } ;
2626}
2727
@@ -60,18 +60,8 @@ class ComponentDot {
6060 let select_str = JSON . stringify ( this . select_data ) ;
6161 this . insert_data = [ ] ;
6262 this . delete_data = [ ] ;
63- let html = `<style>#${ name } -select::-webkit-scrollbar,#${ name } -content::-webkit-scrollbar{width: 4px;height: 4px;}
64- #${ name } -select::-webkit-scrollbar-thumb,#${ name } -content::-webkit-scrollbar-thumb {border-radius: 5px;-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);background: rgba(0,0,0,0.2);}
65- #${ name } -select::-webkit-scrollbar-track,#${ name } -content::-webkit-scrollbar-track {-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);border-radius: 0;background: rgba(0,0,0,0.1);}</style>
66- <div style="width: 100%;height:100%;display: grid; grid-template-rows: 42px auto;border: 1px solid #ccc;border-radius: 5px">
67- <div style="display:flex;background: #e1ffa8bf;"><div style="width:120px;background: #e1ffa8bf;">
68- <input id="${ name } -search" type="text" class="form-control" placeholder="搜索名称"></div>
69- <div id="${ name } -select" style="width:100%;overflow: auto;border-bottom: 1px solid #ccc;padding: 3px;border-radius: 0 0 0 14px;background: #ffffffbf;">${ selected_dom } </div>
70- </div><div id="${ name } -content" style="overflow-y: auto;padding: 3px;background: #e1ffa8bf;">
71- ${ select_dom } </div></div>
72- <input name="${ name } [data]" value='${ select_str } ' type="hidden">
73- <input name="${ name } [insert]" value="[]" type="hidden">
74- <input name="${ name } [delete]" value="[]" type="hidden">` ;
63+ let html = `<style>#${ name } -select::-webkit-scrollbar,#${ name } -content::-webkit-scrollbar{width: 4px;height: 4px;} #${ name } -select::-webkit-scrollbar-thumb,#${ name } -content::-webkit-scrollbar-thumb {border-radius: 5px;-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);background: rgba(0,0,0,0.2);} #${ name } -select::-webkit-scrollbar-track,#${ name } -content::-webkit-scrollbar-track {-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);border-radius: 0;background: rgba(0,0,0,0.1);}</style>
64+ <div style="width: 100%;height:100%;display: grid; grid-template-rows: 42px auto;border: 1px solid #ccc;border-radius: 5px"><div style="display:flex;background: #e1ffa8bf;"><div style="width:120px;background: #e1ffa8bf;"><input id="${ name } -search" type="text" class="form-control" placeholder="搜索名称"></div><div id="${ name } -select" style="width:100%;overflow: auto;border-bottom: 1px solid #ccc;padding: 3px;border-radius: 0 0 0 14px;background: #ffffffbf;">${ selected_dom } </div></div><div id="${ name } -content" style="overflow-y: auto;padding: 3px;background: #e1ffa8bf;">${ select_dom } </div></div><input name="${ name } [data]" value='${ select_str } ' type="hidden"><input name="${ name } [insert]" value="[]" type="hidden"><input name="${ name } [delete]" value="[]" type="hidden">` ;
7565 this . DOM . insertAdjacentHTML ( 'afterbegin' , html ) ;
7666 this . SELECT_DOM = document . getElementById ( name + '-select' ) ;
7767 this . CONTENT_DOM = document . getElementById ( name + '-content' ) ;
@@ -387,12 +377,7 @@ class ComponentPlane {
387377 }
388378
389379 makeModal ( ) {
390- let html = `<div id="dlp" class="modal" style="display: block;">
391- <div class="modal-dialog modal-lg" style="width: ${ window . innerWidth * this . OPTIONS . W } px;">
392- <div class="modal-content">
393- <div class="modal-header" style="background-color: rgb(255, 255, 255); padding: 3px; display: flex; justify-content: flex-end;"></div>
394- <div class="modal-body" style="background-color: rgb(244, 244, 244); padding: 0px; overflow-y: auto; max-height:${ window . innerHeight * this . OPTIONS . H } px; min-height: ${ window . innerHeight * this . OPTIONS . H / 2 } px;"></div>
395- </div></div></div>` ;
380+ let html = `<div id="dlp" class="modal" style="display: block;"><div class="modal-dialog modal-lg" style="width: ${ window . innerWidth * this . OPTIONS . W } px;"><div class="modal-content"><div class="modal-header" style="background-color: rgb(255, 255, 255); padding: 3px; display: flex; justify-content: flex-end;"></div><div class="modal-body" style="background-color: rgb(244, 244, 244); padding: 0px; overflow-y: auto; max-height:${ window . innerHeight * this . OPTIONS . H } px; min-height: ${ window . innerHeight * this . OPTIONS . H / 2 } px;"></div></div></div></div>` ;
396381 document . body . insertAdjacentHTML ( 'beforeEnd' , html ) ;
397382 /*X*/
398383 let X = document . createElement ( 'i' ) ;
@@ -458,30 +443,23 @@ class ComponentPlane {
458443 this . LOADING_DOM = document . createElement ( 'div' ) ;
459444 this . LOADING_DOM . style = 'width: 100%;height: 100px;' ;
460445 this . LOADING_DOM . insertAdjacentHTML ( 'afterbegin' , `<svg version="1.1" style='width: 100%;height:100px' xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
461- width="40px" height="40px" viewBox="0 0 40 40" enable-background="new 0 0 40 40" xml:space="preserve">
462- <path opacity="0.2" fill="#000" d="M20.201,5.169c-8.254,0-14.946,6.692-14.946,14.946c0,8.255,6.692,14.946,14.946,14.946
463- s14.946-6.691,14.946-14.946C35.146,11.861,28.455,5.169,20.201,5.169z M20.201,31.749c-6.425,0-11.634-5.208-11.634-11.634
464- c0-6.425,5.209-11.634,11.634-11.634c6.425,0,11.633,5.209,11.633,11.634C31.834,26.541,26.626,31.749,20.201,31.749z"/>
465- <path fill="#000" d="M26.013,10.047l1.654-2.866c-2.198-1.272-4.743-2.012-7.466-2.012h0v3.312h0
466- C22.32,8.481,24.301,9.057,26.013,10.047z"><animateTransform attributeType="xml"attributeName="transform"
467- type="rotate"from="0 20 20"to="360 20 20"dur="0.5s"repeatCount="indefinite"/></path></svg>` ) ;
468- let firstChild = this . MODEL_BODY_DOM . childNodes [ 0 ] ;
469- if ( firstChild instanceof HTMLElement ) {
470- this . MODEL_BODY_DOM . insertBefore ( loading , firstChild ) ;
471- return ;
472- }
446+ width="40px" height="40px" viewBox="0 0 40 40" enable-background="new 0 0 40 40" xml:space="preserve">
447+ <path opacity="0.2" fill="#000" d="M20.201,5.169c-8.254,0-14.946,6.692-14.946,14.946c0,8.255,6.692,14.946,14.946,14.946
448+ s14.946-6.691,14.946-14.946C35.146,11.861,28.455,5.169,20.201,5.169z M20.201,31.749c-6.425,0-11.634-5.208-11.634-11.634
449+ c0-6.425,5.209-11.634,11.634-11.634c6.425,0,11.633,5.209,11.633,11.634C31.834,26.541,26.626,31.749,20.201,31.749z"/>
450+ <path fill="#000" d="M26.013,10.047l1.654-2.866c-2.198-1.272-4.743-2.012-7.466-2.012h0v3.312h0
451+ C22.32,8.481,24.301,9.057,26.013,10.047z"><animateTransform attributeType="xml"attributeName="transform"
452+ type="rotate"from="0 20 20"to="360 20 20"dur="0.5s"repeatCount="indefinite"/></path></svg>` ) ;
473453 this . MODEL_BODY_DOM . append ( this . LOADING_DOM ) ;
474454 }
475455}
476456
477457class ComponentSortable {
478458 constructor ( list , callback = null ) {
479- this . list = ( typeof list === 'string' )
480- ? document . querySelector ( list )
481- : list ;
459+ this . list = ( typeof list === 'string' ) ? document . querySelector ( list ) : list ;
482460 this . options = {
483461 animationSpeed : 200 ,
484- animationEasing : 'ease-out' ,
462+ animationEasing : 'ease-out'
485463 } ;
486464 this . callback = callback ;
487465 this . animation = false ;
0 commit comments