chore: update
This commit is contained in:
parent
fdba3194fa
commit
fc09eef635
22
bower.json
22
bower.json
@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "layui",
|
|
||||||
"main": "dist/layui.js",
|
|
||||||
"version": "2.6.6",
|
|
||||||
"homepage": "https://github.com/sentsin/layui",
|
|
||||||
"authors": [
|
|
||||||
"sentsin <xu@sentsin.com>"
|
|
||||||
],
|
|
||||||
"description": "Classic modular front-end component library",
|
|
||||||
"moduleType": [
|
|
||||||
"amd",
|
|
||||||
"globals"
|
|
||||||
],
|
|
||||||
"keywords": [
|
|
||||||
"layui",
|
|
||||||
"ui",
|
|
||||||
"JavaScript Framework",
|
|
||||||
"toolkit",
|
|
||||||
"front-end component library"
|
|
||||||
],
|
|
||||||
"license": "MIT"
|
|
||||||
}
|
|
2
dist/css/layui.css
vendored
2
dist/css/layui.css
vendored
File diff suppressed because one or more lines are too long
7
dist/layui.js
vendored
7
dist/layui.js
vendored
File diff suppressed because one or more lines are too long
51
examples/base.html
Normal file
51
examples/base.html
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
<title>基础方法 - layui</title>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../src/css/layui.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="layui-container" style="padding: 30px 0;">
|
||||||
|
|
||||||
|
<div class="" style="padding: 30px 0;">
|
||||||
|
|
||||||
|
<blockquote class="layui-elem-quote" style="color: #666;">
|
||||||
|
调试结果查看浏览器控制台
|
||||||
|
</blockquote>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="../src/layui.js"></script>
|
||||||
|
<script>
|
||||||
|
layui.use('lay', function(){
|
||||||
|
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
'layui.sort: ',
|
||||||
|
layui.sort([{a: 3},{a: 0},{a: 0},{a: -1},{a: -5},{a: 6},{a: 9}], 'a')
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
'layui._typeof: ',
|
||||||
|
layui._typeof(new RegExp()), layui._typeof(new Date()), layui._typeof([])
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
'layui._isArray ',
|
||||||
|
layui._isArray([1,6]), layui._isArray(lay('div')), layui._isArray(document.querySelectorAll('div')),
|
||||||
|
layui._isArray({key: 'value'})
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -8,7 +8,7 @@
|
|||||||
,"data": [{
|
,"data": [{
|
||||||
"id": "10001"
|
"id": "10001"
|
||||||
,"username": "杜甫"
|
,"username": "杜甫"
|
||||||
,"email": "xianxin@layui.com"
|
,"email": "test@email.com"
|
||||||
,"sex": "男"
|
,"sex": "男"
|
||||||
,"city": "浙江杭州"
|
,"city": "浙江杭州"
|
||||||
,"sign": "鼠标移动到此处,可以通过点击单元格右侧的下拉图标,查看到被隐藏的全部内容。"
|
,"sign": "鼠标移动到此处,可以通过点击单元格右侧的下拉图标,查看到被隐藏的全部内容。"
|
||||||
@ -19,7 +19,7 @@
|
|||||||
}, {
|
}, {
|
||||||
"id": "10002"
|
"id": "10002"
|
||||||
,"username": "李白"
|
,"username": "李白"
|
||||||
,"email": "xianxin@layui.com"
|
,"email": "test@email.com"
|
||||||
,"sex": "男"
|
,"sex": "男"
|
||||||
,"city": "浙江杭州"
|
,"city": "浙江杭州"
|
||||||
,"sign": "君不见,黄河之水天上来,奔流到海不复回。 君不见,高堂明镜悲白发,朝如青丝暮成雪。 人生得意须尽欢,莫使金樽空对月。 天生我材必有用,千金散尽还复来。 烹羊宰牛且为乐,会须一饮三百杯。 岑夫子,丹丘生,将进酒,杯莫停。 与君歌一曲,请君为我倾耳听。(倾耳听 一作:侧耳听) 钟鼓馔玉不足贵,但愿长醉不复醒。(不足贵 一作:何足贵;不复醒 一作:不愿醒/不用醒) 古来圣贤皆寂寞,惟有饮者留其名。(古来 一作:自古;惟 通:唯) 陈王昔时宴平乐,斗酒十千恣欢谑。 主人何为言少钱,径须沽取对君酌。 五花马,千金裘,呼儿将出换美酒,与尔同销万古愁。"
|
,"sign": "君不见,黄河之水天上来,奔流到海不复回。 君不见,高堂明镜悲白发,朝如青丝暮成雪。 人生得意须尽欢,莫使金樽空对月。 天生我材必有用,千金散尽还复来。 烹羊宰牛且为乐,会须一饮三百杯。 岑夫子,丹丘生,将进酒,杯莫停。 与君歌一曲,请君为我倾耳听。(倾耳听 一作:侧耳听) 钟鼓馔玉不足贵,但愿长醉不复醒。(不足贵 一作:何足贵;不复醒 一作:不愿醒/不用醒) 古来圣贤皆寂寞,惟有饮者留其名。(古来 一作:自古;惟 通:唯) 陈王昔时宴平乐,斗酒十千恣欢谑。 主人何为言少钱,径须沽取对君酌。 五花马,千金裘,呼儿将出换美酒,与尔同销万古愁。"
|
||||||
@ -31,7 +31,7 @@
|
|||||||
}, {
|
}, {
|
||||||
"id": "10003"
|
"id": "10003"
|
||||||
,"username": "王勃"
|
,"username": "王勃"
|
||||||
,"email": "xianxin@layui.com"
|
,"email": "test@email.com"
|
||||||
,"sex": "男"
|
,"sex": "男"
|
||||||
,"city": "浙江杭州"
|
,"city": "浙江杭州"
|
||||||
,"sign": "人生恰似一场修行"
|
,"sign": "人生恰似一场修行"
|
||||||
@ -42,7 +42,7 @@
|
|||||||
}, {
|
}, {
|
||||||
"id": "10004"
|
"id": "10004"
|
||||||
,"username": "李清照"
|
,"username": "李清照"
|
||||||
,"email": "xianxin@layui.com"
|
,"email": "test@email.com"
|
||||||
,"sex": "女"
|
,"sex": "女"
|
||||||
,"city": "浙江杭州"
|
,"city": "浙江杭州"
|
||||||
,"sign": "人生恰似一场修行"
|
,"sign": "人生恰似一场修行"
|
||||||
@ -53,7 +53,7 @@
|
|||||||
}, {
|
}, {
|
||||||
"id": "10005"
|
"id": "10005"
|
||||||
,"username": "冰心"
|
,"username": "冰心"
|
||||||
,"email": "xianxin@layui.com"
|
,"email": "test@email.com"
|
||||||
,"sex": "女"
|
,"sex": "女"
|
||||||
,"city": "浙江杭州"
|
,"city": "浙江杭州"
|
||||||
,"sign": "人生恰似一场修行"
|
,"sign": "人生恰似一场修行"
|
||||||
@ -64,7 +64,7 @@
|
|||||||
}, {
|
}, {
|
||||||
"id": "10006"
|
"id": "10006"
|
||||||
,"username": "贤心"
|
,"username": "贤心"
|
||||||
,"email": "xianxin@layui.com"
|
,"email": "test@email.com"
|
||||||
,"sex": "男"
|
,"sex": "男"
|
||||||
,"city": "浙江杭州"
|
,"city": "浙江杭州"
|
||||||
,"sign": "人生恰似一场修行"
|
,"sign": "人生恰似一场修行"
|
||||||
@ -75,7 +75,7 @@
|
|||||||
}, {
|
}, {
|
||||||
"id": "10007"
|
"id": "10007"
|
||||||
,"username": "贤心"
|
,"username": "贤心"
|
||||||
,"email": "xianxin@layui.com"
|
,"email": "test@email.com"
|
||||||
,"sex": "男"
|
,"sex": "男"
|
||||||
,"city": "浙江杭州"
|
,"city": "浙江杭州"
|
||||||
,"sign": "人生恰似一场修行"
|
,"sign": "人生恰似一场修行"
|
||||||
@ -86,7 +86,7 @@
|
|||||||
}, {
|
}, {
|
||||||
"id": "10008"
|
"id": "10008"
|
||||||
,"username": "贤心"
|
,"username": "贤心"
|
||||||
,"email": "xianxin@layui.com"
|
,"email": "test@email.com"
|
||||||
,"sex": "男"
|
,"sex": "男"
|
||||||
,"city": "浙江杭州"
|
,"city": "浙江杭州"
|
||||||
,"sign": "人生恰似一场修行"
|
,"sign": "人生恰似一场修行"
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"list": [{
|
"list": [{
|
||||||
"id": "10001"
|
"id": "10001"
|
||||||
,"username": "杜甫3"
|
,"username": "杜甫3"
|
||||||
,"email": "xianxin@layui.com"
|
,"email": "test@email.com"
|
||||||
,"sex": "男"
|
,"sex": "男"
|
||||||
,"city": "浙江杭州"
|
,"city": "浙江杭州"
|
||||||
,"sign": "鼠标移动到此处,可以通过点击单元格右侧的下拉图标,查看到被隐藏的全部内容。"
|
,"sign": "鼠标移动到此处,可以通过点击单元格右侧的下拉图标,查看到被隐藏的全部内容。"
|
||||||
@ -17,7 +17,7 @@
|
|||||||
}, {
|
}, {
|
||||||
"id": "10002"
|
"id": "10002"
|
||||||
,"username": "李白3"
|
,"username": "李白3"
|
||||||
,"email": "xianxin@layui.com"
|
,"email": "test@email.com"
|
||||||
,"sex": "男"
|
,"sex": "男"
|
||||||
,"city": "浙江杭州"
|
,"city": "浙江杭州"
|
||||||
,"sign": "君不见,黄河之水天上来,奔流到海不复回。 君不见,高堂明镜悲白发,朝如青丝暮成雪。 人生得意须尽欢,莫使金樽空对月。 天生我材必有用,千金散尽还复来。 烹羊宰牛且为乐,会须一饮三百杯。 岑夫子,丹丘生,将进酒,杯莫停。 与君歌一曲,请君为我倾耳听。(倾耳听 一作:侧耳听) 钟鼓馔玉不足贵,但愿长醉不复醒。(不足贵 一作:何足贵;不复醒 一作:不愿醒/不用醒) 古来圣贤皆寂寞,惟有饮者留其名。(古来 一作:自古;惟 通:唯) 陈王昔时宴平乐,斗酒十千恣欢谑。 主人何为言少钱,径须沽取对君酌。 五花马,千金裘,呼儿将出换美酒,与尔同销万古愁。"
|
,"sign": "君不见,黄河之水天上来,奔流到海不复回。 君不见,高堂明镜悲白发,朝如青丝暮成雪。 人生得意须尽欢,莫使金樽空对月。 天生我材必有用,千金散尽还复来。 烹羊宰牛且为乐,会须一饮三百杯。 岑夫子,丹丘生,将进酒,杯莫停。 与君歌一曲,请君为我倾耳听。(倾耳听 一作:侧耳听) 钟鼓馔玉不足贵,但愿长醉不复醒。(不足贵 一作:何足贵;不复醒 一作:不愿醒/不用醒) 古来圣贤皆寂寞,惟有饮者留其名。(古来 一作:自古;惟 通:唯) 陈王昔时宴平乐,斗酒十千恣欢谑。 主人何为言少钱,径须沽取对君酌。 五花马,千金裘,呼儿将出换美酒,与尔同销万古愁。"
|
||||||
@ -29,7 +29,7 @@
|
|||||||
}, {
|
}, {
|
||||||
"id": "10003"
|
"id": "10003"
|
||||||
,"username": "王勃"
|
,"username": "王勃"
|
||||||
,"email": "xianxin@layui.com"
|
,"email": "test@email.com"
|
||||||
,"sex": "男"
|
,"sex": "男"
|
||||||
,"city": "浙江杭州"
|
,"city": "浙江杭州"
|
||||||
,"sign": "人生恰似一场修行"
|
,"sign": "人生恰似一场修行"
|
||||||
@ -40,7 +40,7 @@
|
|||||||
}, {
|
}, {
|
||||||
"id": "10004"
|
"id": "10004"
|
||||||
,"username": "李清照"
|
,"username": "李清照"
|
||||||
,"email": "xianxin@layui.com"
|
,"email": "test@email.com"
|
||||||
,"sex": "女"
|
,"sex": "女"
|
||||||
,"city": "浙江杭州"
|
,"city": "浙江杭州"
|
||||||
,"sign": "人生恰似一场修行"
|
,"sign": "人生恰似一场修行"
|
||||||
@ -51,7 +51,7 @@
|
|||||||
}, {
|
}, {
|
||||||
"id": "10005"
|
"id": "10005"
|
||||||
,"username": "冰心"
|
,"username": "冰心"
|
||||||
,"email": "xianxin@layui.com"
|
,"email": "test@email.com"
|
||||||
,"sex": "女"
|
,"sex": "女"
|
||||||
,"city": "浙江杭州"
|
,"city": "浙江杭州"
|
||||||
,"sign": "人生恰似一场修行"
|
,"sign": "人生恰似一场修行"
|
||||||
@ -62,7 +62,7 @@
|
|||||||
}, {
|
}, {
|
||||||
"id": "10006"
|
"id": "10006"
|
||||||
,"username": "贤心"
|
,"username": "贤心"
|
||||||
,"email": "xianxin@layui.com"
|
,"email": "test@email.com"
|
||||||
,"sex": "男"
|
,"sex": "男"
|
||||||
,"city": "浙江杭州"
|
,"city": "浙江杭州"
|
||||||
,"sign": "人生恰似一场修行"
|
,"sign": "人生恰似一场修行"
|
||||||
|
@ -121,13 +121,14 @@ layui.use('laydate', function(laydate){
|
|||||||
//双控件
|
//双控件
|
||||||
laydate.render({
|
laydate.render({
|
||||||
elem: '#test1' //指定元素
|
elem: '#test1' //指定元素
|
||||||
,type: 'date'
|
,type: 'datetime'
|
||||||
,trigger: 'click'
|
,trigger: 'click'
|
||||||
//,lang: 'en'
|
//,lang: 'en'
|
||||||
//,theme: 'grid'
|
//,theme: 'grid'
|
||||||
,range: true //开启日期范围,默认使用“-”分割
|
,range: true //开启日期范围,默认使用“-”分割
|
||||||
,min: 0
|
//,min: '1949-10-1'
|
||||||
,max: 7
|
//,max: '2021-5-9'
|
||||||
|
//,value: '2021-05-09 12:06:09'
|
||||||
//,value: '2021-05-08 - 2021-03-27'
|
//,value: '2021-05-08 - 2021-03-27'
|
||||||
,done: function(value, date, endDate){
|
,done: function(value, date, endDate){
|
||||||
console.log(value, date, endDate);
|
console.log(value, date, endDate);
|
||||||
@ -163,7 +164,7 @@ layui.use('laydate', function(laydate){
|
|||||||
//年选择器
|
//年选择器
|
||||||
laydate.render({
|
laydate.render({
|
||||||
elem: '#test3'
|
elem: '#test3'
|
||||||
,type: 'month'
|
,type: 'year'
|
||||||
//,range: true
|
//,range: true
|
||||||
//,trigger: 'click'
|
//,trigger: 'click'
|
||||||
,done: function(value, date, endDate){
|
,done: function(value, date, endDate){
|
||||||
@ -177,7 +178,7 @@ layui.use('laydate', function(laydate){
|
|||||||
//年月选择器
|
//年月选择器
|
||||||
laydate.render({
|
laydate.render({
|
||||||
elem: '#test4'
|
elem: '#test4'
|
||||||
,type: 'time'
|
,type: 'month'
|
||||||
,range: true
|
,range: true
|
||||||
,trigger: 'click'
|
,trigger: 'click'
|
||||||
//,max: -30
|
//,max: -30
|
||||||
|
@ -63,10 +63,11 @@
|
|||||||
|
|
||||||
<script src="../src/layui.js" src1="//www.layuicdn.com/layui-v2.5.3/layui.js" charset="utf-8"></script>
|
<script src="../src/layui.js" src1="//www.layuicdn.com/layui-v2.5.3/layui.js" charset="utf-8"></script>
|
||||||
<script>
|
<script>
|
||||||
layui.use(['table'], function(){
|
layui.use(['table', 'dropdown'], function(){
|
||||||
var table = layui.table
|
var table = layui.table
|
||||||
,$ = layui.$
|
,$ = layui.$
|
||||||
,laytpl = layui.laytpl;
|
,laytpl = layui.laytpl
|
||||||
|
,dropdown = layui.dropdown;;
|
||||||
|
|
||||||
//全局设定某参数
|
//全局设定某参数
|
||||||
table.set({
|
table.set({
|
||||||
@ -112,10 +113,10 @@ layui.use(['table'], function(){
|
|||||||
,{field:'sex', title:'性别', width:80, edit: 'text', sort: true}
|
,{field:'sex', title:'性别', width:80, edit: 'text', sort: true}
|
||||||
,{field:'city', title:'城市', width:120, templet: '#cityTpl'}
|
,{field:'city', title:'城市', width:120, templet: '#cityTpl'}
|
||||||
,{field:'sign', title:'签名'}
|
,{field:'sign', title:'签名'}
|
||||||
,{field:'experience', title:'积分', width:80, sort: true, totalRow: '{{ d.TOTAL_NUMS }}🍉', templet: '<div>{{ d.experience }} 分</div>'}
|
,{field: 'experience', title: '积分', width:80, sort: true, totalRow: '{{ d.TOTAL_NUMS }} 😊', templet: '<div>{{ d.experience }} 分</div>'}
|
||||||
,{field:'ip', title:'IP', width:120}
|
,{field:'ip', title:'IP', width: 120}
|
||||||
,{field:'logins', title:'登入次数', width:100, sort: true, totalRow: '{{ parseInt(d.TOTAL_NUMS) }} 次'}
|
,{field:'logins', title:'登入次数', width: 100, sort: true, totalRow: '{{ parseInt(d.TOTAL_NUMS) }} 次'}
|
||||||
,{field:'joinTime', title:'加入时间', width:120}
|
,{field:'joinTime', title:'加入时间', width: 120}
|
||||||
,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
|
,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
|
||||||
]]
|
]]
|
||||||
|
|
||||||
@ -133,7 +134,18 @@ layui.use(['table'], function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
,done: function(){
|
,done: function(){
|
||||||
|
//下拉菜单
|
||||||
|
dropdown.render({
|
||||||
|
elem: '#dropdown' //可绑定在任意元素中,此处以上述按钮为例
|
||||||
|
,data: [{
|
||||||
|
id: 0,
|
||||||
|
title: '刷新'
|
||||||
|
}]
|
||||||
|
//菜单被点击的事件
|
||||||
|
,click: function(obj){
|
||||||
|
table.reload('test');
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
,error: function(res, msg){
|
,error: function(res, msg){
|
||||||
@ -213,6 +225,7 @@ layui.use(['table'], function(){
|
|||||||
abc: 123
|
abc: 123
|
||||||
,test: '新的 test1'
|
,test: '新的 test1'
|
||||||
}
|
}
|
||||||
|
,defaultToolbar: ['print']
|
||||||
,page: {curr: 5, limit: 20}
|
,page: {curr: 5, limit: 20}
|
||||||
,cols: ins1.config.cols
|
,cols: ins1.config.cols
|
||||||
//,height: 300
|
//,height: 300
|
||||||
|
20
gulpfile.js
20
gulpfile.js
@ -13,6 +13,7 @@ var concat = require('gulp-concat');
|
|||||||
var rename = require('gulp-rename');
|
var rename = require('gulp-rename');
|
||||||
var replace = require('gulp-replace');
|
var replace = require('gulp-replace');
|
||||||
var header = require('gulp-header');
|
var header = require('gulp-header');
|
||||||
|
var footer = require('gulp-footer');
|
||||||
var del = require('del');
|
var del = require('del');
|
||||||
var gulpif = require('gulp-if');
|
var gulpif = require('gulp-if');
|
||||||
var minimist = require('minimist');
|
var minimist = require('minimist');
|
||||||
@ -27,7 +28,8 @@ var argv = require('minimist')(process.argv.slice(2), {
|
|||||||
|
|
||||||
//注释
|
//注释
|
||||||
,note = [
|
,note = [
|
||||||
'/*! <%= pkg.realname %> v<%= pkg.version %> | Released under the <%= pkg.license %> license */\n <%= js %>'
|
// '/*! <%= pkg.realname %> v<%= pkg.version %> | Released under the <%= pkg.license %> license */\n <%= js %>'
|
||||||
|
'/*! <%= pkg.license %> Licensed */<%= js %>'
|
||||||
,{pkg: pkg, js: ';'}
|
,{pkg: pkg, js: ';'}
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -135,7 +137,7 @@ gulp.task('rls', ['clearRelease'], function(){ // gulp rls
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//打包 layer 独立版
|
//打包 layer 单独版
|
||||||
gulp.task('layer', function(){
|
gulp.task('layer', function(){
|
||||||
var dir = './release/layer';
|
var dir = './release/layer';
|
||||||
|
|
||||||
@ -147,15 +149,15 @@ gulp.task('layer', function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//打包 layDate 独立版
|
//打包 layDate 单独版
|
||||||
gulp.task('laydate', function(){
|
gulp.task('laydate', function(){
|
||||||
//发行目录
|
//发行目录
|
||||||
var dir = './release/laydate'
|
var dir = './release/laydate'
|
||||||
|
|
||||||
//注释
|
//注释
|
||||||
,notes = [
|
,notes = [
|
||||||
'/*! \n * <%= title %> \n * <%= license %> Licensed \n */ \n\n'
|
'\n/*! \n * <%= title %> \n * <%= license %> Licensed \n */ \n\n'
|
||||||
,{title: 'layDate 日期与时间组件', license: 'MIT'}
|
,{title: 'layDate 日期与时间组件(单独版)', license: 'MIT'}
|
||||||
];
|
];
|
||||||
|
|
||||||
//合并所依赖的 css 文件
|
//合并所依赖的 css 文件
|
||||||
@ -164,9 +166,13 @@ gulp.task('laydate', function(){
|
|||||||
.pipe(gulp.dest(dir + '/src/theme/default'));
|
.pipe(gulp.dest(dir + '/src/theme/default'));
|
||||||
|
|
||||||
//合并所依赖的 js 文件
|
//合并所依赖的 js 文件
|
||||||
return gulp.src(['./src/modules/{lay,laydate}.js'])
|
return gulp.src(['./src/layui.js', './src/modules/{lay,laydate}.js'])
|
||||||
|
.pipe(replace('win.layui =', 'var layui =')) //将 layui 替换为局部变量
|
||||||
|
.pipe(replace('}(window); //gulp build: layui-footer', '')) //替换 layui.js 的落脚
|
||||||
|
.pipe(replace(';!function(window){ //gulp build: lay-header', '')) //替换 lay.js 的头部
|
||||||
|
|
||||||
.pipe(concat('laydate.js', {newLine: ''}))
|
.pipe(concat('laydate.js', {newLine: ''}))
|
||||||
.pipe(header.apply(null, notes))
|
.pipe(header.apply(null, notes)) //追加头部
|
||||||
.pipe(gulp.dest(dir + '/src'));
|
.pipe(gulp.dest(dir + '/src'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"name": "layui",
|
"name": "layui",
|
||||||
"realname": "layui",
|
"realname": "layui",
|
||||||
"version": "2.6.7",
|
"version": "2.6.7",
|
||||||
"description": "Classic modular front-end ui component library",
|
"description": "Classic modular Front-End UI library",
|
||||||
"main": "dist/layui.js",
|
"main": "dist/layui.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -24,6 +24,7 @@
|
|||||||
"del": "^2.2.2",
|
"del": "^2.2.2",
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
"gulp-concat": "^2.6.0 ",
|
"gulp-concat": "^2.6.0 ",
|
||||||
|
"gulp-footer": "^2.0.2",
|
||||||
"gulp-header": "^1.8.8",
|
"gulp-header": "^1.8.8",
|
||||||
"gulp-if": "^2.0.1",
|
"gulp-if": "^2.0.1",
|
||||||
"gulp-minify-css": "^1.2.4",
|
"gulp-minify-css": "^1.2.4",
|
||||||
|
@ -1072,7 +1072,7 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
|
|||||||
.layui-nav .layui-nav-item{position: relative; display: inline-block; *display: inline; *zoom: 1; vertical-align: middle; line-height: 60px;}
|
.layui-nav .layui-nav-item{position: relative; display: inline-block; *display: inline; *zoom: 1; vertical-align: middle; line-height: 60px;}
|
||||||
.layui-nav .layui-nav-item a{display: block; padding: 0 20px; color: #fff; color: rgba(255,255,255,.7); transition: all .3s; -webkit-transition: all .3s;}
|
.layui-nav .layui-nav-item a{display: block; padding: 0 20px; color: #fff; color: rgba(255,255,255,.7); transition: all .3s; -webkit-transition: all .3s;}
|
||||||
.layui-nav-bar,
|
.layui-nav-bar,
|
||||||
.layui-nav .layui-this:after{content: ""; position: absolute; left: 0; top: 0; width: 0; height: 5px; background-color: #5FB878; transition: all .2s; -webkit-transition: all .2s;}
|
.layui-nav .layui-this:after{content: ""; position: absolute; left: 0; top: 0; width: 0; height: 5px; background-color: #5FB878; transition: all .2s; -webkit-transition: all .2s; pointer-events: none;}
|
||||||
.layui-nav-bar{z-index: 1000;}
|
.layui-nav-bar{z-index: 1000;}
|
||||||
.layui-nav[lay-bar="disabled"] .layui-nav-bar{display: none;}
|
.layui-nav[lay-bar="disabled"] .layui-nav-bar{display: none;}
|
||||||
.layui-nav[lay-bar="disabled"].layui-this:after{}
|
.layui-nav[lay-bar="disabled"].layui-this:after{}
|
||||||
@ -1099,7 +1099,8 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
|
|||||||
.layui-nav-tree .layui-nav-item{display: block; width: 100%; line-height: 40px;}
|
.layui-nav-tree .layui-nav-item{display: block; width: 100%; line-height: 40px;}
|
||||||
.layui-nav-tree .layui-nav-item a{position: relative; height: 40px; line-height: 40px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}
|
.layui-nav-tree .layui-nav-item a{position: relative; height: 40px; line-height: 40px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}
|
||||||
.layui-nav-tree .layui-nav-item>a{padding-top: 5px; padding-bottom: 5px;}
|
.layui-nav-tree .layui-nav-item>a{padding-top: 5px; padding-bottom: 5px;}
|
||||||
.layui-nav-tree .layui-nav-more{right: 15px; padding: 6px 0;}
|
.layui-nav-tree .layui-nav-more{right: 15px;}
|
||||||
|
.layui-nav-tree .layui-nav-item>a .layui-nav-more{padding: 5px 0;}
|
||||||
.layui-nav-tree .layui-nav-bar{width: 5px; height: 0;}
|
.layui-nav-tree .layui-nav-bar{width: 5px; height: 0;}
|
||||||
.layui-side .layui-nav-tree .layui-nav-bar{width: 2px;}
|
.layui-side .layui-nav-tree .layui-nav-bar{width: 2px;}
|
||||||
.layui-nav-tree .layui-this,
|
.layui-nav-tree .layui-this,
|
||||||
|
78
src/layui.js
78
src/layui.js
@ -1,14 +1,14 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* layui
|
* Layui
|
||||||
* Classic modular front-end ui framework
|
* Classic modular Front-End UI library
|
||||||
* MIT Licensed
|
* MIT Licensed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
;!function(win){
|
;!function(win){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var doc = document, config = {
|
var doc = win.document, config = {
|
||||||
modules: {} //记录模块物理路径
|
modules: {} //记录模块物理路径
|
||||||
,status: {} //记录模块加载状态
|
,status: {} //记录模块加载状态
|
||||||
,timeout: 10 //符合规范的模块请求最长等待秒数
|
,timeout: 10 //符合规范的模块请求最长等待秒数
|
||||||
@ -16,11 +16,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
,Layui = function(){
|
,Layui = function(){
|
||||||
this.v = '2.6.6'; //版本号
|
this.v = '2.6.7'; //版本号
|
||||||
}
|
}
|
||||||
|
|
||||||
//识别预先可能定义的指定全局对象
|
//识别预先可能定义的指定全局对象
|
||||||
,GLOBAL = window.LAYUI_GLOBAL || {}
|
,GLOBAL = win.LAYUI_GLOBAL || {}
|
||||||
|
|
||||||
//获取 layui 所在目录
|
//获取 layui 所在目录
|
||||||
,getPath = function(){
|
,getPath = function(){
|
||||||
@ -125,7 +125,7 @@
|
|||||||
}();
|
}();
|
||||||
|
|
||||||
//如果页面已经存在 jQuery 1.7+ 库且所定义的模块依赖 jQuery,则不加载内部 jquery 模块
|
//如果页面已经存在 jQuery 1.7+ 库且所定义的模块依赖 jQuery,则不加载内部 jquery 模块
|
||||||
if(window.jQuery && jQuery.fn.on){
|
if(win.jQuery && jQuery.fn.on){
|
||||||
that.each(apps, function(index, item){
|
that.each(apps, function(index, item){
|
||||||
if(item === 'jquery'){
|
if(item === 'jquery'){
|
||||||
apps.splice(index, 1);
|
apps.splice(index, 1);
|
||||||
@ -537,29 +537,64 @@
|
|||||||
Layui.prototype.hint = function(){
|
Layui.prototype.hint = function(){
|
||||||
return {
|
return {
|
||||||
error: error
|
error: error
|
||||||
}
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//typeof 类型细分 -> string/number/boolean/undefined/null、object/array/function/…
|
||||||
|
Layui.prototype._typeof = function(operand){
|
||||||
|
if(operand === null) return String(operand);
|
||||||
|
|
||||||
|
//细分引用类型
|
||||||
|
return (typeof operand === 'object' || typeof operand === 'function') ? function(){
|
||||||
|
var type = Object.prototype.toString.call(operand).match(/\s(.+)\]$/) || [] //匹配类型字符
|
||||||
|
,classType = 'Function|Array|Date|RegExp|Object|Error|Symbol'; //常见类型字符
|
||||||
|
|
||||||
|
type = type[1] || 'Object';
|
||||||
|
|
||||||
|
//除匹配到的类型外,其他对象均返回 object
|
||||||
|
return new RegExp('\\b('+ classType + ')\\b').test(type)
|
||||||
|
? type.toLowerCase()
|
||||||
|
: 'object';
|
||||||
|
}() : typeof operand;
|
||||||
|
};
|
||||||
|
|
||||||
|
//对象是否具备数组结构(此处为兼容 jQuery 对象)
|
||||||
|
Layui.prototype._isArray = function(obj){
|
||||||
|
var that = this
|
||||||
|
,len
|
||||||
|
,type = that._typeof(obj);
|
||||||
|
|
||||||
|
if(!obj || (typeof obj !== 'object') || obj === win) return false;
|
||||||
|
|
||||||
|
len = 'length' in obj && obj.length; //兼容 ie
|
||||||
|
return type === 'array' || len === 0 || (
|
||||||
|
typeof len === 'number' && len > 0 && (len - 1) in obj //兼容 jQuery 对象
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
//遍历
|
//遍历
|
||||||
Layui.prototype.each = function(obj, fn){
|
Layui.prototype.each = function(obj, fn){
|
||||||
var key
|
var key
|
||||||
,that = this
|
,that = this
|
||||||
,callFn = function(key, obj){
|
,callFn = function(key, obj){ //回调
|
||||||
return fn.call(obj[key], key, obj[key])
|
return fn.call(obj[key], key, obj[key])
|
||||||
};
|
};
|
||||||
|
|
||||||
if(typeof fn !== 'function') return that;
|
if(typeof fn !== 'function') return that;
|
||||||
obj = obj || [];
|
obj = obj || [];
|
||||||
|
|
||||||
if(obj.constructor === Object){
|
//优先处理数组结构
|
||||||
for(key in obj){
|
if(that._isArray(obj)){
|
||||||
if(callFn(key, obj)) break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for(key = 0; key < obj.length; key++){
|
for(key = 0; key < obj.length; key++){
|
||||||
if(callFn(key, obj)) break;
|
if(callFn(key, obj)) break;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
for(key in obj){
|
||||||
|
if(callFn(key, obj)) break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -571,7 +606,7 @@
|
|||||||
|
|
||||||
if(!key) return clone;
|
if(!key) return clone;
|
||||||
|
|
||||||
//如果是数字,按大小排序,如果是非数字,按字典序排序
|
//如果是数字,按大小排序;如果是非数字,则按字典序排序
|
||||||
clone.sort(function(o1, o2){
|
clone.sort(function(o1, o2){
|
||||||
var isNum = /^-?\d+$/
|
var isNum = /^-?\d+$/
|
||||||
,v1 = o1[key]
|
,v1 = o1[key]
|
||||||
@ -580,6 +615,9 @@
|
|||||||
if(isNum.test(v1)) v1 = parseFloat(v1);
|
if(isNum.test(v1)) v1 = parseFloat(v1);
|
||||||
if(isNum.test(v2)) v2 = parseFloat(v2);
|
if(isNum.test(v2)) v2 = parseFloat(v2);
|
||||||
|
|
||||||
|
return v1 - v2;
|
||||||
|
|
||||||
|
/*
|
||||||
if(v1 && !v2){
|
if(v1 && !v2){
|
||||||
return 1;
|
return 1;
|
||||||
} else if(!v1 && v2){
|
} else if(!v1 && v2){
|
||||||
@ -593,6 +631,8 @@
|
|||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
desc && clone.reverse(); //倒序
|
desc && clone.reverse(); //倒序
|
||||||
@ -607,6 +647,9 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//字符常理
|
||||||
|
var EV_REMOVE = 'LAYUI-EVENT-REMOVE';
|
||||||
|
|
||||||
//自定义模块事件
|
//自定义模块事件
|
||||||
Layui.prototype.onevent = function(modName, events, callback){
|
Layui.prototype.onevent = function(modName, events, callback){
|
||||||
if(typeof modName !== 'string'
|
if(typeof modName !== 'string'
|
||||||
@ -628,7 +671,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
//如果参数传入特定字符,则执行移除事件
|
//如果参数传入特定字符,则执行移除事件
|
||||||
if(params === 'LAYUI-EVENT-REMOVE'){
|
if(params === EV_REMOVE){
|
||||||
delete (that.cache.event[eventName] || {})[filterName];
|
delete (that.cache.event[eventName] || {})[filterName];
|
||||||
return that;
|
return that;
|
||||||
}
|
}
|
||||||
@ -668,10 +711,11 @@
|
|||||||
//移除模块事件
|
//移除模块事件
|
||||||
Layui.prototype.off = function(events, modName){
|
Layui.prototype.off = function(events, modName){
|
||||||
var that = this;
|
var that = this;
|
||||||
return that.event.call(that, modName, events, 'LAYUI-EVENT-REMOVE');
|
return that.event.call(that, modName, events, EV_REMOVE);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//exports layui
|
||||||
win.layui = new Layui();
|
win.layui = new Layui();
|
||||||
|
|
||||||
}(window);
|
}(window); //gulp build: layui-footer
|
||||||
|
|
||||||
|
@ -71,8 +71,9 @@ layui.define([''], function(exports){
|
|||||||
Class.prototype.reload = function(options){
|
Class.prototype.reload = function(options){
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
|
//防止数组深度合并
|
||||||
layui.each(options, function(key, item){
|
layui.each(options, function(key, item){
|
||||||
if(item.constructor === Array) delete that.config[key];
|
if(layui._typeof(item) === 'array') delete that.config[key];
|
||||||
});
|
});
|
||||||
|
|
||||||
that.config = $.extend(true, {}, that.config, options);
|
that.config = $.extend(true, {}, that.config, options);
|
||||||
|
@ -258,7 +258,7 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
|
|||||||
|
|
||||||
//阻止全局事件
|
//阻止全局事件
|
||||||
that.elemView.find('.layui-menu').on(clickOrMousedown, function(e){
|
that.elemView.find('.layui-menu').on(clickOrMousedown, function(e){
|
||||||
lay.stope(e);
|
layui.stope(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
//触发菜单列表事件
|
//触发菜单列表事件
|
||||||
|
@ -100,7 +100,7 @@ layui.define('jquery', function(exports){
|
|||||||
|
|
||||||
//基础事件体
|
//基础事件体
|
||||||
,call = {
|
,call = {
|
||||||
//Tab点击
|
//Tab 点击
|
||||||
tabClick: function(e, index, liElem, options){
|
tabClick: function(e, index, liElem, options){
|
||||||
options = options || {};
|
options = options || {};
|
||||||
var othis = liElem || $(this)
|
var othis = liElem || $(this)
|
||||||
@ -108,9 +108,12 @@ layui.define('jquery', function(exports){
|
|||||||
,parents = options.headerElem ? othis.parent() : othis.parents('.layui-tab').eq(0)
|
,parents = options.headerElem ? othis.parent() : othis.parents('.layui-tab').eq(0)
|
||||||
,item = options.bodyElem ? $(options.bodyElem) : parents.children('.layui-tab-content').children('.layui-tab-item')
|
,item = options.bodyElem ? $(options.bodyElem) : parents.children('.layui-tab-content').children('.layui-tab-item')
|
||||||
,elemA = othis.find('a')
|
,elemA = othis.find('a')
|
||||||
|
,isJump = elemA.attr('href') !== 'javascript:;' && elemA.attr('target') === '_blank' //是否存在跳转
|
||||||
|
,unselect = typeof othis.attr('lay-unselect') === 'string' //是否禁用选中
|
||||||
,filter = parents.attr('lay-filter');
|
,filter = parents.attr('lay-filter');
|
||||||
|
|
||||||
if(!(elemA.attr('href') !== 'javascript:;' && elemA.attr('target') === '_blank')){
|
//执行切换
|
||||||
|
if(!(isJump || unselect)){
|
||||||
othis.addClass(THIS).siblings().removeClass(THIS);
|
othis.addClass(THIS).siblings().removeClass(THIS);
|
||||||
item.eq(index).addClass(SHOW).siblings().removeClass(SHOW);
|
item.eq(index).addClass(SHOW).siblings().removeClass(SHOW);
|
||||||
}
|
}
|
||||||
@ -229,7 +232,7 @@ layui.define('jquery', function(exports){
|
|||||||
,filter = parents.attr('lay-filter')
|
,filter = parents.attr('lay-filter')
|
||||||
,parent = othis.parent()
|
,parent = othis.parent()
|
||||||
,child = othis.siblings('.'+NAV_CHILD)
|
,child = othis.siblings('.'+NAV_CHILD)
|
||||||
,unselect = typeof parent.attr('lay-unselect') === 'string';
|
,unselect = typeof parent.attr('lay-unselect') === 'string'; //是否禁用选中
|
||||||
|
|
||||||
if(!(othis.attr('href') !== 'javascript:;' && othis.attr('target') === '_blank') && !unselect){
|
if(!(othis.attr('href') !== 'javascript:;' && othis.attr('target') === '_blank') && !unselect){
|
||||||
if(!child[0]){
|
if(!child[0]){
|
||||||
@ -310,12 +313,15 @@ layui.define('jquery', function(exports){
|
|||||||
,follow = function(bar, nav, index){
|
,follow = function(bar, nav, index){
|
||||||
var othis = $(this), child = othis.find('.'+NAV_CHILD);
|
var othis = $(this), child = othis.find('.'+NAV_CHILD);
|
||||||
if(nav.hasClass(NAV_TREE)){
|
if(nav.hasClass(NAV_TREE)){
|
||||||
var thisA = othis.children('.'+ NAV_TITLE);
|
//无子菜单时跟随
|
||||||
bar.css({
|
if(!child[0]){
|
||||||
top: othis.offset().top - nav.offset().top
|
var thisA = othis.children('.'+ NAV_TITLE);
|
||||||
,height: (thisA[0] ? thisA : othis).outerHeight()
|
bar.css({
|
||||||
,opacity: 1
|
top: othis.offset().top - nav.offset().top
|
||||||
});
|
,height: (thisA[0] ? thisA : othis).outerHeight()
|
||||||
|
,opacity: 1
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
child.addClass(NAV_ANIM);
|
child.addClass(NAV_ANIM);
|
||||||
|
|
||||||
@ -325,7 +331,7 @@ layui.define('jquery', function(exports){
|
|||||||
});
|
});
|
||||||
|
|
||||||
//滑块定位
|
//滑块定位
|
||||||
if(child[0]){
|
if(child[0]){ //若有子菜单,则滑块消失
|
||||||
bar.css({
|
bar.css({
|
||||||
left: bar.position().left + bar.width()/2
|
left: bar.position().left + bar.width()/2
|
||||||
,width: 0
|
,width: 0
|
||||||
@ -371,13 +377,15 @@ layui.define('jquery', function(exports){
|
|||||||
? itemElem.find('dd,>.'+ NAV_TITLE)
|
? itemElem.find('dd,>.'+ NAV_TITLE)
|
||||||
: itemElem).on('mouseenter', function(){
|
: itemElem).on('mouseenter', function(){
|
||||||
follow.call(this, bar, othis, index);
|
follow.call(this, bar, othis, index);
|
||||||
}).on('mouseleave', function(){
|
}).on('mouseleave', function(){ //鼠标移出
|
||||||
|
//是否为垂直导航
|
||||||
if(othis.hasClass(NAV_TREE)){
|
if(othis.hasClass(NAV_TREE)){
|
||||||
bar.css({
|
bar.css({
|
||||||
height: 0
|
height: 0
|
||||||
,opacity: 0
|
,opacity: 0
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
//隐藏子菜单
|
||||||
clearTimeout(timerMore[index]);
|
clearTimeout(timerMore[index]);
|
||||||
timerMore[index] = setTimeout(function(){
|
timerMore[index] = setTimeout(function(){
|
||||||
othis.find('.'+NAV_CHILD).removeClass(SHOW);
|
othis.find('.'+NAV_CHILD).removeClass(SHOW);
|
||||||
|
@ -618,7 +618,7 @@ layui.define('layer', function(exports){
|
|||||||
,DANGER = 'layui-form-danger' //警示样式
|
,DANGER = 'layui-form-danger' //警示样式
|
||||||
,field = {} //字段集合
|
,field = {} //字段集合
|
||||||
,button = $(this) //当前触发的按钮
|
,button = $(this) //当前触发的按钮
|
||||||
,elem = button.parents(ELEM) //当前所在表单域
|
,elem = button.parents(ELEM).eq(0) //当前所在表单域
|
||||||
,verifyElem = elem.find('*[lay-verify]') //获取需要校验的元素
|
,verifyElem = elem.find('*[lay-verify]') //获取需要校验的元素
|
||||||
,formElem = button.parents('form')[0] //获取当前所在的 form 元素,如果存在的话
|
,formElem = button.parents('form')[0] //获取当前所在的 form 元素,如果存在的话
|
||||||
,filter = button.attr('lay-filter'); //获取过滤器
|
,filter = button.attr('lay-filter'); //获取过滤器
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/*! lay 基础 DOM 操作 */
|
/*! lay 基础 DOM 操作 | MIT Licensed */
|
||||||
|
|
||||||
;!function(){
|
;!function(window){ //gulp build: lay-header
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var MOD_NAME = 'lay' //模块名
|
var MOD_NAME = 'lay' //模块名
|
||||||
@ -56,58 +56,36 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
//lay 模块版本
|
//lay 模块版本
|
||||||
lay.v = '1.0.0';
|
lay.v = '1.0.7';
|
||||||
|
|
||||||
//ie版本
|
//ie版本
|
||||||
lay.ie = function(){
|
lay.ie = function(){
|
||||||
var agent = navigator.userAgent.toLowerCase();
|
var agent = navigator.userAgent.toLowerCase();
|
||||||
return (!!window.ActiveXObject || "ActiveXObject" in window) ? (
|
return (!!window.ActiveXObject || "ActiveXObject" in window) ? (
|
||||||
(agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识
|
(agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于 ie11 并没有 msie 的标识
|
||||||
) : false;
|
) : false;
|
||||||
}();
|
}();
|
||||||
|
|
||||||
//获取当前 JS 所在目录
|
|
||||||
lay.getPath = function(){
|
|
||||||
var jsPath = document.currentScript ? document.currentScript.src : function(){
|
|
||||||
var js = document.scripts
|
|
||||||
,last = js.length - 1
|
|
||||||
,src;
|
|
||||||
for(var i = last; i > 0; i--){
|
|
||||||
if(js[i].readyState === 'interactive'){
|
|
||||||
src = js[i].src;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return src || js[last].src;
|
|
||||||
}();
|
|
||||||
return jsPath.substring(0, jsPath.lastIndexOf('/') + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
//中止冒泡
|
|
||||||
lay.stope = function(e){
|
|
||||||
e = e || window.event;
|
|
||||||
e.stopPropagation
|
|
||||||
? e.stopPropagation()
|
/**
|
||||||
: e.cancelBubble = true;
|
* 获取 layui 常见方法,以便用于组件单独版
|
||||||
|
*/
|
||||||
|
|
||||||
|
lay.layui = layui;
|
||||||
|
lay.getPath = layui.cache.dir; //获取当前 JS 所在目录
|
||||||
|
lay.stope = layui.stope; //中止冒泡
|
||||||
|
lay.each = function(){ //遍历
|
||||||
|
layui.each.apply(layui, arguments);
|
||||||
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
//对象遍历
|
|
||||||
lay.each = function(obj, fn){
|
|
||||||
var key
|
|
||||||
,that = this;
|
|
||||||
if(typeof fn !== 'function') return that;
|
|
||||||
obj = obj || [];
|
|
||||||
if(obj.constructor === Object){
|
|
||||||
for(key in obj){
|
|
||||||
if(fn.call(obj[key], key, obj[key])) break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for(key = 0; key < obj.length; key++){
|
|
||||||
if(fn.call(obj[key], key, obj[key])) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return that;
|
|
||||||
};
|
|
||||||
|
|
||||||
//数字前置补零
|
//数字前置补零
|
||||||
lay.digit = function(num, length, end){
|
lay.digit = function(num, length, end){
|
||||||
@ -129,61 +107,6 @@
|
|||||||
return elem;
|
return elem;
|
||||||
};
|
};
|
||||||
|
|
||||||
//获取节点的 style 属性值
|
|
||||||
lay.getStyle = function(node, name){
|
|
||||||
var style = node.currentStyle ? node.currentStyle : window.getComputedStyle(node, null);
|
|
||||||
return style[style.getPropertyValue ? 'getPropertyValue' : 'getAttribute'](name);
|
|
||||||
};
|
|
||||||
|
|
||||||
//载入 CSS 依赖
|
|
||||||
lay.link = function(href, fn, cssname){
|
|
||||||
var head = document.getElementsByTagName("head")[0]
|
|
||||||
,link = document.createElement('link');
|
|
||||||
|
|
||||||
if(typeof fn === 'string') cssname = fn;
|
|
||||||
|
|
||||||
var app = (cssname || href).replace(/\.|\//g, '');
|
|
||||||
var id = 'layuicss-'+ app
|
|
||||||
,STAUTS_NAME = 'creating'
|
|
||||||
,timeout = 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
link.rel = 'stylesheet';
|
|
||||||
link.href = href;
|
|
||||||
link.id = id;
|
|
||||||
|
|
||||||
if(!document.getElementById(id)){
|
|
||||||
head.appendChild(link);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeof fn !== 'function') return;
|
|
||||||
|
|
||||||
//轮询 css 是否加载完毕
|
|
||||||
(function poll(status) {
|
|
||||||
var delay = 100
|
|
||||||
,getLinkElem = document.getElementById(id); //获取动态插入的 link 元素
|
|
||||||
|
|
||||||
//如果轮询超过指定秒数,则视为请求文件失败或 css 文件不符合规范
|
|
||||||
if(++timeout > 10 * 1000 / delay){
|
|
||||||
return window.console && console.error(app +'.css: Invalid');
|
|
||||||
};
|
|
||||||
|
|
||||||
//css 加载就绪
|
|
||||||
if(parseInt(lay.getStyle(getLinkElem, 'width')) === 1989){
|
|
||||||
//如果参数来自于初始轮询(即未加载就绪时的),则移除 link 标签状态
|
|
||||||
if(status === STAUTS_NAME) getLinkElem.removeAttribute('lay-status');
|
|
||||||
//如果 link 标签的状态仍为「创建中」,则继续进入轮询,直到状态改变,则执行回调
|
|
||||||
getLinkElem.getAttribute('lay-status') === STAUTS_NAME ? setTimeout(poll, delay) : fn();
|
|
||||||
} else {
|
|
||||||
getLinkElem.setAttribute('lay-status', STAUTS_NAME);
|
|
||||||
setTimeout(function(){
|
|
||||||
poll(STAUTS_NAME);
|
|
||||||
}, delay);
|
|
||||||
}
|
|
||||||
}());
|
|
||||||
};
|
|
||||||
|
|
||||||
//当前页面是否存在滚动条
|
//当前页面是否存在滚动条
|
||||||
lay.hasScrollbar = function(){
|
lay.hasScrollbar = function(){
|
||||||
return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight);
|
return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight);
|
||||||
@ -482,5 +405,5 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}();
|
}(window, window.document);
|
||||||
|
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
|
|
||||||
/*!
|
/*! layDate 日期与时间控件 | MIT Licensed */
|
||||||
* layDate 日期与时间控件
|
|
||||||
* MIT Licensed
|
|
||||||
*/
|
|
||||||
|
|
||||||
;!function(window){
|
;!function(window, document){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var isLayui = window.layui && layui.define, ready = {
|
var isLayui = window.layui && layui.define, ready = {
|
||||||
getPath: (window.lay && lay.getPath) ? lay.getPath() : ''
|
getPath: (window.lay && lay.getPath) ? lay.getPath : ''
|
||||||
|
|
||||||
//载入 CSS 依赖
|
//载入 CSS 依赖
|
||||||
,link: function(href, fn, cssname){
|
,link: function(href, fn, cssname){
|
||||||
@ -17,8 +14,8 @@
|
|||||||
if(!laydate.path) return;
|
if(!laydate.path) return;
|
||||||
|
|
||||||
//加载 css
|
//加载 css
|
||||||
if(window.lay && lay.link){
|
if(window.lay && lay.layui){
|
||||||
lay.link(laydate.path + href, fn, cssname);
|
lay.layui.link(laydate.path + href, fn, cssname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -28,7 +25,7 @@
|
|||||||
|
|
||||||
//外部调用
|
//外部调用
|
||||||
,laydate = {
|
,laydate = {
|
||||||
v: '5.3.0'
|
v: '5.3.1'
|
||||||
,config: {} //全局配置项
|
,config: {} //全局配置项
|
||||||
,index: (window.laydate && window.laydate.v) ? 100000 : 0
|
,index: (window.laydate && window.laydate.v) ? 100000 : 0
|
||||||
,path: GLOBAL.laydate_dir || ready.getPath
|
,path: GLOBAL.laydate_dir || ready.getPath
|
||||||
@ -1060,13 +1057,7 @@
|
|||||||
//如果为年月选择器,点击了年列表,则切换到月选择器
|
//如果为年月选择器,点击了年列表,则切换到月选择器
|
||||||
if(options.type === 'month' && type === 'year'){
|
if(options.type === 'month' && type === 'year'){
|
||||||
that.listYM[index][0] = ym;
|
that.listYM[index][0] = ym;
|
||||||
if(isAlone){
|
isAlone && ((index ? that.endDate : dateTime).year = ym);
|
||||||
if(index){
|
|
||||||
dateTime.year = ym;
|
|
||||||
} else {
|
|
||||||
that.endDate.year = ym;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
that.list('month', index);
|
that.list('month', index);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1682,5 +1673,5 @@
|
|||||||
}()
|
}()
|
||||||
);
|
);
|
||||||
|
|
||||||
}(window);
|
}(window, window.document);
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ var isLayui = window.layui && layui.define, $, win, ready = {
|
|||||||
|
|
||||||
//默认内置方法。
|
//默认内置方法。
|
||||||
var layer = {
|
var layer = {
|
||||||
v: '3.5.0',
|
v: '3.5.1',
|
||||||
ie: function(){ //ie版本
|
ie: function(){ //ie版本
|
||||||
var agent = navigator.userAgent.toLowerCase();
|
var agent = navigator.userAgent.toLowerCase();
|
||||||
return (!!window.ActiveXObject || "ActiveXObject" in window) ? (
|
return (!!window.ActiveXObject || "ActiveXObject" in window) ? (
|
||||||
@ -1135,17 +1135,21 @@ layer.photos = function(options, loop, key){
|
|||||||
var dict = {};
|
var dict = {};
|
||||||
options = options || {};
|
options = options || {};
|
||||||
if(!options.photos) return;
|
if(!options.photos) return;
|
||||||
var type = options.photos.constructor === Object;
|
|
||||||
var photos = type ? options.photos : {}, data = photos.data || [];
|
|
||||||
var start = photos.start || 0;
|
|
||||||
dict.imgIndex = (start|0) + 1;
|
|
||||||
|
|
||||||
|
//若 photos 并非选择器或 jQuery 对象,则为普通 object
|
||||||
|
var isObject = !(typeof options.photos === 'string' || options.photos instanceof $)
|
||||||
|
,photos = isObject ? options.photos : {}
|
||||||
|
,data = photos.data || []
|
||||||
|
,start = photos.start || 0;
|
||||||
|
|
||||||
|
dict.imgIndex = (start|0) + 1;
|
||||||
options.img = options.img || 'img';
|
options.img = options.img || 'img';
|
||||||
|
|
||||||
var success = options.success;
|
var success = options.success;
|
||||||
delete options.success;
|
delete options.success;
|
||||||
|
|
||||||
if(!type){ //页面直接获取
|
//如果 options.photos 不是一个对象
|
||||||
|
if(!isObject){ //页面直接获取
|
||||||
var parent = $(options.photos), pushData = function(){
|
var parent = $(options.photos), pushData = function(){
|
||||||
data = [];
|
data = [];
|
||||||
parent.find(options.img).each(function(index){
|
parent.find(options.img).each(function(index){
|
||||||
|
@ -642,8 +642,10 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
|||||||
options = options || {};
|
options = options || {};
|
||||||
delete that.haveInit;
|
delete that.haveInit;
|
||||||
|
|
||||||
//如果直接传入数组 data,则移除原来的数组,以免数组发生深度拷贝
|
//防止数组深度合并
|
||||||
if(options.data && options.data.constructor === Array) delete that.config.data;
|
layui.each(options, function(key, item){
|
||||||
|
if(layui._typeof(item) === 'array') delete that.config[key];
|
||||||
|
});
|
||||||
|
|
||||||
//对参数进行深度或浅扩展
|
//对参数进行深度或浅扩展
|
||||||
that.config = $.extend(deep, {}, that.config, options);
|
that.config = $.extend(deep, {}, that.config, options);
|
||||||
@ -728,7 +730,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
|||||||
typeof options.done === 'function' && options.done(res, curr, res[response.countName]);
|
typeof options.done === 'function' && options.done(res, curr, res[response.countName]);
|
||||||
}
|
}
|
||||||
,error: function(e, msg){
|
,error: function(e, msg){
|
||||||
that.errorView('数据接口请求异常:'+ msg);
|
that.errorView('请求异常,错误提示:'+ msg);
|
||||||
|
|
||||||
that.renderForm();
|
that.renderForm();
|
||||||
that.setColsWidth();
|
that.setColsWidth();
|
||||||
|
Loading…
Reference in New Issue
Block a user