Merge pull request #1035 from layui/main

merge 2.x
pull/1061/head^2
贤心 3 years ago committed by GitHub
commit 8af14baef6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

4
.gitignore vendored

@ -20,6 +20,6 @@ node_modules/
_site/ _site/
.git/ .git/
release/ /release/
v/ /v/
package-lock.json package-lock.json

File diff suppressed because one or more lines are too long

2
dist/layui.js vendored

File diff suppressed because one or more lines are too long

@ -2,21 +2,21 @@
* Building Layui * Building Layui
*/ */
var pkg = require('./package.json'); const pkg = require('./package.json');
var gulp = require('gulp'); const gulp = require('gulp');
var uglify = require('gulp-uglify'); const uglify = require('gulp-uglify');
var cleanCSS = require('gulp-clean-css'); const cleanCSS = require('gulp-clean-css');
var concat = require('gulp-concat'); const concat = require('gulp-concat');
var rename = require('gulp-rename'); const rename = require('gulp-rename');
var replace = require('gulp-replace'); const replace = require('gulp-replace');
var header = require('gulp-header'); const header = require('gulp-header');
var footer = require('gulp-footer'); const footer = require('gulp-footer');
var del = require('del'); const del = require('del');
var minimist = require('minimist'); const minimist = require('minimist');
var yargs = require('yargs'); const yargs = require('yargs');
// 基础配置 // 基础配置
var config = { const config = {
//注释 //注释
comment: [ comment: [
'/** <%= pkg.version %> | <%= pkg.license %> Licensed */<%= js %>' '/** <%= pkg.version %> | <%= pkg.license %> Licensed */<%= js %>'
@ -27,26 +27,26 @@ var config = {
}; };
// 获取参数 // 获取参数
var argv = require('minimist')(process.argv.slice(2), { const argv = require('minimist')(process.argv.slice(2), {
default: { default: {
version: pkg.version version: pkg.version
} }
}); });
// 前置目录 // 前置目录
var dir = { const dir = {
rls: './release/zip/layui-v' + pkg.version rls: './release/zip/layui-v' + pkg.version
}; };
// 输出目录 // 输出目录
var dest = ({ const dest = ({
dist: './dist' dist: './dist'
,rls: dir.rls + '/layui' ,rls: dir.rls + '/layui'
}[argv.dest || 'dist'] || argv.dest) + (argv.vs ? '/'+ pkg.version : ''); }[argv.dest || 'dist'] || argv.dest) + (argv.vs ? '/'+ pkg.version : '');
// js // js
var js = function(){ const js = () => {
var src = [ let src = [
'./src/**/{layui,layui.all,'+ config.modules +'}.js' './src/**/{layui,layui.all,'+ config.modules +'}.js'
]; ];
return gulp.src(src).pipe(uglify({ return gulp.src(src).pipe(uglify({
@ -59,11 +59,11 @@ var js = function(){
}; };
// css // css
var css = function(){ const css = () => {
var src = [ let src = [
'./src/css/**/*.css' './src/css/**/*.css'
,'!./src/css/**/font.css' ,'!./src/css/**/font.css'
] ];
return gulp.src(src).pipe(cleanCSS({ return gulp.src(src).pipe(cleanCSS({
compatibility: 'ie8' compatibility: 'ie8'
})) }))
@ -72,20 +72,20 @@ var css = function(){
}; };
// files // files
var files = function(){ const files = () => {
var src = ['./src/**/*.{eot,svg,ttf,woff,woff2,html,json,png,jpg,gif}']; let src = ['./src/**/*.{eot,svg,ttf,woff,woff2,html,json,png,jpg,gif}'];
return gulp.src(src) return gulp.src(src)
.pipe(gulp.dest(dest)); .pipe(gulp.dest(dest));
}; };
// cp // cp
var cp = function(){ const cp = () => {
return gulp.src('./dist/**/*') return gulp.src('./dist/**/*')
.pipe(gulp.dest(dest)); .pipe(gulp.dest(dest));
}; };
// release // release
var rls = function(){ const rls = () => {
return gulp.src('./release/doc/**/*') return gulp.src('./release/doc/**/*')
.pipe(replace(/[^'"]+(\/layui\.css)/, 'layui/css$1')) //替换 css 引入路径中的本地 path .pipe(replace(/[^'"]+(\/layui\.css)/, 'layui/css$1')) //替换 css 引入路径中的本地 path
.pipe(replace(/[^'"]+(\/layui\.js)/, 'layui$1')) //替换 js 引入路径中的本地 path .pipe(replace(/[^'"]+(\/layui\.js)/, 'layui$1')) //替换 js 引入路径中的本地 path
@ -93,12 +93,12 @@ var rls = function(){
}; };
// clean // clean
var clean = function(cb) { const clean = cb => {
return del([dest], { return del([dest], {
force: true force: true
}); });
}; };
var cleanRLS = function(cb) { const cleanRLS = cb => {
return del([dir.rls]); return del([dir.rls]);
}; };
@ -111,8 +111,8 @@ exports.cp = gulp.series(clean, cp);
exports.rls = gulp.series(cleanRLS, rls); //release task exports.rls = gulp.series(cleanRLS, rls); //release task
// layer task // layer task
exports.layer = function(){ // gulp layer exports.layer = () => { // gulp layer
var dest = './release/layer'; let dest = './release/layer';
gulp.src('./src/css/modules/layer/default/*') gulp.src('./src/css/modules/layer/default/*')
.pipe(gulp.dest(dest + '/src/theme/default')); .pipe(gulp.dest(dest + '/src/theme/default'));
@ -123,9 +123,9 @@ exports.layer = function(){ // gulp layer
// laydate task // laydate task
exports.laydate = function(){ // gulp laydate exports.laydate = () => { // gulp laydate
var dest = './release/laydate/' // 发行目录 let dest = './release/laydate/'; // 发行目录
,comment = [ //注释 let comment = [ //注释
'\n/*! \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'}
]; ];
@ -145,9 +145,9 @@ exports.laydate = function(){ // gulp laydate
}; };
// helper // helper
exports.help = function(){ exports.help = () => {
var usage = '\nUsage: gulp [options] tasks' let usage = '\nUsage: gulp [options] tasks';
,parser = yargs.usage(usage, { let parser = yargs.usage(usage, {
dest: { dest: {
type: 'string' type: 'string'
,desc: '定义输出目录可选项dist默认、rls、任意路径' ,desc: '定义输出目录可选项dist默认、rls、任意路径'

@ -1,7 +1,7 @@
{ {
"name": "layui", "name": "layui",
"realname": "layui", "realname": "layui",
"version": "2.6.12", "version": "2.6.13",
"description": "Classic modular Front-End UI library", "description": "Classic modular Front-End UI library",
"main": "dist/layui.js", "main": "dist/layui.js",
"license": "MIT", "license": "MIT",

@ -1,4 +1,3 @@
/** /**
* Layui * Layui
* Classic modular Front-End UI library * Classic modular Front-End UI library
@ -581,7 +580,7 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-text ol li{margin-top: 5px; list-style-type: decimal;} .layui-text ol li{margin-top: 5px; list-style-type: decimal;}
.layui-text em, .layui-text em,
.layui-word-aux{color: #999 !important; padding-left: 5px !important; padding-right: 5px !important;} .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:first-child{margin-top: 0;}
.layui-text p:last-child{margin-bottom: 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 blockquote:not(.layui-elem-quote){padding: 5px 15px; border-left: 5px solid #eee;}

@ -15,7 +15,7 @@
} }
,Layui = function(){ ,Layui = function(){
this.v = '2.6.12'; // layui 版本号 this.v = '2.6.13'; // layui 版本号
} }
//识别预先可能定义的指定全局对象 //识别预先可能定义的指定全局对象

@ -481,12 +481,12 @@
elem.appendChild(style); elem.appendChild(style);
} }
//记录当前执行的实例索引
laydate.thisId = options.id;
//移除上一个控件 //移除上一个控件
that.remove(Class.thisElemDate); that.remove(Class.thisElemDate);
//记录当前执行的实例索引
laydate.thisId = options.id;
//如果是静态定位则插入到指定的容器中否则插入到body //如果是静态定位则插入到指定的容器中否则插入到body
isStatic ? options.elem.append(elem) : ( isStatic ? options.elem.append(elem) : (
document.body.appendChild(elem) document.body.appendChild(elem)
@ -1583,6 +1583,8 @@
//绑定呼出控件事件 //绑定呼出控件事件
,showEvent = function(elem, bind){ ,showEvent = function(elem, bind){
elem.on(options.trigger, function(){ elem.on(options.trigger, function(){
//已经打开的面板避免重新渲染
if(laydate.thisId === options.id) return;
bind && (that.bindElem = this); bind && (that.bindElem = this);
that.render(); that.render();
}); });

@ -397,6 +397,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
//初始化列参数 //初始化列参数
layui.each(options.cols, function(i1, item1){ layui.each(options.cols, function(i1, item1){
layui.each(item1, function(i2, item2){ layui.each(item1, function(i2, item2){
item2.colspan = item2.colspan || 1;
item2.rowspan = item2.rowspan || 1;
//如果列参数为空,则移除 //如果列参数为空,则移除
if(!item2){ if(!item2){
@ -411,9 +413,9 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
//如果是组合列,则捕获对应的子列 //如果是组合列,则捕获对应的子列
if(item2.colGroup || item2.colspan > 1){ if(item2.colGroup || item2.colspan > 1){
var childIndex = 0; 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则跳出当前子列循环 //如果子列已经被标注为{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.HAS_PARENT = true;
item22.parentKey = i1 + '-' + i2; item22.parentKey = i1 + '-' + i2;
@ -1847,8 +1849,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
var row = $.extend({ var row = $.extend({
title: th.text() title: th.text()
,colspan: th.attr('colspan') || 0 //列单元格 ,colspan: th.attr('colspan') || 1 //列单元格
,rowspan: th.attr('rowspan') || 0 //行单元格 ,rowspan: th.attr('rowspan') || 1 //行单元格
}, itemData); }, itemData);
if(row.colspan < 2) cols.push(row); if(row.colspan < 2) cols.push(row);
@ -1903,9 +1905,9 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
index++ index++
item2.CHILD_COLS = []; 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则跳出当前子列循环 //如果子列已经被标注为{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; item22.PARENT_COL_INDEX = index;

Loading…
Cancel
Save