Merge branch 'layui:main' into master
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
/**
|
||||
* Layui
|
||||
* Classic modular Front-End UI library
|
||||
@@ -243,7 +242,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-icon-music:before{content:"\e690"}
|
||||
|
||||
/* 基本布局 */
|
||||
.layui-main{position: relative; width: 1140px; margin: 0 auto;}
|
||||
.layui-main{position: relative; width: 1160px; margin: 0 auto;}
|
||||
.layui-header{position: relative; z-index: 1000; height: 60px;}
|
||||
.layui-header a:hover{transition: all .5s; -webkit-transition: all .5s;}
|
||||
.layui-side{position: fixed; left: 0; top: 0; bottom: 0; z-index: 999; width: 200px; overflow-x: hidden;}
|
||||
@@ -264,7 +263,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
|
||||
|
||||
/* 栅格布局 */
|
||||
.layui-container{position: relative; margin: 0 auto; padding: 0 15px; box-sizing: border-box;}
|
||||
.layui-container{position: relative; margin: 0 auto; box-sizing: border-box;}
|
||||
.layui-fluid{position: relative; margin: 0 auto; padding: 0 15px;}
|
||||
|
||||
.layui-row:before, .layui-row:after{content: ""; display: block; clear: both;}
|
||||
@@ -302,7 +301,8 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-col-xs-offset12{margin-left: 100%;}
|
||||
|
||||
/* 超小屏幕(手机) */
|
||||
@media screen and (max-width: 768px) {
|
||||
@media screen and (max-width: 767.98px) {
|
||||
.layui-container{padding: 0 15px;}
|
||||
.layui-hide-xs{display: none!important;}
|
||||
.layui-show-xs-block{display: block!important;}
|
||||
.layui-show-xs-inline{display: inline!important;}
|
||||
@@ -311,7 +311,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
|
||||
/* 小型屏幕(平板) */
|
||||
@media screen and (min-width: 768px) {
|
||||
.layui-container{width: 750px;}
|
||||
.layui-container{width: 720px;}
|
||||
.layui-hide-sm{display: none!important;}
|
||||
.layui-show-sm-block{display: block!important;}
|
||||
.layui-show-sm-inline{display: inline!important;}
|
||||
@@ -346,7 +346,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
}
|
||||
/* 中型屏幕(桌面) */
|
||||
@media screen and (min-width: 992px) {
|
||||
.layui-container{width: 970px;}
|
||||
.layui-container{width: 960px;}
|
||||
.layui-hide-md{display: none!important;}
|
||||
.layui-show-md-block{display: block!important;}
|
||||
.layui-show-md-inline{display: inline!important;}
|
||||
@@ -381,7 +381,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
}
|
||||
/* 大型屏幕(桌面) */
|
||||
@media screen and (min-width: 1200px) {
|
||||
.layui-container{width: 1170px;}
|
||||
.layui-container{width: 1150px;}
|
||||
.layui-hide-lg{display: none!important;}
|
||||
.layui-show-lg-block{display: block!important;}
|
||||
.layui-show-lg-inline{display: inline!important;}
|
||||
@@ -472,7 +472,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-progress-bar{position: absolute; left: 0; top: 0; width: 0; max-width: 100%; height: 6px; border-radius: 20px; text-align: right; background-color: #5FB878; transition: all .3s; -webkit-transition: all .3s;}
|
||||
.layui-progress-big,
|
||||
.layui-progress-big .layui-progress-bar{height: 18px; line-height: 18px;}
|
||||
.layui-progress-text{position: relative; top: -20px; line-height: 18px; font-size: 12px; color: #666}
|
||||
.layui-progress-text{position: relative; top: -20px; line-height: 18px; font-size: 12px; color: #5F5F5F}
|
||||
.layui-progress-big .layui-progress-text{position: static; padding: 0 10px; color: #fff;}
|
||||
|
||||
|
||||
@@ -489,7 +489,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-colla-content{border-top-width: 1px; border-top-style: solid;}
|
||||
.layui-colla-item:first-child{border-top: none;}
|
||||
.layui-colla-title{position: relative; height: 42px; line-height: 42px; padding: 0 15px 0 35px; color: #333; background-color: #FAFAFA; cursor: pointer; font-size: 14px; overflow: hidden;}
|
||||
.layui-colla-content{display: none; padding: 10px 15px; line-height: 1.6; color: #666;}
|
||||
.layui-colla-content{display: none; padding: 10px 15px; line-height: 1.6; color: #5F5F5F;}
|
||||
.layui-colla-icon{position: absolute; left: 15px; top: 0; font-size: 14px;}
|
||||
|
||||
/* 卡片面板 */
|
||||
@@ -503,7 +503,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-card .layui-tab{margin: 0;}
|
||||
|
||||
/* 常规面板 */
|
||||
.layui-panel{position: relative; border-width: 1px; border-style: solid; border-radius: 2px; box-shadow: 1px 1px 4px rgb(0 0 0 / 8%); background-color: #fff; color: #666;}
|
||||
.layui-panel{position: relative; border-width: 1px; border-style: solid; border-radius: 2px; box-shadow: 1px 1px 4px rgb(0 0 0 / 8%); background-color: #fff; color: #5F5F5F;}
|
||||
|
||||
/* 窗口面板 */
|
||||
.layui-panel-window{position: relative; padding: 15px; border-radius: 0; border-top: 5px solid #eee; background-color: #fff;}
|
||||
@@ -525,8 +525,8 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-bg-green{background-color: #009688!important; color: #fff!important;} /*绿*/
|
||||
.layui-bg-cyan{background-color: #2F4056!important; color: #fff!important;} /*青*/
|
||||
.layui-bg-blue{background-color: #1E9FFF!important; color: #fff!important;} /*蓝*/
|
||||
.layui-bg-black{background-color: #393D49!important; color: #fff!important;} /*黑*/
|
||||
.layui-bg-gray{background-color: #FAFAFA!important; color: #666!important;} /*灰*/
|
||||
.layui-bg-black{background-color: #393D49!important; color: #fff!important;} /*深*/
|
||||
.layui-bg-gray{background-color: #FAFAFA!important; color: #5F5F5F!important;} /*浅*/
|
||||
|
||||
/* 边框 */
|
||||
.layui-border,
|
||||
@@ -547,7 +547,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-form-pane .layui-form-item[pane],
|
||||
.layui-layedit, .layui-layedit-tool{border-color: #eee;}
|
||||
|
||||
.layui-border{border-width: 1px; border-style: solid; color: #666!important;}
|
||||
.layui-border{border-width: 1px; border-style: solid; color: #5F5F5F!important;}
|
||||
.layui-border-red{border-width: 1px; border-style: solid; border-color: #FF5722!important; color: #FF5722!important;}
|
||||
.layui-border-orange{border-width: 1px; border-style: solid; border-color: #FFB800!important; color: #FFB800!important;}
|
||||
.layui-border-green{border-width: 1px; border-style: solid; border-color: #009688!important; color: #009688!important;}
|
||||
@@ -559,21 +559,32 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-timeline-item:before{background-color: #eee;}
|
||||
|
||||
/* 文本区域 */
|
||||
.layui-text{line-height: 1.6; font-size: 14px; color: #666;}
|
||||
.layui-text{line-height: 1.6; font-size: 14px; color: #5F5F5F;}
|
||||
.layui-text h1,
|
||||
.layui-text h2,
|
||||
.layui-text h3{font-weight: 500; color: #333;}
|
||||
.layui-text h1{font-size: 30px;}
|
||||
.layui-text h3,
|
||||
.layui-text h4,
|
||||
.layui-text h5,
|
||||
.layui-text h6{font-weight: 500; color: #333;}
|
||||
.layui-text h1{font-size: 32px;}
|
||||
.layui-text h2{font-size: 24px;}
|
||||
.layui-text h3{font-size: 18px;}
|
||||
.layui-text h4{font-size: 16px;}
|
||||
.layui-text h5{font-size: 14px;}
|
||||
.layui-text h6{font-size: 13px;}
|
||||
.layui-text a:not(.layui-btn){color: #01AAED;}
|
||||
.layui-text a:not(.layui-btn):hover{text-decoration: underline;}
|
||||
.layui-text ul{padding: 5px 0 5px 15px;}
|
||||
.layui-text ul,
|
||||
.layui-text ol{padding: 5px 0 5px 15px;}
|
||||
.layui-text ul li{margin-top: 5px; list-style-type: disc;}
|
||||
.layui-text ol li{margin-top: 5px; list-style-type: decimal;}
|
||||
.layui-text em,
|
||||
.layui-word-aux{color: #999 !important; padding-left: 5px !important; padding-right: 5px !important;}
|
||||
.layui-text p{margin: 10px 0;}
|
||||
.layui-text p{margin: 15px 0;}
|
||||
.layui-text p:first-child{margin-top: 0;}
|
||||
.layui-text p:last-child{margin-bottom: 0;}
|
||||
.layui-text blockquote:not(.layui-elem-quote){padding: 5px 15px; border-left: 5px solid #eee;}
|
||||
.layui-text pre:not(.layui-code){padding: 15px; font-family: Lucida Console,Consolas,Courier New; background-color: #FAFAFA;}
|
||||
|
||||
/* 字体大小及颜色 */
|
||||
.layui-font-12{font-size: 12px !important;;}
|
||||
@@ -613,7 +624,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
/* 圆角 */.layui-btn-radius{border-radius: 100px;}
|
||||
.layui-btn .layui-icon{padding: 0 2px; vertical-align: middle\0; vertical-align: bottom;}
|
||||
|
||||
/* 原始 */.layui-btn-primary{border-color: #d2d2d2; background: none; color: #666;}
|
||||
/* 原始 */.layui-btn-primary{border-color: #d2d2d2; background: none; color: #5F5F5F;}
|
||||
.layui-btn-primary:hover{border-color: #009688; color: #333;}
|
||||
/* 百搭 */.layui-btn-normal{background-color: #1E9FFF;}
|
||||
/* 暖色 */.layui-btn-warm{background-color: #FFB800;}
|
||||
@@ -704,7 +715,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-form-item .layui-form-checkbox{margin-top: 4px;}
|
||||
|
||||
/* 复选框-原始风格 */.layui-form-checkbox[lay-skin="primary"]{height: auto!important; line-height: normal!important; min-width: 18px; min-height: 18px; border: none!important; margin-right: 0; padding-left: 28px; padding-right: 0; background: none;}
|
||||
.layui-form-checkbox[lay-skin="primary"] span{padding-left: 0; padding-right: 15px; line-height: 18px; background: none; color: #666;}
|
||||
.layui-form-checkbox[lay-skin="primary"] span{padding-left: 0; padding-right: 15px; line-height: 18px; background: none; color: #5F5F5F;}
|
||||
.layui-form-checkbox[lay-skin="primary"] i{right: auto; left: 0; width: 16px; height: 16px; line-height: 16px; border: 1px solid #d2d2d2; font-size: 12px; border-radius: 2px; background-color: #fff; -webkit-transition: .1s linear; transition: .1s linear;}
|
||||
.layui-form-checkbox[lay-skin="primary"]:hover i{border-color: #5FB878; color: #fff;}
|
||||
.layui-form-checked[lay-skin="primary"] i{border-color: #5FB878 !important; background-color: #5FB878; color: #fff;}
|
||||
@@ -838,7 +849,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-flow-more a i{font-size: 30px; color: #737383;}
|
||||
|
||||
/** 表格 **/
|
||||
.layui-table{width: 100%; margin: 10px 0; background-color: #fff; color: #666;}
|
||||
.layui-table{width: 100%; margin: 10px 0; background-color: #fff; color: #5F5F5F;}
|
||||
.layui-table tr{transition: all .3s; -webkit-transition: all .3s;}
|
||||
.layui-table th{text-align: left; font-weight: 400;}
|
||||
|
||||
@@ -887,7 +898,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-table[lay-data]{display: none;}
|
||||
.layui-table-box{position: relative; overflow: hidden;}
|
||||
.layui-table-view{margin: 10px 0;}
|
||||
.layui-table-view .layui-table{position: relative; width: auto; margin: 0;}
|
||||
.layui-table-view .layui-table{position: relative; width: auto; margin: 0; border: 0; border-collapse: separate;}
|
||||
.layui-table-view .layui-table[lay-skin="line"]{border-width: 0; border-right-width: 1px;}
|
||||
.layui-table-view .layui-table[lay-skin="row"]{border-width: 0; border-bottom-width: 1px;}
|
||||
.layui-table-view .layui-table th,
|
||||
@@ -922,9 +933,9 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-table-sort{width: 10px; height: 20px; margin-left: 5px; cursor: pointer!important;}
|
||||
.layui-table-sort .layui-edge{position: absolute; left: 5px; border-width: 5px;}
|
||||
.layui-table-sort .layui-table-sort-asc{top: 3px; border-top: none; border-bottom-style: solid; border-bottom-color: #b2b2b2;}
|
||||
.layui-table-sort .layui-table-sort-asc:hover{border-bottom-color: #666;}
|
||||
.layui-table-sort .layui-table-sort-asc:hover{border-bottom-color: #5F5F5F;}
|
||||
.layui-table-sort .layui-table-sort-desc{bottom: 5px; border-bottom: none; border-top-style: solid; border-top-color: #b2b2b2;}
|
||||
.layui-table-sort .layui-table-sort-desc:hover{border-top-color: #666;}
|
||||
.layui-table-sort .layui-table-sort-desc:hover{border-top-color: #5F5F5F;}
|
||||
.layui-table-sort[lay-sort="asc"] .layui-table-sort-asc{border-bottom-color: #000;}
|
||||
.layui-table-sort[lay-sort="desc"] .layui-table-sort-desc{border-top-color: #000;}
|
||||
|
||||
@@ -987,8 +998,8 @@ select.layui-table-edit{padding: 0 0 0 10px; border-color: #d2d2d2;}
|
||||
.layui-table-grid-down:hover{background-color: #fbfbfb;}
|
||||
|
||||
body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-shadow: 0 1px 6px rgba(0,0,0,.12);}
|
||||
.layui-table-tips-main{margin: -44px 0 0 -1px; max-height: 150px; padding: 8px 15px; font-size: 14px; overflow-y: scroll; background-color: #fff; color: #666;}
|
||||
.layui-table-tips-c{position: absolute; right: -3px; top: -13px; width: 20px; height: 20px; padding: 3px; cursor: pointer; background-color: #666; border-radius: 50%; color: #fff;}
|
||||
.layui-table-tips-main{margin: -44px 0 0 -1px; max-height: 150px; padding: 8px 15px; font-size: 14px; overflow-y: scroll; background-color: #fff; color: #5F5F5F;}
|
||||
.layui-table-tips-c{position: absolute; right: -3px; top: -13px; width: 20px; height: 20px; padding: 3px; cursor: pointer; background-color: #5F5F5F; border-radius: 50%; color: #fff;}
|
||||
.layui-table-tips-c:hover{background-color: #777;}
|
||||
.layui-table-tips-c:before{position: relative; right: -2px;}
|
||||
|
||||
@@ -1061,7 +1072,7 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
|
||||
|
||||
|
||||
/* 下拉菜单 */
|
||||
.layui-dropdown{position: absolute; left: -999999px; top: -999999px; z-index: 66666666; margin: 5px 0; min-width: 100px;}
|
||||
.layui-dropdown{position: absolute; left: -999999px; top: -999999px; z-index: 77777777; margin: 5px 0; min-width: 100px;}
|
||||
.layui-dropdown:before{content:""; position: absolute; width: 100%; height: 6px; left: 0; top: -6px;}
|
||||
|
||||
|
||||
@@ -1087,7 +1098,7 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
|
||||
|
||||
|
||||
.layui-nav-child{display: none; position: absolute; left: 0; top: 65px; min-width: 100%; line-height: 36px; padding: 5px 0; box-shadow: 0 2px 4px rgba(0,0,0,.12); border: 1px solid #eee; background-color: #fff; z-index: 100; border-radius: 2px; white-space: nowrap;}
|
||||
.layui-nav .layui-nav-child a{color: #666; color: rgba(0,0,0,.8);}
|
||||
.layui-nav .layui-nav-child a{color: #5F5F5F; color: rgba(0,0,0,.8);}
|
||||
.layui-nav .layui-nav-child a:hover{background-color: #F6F6F6; color: rgba(0,0,0,.8);}
|
||||
.layui-nav-child dd{margin: 1px 0; position: relative;}
|
||||
.layui-nav-child dd.layui-this{background-color: #F6F6F6; color: #000;}
|
||||
@@ -1131,7 +1142,7 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
|
||||
.layui-breadcrumb>*{font-size: 14px;}
|
||||
.layui-breadcrumb a{color: #999 !important;}
|
||||
.layui-breadcrumb a:hover{color: #5FB878 !important;}
|
||||
.layui-breadcrumb a cite{color: #666; font-style: normal;}
|
||||
.layui-breadcrumb a cite{color: #5F5F5F; font-style: normal;}
|
||||
.layui-breadcrumb span[lay-separator]{margin: 0 10px; color: #999;}
|
||||
|
||||
/** Tab 选项卡 **/
|
||||
@@ -1189,7 +1200,7 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
|
||||
.layui-badge-rim{position:relative; display: inline-block; padding: 0 6px; font-size: 12px; text-align: center; background-color: #FF5722; color: #fff; border-radius: 2px;}
|
||||
.layui-badge{height: 18px; line-height: 18px;}
|
||||
.layui-badge-dot{width: 8px; height: 8px; padding: 0; border-radius: 50%;}
|
||||
.layui-badge-rim{height: 18px; line-height: 18px; border-width: 1px; border-style: solid; background-color: #fff; color: #666;}
|
||||
.layui-badge-rim{height: 18px; line-height: 18px; border-width: 1px; border-style: solid; background-color: #fff; color: #5F5F5F;}
|
||||
|
||||
.layui-btn .layui-badge,
|
||||
.layui-btn .layui-badge-dot{margin-left: 5px;}
|
||||
@@ -1266,7 +1277,7 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
|
||||
|
||||
/** 表情面板 **/
|
||||
body .layui-util-face{border: none; background: none;}
|
||||
body .layui-util-face .layui-layer-content{padding:0; background-color:#fff; color:#666; box-shadow:none}
|
||||
body .layui-util-face .layui-layer-content{padding:0; background-color:#fff; color:#5F5F5F; box-shadow:none}
|
||||
.layui-util-face .layui-layer-TipsG{display:none;}
|
||||
.layui-util-face ul{position:relative; width:372px; padding:10px; border:1px solid #D9D9D9; background-color:#fff; box-shadow: 0 0 20px rgba(0,0,0,.2);}
|
||||
.layui-util-face ul li{cursor: pointer; float: left; border: 1px solid #e8e8e8; height: 22px; width: 26px; overflow: hidden; margin: -1px 0 0 -1px; padding: 4px 2px; text-align: center;}
|
||||
@@ -1284,7 +1295,7 @@ body .layui-util-face .layui-layer-content{padding:0; background-color:#fff; co
|
||||
.layui-transfer-header{height: 38px; line-height: 38px; padding: 0 10px; border-bottom-width: 1px;}
|
||||
.layui-transfer-search{position:relative; padding: 10px; border-bottom-width: 1px;}
|
||||
.layui-transfer-search .layui-input{height: 32px; padding-left: 30px; font-size: 12px;}
|
||||
.layui-transfer-search .layui-icon-search{position: absolute; left: 20px; top: 50%; margin-top: -8px; color: #666;}
|
||||
.layui-transfer-search .layui-icon-search{position: absolute; left: 20px; top: 50%; margin-top: -8px; color: #5F5F5F;}
|
||||
.layui-transfer-active{margin: 0 15px; display: inline-block; vertical-align: middle;}
|
||||
.layui-transfer-active .layui-btn{display: block; margin: 0; padding: 0 15px; background-color: #5FB878; border-color: #5FB878; color: #fff;}
|
||||
.layui-transfer-active .layui-btn-disabled{background-color: #FBFBFB; border-color: #eee; color: #d2d2d2;}
|
||||
@@ -1316,7 +1327,7 @@ body .layui-util-face .layui-layer-content{padding:0; background-color:#fff; co
|
||||
.layui-colorpicker-trigger-i{display: inline-block; color: #FFF; font-size: 12px;}
|
||||
.layui-colorpicker-trigger-i.layui-icon-close{color: #999;}
|
||||
|
||||
.layui-colorpicker-main{position: absolute; left: -999999px; top: -999999px; z-index: 66666666; width: 280px; margin: 5px 0; padding: 7px; background: #FFF; border: 1px solid #d2d2d2; border-radius: 2px; box-shadow: 0 2px 4px rgba(0,0,0,.12);}
|
||||
.layui-colorpicker-main{position: absolute; left: -999999px; top: -999999px; z-index: 77777777; width: 280px; margin: 5px 0; padding: 7px; background: #FFF; border: 1px solid #d2d2d2; border-radius: 2px; box-shadow: 0 2px 4px rgba(0,0,0,.12);}
|
||||
.layui-colorpicker-main-wrapper{height: 180px; position: relative;}
|
||||
.layui-colorpicker-basis{width: 260px; height: 100%; position: relative;}
|
||||
.layui-colorpicker-basis-white{width: 100%; height: 100%; position: absolute; top: 0; left: 0; background: linear-gradient(90deg, #FFF, hsla(0,0%,100%,0));}
|
||||
@@ -1336,7 +1347,7 @@ body .layui-util-face .layui-layer-content{padding:0; background-color:#fff; co
|
||||
.layui-colorpicker-main-input{text-align: right; padding-top: 7px;}
|
||||
.layui-colorpicker-main-input .layui-btn-container .layui-btn{margin: 0 0 0 10px;}
|
||||
.layui-colorpicker-main-input div.layui-inline{float: left; margin-right: 10px; font-size: 14px;}
|
||||
.layui-colorpicker-main-input input.layui-input{width: 150px; height: 30px; color: #666;}
|
||||
.layui-colorpicker-main-input input.layui-input{width: 150px; height: 30px; color: #5F5F5F;}
|
||||
|
||||
/** 滑块 **/
|
||||
.layui-slider{height: 4px; background: #eee; border-radius: 3px; position: relative; cursor: pointer;}
|
||||
@@ -1348,7 +1359,7 @@ body .layui-util-face .layui-layer-content{padding:0; background-color:#fff; co
|
||||
.layui-slider-wrap-btn:hover,
|
||||
.layui-slider-wrap-btn.layui-slider-hover{transform: scale(1.2);}
|
||||
.layui-slider-wrap-btn.layui-disabled:hover{transform: scale(1) !important;}
|
||||
.layui-slider-tips{position: absolute; top: -42px; z-index: 66666666; white-space:nowrap; display: none; -webkit-transform: translateX(-50%); transform: translateX(-50%); color: #FFF; background: #000; border-radius: 3px; height: 25px; line-height: 25px; padding: 0 10px;}
|
||||
.layui-slider-tips{position: absolute; top: -42px; z-index: 77777777; white-space:nowrap; display: none; -webkit-transform: translateX(-50%); transform: translateX(-50%); color: #FFF; background: #000; border-radius: 3px; height: 25px; line-height: 25px; padding: 0 10px;}
|
||||
.layui-slider-tips:after{content: ""; position: absolute; bottom: -12px; left: 50%; margin-left: -6px; width: 0; height: 0; border-width: 6px; border-style: solid; border-color: #000 transparent transparent transparent;}
|
||||
.layui-slider-input{width: 70px; height: 32px; border: 1px solid #eee; border-radius: 3px; font-size: 16px; line-height: 32px; position: absolute; right: 0; top: -14px;}
|
||||
.layui-slider-input-btn{position: absolute; top: 0; right: 0; width: 20px; height: 100%; border-left: 1px solid #eee;}
|
||||
@@ -1388,12 +1399,12 @@ body .layui-util-face .layui-layer-content{padding:0; background-color:#fff; co
|
||||
.layui-tree-iconClick{display: inline-block; vertical-align: middle; position: relative; height: 20px; line-height: 20px; margin: 0 10px; color: #c0c4cc;}
|
||||
.layui-tree-icon{height: 12px; line-height: 12px; width: 12px; text-align: center; border: 1px solid #c0c4cc;}
|
||||
.layui-tree-iconClick .layui-icon{font-size: 18px;}
|
||||
.layui-tree-icon .layui-icon{font-size: 12px; color: #666;}
|
||||
.layui-tree-icon .layui-icon{font-size: 12px; color: #5F5F5F;}
|
||||
.layui-tree-iconArrow{padding: 0 5px;}
|
||||
.layui-tree-iconArrow:after{content: ""; position: absolute; left: 4px; top: 3px; z-index: 100; width: 0; height: 0; border-width: 5px; border-style: solid; border-color: transparent transparent transparent #c0c4cc; transition: 0.5s;}
|
||||
.layui-tree-spread>.layui-tree-entry .layui-tree-iconClick>.layui-tree-iconArrow:after{transform: rotate(90deg) translate(3px, 4px);}
|
||||
.layui-tree-txt{display: inline-block; vertical-align: middle; color: #555;}
|
||||
.layui-tree-search{margin-bottom: 15px; color: #666;}
|
||||
.layui-tree-search{margin-bottom: 15px; color: #5F5F5F;}
|
||||
.layui-tree-btnGroup{visibility: hidden; display: inline-block; vertical-align: middle; position: relative;}
|
||||
.layui-tree-btnGroup .layui-icon{display: inline-block; vertical-align: middle; padding: 0 2px; cursor: pointer;}
|
||||
.layui-tree-btnGroup .layui-icon:hover{color: #999; transition: 0.3s;}
|
||||
|
||||
102
src/layui.js
102
src/layui.js
@@ -1,7 +1,6 @@
|
||||
|
||||
/*!
|
||||
/**
|
||||
* Layui
|
||||
* Classic modular Front-End UI library
|
||||
* Classic modular front-end UI library
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
@@ -16,7 +15,7 @@
|
||||
}
|
||||
|
||||
,Layui = function(){
|
||||
this.v = '2.6.8'; // layui 版本号
|
||||
this.v = '2.6.13'; // layui 版本号
|
||||
}
|
||||
|
||||
//识别预先可能定义的指定全局对象
|
||||
@@ -371,7 +370,7 @@
|
||||
};
|
||||
|
||||
// location.hash 路由解析
|
||||
Layui.prototype.router = function(hash){
|
||||
Layui.prototype.router = Layui.prototype.hash = function(hash){
|
||||
var that = this
|
||||
,hash = hash || location.hash
|
||||
,data = {
|
||||
@@ -541,7 +540,7 @@
|
||||
};
|
||||
|
||||
//typeof 类型细分 -> string/number/boolean/undefined/null、object/array/function/…
|
||||
Layui.prototype._typeof = function(operand){
|
||||
Layui.prototype._typeof = Layui.prototype.type = function(operand){
|
||||
if(operand === null) return String(operand);
|
||||
|
||||
//细分引用类型
|
||||
@@ -559,10 +558,10 @@
|
||||
};
|
||||
|
||||
//对象是否具备数组结构(此处为兼容 jQuery 对象)
|
||||
Layui.prototype._isArray = function(obj){
|
||||
Layui.prototype._isArray = Layui.prototype.isArray = function(obj){
|
||||
var that = this
|
||||
,len
|
||||
,type = that._typeof(obj);
|
||||
,type = that.type(obj);
|
||||
|
||||
if(!obj || (typeof obj !== 'object') || obj === win) return false;
|
||||
|
||||
@@ -584,7 +583,7 @@
|
||||
obj = obj || [];
|
||||
|
||||
//优先处理数组结构
|
||||
if(that._isArray(obj)){
|
||||
if(that.isArray(obj)){
|
||||
for(key = 0; key < obj.length; key++){
|
||||
if(callFn(key, obj)) break;
|
||||
}
|
||||
@@ -597,25 +596,57 @@
|
||||
return that;
|
||||
};
|
||||
|
||||
//将数组中的对象按其某个成员排序
|
||||
Layui.prototype.sort = function(obj, key, desc){
|
||||
var clone = JSON.parse(
|
||||
JSON.stringify(obj || [])
|
||||
// 将数组中的成员对象按照某个 key 的 value 值进行排序
|
||||
Layui.prototype.sort = function(arr, key, desc){
|
||||
var that = this
|
||||
,clone = JSON.parse(
|
||||
JSON.stringify(arr || [])
|
||||
);
|
||||
|
||||
if(!key) return clone;
|
||||
// 若未传入 key,则直接返回原对象
|
||||
if(that.type(arr) === 'object' && !key){
|
||||
return clone;
|
||||
} else if(typeof arr !== 'object'){ //若 arr 非对象
|
||||
return [clone];
|
||||
}
|
||||
|
||||
//如果是数字,按大小排序;如果是非数字,则按字典序排序
|
||||
// 开始排序
|
||||
clone.sort(function(o1, o2){
|
||||
var v1 = o1[key]
|
||||
,v2 = o2[key]
|
||||
,isNum = [
|
||||
!isNaN(v1)
|
||||
,!isNaN(v2)
|
||||
];
|
||||
|
||||
,v2 = o2[key];
|
||||
|
||||
//若为数字比较
|
||||
/*
|
||||
* 特殊数据
|
||||
* 若比较的成员均非对象
|
||||
*/
|
||||
|
||||
// 若比较的成员均为数字
|
||||
if(!isNaN(o1) && !isNaN(o2)) return o1 - o2;
|
||||
// 若比较的成员只存在某一个非对象
|
||||
if(!isNaN(o1) && isNaN(o2)){
|
||||
if(key && typeof o2 === 'object'){
|
||||
v1 = o1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else if (isNaN(o1) && !isNaN(o2)){
|
||||
if(key && typeof o1 === 'object'){
|
||||
v2 = o2;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 正常数据
|
||||
* 即成员均为对象,也传入了对比依据: key
|
||||
* 若 value 为数字,按「大小」排序;若 value 非数字,则按「字典序」排序
|
||||
*/
|
||||
|
||||
// value 是否为数字
|
||||
var isNum = [!isNaN(v1), !isNaN(v2)];
|
||||
|
||||
// 若为数字比较
|
||||
if(isNum[0] && isNum[1]){
|
||||
if(v1 && (!v2 && v2 !== 0)){ //数字 vs 空
|
||||
return 1;
|
||||
@@ -630,9 +661,9 @@
|
||||
* 字典序排序
|
||||
*/
|
||||
|
||||
//若为非数字比较
|
||||
// 若为非数字比较
|
||||
if(!isNum[0] && !isNum[1]){
|
||||
//字典序比较
|
||||
// 字典序比较
|
||||
if(v1 > v2){
|
||||
return 1;
|
||||
} else if (v1 < v2) {
|
||||
@@ -642,33 +673,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
//若为混合比较
|
||||
// 若为混合比较
|
||||
if(isNum[0] || !isNum[1]){ //数字 vs 非数字
|
||||
return -1;
|
||||
} else if(!isNum[0] || isNum[1]) { //非数字 vs 数字
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
//老版本
|
||||
if(v1 && !v2){
|
||||
return 1;
|
||||
} else if(!v1 && v2){
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(v1 > v2){
|
||||
return 1;
|
||||
} else if (v1 < v2) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
});
|
||||
|
||||
desc && clone.reverse(); //倒序
|
||||
desc && clone.reverse(); // 倒序
|
||||
return clone;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
/*!
|
||||
/*!
|
||||
* 用于加载所有内置模块
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
/*!
|
||||
/**
|
||||
* carousel 轮播模块
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/**
|
||||
* code 代码修饰器
|
||||
* MIT Licensed
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
/*!
|
||||
/**
|
||||
* colorpicker
|
||||
* 颜色选择组件
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
/*!
|
||||
/**
|
||||
* MODULE_DEMO_NAME 模块组件通用结构
|
||||
* MIT Licensed
|
||||
*/
|
||||
@@ -73,7 +72,7 @@ layui.define([''], function(exports){
|
||||
|
||||
//防止数组深度合并
|
||||
layui.each(options, function(key, item){
|
||||
if(layui._typeof(item) === 'array') delete that.config[key];
|
||||
if(layui.type(item) === 'array') delete that.config[key];
|
||||
});
|
||||
|
||||
that.config = $.extend(true, {}, that.config, options);
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/**
|
||||
|
||||
@Name:dropdown 下拉菜单组件
|
||||
@License:MIT
|
||||
|
||||
* dropdown
|
||||
* 下拉菜单组件
|
||||
*/
|
||||
|
||||
layui.define(['jquery', 'laytpl', 'lay'], function(exports){
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
/*!
|
||||
/**
|
||||
* element 常用元素操作
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
/**
|
||||
|
||||
@Name flow 流加载组件
|
||||
@License:MIT
|
||||
|
||||
* flow 流加载组件
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
/*!
|
||||
/**
|
||||
* form 表单组件
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
/*! lay 基础 DOM 操作 | MIT Licensed */
|
||||
/** lay 基础 DOM 操作 | MIT Licensed */
|
||||
|
||||
;!function(window){ //gulp build: lay-header
|
||||
"use strict";
|
||||
@@ -33,9 +33,11 @@
|
||||
|
||||
//普通对象深度扩展
|
||||
lay.extend = function(){
|
||||
var ai = 1, args = arguments
|
||||
var ai = 1
|
||||
,length
|
||||
,args = arguments
|
||||
,clone = function(target, obj){
|
||||
target = target || (layui._typeof(obj) === 'array' ? [] : {}); //目标对象
|
||||
target = target || (layui.type(obj) === 'array' ? [] : {}); //目标对象
|
||||
for(var i in obj){
|
||||
//如果值为普通对象,则进入递归,继续深度合并
|
||||
target[i] = (obj[i] && obj[i].constructor === Object)
|
||||
@@ -46,8 +48,9 @@
|
||||
}
|
||||
|
||||
args[0] = typeof args[0] === 'object' ? args[0] : {};
|
||||
length = args.length
|
||||
|
||||
for(; ai < args.length; ai++){
|
||||
for(; ai < length; ai++){
|
||||
if(typeof args[ai] === 'object'){
|
||||
clone(args[0], args[ai]);
|
||||
}
|
||||
@@ -88,14 +91,16 @@
|
||||
|
||||
|
||||
//数字前置补零
|
||||
lay.digit = function(num, length, end){
|
||||
lay.digit = function(num, length){
|
||||
if(!(typeof num === 'string' || typeof num === 'number')) return '';
|
||||
|
||||
var str = '';
|
||||
num = String(num);
|
||||
length = length || 2;
|
||||
for(var i = num.length; i < length; i++){
|
||||
str += '0';
|
||||
}
|
||||
return num < Math.pow(10, length) ? str + (num|0) : num;
|
||||
return num < Math.pow(10, length) ? str + num : num;
|
||||
};
|
||||
|
||||
//创建元素
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
/*! layDate 日期与时间控件 | MIT Licensed */
|
||||
/** layDate 日期与时间控件 | MIT Licensed */
|
||||
|
||||
;!function(window, document){
|
||||
"use strict";
|
||||
@@ -189,10 +188,12 @@
|
||||
if(!options.elem[0]) return;
|
||||
|
||||
//日期范围分隔符
|
||||
that.rangeStr = options.range ? (typeof options.range === 'string' ? options.range : '-') : '';
|
||||
that.rangeStr = options.range ? (
|
||||
typeof options.range === 'string' ? options.range : '-'
|
||||
) : '';
|
||||
|
||||
//若 range 参数为数组,则表示为开始日期和结束日期的 input 对象
|
||||
if(layui._typeof(options.range) === 'array'){
|
||||
if(layui.type(options.range) === 'array'){
|
||||
that.rangeElem = [
|
||||
lay(options.range[0]),
|
||||
lay(options.range[1])
|
||||
@@ -240,7 +241,7 @@
|
||||
) +'$');
|
||||
that.EXP_SPLIT = new RegExp('^'+ that.EXP_SPLIT +'$', '');
|
||||
|
||||
//如果不是input|textarea元素,则默认采用click事件
|
||||
//如果不是 input|textarea 元素,则默认采用 click 事件
|
||||
if(!that.isInput(options.elem[0])){
|
||||
if(options.trigger === 'focus'){
|
||||
options.trigger = 'click';
|
||||
@@ -264,7 +265,6 @@
|
||||
,'0-5-4': '青年'
|
||||
,'0-6-1': '儿童'
|
||||
,'0-9-10': '教师'
|
||||
,'0-9-18': '国耻'
|
||||
,'0-10-1': '国庆'
|
||||
,'0-12-25': '圣诞'
|
||||
} : {}, options.mark);
|
||||
@@ -274,7 +274,15 @@
|
||||
var ymd = [], hms = [];
|
||||
if(typeof options[item] === 'number'){ //如果为数字
|
||||
var day = options[item]
|
||||
,time = new Date().getTime()
|
||||
,tDate = new Date()
|
||||
,time = that.newDate({ //今天的最大毫秒数
|
||||
year: tDate.getFullYear()
|
||||
,month: tDate.getMonth()
|
||||
,date: tDate.getDate()
|
||||
,hours: '23'
|
||||
,minutes: '59'
|
||||
,seconds: '59'
|
||||
}).getTime()
|
||||
,STAMP = 86400000 //代表一天的毫秒数
|
||||
,thisDate = new Date(
|
||||
day ? (
|
||||
@@ -282,7 +290,7 @@
|
||||
) : time
|
||||
);
|
||||
ymd = [thisDate.getFullYear(), thisDate.getMonth() + 1, thisDate.getDate()];
|
||||
day < STAMP || (hms = [thisDate.getHours(), thisDate.getMinutes(), thisDate.getSeconds()]);
|
||||
hms = [thisDate.getHours(), thisDate.getMinutes(), thisDate.getSeconds()];
|
||||
} else {
|
||||
ymd = (options[item].match(/\d+-\d+-\d+/) || [''])[0].split('-');
|
||||
hms = (options[item].match(/\d+:\d+:\d+/) || [''])[0].split(':');
|
||||
@@ -304,7 +312,7 @@
|
||||
|
||||
//默认赋值
|
||||
if(options.value && options.isInitValue){
|
||||
if(layui._typeof(options.value) === 'date'){
|
||||
if(layui.type(options.value) === 'date'){
|
||||
that.setValue(that.parse(0, that.systemDate(options.value)));
|
||||
} else {
|
||||
that.setValue(options.value);
|
||||
@@ -472,13 +480,13 @@
|
||||
lay(elem).addClass('laydate-theme-molv');
|
||||
elem.appendChild(style);
|
||||
}
|
||||
|
||||
|
||||
//移除上一个控件
|
||||
that.remove(Class.thisElemDate);
|
||||
|
||||
//记录当前执行的实例索引
|
||||
laydate.thisId = options.id;
|
||||
|
||||
//移除上一个控件
|
||||
that.remove(Class.thisElemDate);
|
||||
|
||||
|
||||
//如果是静态定位,则插入到指定的容器中,否则,插入到body
|
||||
isStatic ? options.elem.append(elem) : (
|
||||
document.body.appendChild(elem)
|
||||
@@ -509,6 +517,7 @@
|
||||
elem.remove();
|
||||
//delete options.dateTime;
|
||||
//delete that.endDate;
|
||||
delete laydate.thisId;
|
||||
});
|
||||
}
|
||||
return that;
|
||||
@@ -586,11 +595,14 @@
|
||||
//如果传入了开始和结束日期的 input 对象,则将其拼接为日期范围字符
|
||||
if(that.rangeElem){
|
||||
var vals = [that.rangeElem[0].val(), that.rangeElem[1].val()];
|
||||
|
||||
if(vals[0] && vals[1]){
|
||||
return vals.join(' ' + that.rangeStr + ' ');
|
||||
}
|
||||
}
|
||||
return that.isInput(elem) ? elem.value : (options.position === 'static' ? '' : lay(elem).attr('lay-date'));
|
||||
return that.isInput(elem)
|
||||
? elem.value
|
||||
: (options.position === 'static' ? '' : lay(elem).attr('lay-date'));
|
||||
}()
|
||||
|
||||
//校验日期有效数字
|
||||
@@ -696,7 +708,7 @@
|
||||
) + lang.formatError[1]);
|
||||
error = true;
|
||||
}
|
||||
} else if(value && layui._typeof(value) === 'date'){ //如果值为日期对象时
|
||||
} else if(value && layui.type(value) === 'date'){ //若值为日期对象
|
||||
options.dateTime = that.systemDate(value);
|
||||
} else {
|
||||
//重置开始日期
|
||||
@@ -739,7 +751,9 @@
|
||||
};
|
||||
|
||||
//校验主面板是否在可选日期区间
|
||||
if(getDateTime(dateTime) > getDateTime(options.max) || getDateTime(dateTime) < getDateTime(options.min)){
|
||||
if(getDateTime(dateTime) > getDateTime(options.max)){ //若超出最大日期
|
||||
dateTime = options.dateTime = lay.extend({}, options.max);
|
||||
} else if(getDateTime(dateTime) < getDateTime(options.min)){ //若少于最小日期
|
||||
dateTime = options.dateTime = lay.extend({}, options.min);
|
||||
}
|
||||
|
||||
@@ -904,7 +918,9 @@
|
||||
}
|
||||
|
||||
//通过检测当前有效日期,来设定确定按钮是否可点
|
||||
if(!options.range) that.limit(lay(that.footer).find(ELEM_CONFIRM), null, 0, ['hours', 'minutes', 'seconds']);
|
||||
if(!options.range){
|
||||
that.limit(lay(that.footer).find(ELEM_CONFIRM), null, 0, ['hours', 'minutes', 'seconds']);
|
||||
}
|
||||
|
||||
//同步按钮可点状态
|
||||
that.setBtnStatus();
|
||||
@@ -947,10 +963,18 @@
|
||||
lay.each(new Array(15), function(i){
|
||||
var li = lay.elem('li', {
|
||||
'lay-ym': yearNum
|
||||
}), ymd = {year: yearNum};
|
||||
})
|
||||
,ymd = {
|
||||
year: yearNum
|
||||
,month: 0
|
||||
,date: 1
|
||||
};
|
||||
|
||||
yearNum == listYM[0] && lay(li).addClass(THIS);
|
||||
li.innerHTML = yearNum + text;
|
||||
ul.appendChild(li);
|
||||
|
||||
/*
|
||||
if(yearNum < that.firstDate.year){
|
||||
ymd.month = options.min.month;
|
||||
ymd.date = options.min.date;
|
||||
@@ -958,9 +982,12 @@
|
||||
ymd.month = options.max.month;
|
||||
ymd.date = options.max.date;
|
||||
}
|
||||
*/
|
||||
|
||||
that.limit(lay(li), ymd, index);
|
||||
yearNum++;
|
||||
});
|
||||
|
||||
lay(elemYM[isCN ? 0 : 1]).attr('lay-ym', (yearNum - 8) + '-' + listYM[1])
|
||||
.html((startY + text) + ' - ' + (yearNum - 1 + text));
|
||||
}
|
||||
@@ -970,17 +997,28 @@
|
||||
lay.each(new Array(12), function(i){
|
||||
var li = lay.elem('li', {
|
||||
'lay-ym': i
|
||||
}), ymd = {year: listYM[0], month: i};
|
||||
})
|
||||
,ymd = {
|
||||
year: listYM[0]
|
||||
,month: i
|
||||
,date: 1
|
||||
};
|
||||
|
||||
i + 1 == listYM[1] && lay(li).addClass(THIS);
|
||||
li.innerHTML = lang.month[i] + (isCN ? '月' : '');
|
||||
ul.appendChild(li);
|
||||
|
||||
/*
|
||||
if(listYM[0] < that.firstDate.year){
|
||||
ymd.date = options.min.date;
|
||||
} else if(listYM[0] >= that.firstDate.year){
|
||||
ymd.date = options.max.date;
|
||||
}
|
||||
*/
|
||||
|
||||
that.limit(lay(li), ymd, index);
|
||||
});
|
||||
|
||||
lay(elemYM[isCN ? 0 : 1]).attr('lay-ym', listYM[0] + '-' + listYM[1])
|
||||
.html(listYM[0] + text);
|
||||
}
|
||||
@@ -1003,7 +1041,9 @@
|
||||
}][i], index, [['hours'], ['hours', 'minutes'], ['hours', 'minutes', 'seconds']][i]);
|
||||
});
|
||||
});
|
||||
if(!options.range) that.limit(lay(that.footer).find(ELEM_CONFIRM), that[startEnd], 0, ['hours', 'minutes', 'seconds']);
|
||||
if(!options.range){
|
||||
that.limit(lay(that.footer).find(ELEM_CONFIRM), that[startEnd], 0, ['hours', 'minutes', 'seconds']);
|
||||
}
|
||||
};
|
||||
|
||||
//初始化时间对象
|
||||
@@ -1040,7 +1080,6 @@
|
||||
lay(ul).find('li').on('click', function(){
|
||||
var ym = lay(this).attr('lay-ym') | 0;
|
||||
if(lay(this).hasClass(DISABLED)) return;
|
||||
|
||||
if(index === 0){
|
||||
dateTime[type] = ym;
|
||||
that.limit(lay(that.footer).find(ELEM_CONFIRM), null, 0);
|
||||
@@ -1181,14 +1220,18 @@
|
||||
,options = that.config
|
||||
,dateTime = date || (state == 'end'
|
||||
? lay.extend({}, that.endDate, that.endTime)
|
||||
: (options.range ? lay.extend({}, options.dateTime, that.startTime) : options.dateTime))
|
||||
: (
|
||||
options.range
|
||||
? lay.extend({}, options.dateTime, that.startTime)
|
||||
: options.dateTime)
|
||||
)
|
||||
,format = laydate.parse(dateTime, that.format, 1);
|
||||
|
||||
//返回日期范围字符
|
||||
if(options.range && state === undefined){
|
||||
return format + ' '+ that.rangeStr +' ' + that.parse('end');
|
||||
}
|
||||
|
||||
|
||||
return format;
|
||||
};
|
||||
|
||||
@@ -1221,9 +1264,13 @@
|
||||
lay(elem).val(value);
|
||||
} else {
|
||||
//如果 range 传入了开始和结束的 input 对象,则分别对其赋值
|
||||
if(that.rangeElem){
|
||||
that.rangeElem[0].val(value ? that.parse('start') : '');
|
||||
that.rangeElem[1].val(value ? that.parse('end') : '');
|
||||
var rangeElem = that.rangeElem;
|
||||
if(rangeElem){
|
||||
if(layui.type(value) !== 'array'){
|
||||
value = value.split(' '+ that.rangeStr +' ');
|
||||
}
|
||||
rangeElem[0].val(value[0] || '');
|
||||
rangeElem[1].val(value[1] || '');
|
||||
} else {
|
||||
if(lay(elem).find('*').length === 0){
|
||||
lay(elem).html(value);
|
||||
@@ -1302,9 +1349,9 @@
|
||||
//补充时分秒
|
||||
lay.each(['startTime', 'endTime'], function(i, item){
|
||||
that[item] = that[item] || {
|
||||
hours: 0
|
||||
,minutes: 0
|
||||
,seconds: 0
|
||||
hours: i ? 23: 0
|
||||
,minutes: i ? 59: 0
|
||||
,seconds: i ? 59: 0
|
||||
};
|
||||
});
|
||||
that.calendar(null, index).done(null, 'change');
|
||||
@@ -1377,8 +1424,9 @@
|
||||
} else {
|
||||
if(lay(btn).hasClass(DISABLED)) return that.hint(lang.invalidDate);
|
||||
}
|
||||
|
||||
that.setValue(that.parse()).remove();
|
||||
that.done();
|
||||
that.setValue(that.parse()).remove()
|
||||
}
|
||||
};
|
||||
active[type] && active[type]();
|
||||
@@ -1535,6 +1583,8 @@
|
||||
//绑定呼出控件事件
|
||||
,showEvent = function(elem, bind){
|
||||
elem.on(options.trigger, function(){
|
||||
//已经打开的面板避免重新渲染
|
||||
if(laydate.thisId === options.id) return;
|
||||
bind && (that.bindElem = this);
|
||||
that.render();
|
||||
});
|
||||
@@ -1581,6 +1631,8 @@
|
||||
var that = thisModule.getThis(laydate.thisId);
|
||||
if(!that) return;
|
||||
|
||||
// 回车触发确认
|
||||
if(that.config.position === 'static') return;
|
||||
if(e.keyCode === 13){
|
||||
if(lay('#'+ that.elemID)[0] && that.elemID === Class.thisElemDate){
|
||||
e.preventDefault();
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
/**
|
||||
|
||||
@Name:layedit 富文本编辑器
|
||||
@License:MIT
|
||||
|
||||
* layedit 富文本编辑器
|
||||
*/
|
||||
|
||||
layui.define(['layer', 'form'], function(exports){
|
||||
@@ -28,7 +25,7 @@ layui.define(['layer', 'form'], function(exports){
|
||||
,'|'
|
||||
,'left', 'center', 'right'
|
||||
,'|'
|
||||
,'link', 'unlink', 'face', 'image'
|
||||
,'link', 'unlink'
|
||||
]
|
||||
,hideTool: []
|
||||
,height: 280 //默认高
|
||||
@@ -372,38 +369,6 @@ layui.define(['layer', 'form'], function(exports){
|
||||
,unlink: function(range){
|
||||
iframeDOM.execCommand('unlink');
|
||||
}
|
||||
//表情
|
||||
,face: function(range){
|
||||
face.call(this, function(img){
|
||||
insertInline.call(iframeWin, 'img', {
|
||||
src: img.src
|
||||
,alt: img.alt
|
||||
}, range);
|
||||
});
|
||||
}
|
||||
//图片
|
||||
,image: function(range){
|
||||
var that = this;
|
||||
layui.use('upload', function(upload){
|
||||
var uploadImage = set.uploadImage || {};
|
||||
upload.render({
|
||||
url: uploadImage.url
|
||||
,method: uploadImage.type
|
||||
,elem: $(that).find('input')[0]
|
||||
,done: function(res){
|
||||
if(res.code == 0){
|
||||
res.data = res.data || {};
|
||||
insertInline.call(iframeWin, 'img', {
|
||||
src: res.data.src
|
||||
,alt: res.data.title
|
||||
}, range);
|
||||
} else {
|
||||
layer.msg(res.msg||'上传失败');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
//插入代码
|
||||
,code: function(range){
|
||||
code.call(body, function(pre){
|
||||
@@ -471,7 +436,6 @@ layui.define(['layer', 'form'], function(exports){
|
||||
//触发内容区域
|
||||
body.on('click', function(){
|
||||
toolCheck.call(iframeWin, tools);
|
||||
layer.close(face.index);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -523,48 +487,6 @@ layui.define(['layer', 'form'], function(exports){
|
||||
link.index = index;
|
||||
}
|
||||
|
||||
//表情面板
|
||||
,face = function(callback){
|
||||
//表情库
|
||||
var faces = function(){
|
||||
var alt = ["[微笑]", "[嘻嘻]", "[哈哈]", "[可爱]", "[可怜]", "[挖鼻]", "[吃惊]", "[害羞]", "[挤眼]", "[闭嘴]", "[鄙视]", "[爱你]", "[泪]", "[偷笑]", "[亲亲]", "[生病]", "[太开心]", "[白眼]", "[右哼哼]", "[左哼哼]", "[嘘]", "[衰]", "[委屈]", "[吐]", "[哈欠]", "[抱抱]", "[怒]", "[疑问]", "[馋嘴]", "[拜拜]", "[思考]", "[汗]", "[困]", "[睡]", "[钱]", "[失望]", "[酷]", "[色]", "[哼]", "[鼓掌]", "[晕]", "[悲伤]", "[抓狂]", "[黑线]", "[阴险]", "[怒骂]", "[互粉]", "[心]", "[伤心]", "[猪头]", "[熊猫]", "[兔子]", "[ok]", "[耶]", "[good]", "[NO]", "[赞]", "[来]", "[弱]", "[草泥马]", "[神马]", "[囧]", "[浮云]", "[给力]", "[围观]", "[威武]", "[奥特曼]", "[礼物]", "[钟]", "[话筒]", "[蜡烛]", "[蛋糕]"], arr = {};
|
||||
layui.each(alt, function(index, item){
|
||||
arr[item] = layui.cache.dir + 'images/face/'+ index + '.gif';
|
||||
});
|
||||
return arr;
|
||||
}();
|
||||
face.hide = face.hide || function(e){
|
||||
if($(e.target).attr('layedit-event') !== 'face'){
|
||||
layer.close(face.index);
|
||||
}
|
||||
}
|
||||
return face.index = layer.tips(function(){
|
||||
var content = [];
|
||||
layui.each(faces, function(key, item){
|
||||
content.push('<li title="'+ key +'"><img src="'+ item +'" alt="'+ key +'"></li>');
|
||||
});
|
||||
return '<ul class="layui-clear">' + content.join('') + '</ul>';
|
||||
}(), this, {
|
||||
tips: 1
|
||||
,time: 0
|
||||
,skin: 'layui-box layui-util-face'
|
||||
,maxWidth: 500
|
||||
,success: function(layero, index){
|
||||
layero.css({
|
||||
marginTop: -4
|
||||
,marginLeft: -10
|
||||
}).find('.layui-clear>li').on('click', function(){
|
||||
callback && callback({
|
||||
src: faces[this.title]
|
||||
,alt: this.title
|
||||
});
|
||||
layer.close(index);
|
||||
});
|
||||
$(document).off('click', face.hide).on('click', face.hide);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//插入代码面板
|
||||
,code = function(callback){
|
||||
var body = this, index = layer.open({
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
/*!
|
||||
/**
|
||||
* layer - 通用 Web 弹出层组件
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
/**
|
||||
|
||||
@Name : laypage 分页组件
|
||||
@License:MIT
|
||||
|
||||
* laypage 分页组件
|
||||
*/
|
||||
|
||||
layui.define(function(exports){
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
/**
|
||||
|
||||
@Name : laytpl 模板引擎
|
||||
@License:MIT
|
||||
|
||||
* laytpl 模板引擎
|
||||
*/
|
||||
|
||||
layui.define(function(exports){
|
||||
|
||||
"use strict";
|
||||
|
||||
var config = {
|
||||
@@ -27,8 +23,15 @@ layui.define(function(exports){
|
||||
return exp((_||'') + config.open + types + config.close + (__||''));
|
||||
},
|
||||
escape: function(html){
|
||||
return String(html||'').replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&')
|
||||
.replace(/</g, '<').replace(/>/g, '>').replace(/'/g, ''').replace(/"/g, '"');
|
||||
var exp = /[<"'>]|&(?=#[a-zA-Z0-9]+)/g;
|
||||
if(html === undefined || html === null) return '';
|
||||
|
||||
html += '';
|
||||
if(!exp.test(html)) return html;
|
||||
|
||||
return html.replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&')
|
||||
.replace(/</g, '<').replace(/>/g, '>')
|
||||
.replace(/'/g, ''').replace(/"/g, '"');
|
||||
},
|
||||
error: function(e, tplog){
|
||||
var error = 'Laytpl Error: ';
|
||||
@@ -64,22 +67,24 @@ layui.define(function(exports){
|
||||
return str
|
||||
})
|
||||
|
||||
//匹配JS规则内容
|
||||
//匹配 JS 语法
|
||||
.replace(/(?="|')/g, '\\').replace(tool.query(), function(str){
|
||||
str = str.replace(jss, '').replace(jsse, '');
|
||||
return '";' + str.replace(/\\(.)/g, '$1') + ';view+="';
|
||||
})
|
||||
|
||||
//匹配普通字段
|
||||
//匹配普通输出语句
|
||||
.replace(tool.query(1), function(str){
|
||||
var start = '"+(';
|
||||
var start = '"+laytpl.escape(';
|
||||
if(str.replace(/\s/g, '') === config.open+config.close){
|
||||
return '';
|
||||
}
|
||||
str = str.replace(exp(config.open+'|'+config.close), '');
|
||||
if(/^=/.test(str)){
|
||||
str = str.replace(/^=/, '');
|
||||
start = '"+_escape_(';
|
||||
} else if(/^-/.test(str)){
|
||||
str = str.replace(/^-/, '');
|
||||
start = '"+(';
|
||||
}
|
||||
return start + str.replace(/\\(.)/g, '$1') + ')+"';
|
||||
});
|
||||
@@ -87,8 +92,8 @@ layui.define(function(exports){
|
||||
tpl = '"use strict";var view = "' + tpl + '";return view;';
|
||||
|
||||
try{
|
||||
that.cache = tpl = new Function('d, _escape_', tpl);
|
||||
return tpl(data, tool.escape);
|
||||
that.cache = tpl = new Function('d, laytpl', tpl);
|
||||
return tpl(data, tool);
|
||||
} catch(e){
|
||||
delete that.cache;
|
||||
return tool.error(e, tplog);
|
||||
@@ -98,7 +103,7 @@ layui.define(function(exports){
|
||||
Tpl.pt.render = function(data, callback){
|
||||
var that = this, tpl;
|
||||
if(!data) return tool.error('no data');
|
||||
tpl = that.cache ? that.cache(data, tool.escape) : that.parse(that.tpl, data);
|
||||
tpl = that.cache ? that.cache(data, tool) : that.parse(that.tpl, data);
|
||||
if(!callback) return tpl;
|
||||
callback(tpl);
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
/*!
|
||||
/**
|
||||
* 用于打包聚合版,该文件不会存在于构建后的目录
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/**
|
||||
|
||||
@Name:layui 移动模块入口 | 构建后则为移动模块集合
|
||||
@License:MIT
|
||||
|
||||
* layui 移动模块入口
|
||||
* 构建后则为移动模块集合
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
/**
|
||||
|
||||
@Title: rate 评分评星组件
|
||||
@License:MIT
|
||||
|
||||
* rate 评分评星组件
|
||||
*/
|
||||
|
||||
layui.define('jquery',function(exports){
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
/**
|
||||
|
||||
@Title: slider 滑块组件
|
||||
@License:MIT
|
||||
|
||||
* slider 滑块组件
|
||||
*/
|
||||
|
||||
layui.define('jquery', function(exports){
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
/*!
|
||||
/**
|
||||
* layui.table
|
||||
* 数据表格组件
|
||||
* 表格组件
|
||||
*/
|
||||
|
||||
layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
@@ -71,19 +70,28 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
}
|
||||
|
||||
//解析自定义模板数据
|
||||
,parseTempData = function(item3, content, tplData, text){ //表头数据、原始内容、表体数据、是否只返回文本
|
||||
var options = this.config || {};
|
||||
,parseTempData = function(obj){
|
||||
obj = obj || {};
|
||||
|
||||
var options = this.config || {}
|
||||
,item3 = obj.item3 //表头数据
|
||||
,content = obj.content; //原始内容
|
||||
|
||||
//是否防 xss
|
||||
//是否编码 HTML
|
||||
if(options.escape) content = util.escape(content);
|
||||
|
||||
//获取内容
|
||||
var str = item3.templet ? function(){
|
||||
return typeof item3.templet === 'function'
|
||||
? item3.templet(tplData)
|
||||
: laytpl($(item3.templet).html() || String(content)).render(tplData)
|
||||
}() : content;
|
||||
return text ? $('<div>'+ str +'</div>').text() : str;
|
||||
//获取模板
|
||||
var templet = obj.text && item3.exportTemplet || (item3.templet || item3.toolbar);
|
||||
|
||||
//获取模板内容
|
||||
if(templet){
|
||||
content = typeof templet === 'function'
|
||||
? templet.call(item3, obj.tplData, obj.obj)
|
||||
: laytpl($(templet).html() || String(content)).render(obj.tplData);
|
||||
}
|
||||
|
||||
//是否只返回文本
|
||||
return obj.text ? $('<div>'+ content +'</div>').text() : content;
|
||||
}
|
||||
|
||||
//字符常量
|
||||
@@ -93,11 +101,11 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
|
||||
//thead区域模板
|
||||
,TPL_HEADER = function(options){
|
||||
var rowCols = '{{#if(item2.colspan){}} colspan="{{item2.colspan}}"{{#} if(item2.rowspan){}} rowspan="{{item2.rowspan}}"{{#}}}';
|
||||
var rowCols = '{{#if(item2.colspan){}} colspan="{{=item2.colspan}}"{{#} if(item2.rowspan){}} rowspan="{{=item2.rowspan}}"{{#}}}';
|
||||
|
||||
options = options || {};
|
||||
return ['<table cellspacing="0" cellpadding="0" border="0" class="layui-table" '
|
||||
,'{{# if(d.data.skin){ }}lay-skin="{{d.data.skin}}"{{# } }} {{# if(d.data.size){ }}lay-size="{{d.data.size}}"{{# } }} {{# if(d.data.even){ }}lay-even{{# } }}>'
|
||||
,'{{# if(d.data.skin){ }}lay-skin="{{=d.data.skin}}"{{# } }} {{# if(d.data.size){ }}lay-size="{{=d.data.size}}"{{# } }} {{# if(d.data.even){ }}lay-even{{# } }}>'
|
||||
,'<thead>'
|
||||
,'{{# layui.each(d.data.cols, function(i1, item1){ }}'
|
||||
,'<tr>'
|
||||
@@ -114,21 +122,21 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
return '';
|
||||
}()
|
||||
,'{{# var isSort = !(item2.colGroup) && item2.sort; }}'
|
||||
,'<th data-field="{{ item2.field||i2 }}" data-key="{{d.index}}-{{i1}}-{{i2}}" {{# if( item2.parentKey){ }}data-parentkey="{{ item2.parentKey }}"{{# } }} {{# if(item2.minWidth){ }}data-minwidth="{{item2.minWidth}}"{{# } }} '+ rowCols +' {{# if(item2.unresize || item2.colGroup){ }}data-unresize="true"{{# } }} class="{{# if(item2.hide){ }}layui-hide{{# } }}{{# if(isSort){ }} layui-unselect{{# } }}{{# if(!item2.field){ }} layui-table-col-special{{# } }}">'
|
||||
,'<th data-field="{{= item2.field||i2 }}" data-key="{{=d.index}}-{{=i1}}-{{=i2}}" {{# if( item2.parentKey){ }}data-parentkey="{{= item2.parentKey }}"{{# } }} {{# if(item2.minWidth){ }}data-minwidth="{{=item2.minWidth}}"{{# } }} '+ rowCols +' {{# if(item2.unresize || item2.colGroup){ }}data-unresize="true"{{# } }} class="{{# if(item2.hide){ }}layui-hide{{# } }}{{# if(isSort){ }} layui-unselect{{# } }}{{# if(!item2.field){ }} layui-table-col-special{{# } }}">'
|
||||
,'<div class="layui-table-cell laytable-cell-'
|
||||
,'{{# if(item2.colGroup){ }}'
|
||||
,'group'
|
||||
,'{{# } else { }}'
|
||||
,'{{d.index}}-{{i1}}-{{i2}}'
|
||||
,'{{=d.index}}-{{=i1}}-{{=i2}}'
|
||||
,'{{# if(item2.type !== "normal"){ }}'
|
||||
,' laytable-cell-{{ item2.type }}'
|
||||
,' laytable-cell-{{= item2.type }}'
|
||||
,'{{# } }}'
|
||||
,'{{# } }}'
|
||||
,'" {{#if(item2.align){}}align="{{item2.align}}"{{#}}}>'
|
||||
,'" {{#if(item2.align){}}align="{{=item2.align}}"{{#}}}>'
|
||||
,'{{# if(item2.type === "checkbox"){ }}' //复选框
|
||||
,'<input type="checkbox" name="layTableCheckbox" lay-skin="primary" lay-filter="layTableAllChoose" {{# if(item2[d.data.checkName]){ }}checked{{# }; }}>'
|
||||
,'{{# } else { }}'
|
||||
,'<span>{{item2.title||""}}</span>'
|
||||
,'<span>{{-item2.title||""}}</span>'
|
||||
,'{{# if(isSort){ }}'
|
||||
,'<span class="layui-table-sort layui-inline"><i class="layui-edge layui-table-sort-asc" title="升序"></i><i class="layui-edge layui-table-sort-desc" title="降序"></i></span>'
|
||||
,'{{# } }}'
|
||||
@@ -143,14 +151,14 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
,'</table>'].join('');
|
||||
}
|
||||
|
||||
//tbody区域模板
|
||||
// tbody 区域模板
|
||||
,TPL_BODY = ['<table cellspacing="0" cellpadding="0" border="0" class="layui-table" '
|
||||
,'{{# if(d.data.skin){ }}lay-skin="{{d.data.skin}}"{{# } }} {{# if(d.data.size){ }}lay-size="{{d.data.size}}"{{# } }} {{# if(d.data.even){ }}lay-even{{# } }}>'
|
||||
,'{{# if(d.data.skin){ }}lay-skin="{{=d.data.skin}}"{{# } }} {{# if(d.data.size){ }}lay-size="{{=d.data.size}}"{{# } }} {{# if(d.data.even){ }}lay-even{{# } }}>'
|
||||
,'<tbody></tbody>'
|
||||
,'</table>'].join('')
|
||||
|
||||
//主模板
|
||||
,TPL_MAIN = ['<div class="layui-form layui-border-box {{d.VIEW_CLASS}}{{# if(d.data.className){ }} {{ d.data.className }}{{# } }}" lay-filter="LAY-table-{{d.index}}" lay-id="{{ d.data.id }}" style="{{# if(d.data.width){ }}width:{{d.data.width}}px;{{# } }} {{# if(d.data.height){ }}height:{{d.data.height}}px;{{# } }}">'
|
||||
,TPL_MAIN = ['<div class="layui-form layui-border-box {{=d.VIEW_CLASS}}{{# if(d.data.className){ }} {{= d.data.className }}{{# } }}" lay-filter="LAY-table-{{=d.index}}" lay-id="{{= d.data.id }}" style="{{# if(d.data.width){ }}width:{{=d.data.width}}px;{{# } }} {{# if(d.data.height){ }}height:{{=d.data.height}}px;{{# } }}">'
|
||||
|
||||
,'{{# if(d.data.toolbar){ }}'
|
||||
,'<div class="layui-table-tool">'
|
||||
@@ -201,7 +209,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
,'{{# if(d.data.totalRow){ }}'
|
||||
,'<div class="layui-table-total">'
|
||||
,'<table cellspacing="0" cellpadding="0" border="0" class="layui-table" '
|
||||
,'{{# if(d.data.skin){ }}lay-skin="{{d.data.skin}}"{{# } }} {{# if(d.data.size){ }}lay-size="{{d.data.size}}"{{# } }} {{# if(d.data.even){ }}lay-even{{# } }}>'
|
||||
,'{{# if(d.data.skin){ }}lay-skin="{{=d.data.skin}}"{{# } }} {{# if(d.data.size){ }}lay-size="{{=d.data.size}}"{{# } }} {{# if(d.data.even){ }}lay-even{{# } }}>'
|
||||
,'<tbody><tr><td><div class="layui-table-cell" style="visibility: hidden;">Total</div></td></tr></tbody>'
|
||||
, '</table>'
|
||||
,'</div>'
|
||||
@@ -209,16 +217,16 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
|
||||
,'{{# if(d.data.page){ }}'
|
||||
,'<div class="layui-table-page">'
|
||||
,'<div id="layui-table-page{{d.index}}"></div>'
|
||||
,'<div id="layui-table-page{{=d.index}}"></div>'
|
||||
,'</div>'
|
||||
,'{{# } }}'
|
||||
|
||||
,'<style>'
|
||||
,'{{# layui.each(d.data.cols, function(i1, item1){'
|
||||
,'layui.each(item1, function(i2, item2){ }}'
|
||||
,'.laytable-cell-{{d.index}}-{{i1}}-{{i2}}{ '
|
||||
,'.laytable-cell-{{=d.index}}-{{=i1}}-{{=i2}}{ '
|
||||
,'{{# if(item2.width){ }}'
|
||||
,'width: {{item2.width}}px;'
|
||||
,'width: {{=item2.width}}px;'
|
||||
,'{{# } }}'
|
||||
,' }'
|
||||
,'{{# });'
|
||||
@@ -241,6 +249,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
Class.prototype.config = {
|
||||
limit: 10 //每页显示的数量
|
||||
,loading: true //请求数据时,是否显示 loading
|
||||
,escape: true // 是否开启 HTML 编码功能,即转义 html 原文
|
||||
,cellMinWidth: 60 //所有单元格默认最小宽度
|
||||
,defaultToolbar: ['filter', 'exports', 'print'] //工具栏右侧图标
|
||||
,autoSort: true //是否前端自动排序。如果否,则需自主排序(通常为服务端处理好排序)
|
||||
@@ -388,7 +397,9 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
//初始化列参数
|
||||
layui.each(options.cols, function(i1, item1){
|
||||
layui.each(item1, function(i2, item2){
|
||||
|
||||
item2.colspan = item2.colspan || 1;
|
||||
item2.rowspan = item2.rowspan || 1;
|
||||
|
||||
//如果列参数为空,则移除
|
||||
if(!item2){
|
||||
item1.splice(i2, 1);
|
||||
@@ -402,10 +413,10 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
//如果是组合列,则捕获对应的子列
|
||||
if(item2.colGroup || item2.colspan > 1){
|
||||
var childIndex = 0;
|
||||
layui.each(options.cols[i1 + 1], function(i22, item22){
|
||||
layui.each(options.cols[i1 + item2.rowspan], function(i22, item22){
|
||||
//如果子列已经被标注为{HAS_PARENT},或者子列累计 colspan 数等于父列定义的 colspan,则跳出当前子列循环
|
||||
if(item22.HAS_PARENT || (childIndex > 1 && childIndex == item2.colspan)) return;
|
||||
|
||||
if(item22.HAS_PARENT || (childIndex >= 1 && childIndex == item2.colspan)) return;
|
||||
|
||||
item22.HAS_PARENT = true;
|
||||
item22.parentKey = i1 + '-' + i2;
|
||||
|
||||
@@ -650,7 +661,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
|
||||
//防止数组深度合并
|
||||
layui.each(options, function(key, item){
|
||||
if(layui._typeof(item) === 'array') delete that.config[key];
|
||||
if(layui.type(item) === 'array') delete that.config[key];
|
||||
});
|
||||
|
||||
//对参数进行深度或浅扩展
|
||||
@@ -744,7 +755,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
typeof options.error === 'function' && options.error(e, msg);
|
||||
}
|
||||
});
|
||||
} else if(layui._typeof(options.data) === 'array'){ //已知数据
|
||||
} else if(layui.type(options.data) === 'array'){ //已知数据
|
||||
var res = {}
|
||||
,startLimit = curr*options.limit - options.limit
|
||||
|
||||
@@ -790,7 +801,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
,numbers = i1 + options.limit*(curr - 1) + 1; //序号
|
||||
|
||||
//若数据项为空数组,则不往下执行(因为删除数据时,会将原有数据设置为 [])
|
||||
if(layui._typeof(item1) === 'array' && item1.length === 0) return;
|
||||
if(layui.type(item1) === 'array' && item1.length === 0) return;
|
||||
|
||||
//记录下标索引,用于恢复排序
|
||||
if(!sort){
|
||||
@@ -810,7 +821,6 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
var td = ['<td data-field="'+ field +'" data-key="'+ key +'" '+ function(){ //追加各种属性
|
||||
var attr = [];
|
||||
if(item3.edit) attr.push('data-edit="'+ item3.edit +'"'); //是否允许单元格编辑
|
||||
if(item3.align) attr.push('align="'+ item3.align +'"'); //对齐方式
|
||||
if(item3.templet) attr.push('data-content="'+ content +'"'); //自定义模板
|
||||
if(item3.toolbar) attr.push('data-off="true"'); //行工具列关闭单元格事件
|
||||
if(item3.event) attr.push('lay-event="'+ item3.event +'"'); //自定义事件
|
||||
@@ -826,7 +836,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
,'<div class="layui-table-cell laytable-cell-'+ function(){ //返回对应的CSS类标识
|
||||
return item3.type === 'normal' ? key
|
||||
: (key + ' laytable-cell-' + item3.type);
|
||||
}() +'">' + function(){
|
||||
}() +'"'+ (item3.align ? ' align="'+ item3.align +'"' : '') +'>' + function(){
|
||||
var tplData = $.extend(true, {
|
||||
LAY_INDEX: numbers
|
||||
,LAY_COL: item3
|
||||
@@ -861,7 +871,11 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
if(item3.toolbar){
|
||||
return laytpl($(item3.toolbar).html()||'').render(tplData);
|
||||
}
|
||||
return parseTempData.call(that, item3, content, tplData);
|
||||
return parseTempData.call(that, {
|
||||
item3: item3
|
||||
,content: content
|
||||
,tplData: tplData
|
||||
});
|
||||
}()
|
||||
,'</div></td>'].join('');
|
||||
|
||||
@@ -957,7 +971,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
|
||||
layui.each(data, function(i1, item1){
|
||||
//若数据项为空数组,则不往下执行(因为删除数据时,会将原有数据设置为 [])
|
||||
if(layui._typeof(item1) === 'array' && item1.length === 0) return;
|
||||
if(layui.type(item1) === 'array' && item1.length === 0) return;
|
||||
|
||||
that.eachCols(function(i3, item3){
|
||||
var field = item3.field || i3
|
||||
@@ -990,7 +1004,11 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
tplData[field] = thisTotalNum;
|
||||
|
||||
//获取自动计算的合并内容
|
||||
getContent = item3.totalRow ? (parseTempData.call(that, item3, thisTotalNum, tplData) || text) : text;
|
||||
getContent = item3.totalRow ? (parseTempData.call(that, {
|
||||
item3: item3
|
||||
,content: thisTotalNum
|
||||
,tplData: tplData
|
||||
}) || text) : text;
|
||||
|
||||
//如果直接传入了合计行数据,则不输出自动计算的结果
|
||||
return totalRowData ? (totalRowData[item3.field] || getContent) : getContent;
|
||||
@@ -1147,7 +1165,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
,options = that.config
|
||||
,thisData = table.cache[that.key];
|
||||
if(!thisData[index]) return;
|
||||
if(layui._typeof(thisData[index]) === 'array') return;
|
||||
if(layui.type(thisData[index]) === 'array') return;
|
||||
thisData[index][options.checkName] = checked;
|
||||
};
|
||||
|
||||
@@ -1199,7 +1217,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
Class.prototype.fullSize = function(){
|
||||
var that = this
|
||||
,options = that.config
|
||||
,height = options.height, bodyHeight;
|
||||
,height = options.height
|
||||
,bodyHeight;
|
||||
|
||||
if(that.fullHeightGap){
|
||||
height = _WIN.height() - that.fullHeightGap;
|
||||
@@ -1214,17 +1233,17 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
|
||||
//减去工具栏的高度
|
||||
if(options.toolbar){
|
||||
bodyHeight = bodyHeight - (that.layTool.outerHeight() || 50);
|
||||
bodyHeight -= (that.layTool.outerHeight() || 50);
|
||||
}
|
||||
|
||||
//减去统计朗的高度
|
||||
if(options.totalRow){
|
||||
bodyHeight = bodyHeight - (that.layTotal.outerHeight() || 40);
|
||||
bodyHeight -= (that.layTotal.outerHeight() || 40);
|
||||
}
|
||||
|
||||
//减去分页栏的高度
|
||||
if(options.page){
|
||||
bodyHeight = bodyHeight - (that.layPage.outerHeight() || 41);
|
||||
bodyHeight -= (that.layPage.outerHeight() || 41);
|
||||
}
|
||||
|
||||
that.layMain.css('height', bodyHeight - 2);
|
||||
@@ -1336,7 +1355,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
var lis = [];
|
||||
that.eachCols(function(i, item){
|
||||
if(item.field && item.type == 'normal'){
|
||||
lis.push('<li><input type="checkbox" name="'+ item.field +'" data-key="'+ item.key +'" data-parentkey="'+ (item.parentKey||'') +'" lay-skin="primary" '+ (item.hide ? '' : 'checked') +' title="'+ (item.title || item.field) +'" lay-filter="LAY_TABLE_TOOL_COLS"></li>');
|
||||
lis.push('<li><input type="checkbox" name="'+ item.field +'" data-key="'+ item.key +'" data-parentkey="'+ (item.parentKey||'') +'" lay-skin="primary" '+ (item.hide ? '' : 'checked') +' title="'+ util.escape(item.title || item.field) +'" lay-filter="LAY_TABLE_TOOL_COLS"></li>');
|
||||
}
|
||||
});
|
||||
return lis.join('');
|
||||
@@ -1381,8 +1400,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
openPanel({
|
||||
list: function(){
|
||||
return [
|
||||
'<li data-type="csv">导出到 Csv 文件</li>'
|
||||
,'<li data-type="xls">导出到 Excel 文件</li>'
|
||||
'<li data-type="csv">导出 csv 格式文件</li>'
|
||||
,'<li data-type="xls">导出 xls 格式文件</li>'
|
||||
].join('')
|
||||
}()
|
||||
,done: function(panel, list){
|
||||
@@ -1508,7 +1527,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
});
|
||||
|
||||
//数据行中的事件返回的公共对象成员
|
||||
var commonMember = function(sets){
|
||||
var commonMember = that.commonMember = function(sets){
|
||||
var othis = $(this)
|
||||
,index = othis.parents('tr').eq(0).data('index')
|
||||
,tr = that.layBody.find('tr[data-index="'+ index +'"]')
|
||||
@@ -1528,19 +1547,34 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
,update: function(fields){ //修改行数据
|
||||
fields = fields || {};
|
||||
layui.each(fields, function(key, value){
|
||||
if(key in data){
|
||||
var templet, td = tr.children('td[data-field="'+ key +'"]');
|
||||
data[key] = value;
|
||||
that.eachCols(function(i, item2){
|
||||
if(item2.field == key && item2.templet){
|
||||
templet = item2.templet;
|
||||
}
|
||||
});
|
||||
td.children(ELEM_CELL).html(parseTempData.call(that, {
|
||||
templet: templet
|
||||
}, value, data));
|
||||
td.data('content', value);
|
||||
}
|
||||
var td = tr.children('td[data-field="'+ key +'"]')
|
||||
,cell = td.children(ELEM_CELL); //获取当前修改的列
|
||||
|
||||
//更新缓存中的数据
|
||||
if(key in data) data[key] = value;
|
||||
|
||||
that.eachCols(function(i, item3){
|
||||
//更新相应列视图
|
||||
if(item3.field == key){
|
||||
cell.html(parseTempData.call(that, {
|
||||
item3: item3
|
||||
,content: value
|
||||
,tplData: data
|
||||
}));
|
||||
td.data('content', value);
|
||||
item3.templet && that.renderForm();
|
||||
} else if(item3.templet || item3.toolbar){ //更新所有其他列的模板
|
||||
var thisTd = tr.children('td[data-field="'+ (item3.field || i) +'"]')
|
||||
,content = data[item3.field];
|
||||
thisTd.children(ELEM_CELL).html(parseTempData.call(that, {
|
||||
item3: item3
|
||||
,content: content
|
||||
,tplData: data
|
||||
}));
|
||||
thisTd.data('content', content);
|
||||
that.renderForm();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}, sets);
|
||||
@@ -1637,7 +1671,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
,field: field
|
||||
}));
|
||||
}).on('blur', '.'+ELEM_EDIT, function(){
|
||||
var templet
|
||||
var item3
|
||||
,othis = $(this)
|
||||
,thisElem = this
|
||||
,field = othis.parent().data('field')
|
||||
@@ -1645,13 +1679,15 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
,data = table.cache[that.key][index];
|
||||
that.eachCols(function(i, item){
|
||||
if(item.field == field && item.templet){
|
||||
templet = item.templet;
|
||||
item3 = item;
|
||||
}
|
||||
});
|
||||
othis.siblings(ELEM_CELL).html(function(value){
|
||||
return parseTempData.call(that, {
|
||||
templet: templet
|
||||
}, value, data);
|
||||
item3: item3 || {}
|
||||
,content: value
|
||||
,tplData: data
|
||||
});
|
||||
}(thisElem.value));
|
||||
othis.parent().data('content', thisElem.value);
|
||||
othis.remove();
|
||||
@@ -1818,8 +1854,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
|
||||
var row = $.extend({
|
||||
title: th.text()
|
||||
,colspan: th.attr('colspan') || 0 //列单元格
|
||||
,rowspan: th.attr('rowspan') || 0 //行单元格
|
||||
,colspan: th.attr('colspan') || 1 //列单元格
|
||||
,rowspan: th.attr('rowspan') || 1 //行单元格
|
||||
}, itemData);
|
||||
|
||||
if(row.colspan < 2) cols.push(row);
|
||||
@@ -1873,11 +1909,11 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
var childIndex = 0;
|
||||
index++
|
||||
item2.CHILD_COLS = [];
|
||||
|
||||
layui.each(cols[i1 + 1], function(i22, item22){
|
||||
|
||||
layui.each(cols[i1 + item2.rowspan], function(i22, item22){
|
||||
//如果子列已经被标注为{PARENT_COL_INDEX},或者子列累计 colspan 数等于父列定义的 colspan,则跳出当前子列循环
|
||||
if(item22.PARENT_COL_INDEX || (childIndex > 1 && childIndex == item2.colspan)) return;
|
||||
|
||||
if(item22.PARENT_COL_INDEX || (childIndex >= 1 && childIndex == item2.colspan)) return;
|
||||
|
||||
item22.PARENT_COL_INDEX = index;
|
||||
|
||||
item2.CHILD_COLS.push(item22);
|
||||
@@ -1909,7 +1945,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
,data = table.cache[id] || [];
|
||||
//计算全选个数
|
||||
layui.each(data, function(i, item){
|
||||
if(layui._typeof(item) === 'array'){
|
||||
if(layui.type(item) === 'array'){
|
||||
invalidNum++; //无效数据,或已删除的
|
||||
return;
|
||||
}
|
||||
@@ -1929,7 +1965,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
var arr = []
|
||||
,data = table.cache[id] || [];
|
||||
layui.each(data, function(i, item){
|
||||
if(layui._typeof(item) === 'array'){
|
||||
if(layui.type(item) === 'array'){
|
||||
return;
|
||||
};
|
||||
arr.push(table.clearCacheKey(item));
|
||||
@@ -1955,7 +1991,10 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
if(device.ie) return hint.error('IE_NOT_SUPPORT_EXPORTS');
|
||||
|
||||
alink.href = 'data:'+ textType +';charset=utf-8,\ufeff'+ encodeURIComponent(function(){
|
||||
var dataTitle = [], dataMain = [], dataTotal = [];
|
||||
var dataTitle = []
|
||||
,dataMain = []
|
||||
,dataTotal = []
|
||||
,fieldsIsHide = {};
|
||||
|
||||
//表头和表体
|
||||
layui.each(data, function(i1, item1){
|
||||
@@ -1969,12 +2008,30 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
});
|
||||
} else {
|
||||
table.eachCols(id, function(i3, item3){
|
||||
if(item3.field && item3.type == 'normal' && !item3.hide){
|
||||
var content = item1[item3.field];
|
||||
if(item3.field && item3.type == 'normal'){
|
||||
//不导出隐藏列
|
||||
if(item3.hide){
|
||||
if(i1 == 0) fieldsIsHide[item3.field] = true; //记录隐藏列
|
||||
return;
|
||||
}
|
||||
|
||||
var content = item1[item3.field]
|
||||
,td = that.layBody.find('tr[data-index="'+ i1 +'"]>td');
|
||||
|
||||
if(content === undefined || content === null) content = '';
|
||||
|
||||
i1 == 0 && dataTitle.push(item3.title || '');
|
||||
vals.push('"'+ parseTempData.call(thatTable, item3, content, item1, 'text') + '"');
|
||||
vals.push('"'+ parseTempData.call(thatTable, {
|
||||
item3: item3
|
||||
,content: content
|
||||
,tplData: item1
|
||||
,text: 'text'
|
||||
,obj: thatTable.commonMember.call(td.eq(0), {
|
||||
td: function(field){
|
||||
return td.filter('[data-field="'+ field +'"]');
|
||||
}
|
||||
})
|
||||
}) + '"');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1983,7 +2040,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
|
||||
//表合计
|
||||
layui.each(that.dataTotal, function(key, value){
|
||||
dataTotal.push(value);
|
||||
fieldsIsHide[key] || dataTotal.push(value);
|
||||
});
|
||||
|
||||
return dataTitle.join(',') + '\r\n' + dataMain.join('\r\n') + '\r\n' + dataTotal.join(',');
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
/**
|
||||
|
||||
@Name:transfer 穿梭框组件
|
||||
@License:MIT
|
||||
|
||||
* transfer 穿梭框组件
|
||||
*/
|
||||
|
||||
layui.define(['laytpl', 'form'], function(exports){
|
||||
@@ -171,7 +168,11 @@ layui.define(['laytpl', 'form'], function(exports){
|
||||
});
|
||||
that.layData.css({
|
||||
height: function(){
|
||||
return options.height - that.layHeader.outerHeight() - that.laySearch.outerHeight() - 2
|
||||
var height = options.height - that.layHeader.outerHeight();
|
||||
if(options.showSearch){
|
||||
height -= that.laySearch.outerHeight();
|
||||
}
|
||||
return height - 2;
|
||||
}()
|
||||
});
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
/**
|
||||
|
||||
@Name:tree 树组件
|
||||
@License:MIT
|
||||
|
||||
* tree 树组件
|
||||
*/
|
||||
|
||||
layui.define('form', function(exports){
|
||||
@@ -101,7 +98,7 @@ layui.define('form', function(exports){
|
||||
var that = this;
|
||||
|
||||
layui.each(options, function(key, item){
|
||||
if(layui._typeof(item) === 'array') delete that.config[key];
|
||||
if(layui.type(item) === 'array') delete that.config[key];
|
||||
});
|
||||
|
||||
that.config = $.extend(true, {}, that.config, options);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
/*!
|
||||
* upload 文件上传组件
|
||||
* MIT Licensed
|
||||
/**
|
||||
* upload
|
||||
* 上传组件
|
||||
*/
|
||||
|
||||
layui.define('layer' , function(exports){
|
||||
@@ -63,6 +62,7 @@ layui.define('layer' , function(exports){
|
||||
,auto: true //是否选完文件后自动上传
|
||||
,bindAction: '' //手动上传触发的元素
|
||||
,url: '' //上传地址
|
||||
,force: '' //强制规定返回的数据格式,目前只支持是否强制 json
|
||||
,field: 'file' //文件字段名
|
||||
,acceptMime: '' //筛选出的文件类型,默认为所有文件
|
||||
,method: 'post' //请求上传的 http 类型
|
||||
@@ -180,14 +180,14 @@ layui.define('layer' , function(exports){
|
||||
|
||||
//高级浏览器处理方式,支持跨域
|
||||
,ajaxSend = function(){
|
||||
var successful = 0, aborted = 0
|
||||
var successful = 0, failed = 0
|
||||
,items = files || that.files || that.chooseFiles || elemFile.files
|
||||
,allDone = function(){ //多文件全部上传完毕的回调
|
||||
if(options.multiple && successful + aborted === that.fileLength){
|
||||
if(options.multiple && successful + failed === that.fileLength){
|
||||
typeof options.allDone === 'function' && options.allDone({
|
||||
total: that.fileLength
|
||||
,successful: successful
|
||||
,aborted: aborted
|
||||
,failed: failed
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -218,9 +218,9 @@ layui.define('layer' , function(exports){
|
||||
allDone();
|
||||
}
|
||||
//异常回调
|
||||
,error: function(){
|
||||
aborted++;
|
||||
that.msg('请求上传接口出现异常');
|
||||
,error: function(e){
|
||||
failed++;
|
||||
that.msg('Request URL is abnormal: '+ (e.statusText || 'error'));
|
||||
error(index);
|
||||
allDone();
|
||||
}
|
||||
@@ -243,7 +243,7 @@ layui.define('layer' , function(exports){
|
||||
});
|
||||
}
|
||||
|
||||
//低版本IE处理方式,不支持跨域
|
||||
//低版本 IE 处理方式,不支持跨域
|
||||
,iframeSend = function(){
|
||||
var iframe = $('#'+ ELEM_IFRAME);
|
||||
|
||||
@@ -256,7 +256,7 @@ layui.define('layer' , function(exports){
|
||||
try {
|
||||
res = iframeBody.text();
|
||||
} catch(e) {
|
||||
that.msg('获取上传后的响应信息出现异常');
|
||||
that.msg('Cross-domain requests are not supported');
|
||||
clearInterval(Class.timer);
|
||||
error();
|
||||
}
|
||||
@@ -272,14 +272,18 @@ layui.define('layer' , function(exports){
|
||||
,done = function(index, res){
|
||||
that.elemFile.next('.'+ ELEM_CHOOSE).remove();
|
||||
elemFile.value = '';
|
||||
if(typeof res !== 'object'){
|
||||
try {
|
||||
res = JSON.parse(res);
|
||||
} catch(e){
|
||||
res = {};
|
||||
return that.msg('请对上传接口返回有效JSON');
|
||||
|
||||
if(options.force === 'json'){
|
||||
if(typeof res !== 'object'){
|
||||
try {
|
||||
res = JSON.parse(res);
|
||||
} catch(e){
|
||||
res = {};
|
||||
return that.msg('Please return JSON data format');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typeof options.done === 'function' && options.done(res, index || 0, function(files){
|
||||
that.upload(files);
|
||||
});
|
||||
@@ -334,14 +338,6 @@ layui.define('layer' , function(exports){
|
||||
|
||||
//提交上传
|
||||
,send = function(){
|
||||
//选择文件的回调
|
||||
if(type === 'choose' || options.auto){
|
||||
options.choose && options.choose(args);
|
||||
if(type === 'choose'){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//上传前的回调 - 如果回调函数明确返回false,则停止上传(#pulls55)
|
||||
if(options.before && (options.before(args) === false)) return;
|
||||
|
||||
@@ -352,6 +348,14 @@ layui.define('layer' , function(exports){
|
||||
|
||||
ajaxSend();
|
||||
}
|
||||
|
||||
//文件类型名称
|
||||
,typeName = ({
|
||||
file: '文件'
|
||||
,images: '图片'
|
||||
,video: '视频'
|
||||
,audio: '音频'
|
||||
})[options.accept] || '文件';
|
||||
|
||||
//校验文件格式
|
||||
value = value.length === 0
|
||||
@@ -359,39 +363,53 @@ layui.define('layer' , function(exports){
|
||||
: value;
|
||||
|
||||
if(value.length === 0) return;
|
||||
|
||||
|
||||
//根据文件类型校验
|
||||
switch(options.accept){
|
||||
case 'file': //一般文件
|
||||
if(exts && !RegExp('\\w\\.('+ exts +')$', 'i').test(escape(value))){
|
||||
that.msg('选择的文件中包含不支持的格式');
|
||||
return elemFile.value = '';
|
||||
}
|
||||
layui.each(value, function(i, item){
|
||||
if(exts && !RegExp('.\\.('+ exts +')$', 'i').test(escape(item))){
|
||||
return check = true;
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'video': //视频文件
|
||||
if(!RegExp('\\w\\.('+ (exts || 'avi|mp4|wma|rmvb|rm|flash|3gp|flv') +')$', 'i').test(escape(value))){
|
||||
that.msg('选择的视频中包含不支持的格式');
|
||||
return elemFile.value = '';
|
||||
}
|
||||
layui.each(value, function(i, item){
|
||||
if(!RegExp('.\\.('+ (exts || 'avi|mp4|wma|rmvb|rm|flash|3gp|flv') +')$', 'i').test(escape(item))){
|
||||
return check = true;
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'audio': //音频文件
|
||||
if(!RegExp('\\w\\.('+ (exts || 'mp3|wav|mid') +')$', 'i').test(escape(value))){
|
||||
that.msg('选择的音频中包含不支持的格式');
|
||||
return elemFile.value = '';
|
||||
}
|
||||
layui.each(value, function(i, item){
|
||||
if(!RegExp('.\\.('+ (exts || 'mp3|wav|mid') +')$', 'i').test(escape(item))){
|
||||
return check = true;
|
||||
}
|
||||
});
|
||||
break;
|
||||
default: //图片文件
|
||||
layui.each(value, function(i, item){
|
||||
if(!RegExp('\\w\\.('+ (exts || 'jpg|png|gif|bmp|jpeg$') +')', 'i').test(escape(item))){
|
||||
check = true;
|
||||
if(!RegExp('.\\.('+ (exts || 'jpg|png|gif|bmp|jpeg') +')$', 'i').test(escape(item))){
|
||||
return check = true;
|
||||
}
|
||||
});
|
||||
if(check){
|
||||
that.msg('选择的图片中包含不支持的格式');
|
||||
return elemFile.value = '';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//校验失败提示
|
||||
if(check){
|
||||
that.msg('选择的'+ typeName +'中包含不支持的格式');
|
||||
return elemFile.value = '';
|
||||
}
|
||||
|
||||
//选择文件的回调
|
||||
if(type === 'choose' || options.auto){
|
||||
options.choose && options.choose(args);
|
||||
if(type === 'choose'){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//检验文件数量
|
||||
that.fileLength = function(){
|
||||
var length = 0
|
||||
@@ -401,8 +419,12 @@ layui.define('layer' , function(exports){
|
||||
});
|
||||
return length;
|
||||
}();
|
||||
|
||||
if(options.number && that.fileLength > options.number){
|
||||
return that.msg('同时最多只能上传的数量为:'+ options.number);
|
||||
return that.msg(
|
||||
'同时最多只能上传: '+ options.number + ' 个文件'
|
||||
+'<br>您当前已经选择了: '+ that.fileLength +' 个文件'
|
||||
);
|
||||
}
|
||||
|
||||
//检验文件大小
|
||||
@@ -417,8 +439,9 @@ layui.define('layer' , function(exports){
|
||||
limitSize = size;
|
||||
}
|
||||
});
|
||||
if(limitSize) return that.msg('文件不能超过'+ limitSize);
|
||||
if(limitSize) return that.msg('文件大小不能超过 '+ limitSize);
|
||||
}
|
||||
|
||||
send();
|
||||
};
|
||||
|
||||
@@ -502,12 +525,8 @@ layui.define('layer' , function(exports){
|
||||
|
||||
othis.removeAttr('lay-over');
|
||||
setChooseFile(files);
|
||||
|
||||
if(options.auto){
|
||||
that.upload(files);
|
||||
} else {
|
||||
setChooseText(files);
|
||||
}
|
||||
|
||||
options.auto ? that.upload() : setChooseText(files); //是否自动触发上传
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
/*!
|
||||
/**
|
||||
* util 工具组件
|
||||
*/
|
||||
*/
|
||||
|
||||
layui.define('jquery', function(exports){
|
||||
"use strict";
|
||||
@@ -170,18 +169,27 @@ layui.define('jquery', function(exports){
|
||||
.replace(/ss/g, hms[2]);
|
||||
}
|
||||
|
||||
//转义 html,防 xss 攻击
|
||||
//转义 html
|
||||
,escape: function(html){
|
||||
return String(html || '').replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&')
|
||||
var exp = /[<"'>]|&(?=#[a-zA-Z0-9]+)/g;
|
||||
if(html === undefined || html === null) return '';
|
||||
|
||||
html += '';
|
||||
if(!exp.test(html)) return html;
|
||||
|
||||
return html.replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&')
|
||||
.replace(/</g, '<').replace(/>/g, '>')
|
||||
.replace(/'/g, ''').replace(/"/g, '"');
|
||||
}
|
||||
|
||||
//还原转义的 html
|
||||
,unescape: function(str){
|
||||
return String(str || '').replace(/\&/g, '&')
|
||||
,unescape: function(html){
|
||||
if(html === undefined || html === null) html = '';
|
||||
html += '';
|
||||
|
||||
return html.replace(/\&/g, '&')
|
||||
.replace(/\</g, '<').replace(/\>/g, '>')
|
||||
.replace(/\'/, '\'').replace(/\"/, '"');
|
||||
.replace(/\'/g, '\'').replace(/\"/g, '"');
|
||||
}
|
||||
|
||||
//让指定的元素保持在可视区域
|
||||
@@ -237,12 +245,14 @@ layui.define('jquery', function(exports){
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
|
||||
util.on = util.event;
|
||||
|
||||
// DOM 尺寸变化,该创意来自:http://benalman.com/projects/jquery-resize-plugin/
|
||||
/*
|
||||
!function(a,b,c){"$:nomunge";function l(){f=b[g](function(){d.each(function(){var b=a(this),c=b.width(),d=b.height(),e=a.data(this,i);(c!==e.w||d!==e.h)&&b.trigger(h,[e.w=c,e.h=d])}),l()},e[j])}var f,d=a([]),e=a.resize=a.extend(a.resize,{}),g="setTimeout",h="resize",i=h+"-special-event",j="delay",k="throttleWindow";e[j]=250,e[k]=!0,a.event.special[h]={setup:function(){if(!e[k]&&this[g])return!1;var b=a(this);d=d.add(b),a.data(this,i,{w:b.width(),h:b.height()}),1===d.length&&l()},teardown:function(){if(!e[k]&&this[g])return!1;var b=a(this);d=d.not(b),b.removeData(i),d.length||clearTimeout(f)},add:function(b){function f(b,e,f){var g=a(this),h=a.data(this,i)||{};h.w=e!==c?e:g.width(),h.h=f!==c?f:g.height(),d.apply(this,arguments)}if(!e[k]&&this[g])return!1;var d;return a.isFunction(b)?(d=b,f):(d=b.handler,b.handler=f,void 0)}}}($,window);
|
||||
*/
|
||||
|
||||
//暴露接口
|
||||
// 输出接口
|
||||
exports('util', util);
|
||||
});
|
||||
Reference in New Issue
Block a user