Browse Source

修复一些问题和加强一些功能

pull/1128/head
sunxiaobin89 2 years ago
parent
commit
afd5dbd676
  1. 22
      src/css/modules/laydate.css
  2. 1
      src/layui.js
  3. 20
      src/modules/carousel.js
  4. 10
      src/modules/laydate.js
  5. 3
      src/modules/table.js
  6. 6
      src/modules/util.js

22
src/css/modules/laydate.css

@ -55,7 +55,7 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;}
.layui-laydate-content{position: relative; padding: 10px; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none;} .layui-laydate-content{position: relative; padding: 10px; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none;}
.layui-laydate-content table{border-collapse: collapse; border-spacing: 0;} .layui-laydate-content table{border-collapse: collapse; border-spacing: 0;}
.layui-laydate-content th, .layui-laydate-content th,
.layui-laydate-content td{width: 36px; height: 30px; padding: 5px; text-align: center;} .layui-laydate-content td{width: 36px; height: 30px; padding: 0; text-align: center;}
.layui-laydate-content th{font-weight: 400;} .layui-laydate-content th{font-weight: 400;}
.layui-laydate-content td{position: relative; cursor: pointer;} .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{position: absolute; left: 0; top: 0; width: 100%; line-height: 30px; font-size: 12px; overflow: hidden;}
@ -107,7 +107,7 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;}
.layui-laydate-content td{color: #666;} .layui-laydate-content td{color: #666;}
.layui-laydate-content td.laydate-selected{background-color: #B5FFF8;} .layui-laydate-content td.laydate-selected{background-color: #B5FFF8;}
.laydate-selected:hover{background-color: #00F7DE !important;} .laydate-selected:hover{background-color: #00F7DE !important;}
.layui-laydate-content td:hover, .layui-laydate-content td>div:hover,
.layui-laydate-list li:hover{background-color: #eee; color: #333;} .layui-laydate-list li:hover{background-color: #eee; color: #333;}
.laydate-time-list li ol{margin: 0; padding: 0; border: 1px solid #e2e2e2; border-left-width: 0;} .laydate-time-list li ol{margin: 0; padding: 0; border: 1px solid #e2e2e2; border-left-width: 0;}
.laydate-time-list li:first-child ol{border-left-width: 1px;} .laydate-time-list li:first-child ol{border-left-width: 1px;}
@ -124,6 +124,7 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;}
.layui-laydate .layui-this{background-color: #009688 !important; color: #fff !important;} .layui-laydate .layui-this{background-color: #009688 !important; color: #fff !important;}
.layui-laydate .laydate-disabled, .layui-laydate .laydate-disabled,
.layui-laydate .laydate-disabled:hover{background:none !important; color: #d2d2d2 !important; cursor: not-allowed !important; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none;} .layui-laydate .laydate-disabled:hover{background:none !important; color: #d2d2d2 !important; cursor: not-allowed !important; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none;}
.layui-laydate-content td>div{padding: 7px 0;height: 100%;}
/* 墨绿/自定义背景色主题 */ /* 墨绿/自定义背景色主题 */
.laydate-theme-molv{border: none;} .laydate-theme-molv{border: none;}
@ -153,4 +154,19 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;}
.laydate-theme-grid .laydate-month-list>li{margin: 0 -1px -1px 0;} .laydate-theme-grid .laydate-month-list>li{margin: 0 -1px -1px 0;}
.laydate-theme-grid .laydate-year-list>li{height: 43px; line-height: 43px;} .laydate-theme-grid .laydate-year-list>li{height: 43px; line-height: 43px;}
.laydate-theme-grid .laydate-month-list>li{height: 71px; line-height: 71px;} .laydate-theme-grid .laydate-month-list>li{height: 71px; line-height: 71px;}
.laydate-theme-grid .layui-laydate-content td>div{height: 29px;margin-top: -1px;}
/* 圆圈高亮主题 */
.laydate-theme-circle .layui-laydate-content td>div,
.laydate-theme-circle .layui-laydate-content td.layui-this>div{width: 28px;height: 28px;line-height: 28px;border-radius: 14px;margin: 0 4px;padding: 0;}
.layui-laydate.laydate-theme-circle .layui-laydate-content table td.layui-this{background-color: transparent !important;}
.laydate-theme-grid.laydate-theme-circle .layui-laydate-content td>div{margin: 0 3.5px;}
/* 全面板 */
.laydate-theme-fullpanel .layui-laydate-main {width: 526px;}
.laydate-theme-fullpanel .layui-laydate-list {width: 252px;left: 272px;}
.laydate-theme-fullpanel .laydate-set-ym span {display: none;}
.laydate-theme-fullpanel .laydate-time-show .layui-laydate-header .layui-icon,
.laydate-theme-fullpanel .laydate-time-show .laydate-set-ym span[lay-type="year"],
.laydate-theme-fullpanel .laydate-time-show .laydate-set-ym span[lay-type="month"] {display: inline-block !important;}
.laydate-theme-fullpanel .laydate-btns-time{display: none;}

1
src/layui.js vendored

@ -54,7 +54,6 @@
,laydate: 'laydate' //日期 ,laydate: 'laydate' //日期
,laypage: 'laypage' //分页 ,laypage: 'laypage' //分页
,laytpl: 'laytpl' //模板引擎 ,laytpl: 'laytpl' //模板引擎
// ,layedit: 'layedit' //富文本编辑器
,form: 'form' //表单集 ,form: 'form' //表单集
,upload: 'upload' //上传 ,upload: 'upload' //上传
,dropdown: 'dropdown' //下拉菜单 ,dropdown: 'dropdown' //下拉菜单

20
src/modules/carousel.js

@ -194,6 +194,18 @@ layui.define('jquery', function(exports){
that.slide(type); that.slide(type);
}); });
}; };
// 跳转到特定下标
Class.prototype.jump = function(index){
var that = this;
var options = that.config;
if(index > options.index){
that.slide('add', index - options.index);
} else if(index < options.index){
that.slide('sub', options.index - index);
}
}
//指示器 //指示器
Class.prototype.indicator = function(){ Class.prototype.indicator = function(){
@ -226,13 +238,7 @@ layui.define('jquery', function(exports){
//事件 //事件
tplInd.find('li').on(options.trigger === 'hover' ? 'mouseover' : options.trigger, function(){ tplInd.find('li').on(options.trigger === 'hover' ? 'mouseover' : options.trigger, function(){
var othis = $(this) that.jump($(this).index());
,index = othis.index();
if(index > options.index){
that.slide('add', index - options.index);
} else if(index < options.index){
that.slide('sub', options.index - index);
}
}); });
}; };

10
src/modules/laydate.js

@ -909,8 +909,8 @@
}, function(key, item){ }, function(key, item){
timestrap[key] = that.newDate(lay.extend({ timestrap[key] = that.newDate(lay.extend({
year: item.year year: item.year
,month: item.month ,month: type === 'year' ? 0 : item.month // 年份的时候只比较年
,date: item.date ,date: (type === 'year' || type === 'month') ? 1 : item.date // 年月只比较年月不与最大最小比日期
}, function(){ }, function(){
var hms = {}; var hms = {};
lay.each(time, function(i, keys){ lay.each(time, function(i, keys){
@ -1094,7 +1094,7 @@
} }
*/ */
that.limit(lay(li), ymd, index); that.limit(lay(li), ymd, index, null, type);
yearNum++; yearNum++;
}); });
@ -1126,7 +1126,7 @@
} }
*/ */
that.limit(lay(li), ymd, index); that.limit(lay(li), ymd, index, null, type);
}); });
lay(elemYM[isCN ? 0 : 1]).attr('lay-ym', listYM[0] + '-' + listYM[1]) lay(elemYM[isCN ? 0 : 1]).attr('lay-ym', listYM[0] + '-' + listYM[1])
@ -1729,7 +1729,6 @@
//绑定呼出控件事件 //绑定呼出控件事件
// var showEvent = function(elem, bind){ // var showEvent = function(elem, bind){
// elem.on(options.trigger, function(){ // elem.on(options.trigger, function(){
// console.log('showEvent, ' + options.trigger, elem);
// //已经打开的面板避免重新渲染 // //已经打开的面板避免重新渲染
// if(laydate.thisId === options.id) return; // if(laydate.thisId === options.id) return;
// bind && (that.bindElem = this); // bind && (that.bindElem = this);
@ -1756,6 +1755,7 @@
that.remove(); that.remove();
options.elem.off(options.trigger, showFn); options.elem.off(options.trigger, showFn);
options.elem[0].eventHandler = false; options.elem[0].eventHandler = false;
options.elem.removeAttr('lay-key');
delete thisModule.that[options.id]; delete thisModule.that[options.id];
} }
}; };

3
src/modules/table.js

@ -754,7 +754,8 @@ layui.define(['laytpl', 'laypage', 'form', 'util'], function(exports){
// 给设定百分比的列分配列宽 // 给设定百分比的列分配列宽
else if(/\d+%$/.test(item3.width)){ else if(/\d+%$/.test(item3.width)){
that.getCssRule(options.index +'-'+ item3.key, function(item){ that.getCssRule(options.index +'-'+ item3.key, function(item){
item.style.width = Math.floor((parseFloat(item3.width) / 100) * cntrWidth) + 'px'; var width = Math.floor((parseFloat(item3.width) / 100) * cntrWidth);
item.style.width = (width < minWidth ? minWidth : width) + 'px';
}); });
} }

6
src/modules/util.js

@ -13,7 +13,7 @@ layui.define('jquery', function(exports){
//固定块 //固定块
fixbar: function(options){ fixbar: function(options){
var ELEM = 'layui-fixbar', TOP_BAR = 'layui-fixbar-top' var ELEM = 'layui-fixbar', TOP_BAR = 'layui-fixbar-top'
,dom = $(document), body = $('body') ,dom = $(options.elem || document), body = $(options.elem || 'body')
,is, timer; ,is, timer;
options = $.extend({ options = $.extend({
@ -39,7 +39,7 @@ layui.define('jquery', function(exports){
is && (topBar.hide(), is = 0); is && (topBar.hide(), is = 0);
} }
}; };
if($('.'+ ELEM)[0]) return; if(body.find('.'+ ELEM)[0]) return;
typeof options.css === 'object' && elem.css(options.css); typeof options.css === 'object' && elem.css(options.css);
body.append(elem), scroll(); body.append(elem), scroll();
@ -48,7 +48,7 @@ layui.define('jquery', function(exports){
elem.find('li').on('click', function(){ elem.find('li').on('click', function(){
var othis = $(this), type = othis.attr('lay-type'); var othis = $(this), type = othis.attr('lay-type');
if(type === 'top'){ if(type === 'top'){
$('html,body').animate({ (options.elem ? $(options.elem) : $('html,body')).animate({
scrollTop : 0 scrollTop : 0
}, 200); }, 200);
} }

Loading…
Cancel
Save