Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
sentsim committed May 17, 2021
1 parent fdba319 commit fc09eef
Show file tree
Hide file tree
Showing 20 changed files with 247 additions and 224 deletions.
22 changes: 0 additions & 22 deletions bower.json

This file was deleted.

2 changes: 1 addition & 1 deletion dist/css/layui.css

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions dist/layui.js

Large diffs are not rendered by default.

51 changes: 51 additions & 0 deletions examples/base.html
@@ -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>
16 changes: 8 additions & 8 deletions examples/json/table/demo1.json
Expand Up @@ -8,7 +8,7 @@
,"data": [{
"id": "10001"
,"username": "杜甫"
,"email": "xianxin@layui.com"
,"email": "test@email.com"
,"sex": ""
,"city": "浙江杭州"
,"sign": "鼠标移动到此处,可以通过点击单元格右侧的下拉图标,查看到被隐藏的全部内容。"
Expand All @@ -19,7 +19,7 @@
}, {
"id": "10002"
,"username": "李白"
,"email": "xianxin@layui.com"
,"email": "test@email.com"
,"sex": ""
,"city": "浙江杭州"
,"sign": "君不见,黄河之水天上来,奔流到海不复回。 君不见,高堂明镜悲白发,朝如青丝暮成雪。 人生得意须尽欢,莫使金樽空对月。 天生我材必有用,千金散尽还复来。 烹羊宰牛且为乐,会须一饮三百杯。 岑夫子,丹丘生,将进酒,杯莫停。 与君歌一曲,请君为我倾耳听。(倾耳听 一作:侧耳听) 钟鼓馔玉不足贵,但愿长醉不复醒。(不足贵 一作:何足贵;不复醒 一作:不愿醒/不用醒) 古来圣贤皆寂寞,惟有饮者留其名。(古来 一作:自古;惟 通:唯) 陈王昔时宴平乐,斗酒十千恣欢谑。 主人何为言少钱,径须沽取对君酌。 五花马,千金裘,呼儿将出换美酒,与尔同销万古愁。"
Expand All @@ -31,7 +31,7 @@
}, {
"id": "10003"
,"username": "王勃"
,"email": "xianxin@layui.com"
,"email": "test@email.com"
,"sex": ""
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
Expand All @@ -42,7 +42,7 @@
}, {
"id": "10004"
,"username": "李清照"
,"email": "xianxin@layui.com"
,"email": "test@email.com"
,"sex": ""
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
Expand All @@ -53,7 +53,7 @@
}, {
"id": "10005"
,"username": "冰心"
,"email": "xianxin@layui.com"
,"email": "test@email.com"
,"sex": ""
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
Expand All @@ -64,7 +64,7 @@
}, {
"id": "10006"
,"username": "贤心"
,"email": "xianxin@layui.com"
,"email": "test@email.com"
,"sex": ""
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
Expand All @@ -75,7 +75,7 @@
}, {
"id": "10007"
,"username": "贤心"
,"email": "xianxin@layui.com"
,"email": "test@email.com"
,"sex": ""
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
Expand All @@ -86,7 +86,7 @@
}, {
"id": "10008"
,"username": "贤心"
,"email": "xianxin@layui.com"
,"email": "test@email.com"
,"sex": ""
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
Expand Down
12 changes: 6 additions & 6 deletions examples/json/table/demo3.json
Expand Up @@ -6,7 +6,7 @@
"list": [{
"id": "10001"
,"username": "杜甫3"
,"email": "xianxin@layui.com"
,"email": "test@email.com"
,"sex": ""
,"city": "浙江杭州"
,"sign": "鼠标移动到此处,可以通过点击单元格右侧的下拉图标,查看到被隐藏的全部内容。"
Expand All @@ -17,7 +17,7 @@
}, {
"id": "10002"
,"username": "李白3"
,"email": "xianxin@layui.com"
,"email": "test@email.com"
,"sex": ""
,"city": "浙江杭州"
,"sign": "君不见,黄河之水天上来,奔流到海不复回。 君不见,高堂明镜悲白发,朝如青丝暮成雪。 人生得意须尽欢,莫使金樽空对月。 天生我材必有用,千金散尽还复来。 烹羊宰牛且为乐,会须一饮三百杯。 岑夫子,丹丘生,将进酒,杯莫停。 与君歌一曲,请君为我倾耳听。(倾耳听 一作:侧耳听) 钟鼓馔玉不足贵,但愿长醉不复醒。(不足贵 一作:何足贵;不复醒 一作:不愿醒/不用醒) 古来圣贤皆寂寞,惟有饮者留其名。(古来 一作:自古;惟 通:唯) 陈王昔时宴平乐,斗酒十千恣欢谑。 主人何为言少钱,径须沽取对君酌。 五花马,千金裘,呼儿将出换美酒,与尔同销万古愁。"
Expand All @@ -29,7 +29,7 @@
}, {
"id": "10003"
,"username": "王勃"
,"email": "xianxin@layui.com"
,"email": "test@email.com"
,"sex": ""
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
Expand All @@ -40,7 +40,7 @@
}, {
"id": "10004"
,"username": "李清照"
,"email": "xianxin@layui.com"
,"email": "test@email.com"
,"sex": ""
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
Expand All @@ -51,7 +51,7 @@
}, {
"id": "10005"
,"username": "冰心"
,"email": "xianxin@layui.com"
,"email": "test@email.com"
,"sex": ""
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
Expand All @@ -62,7 +62,7 @@
}, {
"id": "10006"
,"username": "贤心"
,"email": "xianxin@layui.com"
,"email": "test@email.com"
,"sex": ""
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
Expand Down
13 changes: 7 additions & 6 deletions examples/laydate.html
Expand Up @@ -121,13 +121,14 @@
//双控件
laydate.render({
elem: '#test1' //指定元素
,type: 'date'
,type: 'datetime'
,trigger: 'click'
//,lang: 'en'
//,theme: 'grid'
,range: true //开启日期范围,默认使用“-”分割
,min: 0
,max: 7
//,min: '1949-10-1'
//,max: '2021-5-9'
//,value: '2021-05-09 12:06:09'
//,value: '2021-05-08 - 2021-03-27'
,done: function(value, date, endDate){
console.log(value, date, endDate);
Expand Down Expand Up @@ -163,7 +164,7 @@
//年选择器
laydate.render({
elem: '#test3'
,type: 'month'
,type: 'year'
//,range: true
//,trigger: 'click'
,done: function(value, date, endDate){
Expand All @@ -177,8 +178,8 @@
//年月选择器
laydate.render({
elem: '#test4'
,type: 'time'
,range: true
,type: 'month'
,range: true
,trigger: 'click'
//,max: -30
,done: function(value, date, endDate){
Expand Down
27 changes: 20 additions & 7 deletions examples/table-test.html
Expand Up @@ -63,10 +63,11 @@

<script src="../src/layui.js" src1="//www.layuicdn.com/layui-v2.5.3/layui.js" charset="utf-8"></script>
<script>
layui.use(['table'], function(){
layui.use(['table', 'dropdown'], function(){
var table = layui.table
,$ = layui.$
,laytpl = layui.laytpl;
,laytpl = layui.laytpl
,dropdown = layui.dropdown;;

//全局设定某参数
table.set({
Expand Down Expand Up @@ -112,10 +113,10 @@
,{field:'sex', title:'性别', width:80, edit: 'text', sort: true}
,{field:'city', title:'城市', width:120, templet: '#cityTpl'}
,{field:'sign', title:'签名'}
,{field:'experience', title:'积分', width:80, sort: true, totalRow: '{{ d.TOTAL_NUMS }}🍉', templet: '<div>{{ d.experience }} 分</div>'}
,{field:'ip', title:'IP', width:120}
,{field:'logins', title:'登入次数', width:100, sort: true, totalRow: '{{ parseInt(d.TOTAL_NUMS) }} 次'}
,{field:'joinTime', title:'加入时间', width:120}
,{field: 'experience', title: '积分', width:80, sort: true, totalRow: '{{ d.TOTAL_NUMS }} 😊', templet: '<div>{{ d.experience }} 分</div>'}
,{field:'ip', title:'IP', width: 120}
,{field:'logins', title:'登入次数', width: 100, sort: true, totalRow: '{{ parseInt(d.TOTAL_NUMS) }} 次'}
,{field:'joinTime', title:'加入时间', width: 120}
,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
]]

Expand All @@ -133,7 +134,18 @@
}

,done: function(){

//下拉菜单
dropdown.render({
elem: '#dropdown' //可绑定在任意元素中,此处以上述按钮为例
,data: [{
id: 0,
title: '刷新'
}]
//菜单被点击的事件
,click: function(obj){
table.reload('test');
}
});
}

,error: function(res, msg){
Expand Down Expand Up @@ -213,6 +225,7 @@
abc: 123
,test: '新的 test1'
}
,defaultToolbar: ['print']
,page: {curr: 5, limit: 20}
,cols: ins1.config.cols
//,height: 300
Expand Down
20 changes: 13 additions & 7 deletions gulpfile.js
Expand Up @@ -13,6 +13,7 @@ var concat = require('gulp-concat');
var rename = require('gulp-rename');
var replace = require('gulp-replace');
var header = require('gulp-header');
var footer = require('gulp-footer');
var del = require('del');
var gulpif = require('gulp-if');
var minimist = require('minimist');
Expand All @@ -27,7 +28,8 @@ var argv = require('minimist')(process.argv.slice(2), {

//注释
,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: ';'}
]

Expand Down Expand Up @@ -135,7 +137,7 @@ gulp.task('rls', ['clearRelease'], function(){ // gulp rls
}
});

//打包 layer 独立版
//打包 layer 单独版
gulp.task('layer', function(){
var dir = './release/layer';

Expand All @@ -147,15 +149,15 @@ gulp.task('layer', function(){
});


//打包 layDate 独立版
//打包 layDate 单独版
gulp.task('laydate', function(){
//发行目录
var dir = './release/laydate'

//注释
,notes = [
'/*! \n * <%= title %> \n * <%= license %> Licensed \n */ \n\n'
,{title: 'layDate 日期与时间组件', license: 'MIT'}
'\n/*! \n * <%= title %> \n * <%= license %> Licensed \n */ \n\n'
,{title: 'layDate 日期与时间组件(单独版)', license: 'MIT'}
];

//合并所依赖的 css 文件
Expand All @@ -164,9 +166,13 @@ gulp.task('laydate', function(){
.pipe(gulp.dest(dir + '/src/theme/default'));

//合并所依赖的 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(header.apply(null, notes))
.pipe(header.apply(null, notes)) //追加头部
.pipe(gulp.dest(dir + '/src'));
});

Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -2,7 +2,7 @@
"name": "layui",
"realname": "layui",
"version": "2.6.7",
"description": "Classic modular front-end ui component library",
"description": "Classic modular Front-End UI library",
"main": "dist/layui.js",
"license": "MIT",
"scripts": {
Expand All @@ -24,6 +24,7 @@
"del": "^2.2.2",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0 ",
"gulp-footer": "^2.0.2",
"gulp-header": "^1.8.8",
"gulp-if": "^2.0.1",
"gulp-minify-css": "^1.2.4",
Expand Down
5 changes: 3 additions & 2 deletions src/css/layui.css
Expand Up @@ -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 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 .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[lay-bar="disabled"] .layui-nav-bar{display: none;}
.layui-nav[lay-bar="disabled"].layui-this:after{}
Expand All @@ -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 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-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-side .layui-nav-tree .layui-nav-bar{width: 2px;}
.layui-nav-tree .layui-this,
Expand Down

0 comments on commit fc09eef

Please sign in to comment.