@@ -484,10 +484,11 @@ public function switchs($name = '', $switch=[], $options = [], $value = '')
484484 {
485485 $ switchArr = $ this ->getArray ($ name ,$ switch );
486486 $ switchStr = $ switchArr ? $ this ->__ ($ switchArr [1 ]) . '| ' . $ this ->__ ($ switchArr [0 ]) : $ this ->__ ('open ' ) . '| ' . 'close ' ;
487+ $ checked = $ value ?'checked="true" ' :'' ;
487488 $ str = <<<EOF
488489 <div class="layui-form-item"> {$ this ->label ($ name , $ options )}
489490 <div class="layui-input-block">
490- <input {$ this ->getDataPropAttr ($ name ,$ value ,$ options )} class=" {$ this ->getClass ($ options )}" type="checkbox" checked="" lay-skin="switch" lay-text=" {$ switchStr }" data-text=" {$ this ->__ ($ value )}"/>
491+ <input {$ this ->getDataPropAttr ($ name ,$ value ,$ options )} class=" {$ this ->getClass ($ options )}" type="checkbox" { $ checked} lay-skin="switch" lay-text=" {$ switchStr }" data-text=" {$ this ->__ ($ value )}"/>
491492 {$ this ->tips ($ options )}
492493 </div>
493494 </div>'
@@ -688,7 +689,7 @@ public function selectn($name = '', $select= [], $options=[], $attr=[], $value=
688689<div class="layui-form-item layui-form" lay-filter=" {$ name }"> {$ this ->label ($ name ,$ options )}
689690 <div class="layui-input-block">
690691 <div data-verify =" {$ this ->labelRequire ($ options )}"
691- {$ this ->getDataPropAttr ($ name , $ value , $ options )} class=" {$ this ->getClass ($ options )}" {$ this ->search ($ options )} {$ this ->readonlyOrdisabled ($ options )} >
692+ {$ this ->getDataPropAttr ($ name , $ value , $ options )} class=" {$ this ->getClass ($ options )}" {$ this ->laysearch ($ options )} {$ this ->readonlyOrdisabled ($ options )} >
692693 </div>
693694 {$ this ->tips ($ options )}
694695 </div>
@@ -752,6 +753,19 @@ public function autocomplete($name='',$list=[],$options=[],$attr=[],$value=''){
752753EOF ;
753754 return $ str ;
754755 }
756+
757+ /**
758+ * @param $name
759+ * @param $select
760+ * @param $options
761+ * @param $attr
762+ * @param $value
763+ * @return string
764+ */
765+ public function select ($ name = '' , $ select =[], $ options =[], $ attr =[], $ value ='' )
766+ {
767+ return $ this ->multiselect ($ name ,$ select ,$ options ,$ attr ,$ value );
768+ }
755769 /**
756770 * @param $name
757771 * @param $select
@@ -947,8 +961,8 @@ public function color($name = '', $options = [], $value = '')
947961 public function icon ($ name = '' , $ options = [], $ value = '' )
948962 {
949963 list ($ name ,$ id ) = $ this ->getNameId ($ name ,$ options );
950- $ value = $ value ?: 'layui-icon-app ' ;
951- $ options ['filter ' ] = 'iconPickers ' ;
964+ $ value = $ value ?: 'layui-icon layui-icon -app ' ;
965+ $ options ['filter ' ] = 'iconPicker ' ;
952966 $ str = <<<EOF
953967<div class="layui-form-item"> {$ this ->label ($ name ,$ options )}
954968 <div class="layui-input-block">
@@ -1057,10 +1071,17 @@ public function editor($name = 'container', $options = [], $value = '')
10571071
10581072 $ text = '' ;
10591073 if (isset ($ options ['textarea ' ])) {
1060- $ text = <<<EOF
1061- <textarea {$ this ->getNameValueAttr ($ name ,$ value ,$ options )} </textarea>
1074+ $ verify = '' ;
1075+ if (!empty ($ options ['verify ' ])){
1076+ $ verify = 'lay-verify =" ' .$ options ['verify ' ].'" ' ;
1077+ }
1078+ $ text = <<<EOF
1079+ <textarea {$ verify } {$ this ->getNameValueAttr ($ name ,$ value ,$ options )} </textarea>
10621080EOF ;
10631081 }
1082+ if (!empty ($ options ['verify ' ])){
1083+ unset($ options ['verify ' ]);
1084+ }
10641085 $ content = <<<EOF
10651086 <div {$ this ->getDataPropAttr ($ name ,$ value ,$ options )} lay-editor type="text/plain" >
10661087 {$ text }
@@ -1122,21 +1143,25 @@ public function upload($name = 'avatar', $options = [], $value = '')
11221143 if ($ k + 1 <= $ options ['num ' ]) {
11231144 switch ($ options ['mime ' ]) {
11241145 case 'video ' :
1146+ $ v = $ v ?:'/static/backend/images/filetype/video.png ' ;
11251147 $ li .= <<<EOF
11261148<li><video lay-event="" class="layui-upload-img fl" width="150" src=" {$ v }"></video> <i class="layui-icon layui-icon-close" lay-event="filedelete" data-fileurl=" $ v"></i></li>
11271149EOF ;
11281150 break ;
11291151 case 'audio ' :
1152+ $ v = $ v ?:'/static/backend/images/filetype/audio.jpg ' ;
11301153 $ li .= <<<EOF
11311154<li><audio lay-event="" class="layui-upload-img fl" width="150" src="' {$ v }"></audio> <i class="layui-icon layui-icon-close" lay-event="filedelete" data-fileurl=" {$ v }"></i></li>
11321155EOF ;
11331156 break ;
11341157 case 'images ' :
1158+ $ v = $ v ?:'/static/backend/images/filetype/image.jpg ' ;
11351159 $ li .= <<<EOF
11361160<li><img lay-event="photos" class="layui-upload-img fl" width="150" src=" {$ v }"></img> <i class="layui-icon layui-icon-close" lay-event="filedelete" data-fileurl=" {$ v }"></i></li>
11371161EOF ;
11381162 break ;
11391163 case 'image ' :
1164+ $ v = $ v ?:'/static/backend/images/filetype/image.jpg ' ;
11401165 $ li .= <<<EOF
11411166<li><img lay-event="photos" class="layui-upload-img fl" width="150" src=" {$ v }"></img> <i class="layui-icon layui-icon-close" lay-event="filedelete" data-fileurl=" {$ v }"></i></li>
11421167EOF ;
@@ -1396,7 +1421,7 @@ protected function tips($options = [])
13961421 * @ 验证
13971422 * @return string
13981423 */
1399- protected function verify ($ options = [])
1424+ protected function layverify ($ options = [])
14001425 {
14011426 $ verify = '' ;
14021427 if (isset ($ options ['verify ' ])) {
@@ -1417,26 +1442,74 @@ protected function verify($options = [])
14171442 * @param $options
14181443 * @return string
14191444 */
1420- protected function filter ($ options = [])
1445+ protected function layfilter ($ options = [])
14211446 {
14221447 $ filter = '' ;
14231448 if (isset ($ options ['filter ' ])) {
14241449 $ filter = ' lay-filter=" ' . $ options ['filter ' ] . '" ' ;
14251450 }
14261451 return $ filter ;
14271452 }
1428-
1453+ protected function layaffix ($ options = [])
1454+ {
1455+ $ affix = '' ;
1456+ if (isset ($ options ['affix ' ])) {
1457+ $ affix = ' lay-affix=" ' . $ options ['affix ' ] . '" ' ;
1458+ }
1459+ return $ affix ;
1460+ }
1461+ protected function layautocomplete ($ options = [])
1462+ {
1463+ $ affix = ' ' ;
1464+ if (isset ($ options ['affix ' ])) {
1465+ $ affix = ' autocomplete=" ' .$ options ['autocomplete ' ] .'" ' ;
1466+ }
1467+ return $ affix ;
1468+ }
1469+ protected function laysubmit ($ options = [])
1470+ {
1471+ $ affix = ' ' ;
1472+ if (isset ($ options ['submit ' ])) {
1473+ $ affix = ' lay-submit=" ' .$ options ['submit ' ] .'" ' ;
1474+ }
1475+ return $ affix ;
1476+ }
1477+ protected function layignore ($ options = [])
1478+ {
1479+ $ affix = ' ' ;
1480+ if (isset ($ options ['ignore ' ])) {
1481+ $ affix = ' lay-ignore=" ' .$ options ['ignore ' ] .'" ' ;
1482+ }
1483+ return $ affix ;
1484+ }
1485+ protected function laystep ($ options = [])
1486+ {
1487+ $ str = ' ' ;
1488+ if (isset ($ options ['step ' ])) {
1489+ $ str = ' step=" ' . $ options ['step ' ] . '" ' ;
1490+ }
1491+ return $ str ;
1492+ }
14291493 /**搜索
14301494 * @return string
14311495 */
1432- protected function search ($ options = [])
1496+ protected function laysearch ($ options = [])
14331497 {
14341498 $ search = '' ;
14351499 if (!isset ($ options ['search ' ]) || $ options ['search ' ] == true ) {
14361500 $ search = ' lay-search ' ;
14371501 }
14381502 return $ search ;
14391503 }
1504+
1505+ protected function layskin ($ options = [])
1506+ {
1507+ $ search = '' ;
1508+ if (isset ($ options ['skin ' ])) {
1509+ $ affix = ' lay-skin=" ' .$ options ['skin ' ] .'" ' ;
1510+ }
1511+ return $ search ;
1512+ }
14401513 /**
14411514 * @param $ops
14421515 * @param $val
@@ -1541,10 +1614,25 @@ public function getOptionsAttr($name='',$options=[]){
15411614 $ attr .= $ key .'=" ' . $ this ->__ ($ val ).'" ' ;
15421615 break ;
15431616 case 'verify ' :
1544- $ attr .= $ this ->verify ($ options );
1617+ $ attr .= $ this ->layverify ($ options );
15451618 break ;
15461619 case 'filter ' :
1547- $ attr .= $ this ->filter ($ options );
1620+ $ attr .= $ this ->layfilter ($ options );
1621+ break ;
1622+ case 'step ' :
1623+ $ attr .= $ this ->laystep ($ options );
1624+ break ;
1625+ case 'affix ' :
1626+ $ attr .= $ this ->layaffix ($ options );
1627+ break ;
1628+ case 'autocomplete ' :
1629+ $ attr .= $ this ->layautocomplete ($ options );
1630+ break ;
1631+ case 'submit ' :
1632+ $ attr .= $ this ->laysubmit ($ options );
1633+ break ;
1634+ case 'ignore ' :
1635+ $ attr .= $ this ->layignore ($ options );
15481636 break ;
15491637 case 'style ' :
15501638 $ attr .= $ this ->getStyle ($ options );
@@ -1553,7 +1641,10 @@ public function getOptionsAttr($name='',$options=[]){
15531641 $ attr .= $ this ->readonlyOrdisabled ($ options );
15541642 break ;
15551643 case 'search ' :
1556- $ attr .= $ this ->search ($ options );
1644+ $ attr .= $ this ->laysearch ($ options );
1645+ break ;
1646+ case 'skin ' :
1647+ $ attr .= $ this ->layskin ($ options );
15571648 break ;
15581649 case 'value ' :
15591650 $ attr .= $ key ."=' " .$ this ->entities ($ val ) ."' data- " .$ key ."=' " .$ this ->entities ($ val )."' " ;
@@ -1565,9 +1656,6 @@ public function getOptionsAttr($name='',$options=[]){
15651656 }
15661657 $ attr .= " data- " .$ key ."=' " .$ val ."' " ;
15671658 break ;
1568- case 'skin ' :
1569- $ attr .= " lay-' " .$ key .'"=" ' . $ val .'" ' ;
1570- break ;
15711659 default :
15721660 if (is_object ($ val ) || is_array ($ val )){
15731661 $ val = (array )$ val ;
0 commit comments