This commit is contained in:
贤心
2022-05-27 07:28:25 +08:00
parent d744fea2a3
commit abb387250c
16 changed files with 111 additions and 266 deletions

View File

@@ -243,7 +243,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 +264,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 +302,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 +312,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 +347,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 +382,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;}

View File

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

View File

@@ -917,7 +917,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();
@@ -960,10 +962,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;
@@ -971,9 +981,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));
}
@@ -983,17 +996,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);
}
@@ -1016,7 +1040,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']);
}
};
//初始化时间对象

View File

@@ -3,7 +3,6 @@
*/
layui.define(function(exports){
"use strict";
var config = {
@@ -24,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, '&amp;')
.replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/'/g, '&#39;').replace(/"/g, '&quot;');
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, '&amp;')
.replace(/</g, '&lt;').replace(/>/g, '&gt;')
.replace(/'/g, '&#39;').replace(/"/g, '&quot;');
},
error: function(e, tplog){
var error = 'Laytpl Error: ';
@@ -61,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 = '"+laytpl.escape(';
} else if(/^-/.test(str)){
str = str.replace(/^-/, '');
start = '"+(';
}
return start + str.replace(/\\(.)/g, '$1') + ')+"';
});

View File

@@ -77,7 +77,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
,item3 = obj.item3 //表头数据
,content = obj.content; //原始内容
//是否防 xss
//是否编码 HTML
if(options.escape) content = util.escape(content);
//获取模板
@@ -249,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 //是否前端自动排序。如果否,则需自主排序(通常为服务端处理好排序)
@@ -1546,21 +1547,19 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
if(key in data) data[key] = value;
that.eachCols(function(i, item3){
var templet = item3.templet || item3.toolbar;
//更新相应列视图
if(item3.field == key && item3.templet){
if(item3.field == key){
cell.html(parseTempData.call(that, {
item3: {templet: item3.templet}
item3: item3
,content: value
,tplData: data
}));
td.data('content', value);
} else if(templet){ //更新所有其他列的模板
} 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: {templet: templet}
item3: item3
,content: content
,tplData: data
}));
@@ -1663,7 +1662,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')
@@ -1671,12 +1670,12 @@ 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, {
item3: {templet: templet}
item3: item3 || {}
,content: value
,tplData: data
});

View File

@@ -169,10 +169,14 @@ layui.define('jquery', function(exports){
.replace(/ss/g, hms[2]);
}
//转义 html,防 xss 攻击
//转义 html
,escape: function(html){
if(html === undefined || html === null) html = '';
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, '&amp;')
.replace(/</g, '&lt;').replace(/>/g, '&gt;')
.replace(/'/g, '&#39;').replace(/"/g, '&quot;');
@@ -182,6 +186,7 @@ layui.define('jquery', function(exports){
,unescape: function(html){
if(html === undefined || html === null) html = '';
html += '';
return html.replace(/\&amp;/g, '&')
.replace(/\&lt;/g, '<').replace(/\&gt;/g, '>')
.replace(/\&#39;/, '\'').replace(/\&quot;/, '"');
@@ -248,6 +253,6 @@ layui.define('jquery', function(exports){
!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);
});