[go: nahoru, domu]

Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
sentsim committed Jul 5, 2022
1 parent d7e3601 commit dd8e365
Show file tree
Hide file tree
Showing 11 changed files with 136 additions and 110 deletions.
2 changes: 1 addition & 1 deletion examples/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</head>
<body>

<form class="layui-form" method="get" lay-filter="top">
<form class="layui-form" method="get" lay-filter="top" id="AAA">
<div class="layui-form-item">
<div class="layui-input-inline">
<input type="text" name="arr[]" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
Expand Down
20 changes: 10 additions & 10 deletions examples/laydate.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,6 @@
//全局配置
laydate.set({
//trigger: 'focus'
workrest: [
['2022-1-1', '2022-1-2', '2022-1-3', '2022-1-31', '2022-2-1', '2022-2-2', '2022-2-3', '2022-2-4', '2022-2-5', '2022-2-6', '2022-4-3', '2022-4-4', '2022-4-5', '2022-4-30', '2022-5-1', '2022-5-2', '2022-5-3', '2022-5-4', '2022-6-3', '2022-6-4', '2022-6-5', '2022-9-10', '2022-9-11', '2022-9-12', '2022-10-1', '2022-10-2', '2022-10-3', '2022-10-4', '2022-10-5', '2022-10-6', '2022-10-7'],
['2022-1-29', '2022-1-30', '2022-4-2', '2022-4-24', '2022-5-7', '2022-10-8', '2022-10-9']
]
})

//范围选择1
Expand Down Expand Up @@ -274,14 +270,14 @@
elem: '#test555'
//,calendar: true //是否开启公历重要节日
,mark: { //标记重要日子
'0-8-15': '纪念' //0代表:每年
'0-10-14': '生日' //0代表:每年
,'0-0-15': '中旬'
,'2017-8-20': '发布'
,'2017-8-20': 'v2'
,'2017-8-31': '月底'
}
,done: function(value, date, endDate){
if(date.year == 2017 && date.month == 8 && date.date == 15){
//console.log('中国人民战胜日本法西斯纪念日');
if(date.year == 2016 && date.month == 10 && date.date == 14){
//console.log('Layui 诞生日');
}
}
,change: function(value, date, endDate){
Expand All @@ -290,10 +286,14 @@
});

// 标注法定节假日及补班
var ins5555 = laydate.render({
laydate.render({
elem: '#test5555',
value: '2022-5-21',
isWorkrest: true
holidays: [
['2022-1-1', '2022-1-2', '2022-1-3', '2022-1-31', '2022-2-1', '2022-2-2', '2022-2-3', '2022-2-4', '2022-2-5', '2022-2-6', '2022-4-3', '2022-4-4', '2022-4-5', '2022-4-30', '2022-5-1', '2022-5-2', '2022-5-3', '2022-5-4', '2022-6-3', '2022-6-4', '2022-6-5', '2022-9-10', '2022-9-11', '2022-9-12', '2022-10-1', '2022-10-2', '2022-10-3', '2022-10-4', '2022-10-5', '2022-10-6', '2022-10-7'],

['2022-1-29', '2022-1-30', '2022-4-2', '2022-4-24', '2022-5-7', '2022-10-8', '2022-10-9']
]
});

//墨绿主题
Expand Down
10 changes: 7 additions & 3 deletions examples/table-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
].join('')
//,className: '.demo-table-view'

//,size: 'sm'
//,size: 'lg'
//,skin: 'line'
//,loading: false

Expand All @@ -153,8 +153,8 @@
//,{type: 'numbers', fixed: 'left'}
,{field:'id', title:'ID', width:80, fixed: 'left', unresize: true, sort: true, totalRowText: '合计:'}
,{field:'username', title:'用户名', width:120, edit: 'text', templet: '#usernameTpl'}
,{field:'email', minWidth: 230, title:'邮箱 <i class="layui-icon layui-icon-email"></i>', hide: 0, edit: 'text', templet: function(d){
return '<em>'+ layui.util.escape(d.email) +'</em> <input type="checkbox" title="激活">'
,{field:'email', minWidth: 160, title:'邮箱 <i class="layui-icon layui-icon-email"></i>', hide: 0, edit: 'text', templet: function(d){
return '<em>'+ layui.util.escape(d.email) +'</em>'
}}
,{field:'sex', title:'性别', width:80, edit: 'text', sort: true}
,{field:'city', title:'城市', width:120, templet: '#cityTpl', exportTemplet: function(d, obj){
Expand Down Expand Up @@ -183,6 +183,10 @@
,key: 'experience'
,order: 'asc'
}
,before: function(options){
options.where.AAAAA = 123;
//console.log(options)
}
,done: function(res, curr, count){
var id = this.id;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "layui",
"realname": "layui",
"version": "2.7.2",
"version": "2.7.3",
"description": "Classic modular Front-End UI library",
"main": "dist/layui.js",
"license": "MIT",
Expand Down
10 changes: 7 additions & 3 deletions src/css/layui.css
Original file line number Diff line number Diff line change
Expand Up @@ -892,12 +892,15 @@ a cite{font-style: normal; *cursor:pointer;}

.layui-table img{max-width:100px;}

/* 大表格 */.layui-table[lay-size="lg"] th,
/* 大表格 */
.layui-table[lay-size="lg"] th,
.layui-table[lay-size="lg"] td{padding-top: 15px; padding-right: 30px; padding-bottom: 15px; padding-left: 30px;}
.layui-table-view .layui-table[lay-size="lg"] .layui-table-cell{height: 50px; line-height: 40px;}
/* 小表格 */.layui-table[lay-size="sm"] th,

/* 小表格 */
.layui-table[lay-size="sm"] th,
.layui-table[lay-size="sm"] td{padding-top: 5px; padding-right: 10px; padding-bottom: 5px; padding-left: 10px; font-size: 12px;}
.layui-table-view .layui-table[lay-size="sm"] .layui-table-cell{height: 30px; line-height: 20px;}
.layui-table-view .layui-table[lay-size="sm"] .layui-table-cell{height: 30px; line-height: 20px; padding-top: 5px; padding-right: 5px;}

/* 数据表格 */
.layui-table[lay-data]{display: none;}
Expand Down Expand Up @@ -951,6 +954,7 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-table-cell{height: 38px; line-height: 28px; padding: 6px 15px; position: relative; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; box-sizing: border-box;}
.layui-table-cell .layui-form-checkbox[lay-skin="primary"]{top: -1px; padding: 0;}
.layui-table-cell .layui-table-link{color: #01AAED;}
.layui-table-cell .layui-btn{vertical-align: inherit;}
.layui-table-cell[align="center"]{-webkit-box-pack: center;}
.layui-table-cell[align="right"]{-webkit-box-pack: end;}

Expand Down
8 changes: 4 additions & 4 deletions src/css/modules/laydate/default/laydate.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;}
.layui-laydate-content td{position: relative; cursor: pointer;}
.laydate-day-mark{position: absolute; left: 0; top: 0; width: 100%; line-height: 30px; font-size: 12px; overflow: hidden;}
.laydate-day-mark::after{position: absolute; content:''; right: 2px; top: 2px; width: 5px; height: 5px; border-radius: 50%;}
.laydate-day-workrest:before{position: absolute; left: 0;top: 3px;font-size: 12px;transform: scale(.7);}
.laydate-day-workrest.rest:before{content:'假';color: #d11211;}
.laydate-day-workrest.work:before{content:'班';color: #1589ee;}
.layui-laydate .layui-this .laydate-day-workrest:before{color: #fff;}
.laydate-day-holidays:before{position: absolute; left: 0; top: 0; font-size: 12px; transform: scale(.7);}
.laydate-day-holidays:before{content:'\4F11'; color: #FF5722;}
.laydate-day-holidays[type="work"]:before{content:'\73ED'; color: inherit;}
.layui-laydate .layui-this .laydate-day-holidays:before{color: #fff;}

/* 底部结构 */
.layui-laydate-footer{position: relative; height: 46px; line-height: 26px; padding: 10px;}
Expand Down
2 changes: 1 addition & 1 deletion src/layui.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}

,Layui = function(){
this.v = '2.7.2'; // layui 版本号
this.v = '2.7.3'; // layui 版本号
}

//识别预先可能定义的指定全局对象
Expand Down
4 changes: 3 additions & 1 deletion src/modules/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,8 @@ layui.define('layer', function(exports){
if(!elem[0]) return !0;

// 若节点不存在特定属性,则查找容器内有待验证的子节点
if(elem.attr('lay-verify') === undefined){ // 如果校验的是一个不带验证规则的容器,校验内部的verify节点
if(elem.attr('lay-verify') === undefined){
// 若校验的是一个不带验证规则的容器,校验内部的 lay-verify 节点
if (that.validate(elem.find('*[lay-verify]')) === false) {
return false;
}
Expand All @@ -706,6 +707,7 @@ layui.define('layer', function(exports){
//匹配验证规则
if(verify[thisVer]){
var isTrue = isFn ? errorText = verify[thisVer](value, item) : !verify[thisVer][0].test(value)

//是否属于美化替换后的表单元素
,isForm2Elem = item.tagName.toLowerCase() === 'select' || /^checkbox|radio$/.test(item.type);

Expand Down
42 changes: 17 additions & 25 deletions src/modules/laydate.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@
,position: null //控件定位方式定位, 默认absolute,支持:fixed/absolute/static
,calendar: false //是否开启公历重要节日,仅支持中文版
,mark: {} //日期备注,如重要事件或活动标记
,isWorkrest: false // 是否标注节假日或补假上班, 默认 false
,workrest: [] // 标注法定节假日或补假上班
,holidays: null // 标注法定节假日或补假上班
,zIndex: null //控件层叠顺序
,done: null //控件选择完毕后的回调,点击清空/现在/确定也均会触发
,change: null //日期时间改变后的回调
Expand Down Expand Up @@ -281,10 +280,6 @@
,'0-10-1': '国庆'
,'0-12-25': '圣诞'
} : {}, options.mark);

if(options.isWorkrest){
options.workrest = lay.extend({}, (options.calendar && options.lang === 'cn') ? [] : [], options.workrest);
}

//获取限制内日期
lay.each(['min', 'max'], function(i, item){
Expand Down Expand Up @@ -785,7 +780,7 @@
return that;
};

//公历重要日期与自定义备注
// 公历重要日期与自定义备注
Class.prototype.mark = function(td, YMD){
var that = this
,mark, options = that.config;
Expand All @@ -803,18 +798,23 @@
};

// 标注法定节假日或补假上班
Class.prototype.workrest = function(td, YMD) {
var that = this,
workrest,
workclsArr = ['rest', 'work'],
options = that.config;
lay.each(options.workrest, function(idx, itm) {
lay.each(itm, function(i, dayStr) {
if(dayStr === td[0].getAttribute('lay-ymd')){
td.html('<span class="laydate-day-workrest ' + workclsArr[idx] + '">' + YMD[2] + '</span>');
Class.prototype.holidays = function(td, YMD) {
var that = this;
var options = that.config;
var type = ['', 'work'];

if(layui.type(options.holidays) !== 'array') return that;

lay.each(options.holidays, function(idx, item) {
lay.each(item, function(i, dayStr) {
if(dayStr === td.attr('lay-ymd')){
td.html('<span class="laydate-day-holidays"' + (
type[idx] ? ('type="'+ type[idx] +'"') : ''
) + '>' + YMD[2] + '</span>');
}
});
});

return that;
}

Expand Down Expand Up @@ -903,19 +903,11 @@
YMD[1]++;
YMD[2] = st + 1;
item.attr('lay-ymd', YMD.join('-')).html(YMD[2]);
that.mark(item, YMD).limit(item, {
that.mark(item, YMD).holidays(item, YMD).limit(item, {
year: YMD[0]
,month: YMD[1] - 1
,date: YMD[2]
}, index_);

if(options.isWorkrest){
that.workrest(item, YMD).limit(item, {
year: YMD[0]
,month: YMD[1] - 1
,date: YMD[2]
}, index_);
}
});

//同步头部年月
Expand Down
2 changes: 1 addition & 1 deletion src/modules/layedit.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* layedit 富文本编辑器
* layedit 富文本编辑器(该组件已被弃用,为了向下兼容而保留)
*/

layui.define(['layer', 'form'], function(exports){
Expand Down
Loading

0 comments on commit dd8e365

Please sign in to comment.