From 4cae7241d2849766632a4fbd656ae53238ccaa53 Mon Sep 17 00:00:00 2001
From: sunxiaobin89 <470459819@qq.com>
Date: Thu, 3 Aug 2023 00:07:22 +0800
Subject: [PATCH 01/37] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20treeTable=20?=
=?UTF-8?q?=E9=83=A8=E5=88=86=E6=93=8D=E4=BD=9C=E4=B9=8B=E5=90=8E=20`radio?=
=?UTF-8?q?`=20=E5=88=97=E9=80=89=E4=B8=AD=E7=8A=B6=E6=80=81=E4=B8=A2?=
=?UTF-8?q?=E5=A4=B1=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/treeTable.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/modules/treeTable.js b/src/modules/treeTable.js
index 01def596..51c2daca 100644
--- a/src/modules/treeTable.js
+++ b/src/modules/treeTable.js
@@ -1526,6 +1526,9 @@ layui.define(['table'], function (exports) {
Class.prototype.updateCheckStatus = function (dataP, checked) {
var that = this;
var options = that.getOptions();
+ if (!options.hasChecboxCol) {
+ return false; // 如果没有复选列则不需要更新状态
+ }
var treeOptions = options.tree;
var tableId = options.id;
var tableView = options.elem.next();
From 697b3ce7bffe376c362970c8b632a8c5c2d1518e Mon Sep 17 00:00:00 2001
From: sunxiaobin89 <470459819@qq.com>
Date: Sun, 13 Aug 2023 23:14:22 +0800
Subject: [PATCH 02/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=20treeTable=20`cascade?=
=?UTF-8?q?`=20=E6=96=B0=E5=A2=9E=20`none`=20=E6=97=A0=E7=BA=A7=E8=81=94?=
=?UTF-8?q?=E7=9A=84=E6=A8=A1=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/treeTable.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/modules/treeTable.js b/src/modules/treeTable.js
index 6e880337..0898be1f 100644
--- a/src/modules/treeTable.js
+++ b/src/modules/treeTable.js
@@ -78,6 +78,7 @@ layui.define(['table'], function (exports) {
var LAY_EXPAND = 'LAY_EXPAND';
var LAY_HAS_EXPANDED = 'LAY_HAS_EXPANDED';
var LAY_ASYNC_STATUS = 'LAY_ASYNC_STATUS';
+ var LAY_CASCADE = ['all', 'parent', 'children', 'none'];
// 构造器
var Class = function (options) {
@@ -204,7 +205,7 @@ layui.define(['table'], function (exports) {
var that = this;
var options = that.config;
var cascade = options.tree.data.cascade;
- if (cascade !== 'parent' && cascade !== 'children') {
+ if (LAY_CASCADE.indexOf(cascade) === -1) {
options.tree.data.cascade = 'all'; // 超出范围的都重置为全联动
}
@@ -1722,7 +1723,7 @@ layui.define(['table'], function (exports) {
}
}
- var trs = that.updateStatus(trData ? [trData] : table.cache[tableId], checkedStatusFn, trData && treeOptions.data.cascade === 'parent');
+ var trs = that.updateStatus(trData ? [trData] : table.cache[tableId], checkedStatusFn, trData && ['parent', 'none'].indexOf(treeOptions.data.cascade) !== -1);
var checkboxElem = tableView.find(trs.map(function (value) {
return 'tr[lay-data-index="' + value[LAY_DATA_INDEX] + '"] input[name="layTableCheckbox"]:not(:disabled)';
}).join(','));
From dda323caa063cc5f6def494b387131301c87d0b6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Thu, 17 Aug 2023 15:52:00 +0800
Subject: [PATCH 03/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=20carousel=20=E4=BB=A3?=
=?UTF-8?q?=E7=A0=81=E4=B9=A6=E5=86=99=E8=A7=84=E8=8C=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/carousel.js | 202 +++++++++++++++++++++-------------------
1 file changed, 108 insertions(+), 94 deletions(-)
diff --git a/src/modules/carousel.js b/src/modules/carousel.js
index 765abe93..e58637f7 100644
--- a/src/modules/carousel.js
+++ b/src/modules/carousel.js
@@ -12,50 +12,61 @@ layui.define(['jquery', 'lay'], function(exports){
var hint = layui.hint();
var device = layui.device();
- //外部接口
+ // 外部接口
var carousel = {
- config: {} //全局配置项
+ config: {}, // 全局配置项
- //设置全局项
- ,set: function(options){
+ // 设置全局项
+ set: function(options){
var that = this;
that.config = $.extend({}, that.config, options);
return that;
- }
+ },
- //事件
- ,on: function(events, callback){
+ // 事件
+ on: function(events, callback){
return layui.onevent.call(this, MOD_NAME, events, callback);
}
- }
+ };
- //字符常量
- ,MOD_NAME = 'carousel', ELEM = '.layui-carousel', THIS = 'layui-this', SHOW = 'layui-show', HIDE = 'layui-hide', DISABLED = 'layui-disabled'
+ // 字符常量
+ var MOD_NAME = 'carousel';
+ var ELEM = '.layui-carousel';
+ var THIS = 'layui-this';
+ var SHOW = 'layui-show';
+ var HIDE = 'layui-hide';
+ var DISABLED = 'layui-disabled'
- ,ELEM_ITEM = '>*[carousel-item]>*', ELEM_LEFT = 'layui-carousel-left', ELEM_RIGHT = 'layui-carousel-right', ELEM_PREV = 'layui-carousel-prev', ELEM_NEXT = 'layui-carousel-next', ELEM_ARROW = 'layui-carousel-arrow', ELEM_IND = 'layui-carousel-ind'
+ var ELEM_ITEM = '>*[carousel-item]>*';
+ var ELEM_LEFT = 'layui-carousel-left';
+ var ELEM_RIGHT = 'layui-carousel-right';
+ var ELEM_PREV = 'layui-carousel-prev';
+ var ELEM_NEXT = 'layui-carousel-next';
+ var ELEM_ARROW = 'layui-carousel-arrow';
+ var ELEM_IND = 'layui-carousel-ind';
- //构造器
- ,Class = function(options){
+ // 构造器
+ var Class = function(options){
var that = this;
that.config = $.extend({}, that.config, carousel.config, options);
that.render();
};
- //默认配置
+ // 默认配置
Class.prototype.config = {
- width: '600px'
- ,height: '280px'
- ,full: false //是否全屏
- ,arrow: 'hover' //切换箭头默认显示状态:hover/always/none
- ,indicator: 'inside' //指示器位置:inside/outside/none
- ,autoplay: true //是否自动切换
- ,interval: 3000 //自动切换的时间间隔,不能低于800ms
- ,anim: '' //动画类型:default/updown/fade
- ,trigger: 'click' //指示器的触发方式:click/hover
- ,index: 0 //初始开始的索引
+ width: '600px',
+ height: '280px',
+ full: false, // 是否全屏
+ arrow: 'hover', // 切换箭头默认显示状态:hover/always/none
+ indicator: 'inside', // 指示器位置:inside/outside/none
+ autoplay: true, // 是否自动切换
+ interval: 3000, // 自动切换的时间间隔,不能低于800ms
+ anim: '', // 动画类型:default/updown/fade
+ trigger: 'click', // 指示器的触发方式:click/hover
+ index: 0 // 初始开始的索引
};
- //轮播渲染
+ // 轮播渲染
Class.prototype.render = function(){
var that = this;
var options = that.config;
@@ -82,35 +93,36 @@ layui.define(['jquery', 'lay'], function(exports){
if(options.index >= that.elemItem.length) options.index = that.elemItem.length - 1;
if(options.interval < 800) options.interval = 800;
- //是否全屏模式
+ // 是否全屏模式
if(options.full){
options.elem.css({
- position: 'fixed'
- ,width: '100%'
- ,height: '100%'
- ,zIndex: 9999
+ position: 'fixed',
+ width: '100%',
+ height: '100%',
+ zIndex: 9999
});
} else {
options.elem.css({
- width: options.width
- ,height: options.height
+ width: options.width,
+ height: options.height
});
}
options.elem.attr('lay-anim', options.anim);
- //初始焦点状态
+ // 初始焦点状态
that.elemItem.eq(options.index).addClass(THIS);
- //指示器等动作
+ // 指示器等动作
if(that.elemItem.length <= 1) return;
+
that.indicator();
that.arrow();
that.autoplay();
that.events();
};
- //重置轮播
+ // 重置轮播
Class.prototype.reload = function(options){
var that = this;
clearInterval(that.timer);
@@ -118,62 +130,64 @@ layui.define(['jquery', 'lay'], function(exports){
that.render();
};
- //获取上一个等待条目的索引
+ // 获取上一个等待条目的索引
Class.prototype.prevIndex = function(){
- var that = this
- ,options = that.config;
-
+ var that = this;
+ var options = that.config;
var prevIndex = options.index - 1;
+
if(prevIndex < 0){
prevIndex = that.elemItem.length - 1;
}
+
return prevIndex;
};
- //获取下一个等待条目的索引
+ // 获取下一个等待条目的索引
Class.prototype.nextIndex = function(){
- var that = this
- ,options = that.config;
-
+ var that = this;
+ var options = that.config;
var nextIndex = options.index + 1;
+
if(nextIndex >= that.elemItem.length){
nextIndex = 0;
}
+
return nextIndex;
};
- //索引递增
+ // 索引递增
Class.prototype.addIndex = function(num){
- var that = this
- ,options = that.config;
+ var that = this;
+ var options = that.config;
num = num || 1;
options.index = options.index + num;
- //index不能超过轮播总数量
+ // index 不能超过轮播总数量
if(options.index >= that.elemItem.length){
options.index = 0;
}
};
- //索引递减
+ // 索引递减
Class.prototype.subIndex = function(num){
- var that = this
- ,options = that.config;
+ var that = this;
+ var options = that.config;
num = num || 1;
options.index = options.index - num;
- //index不能超过轮播总数量
+ // index 不能超过轮播总数量
if(options.index < 0){
options.index = that.elemItem.length - 1;
}
};
- //自动轮播
+ // 自动轮播
Class.prototype.autoplay = function(){
- var that = this
- ,options = that.config;
+ var that = this;
+ var options = that.config;
if(!options.autoplay) return;
clearInterval(that.timer);
@@ -183,30 +197,30 @@ layui.define(['jquery', 'lay'], function(exports){
}, options.interval);
};
- //箭头
+ // 箭头
Class.prototype.arrow = function(){
- var that = this
- ,options = that.config;
+ var that = this;
+ var options = that.config;
- //模板
+ // 模板
var tplArrow = $([
- ''
- ,''
+ '',
+ ''
].join(''));
- //预设基础属性
+ // 预设基础属性
options.elem.attr('lay-arrow', options.arrow);
- //避免重复插入
+ // 避免重复插入
if(options.elem.find('.'+ELEM_ARROW)[0]){
options.elem.find('.'+ELEM_ARROW).remove();
}
options.elem.append(tplArrow);
- //事件
+ // 事件
tplArrow.on('click', function(){
- var othis = $(this)
- ,type = othis.attr('lay-type')
+ var othis = $(this);
+ var type = othis.attr('lay-type')
that.slide(type);
});
};
@@ -223,26 +237,26 @@ layui.define(['jquery', 'lay'], function(exports){
}
}
- //指示器
+ // 指示器
Class.prototype.indicator = function(){
- var that = this
- ,options = that.config;
+ var that = this;
+ var options = that.config;
- //模板
- var tplInd = that.elemInd = $(['
'
- ,function(){
+ // 模板
+ var tplInd = that.elemInd = $(['',
+ function(){
var li = [];
layui.each(that.elemItem, function(index){
li.push('');
});
return li.join('');
- }()
- ,'
'].join(''));
+ }(),
+ '
'].join(''));
- //预设基础属性
+ // 预设基础属性
options.elem.attr('lay-indicator', options.indicator);
- //避免重复插入
+ // 避免重复插入
if(options.elem.find('.'+ELEM_IND)[0]){
options.elem.find('.'+ELEM_IND).remove();
}
@@ -258,17 +272,17 @@ layui.define(['jquery', 'lay'], function(exports){
});
};
- //滑动切换
+ // 滑动切换
Class.prototype.slide = function(type, num){
- var that = this
- ,elemItem = that.elemItem
- ,options = that.config
- ,thisIndex = options.index
- ,filter = options.elem.attr('lay-filter');
+ var that = this;
+ var elemItem = that.elemItem;
+ var options = that.config;
+ var thisIndex = options.index;
+ var filter = options.elem.attr('lay-filter');
if(that.haveSlide) return;
- //滑动方向
+ // 滑动方向
if(type === 'sub'){
that.subIndex(num);
elemItem.eq(options.index).addClass(ELEM_PREV);
@@ -276,7 +290,7 @@ layui.define(['jquery', 'lay'], function(exports){
elemItem.eq(thisIndex).addClass(ELEM_RIGHT);
elemItem.eq(options.index).addClass(ELEM_RIGHT);
}, 50);
- } else { //默认递增滑
+ } else { // 默认递增滑
that.addIndex(num);
elemItem.eq(options.index).addClass(ELEM_NEXT);
setTimeout(function(){
@@ -285,14 +299,14 @@ layui.define(['jquery', 'lay'], function(exports){
}, 50);
}
- //移除过度类
+ // 移除过度类
setTimeout(function(){
elemItem.removeClass(THIS + ' ' + ELEM_PREV + ' ' + ELEM_NEXT + ' ' + ELEM_LEFT + ' ' + ELEM_RIGHT);
elemItem.eq(options.index).addClass(THIS);
- that.haveSlide = false; //解锁
+ that.haveSlide = false; // 解锁
}, 300);
- //指示器焦点
+ // 指示器焦点
that.elemInd.find('li').eq(options.index).addClass(THIS)
.siblings().removeClass(THIS);
@@ -300,23 +314,23 @@ layui.define(['jquery', 'lay'], function(exports){
// 回调返回的参数
var params = {
- index: options.index
- ,prevIndex: thisIndex
- ,item: elemItem.eq(options.index)
+ index: options.index,
+ prevIndex: thisIndex,
+ item: elemItem.eq(options.index)
};
typeof options.change === 'function' && options.change(params);
layui.event.call(this, MOD_NAME, 'change('+ filter +')', params);
};
- //事件处理
+ // 事件处理
Class.prototype.events = function(){
- var that = this
- ,options = that.config;
+ var that = this;
+ var options = that.config;
if(options.elem.data('haveEvents')) return;
- //移入移出容器
+ // 移入移出容器
options.elem.on('mouseenter', function(){
if (that.config.autoplay === 'always') return;
clearInterval(that.timer);
@@ -328,7 +342,7 @@ layui.define(['jquery', 'lay'], function(exports){
options.elem.data('haveEvents', true);
};
- //核心入口
+ // 核心入口
carousel.render = function(options){
return new Class(options);
};
From 634361af1b9caff1fd0a6d887d545fc5d3bd6790 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Fri, 18 Aug 2023 17:29:54 +0800
Subject: [PATCH 04/37] =?UTF-8?q?=E8=B0=83=E6=95=B4=20treeTable=20?=
=?UTF-8?q?=E7=A4=BA=E4=BE=8B=E7=BB=86=E8=8A=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/treeTable/examples/demo.md | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/docs/treeTable/examples/demo.md b/docs/treeTable/examples/demo.md
index b8b542b2..c4566066 100644
--- a/docs/treeTable/examples/demo.md
+++ b/docs/treeTable/examples/demo.md
@@ -41,11 +41,10 @@ layui.use(function(){
{type: 'checkbox', fixed: 'left'},
{field: 'id', title: 'ID', width: 80, sort: true, fixed: 'left'},
{field: 'name', title: '用户名', width: 180, fixed: 'left'},
- {field: 'experience', title: '积分', width: 90, sort: true},
{field: 'sex', title: '性别', width: 80, sort: true},
- {field: 'score', title: '评分', width: 80, sort: true},
- {field: 'city', title: '城市'},
- { fixed: "right", title: "操作", width: 181, align: "center", toolbar: "#TPL-treeTable-demo-tools"}
+ {field: 'experience', title: '积分', width: 90, sort: true},
+ {field: 'city', title: '城市', width: 100},
+ { fixed: "right", title: "操作", width: 190, align: "center", toolbar: "#TPL-treeTable-demo-tools"}
]],
page: true
});
From 99bb02889021b99c44cc374bb7ecc0023d0d4c02 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Fri, 18 Aug 2023 17:30:36 +0800
Subject: [PATCH 05/37] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20transfer=20=E6=B5=8B?=
=?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
examples/transfer.html | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/examples/transfer.html b/examples/transfer.html
index 65a11a7d..686012a6 100644
--- a/examples/transfer.html
+++ b/examples/transfer.html
@@ -48,12 +48,13 @@
{"value": "1", "title": "李白"}
,{"value": "2", "title": "杜甫"}
,{"value": "3", "title": "贤心"}
- ,{"value": "4", "title": "鲁迅", "disabled": true}
- ,{"value": "5", "title": "巴金"}
- ,{"value": "6", "title": "冰心"},{"value": "6", "title": "冰心"},{"value": "6", "title": "冰心"},{"value": "6", "title": "冰心"},{"value": "6", "title": "冰心"},{"value": "6", "title": "冰心"},{"value": "6", "title": "Bbb"},{"value": "6", "title": "BB"},{"value": "6", "title": "Aa"},{"value": "6", "title": "aa"}
+ ,{"value": "11", "title": "鲁迅", "disabled": true}
+ ,{"value": "15", "title": "巴金"}
+ ,{"value": "16", "title": "冰心"},
+ {"value": "6", "title": "冰心"},{"value": "6", "title": "冰心"},{"value": "6", "title": "冰心"},{"value": "6", "title": "冰心"},{"value": "6", "title": "冰心"},{"value": "6", "title": "Bbb"},{"value": "6", "title": "BB"},{"value": "6", "title": "Aa"},{"value": "6", "title": "aa"}
]
,id: 'demoId'
- ,value: ["2", "3"]
+ ,value: ["1", "15", "16"]
,showSearch: true // 若区分大小写,设置 'cs'
});
From 0ca293f2c914c86019df4a32a9a613cf258cb2f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Fri, 18 Aug 2023 17:30:45 +0800
Subject: [PATCH 06/37] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20treeTable=20?=
=?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
examples/treeTable.html | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/examples/treeTable.html b/examples/treeTable.html
index afaa7b7e..d59d349b 100644
--- a/examples/treeTable.html
+++ b/examples/treeTable.html
@@ -45,6 +45,11 @@ layui.use(['treeTable'], function(){
]],
page: true
});
+
+ // 单元格工具事件
+ treeTable.on('row(test)', function (obj) {
+ console.log(obj);
+ });
});
From f428eceb6c94596b1923e28bdd4fcf136471b75c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Fri, 18 Aug 2023 17:58:39 +0800
Subject: [PATCH 07/37] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20carousel=20=E6=96=87?=
=?UTF-8?q?=E6=A1=A3=E4=B8=AD=E7=9A=84=20`autoplay`=20=E5=B1=9E=E6=80=A7?=
=?UTF-8?q?=E5=8F=AF=E9=80=89=E5=80=BC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/carousel/detail/options.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/carousel/detail/options.md b/docs/carousel/detail/options.md
index d347040a..d4b0908a 100644
--- a/docs/carousel/detail/options.md
+++ b/docs/carousel/detail/options.md
@@ -92,7 +92,7 @@
- `true` 自动滚动,鼠标移入会暂停、移出重新恢复
- `false` 不自动滚动
-- `alway` 始终自动滚动,不受鼠标移入移出影响 2.7+
+- `always` 始终自动滚动,不受鼠标移入移出影响 2.7+
From 0dc95b4ee96bc263c254b2d544bc88e9db253ecb Mon Sep 17 00:00:00 2001
From: sight <1453017105@qq.com>
Date: Sat, 19 Aug 2023 07:02:32 +0800
Subject: [PATCH 08/37] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20laydate=20=E5=BF=AB?=
=?UTF-8?q?=E6=8D=B7=E9=80=89=E6=8B=A9=20`shortcuts.value=20`=E9=80=89?=
=?UTF-8?q?=E9=A1=B9=E5=87=BD=E6=95=B0=E7=B1=BB=E5=9E=8B=E6=94=AF=E6=8C=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/laydate.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/modules/laydate.js b/src/modules/laydate.js
index 3da065fe..36973a07 100644
--- a/src/modules/laydate.js
+++ b/src/modules/laydate.js
@@ -591,7 +591,9 @@
return shortcutBtns.join('');
}()).find('li').on('click', function (event) {
var btnSetting = options.shortcuts[this.dataset['index']] || {};
- var value = btnSetting.value || [];
+ var value = (typeof btnSetting.value === 'function'
+ ? btnSetting.value()
+ : btnSetting.value) || [];
if (!layui.isArray(value)) {
value = [value];
}
From d1bc0468a566d22f45ff542b20a5389d9366c111 Mon Sep 17 00:00:00 2001
From: sight <1453017105@qq.com>
Date: Sat, 19 Aug 2023 07:44:51 +0800
Subject: [PATCH 09/37] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20laydate=20=E6=96=87?=
=?UTF-8?q?=E6=A1=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/laydate/detail/options.md | 3 +-
docs/laydate/examples/shortcut.md | 76 +++++++++++++++++--------------
2 files changed, 45 insertions(+), 34 deletions(-)
diff --git a/docs/laydate/detail/options.md b/docs/laydate/detail/options.md
index 564e0ca7..1be45c1a 100644
--- a/docs/laydate/detail/options.md
+++ b/docs/laydate/detail/options.md
@@ -249,11 +249,12 @@ shortcuts: [
- 若为 `string` 类型,必须和 `format` 设置的格式对应;
- 若为 `date` 对象类型,则可通过操作 `new Date()` 来对选项值进行相应的返回计算;
- 若为 `array` 类型,则数组成员可填写开始日期和结束日期。
+- 若为 `function` 类型,返回值同上。2.8.16+
详细用法可参考: [#示例](#demo-shortcut)
-string date array |
+string date array function |
- |
diff --git a/docs/laydate/examples/shortcut.md b/docs/laydate/examples/shortcut.md
index a1d31207..86676922 100644
--- a/docs/laydate/examples/shortcut.md
+++ b/docs/laydate/examples/shortcut.md
@@ -90,16 +90,21 @@ layui.use(function(){
var now = new Date();
now.setDate(now.getDate() - 1);
return now;
- }()
+ }
+ },
+ {
+ text: "今天",
+ value: function(){
+ return Date.now();
+ }
},
- { text: "今天", value: Date.now() },
{
text: "明天",
value: function(){
var now = new Date();
now.setDate(now.getDate() + 1);
return now;
- }()
+ }
},
{
text: "上个月",
@@ -108,7 +113,7 @@ layui.use(function(){
// now.setDate(now.getDate() - 1);
now.setMonth(now.getMonth() - 1);
return [now];
- }()
+ }
},
{
text: "上个月的前一天",
@@ -117,7 +122,7 @@ layui.use(function(){
now.setMonth(now.getMonth() - 1);
now.setDate(now.getDate() - 1);
return [now];
- }()
+ }
},
{
text: "某一天",
@@ -137,7 +142,7 @@ layui.use(function(){
var now = new Date();
now.setFullYear(now.getFullYear() - 1);
return now;
- }()
+ }
},
{
text: "明年",
@@ -145,7 +150,7 @@ layui.use(function(){
var now = new Date();
now.setFullYear(now.getFullYear() + 1);
return now;
- }()
+ }
}
]
});
@@ -161,7 +166,7 @@ layui.use(function(){
var now = new Date();
now.setMonth(now.getMonth() - 1);
return now;
- }()
+ }
},
{
text: "下个月",
@@ -169,7 +174,7 @@ layui.use(function(){
var now = new Date();
now.setMonth(now.getMonth() + 1);
return now;
- }()
+ }
},
{
text: "去年12月",
@@ -178,7 +183,7 @@ layui.use(function(){
now.setMonth(11);
now.setFullYear(now.getFullYear() - 1);
return now;
- }()
+ }
}
]
});
@@ -214,16 +219,21 @@ layui.use(function(){
var now = new Date();
now.setDate(now.getDate() - 1);
return now;
- }()
+ }
+ },
+ {
+ text: "今天",
+ value: function(){
+ return Date.now();
+ }
},
- { text: "今天", value: Date.now() },
{
text: "明天",
value: function(){
var now = new Date();
now.setDate(now.getDate() + 1);
return now;
- }()
+ }
},
{
text: "上个月",
@@ -232,7 +242,7 @@ layui.use(function(){
// now.setDate(now.getDate() - 1);
now.setMonth(now.getMonth() - 1);
return [now];
- }()
+ }
},
{
text: "上个月的前一天",
@@ -241,7 +251,7 @@ layui.use(function(){
now.setMonth(now.getMonth() - 1);
now.setDate(now.getDate() - 1);
return [now];
- }()
+ }
},
{
text: "某一天",
@@ -263,7 +273,7 @@ layui.use(function(){
var now = new Date();
now.setDate(now.getDate() - 1);
return now;
- }()
+ }
},
{ text: "今天", value: Date.now() },
{
@@ -272,7 +282,7 @@ layui.use(function(){
var now = new Date();
now.setDate(now.getDate() + 1);
return now;
- }()
+ }
},
{
text: "上个月",
@@ -281,7 +291,7 @@ layui.use(function(){
// now.setDate(now.getDate() - 1);
now.setMonth(now.getMonth() - 1);
return [now];
- }()
+ }
},
{
text: "上个月的前一天",
@@ -290,7 +300,7 @@ layui.use(function(){
now.setMonth(now.getMonth() - 1);
now.setDate(now.getDate() - 1);
return [now];
- }()
+ }
},
{
text: "某一天",
@@ -323,7 +333,7 @@ layui.use(function(){
value.push(new Date(date2));
return value;
- }()
+ }
},
{
text: "这个月",
@@ -344,7 +354,7 @@ layui.use(function(){
value.push(new Date(date2));
return value;
- }()
+ }
},
{
text: "下个月",
@@ -365,7 +375,7 @@ layui.use(function(){
value.push(new Date(date2));
return value;
- }()
+ }
}
]
});
@@ -383,7 +393,7 @@ layui.use(function(){
var now = new Date();
now.setFullYear(now.getFullYear() - 1);
return [now, new Date()];
- }()
+ }
},
{
text: "未来一年",
@@ -391,7 +401,7 @@ layui.use(function(){
var now = new Date();
now.setFullYear(now.getFullYear() + 1);
return [new Date(), now];
- }()
+ }
},
{
text: "近三年",
@@ -399,7 +409,7 @@ layui.use(function(){
var now = new Date();
now.setFullYear(now.getFullYear() - 3);
return [now, new Date()];
- }()
+ }
}
]
});
@@ -420,7 +430,7 @@ layui.use(function(){
date2.setMonth(0, 1);
date2.setHours(0, 0, 0, 0);
return [date1, date2.getTime() - 1];
- }()
+ }
},
{
text: "明年",
@@ -428,7 +438,7 @@ layui.use(function(){
var now = new Date();
now.setFullYear(now.getFullYear() + 1);
return [now, now];
- }()
+ }
},
{
text: "近三年",
@@ -436,7 +446,7 @@ layui.use(function(){
var now = new Date();
now.setFullYear(now.getFullYear() - 3);
return [now, new Date()];
- }()
+ }
}
]
});
@@ -457,7 +467,7 @@ layui.use(function(){
date2.setHours(11, 30, 0, 0);
return [date1, date2];
- })()
+ })
},
{
text: '13:00 到
15:00',
@@ -469,7 +479,7 @@ layui.use(function(){
date2.setHours(15, 0, 0, 0);
return [date1, date2];
- })()
+ })
}
]
});
@@ -498,7 +508,7 @@ layui.use(function(){
value.push(new Date(date2));
return value;
- }()
+ }
},
{
text: "这个月",
@@ -519,7 +529,7 @@ layui.use(function(){
value.push(new Date(date2));
return value;
- }()
+ }
},
{
text: "下个月",
@@ -540,7 +550,7 @@ layui.use(function(){
value.push(new Date(date2));
return value;
- }()
+ }
}
]
});
From c06861321e241b5adbc98987d62f5f2c054f1e12 Mon Sep 17 00:00:00 2001
From: sight <1453017105@qq.com>
Date: Wed, 23 Aug 2023 19:45:42 +0800
Subject: [PATCH 10/37] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20code=20=E8=87=AA?=
=?UTF-8?q?=E5=AE=9A=E4=B9=89=E5=B7=A5=E5=85=B7=E6=A0=8F=E5=BC=82=E5=B8=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/code.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/modules/code.js b/src/modules/code.js
index 4dd034db..ded85848 100644
--- a/src/modules/code.js
+++ b/src/modules/code.js
@@ -209,12 +209,12 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){
elemToolbar.on('click', '>i', function(){
var oi = $(this);
var type = oi.data('type');
- typeof tools[type].event === 'function' && tools[type].event(oi, type);
+ tools[type] && typeof tools[type].event === 'function' && tools[type].event(oi, type);
typeof options.toolsEvent === 'function' && options.toolsEvent(oi, type);
});
layui.each(options.tools, function(i, v){
var className = (tools[v] && tools[v].className) || v;
- var title = tools[v].title || [''];
+ var title = (tools[v] && tools[v].title) || [''];
elemToolbar.append(
''
);
From 2d17898b5014b6c91be8db1f0cce7474dcaa4b6c Mon Sep 17 00:00:00 2001
From: Diyar-IT <136627746+Diyar-IT@users.noreply.github.com>
Date: Wed, 23 Aug 2023 19:55:03 +0800
Subject: [PATCH 11/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=20rate.js=20=E4=BB=A3?=
=?UTF-8?q?=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/rate.js | 79 ++++++++++++++++++++++++---------------------
1 file changed, 42 insertions(+), 37 deletions(-)
diff --git a/src/modules/rate.js b/src/modules/rate.js
index 23d7faf2..cb6e3e65 100644
--- a/src/modules/rate.js
+++ b/src/modules/rate.js
@@ -10,42 +10,47 @@ layui.define(['jquery', 'lay'],function(exports){
// 外部接口
var rate = {
- config: {}
- ,index: layui.rate ? (layui.rate.index + 10000) : 0
+ config: {},
+ index: layui.rate ? (layui.rate.index + 10000) : 0,
//设置全局项
- ,set: function(options){
+ set: function(options){
var that = this;
that.config = $.extend({}, that.config, options);
return that;
- }
+ },
//事件
- ,on: function(events, callback){
+ on: function(events, callback){
return layui.onevent.call(this, MOD_NAME, events, callback);
}
}
// 操作当前实例
- ,thisRate = function(){
- var that = this
- ,options = that.config;
-
+ var thisRate = function () {
+ var that = this;
+ var options = that.config;
+
return {
- setvalue: function(value){
+ setvalue: function (value) {
that.setvalue.call(that, value);
- }
- ,config: options
+ },
+ config: options
}
- }
+ };
//字符常量
- ,MOD_NAME = 'rate',ELEM_VIEW = 'layui-rate', ICON_RATE = 'layui-icon-rate', ICON_RATE_SOLID = 'layui-icon-rate-solid', ICON_RATE_HALF = 'layui-icon-rate-half'
-
- ,ICON_SOLID_HALF = 'layui-icon-rate-solid layui-icon-rate-half', ICON_SOLID_RATE = 'layui-icon-rate-solid layui-icon-rate', ICON_HALF_RATE = 'layui-icon-rate layui-icon-rate-half'
+ var MOD_NAME = 'rate';
+ var ELEM_VIEW = 'layui-rate';
+ var ICON_RATE = 'layui-icon-rate';
+ var ICON_RATE_SOLID = 'layui-icon-rate-solid';
+ var ICON_RATE_HALF = 'layui-icon-rate-half';
+ var ICON_SOLID_HALF = 'layui-icon-rate-solid layui-icon-rate-half';
+ var ICON_SOLID_RATE = 'layui-icon-rate-solid layui-icon-rate';
+ var ICON_HALF_RATE = 'layui-icon-rate layui-icon-rate-half';
//构造器
- ,Class = function(options){
+ var Class = function (options) {
var that = this;
that.index = ++rate.index;
that.config = $.extend({}, that.config, rate.config, options);
@@ -54,12 +59,12 @@ layui.define(['jquery', 'lay'],function(exports){
//默认配置
Class.prototype.config = {
- length: 5 //初始长度
- ,text: false //是否显示评分等级
- ,readonly: false //是否只读
- ,half: false //是否可以半星
- ,value: 0 //星星选中个数
- ,theme: ''
+ length: 5, //初始长度
+ text: false, //是否显示评分等级
+ readonly: false, //是否只读
+ half: false, //是否可以半星
+ value: 0, //星星选中个数
+ theme: '',
};
//评分渲染
@@ -114,8 +119,8 @@ layui.define(['jquery', 'lay'],function(exports){
temp += '' + (options.text ? (''+ options.value + '星') : '') + '';
//开始插入替代元素
- var othis = options.elem
- ,hasRender = othis.next('.' + ELEM_VIEW);
+ var othis = options.elem;
+ var hasRender = othis.next('.' + ELEM_VIEW);
//生成替代元素
hasRender[0] && hasRender.remove(); //如果已经渲染,则Rerender
@@ -137,8 +142,8 @@ layui.define(['jquery', 'lay'],function(exports){
//评分重置
Class.prototype.setvalue = function(value){
- var that = this
- ,options = that.config ;
+ var that = this;
+ var options = that.config;
options.value = value ;
that.render();
@@ -146,14 +151,14 @@ layui.define(['jquery', 'lay'],function(exports){
//li触控事件
Class.prototype.action = function(){
- var that = this
- ,options = that.config
- ,_ul = that.elemTemp
- ,wide = _ul.find("i").width();
+ var that = this;
+ var options = that.config;
+ var _ul = that.elemTemp;
+ var wide = _ul.find("i").width();
_ul.children("li").each(function(index){
- var ind = index + 1
- ,othis = $(this);
+ var ind = index + 1;
+ var othis = $(this);
//点击
othis.on('click', function(e){
@@ -210,9 +215,9 @@ layui.define(['jquery', 'lay'],function(exports){
};
//事件处理
- Class.prototype.events = function(){
- var that = this
- ,options = that.config;
+ Class.prototype.events = function () {
+ var that = this;
+ //var options = that.config;
};
//核心入口
@@ -222,4 +227,4 @@ layui.define(['jquery', 'lay'],function(exports){
};
exports(MOD_NAME, rate);
-})
\ No newline at end of file
+})
From ab3d7d186caa2dfacdad02eabb1331d68f46b637 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Wed, 23 Aug 2023 22:02:52 +0800
Subject: [PATCH 12/37] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20EditorConfig?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.editorconfig | 11 +++++++++++
1 file changed, 11 insertions(+)
create mode 100644 .editorconfig
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 00000000..58be1854
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,11 @@
+# editorconfig.org
+
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 2
+end_of_line = lf
+trim_trailing_whitespace = true
+insert_final_newline = true
From da33f7db1d6c90f4458c689b9475b084c480e896 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Wed, 23 Aug 2023 22:51:56 +0800
Subject: [PATCH 13/37] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20=E5=AF=B9=E8=B1=A1?=
=?UTF-8?q?=E9=80=97=E5=8F=B7=E7=BB=93=E6=9D=9F=E7=AC=A6=EF=BC=8C=E9=81=BF?=
=?UTF-8?q?=E5=85=8D=20IE=20=E6=8A=A5=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/rate.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/modules/rate.js b/src/modules/rate.js
index cb6e3e65..34fb83ad 100644
--- a/src/modules/rate.js
+++ b/src/modules/rate.js
@@ -64,7 +64,7 @@ layui.define(['jquery', 'lay'],function(exports){
readonly: false, //是否只读
half: false, //是否可以半星
value: 0, //星星选中个数
- theme: '',
+ theme: ''
};
//评分渲染
From 4447ed0953c7302c7875bfba60f6fb1836aac0b3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Thu, 24 Aug 2023 10:15:53 +0800
Subject: [PATCH 14/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=20`layer.photos`=20?=
=?UTF-8?q?=E5=A4=B4=E9=83=A8=E5=B7=A5=E5=85=B7=E6=A0=8F=E5=92=8C=E5=BA=95?=
=?UTF-8?q?=E9=83=A8=E6=A0=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/layer/examples/other.md | 4 +-
docs/layer/index.md | 4 +-
examples/layer.html | 27 ++--
src/css/modules/layer.css | 41 +++---
src/modules/layer.js | 265 ++++++++++++++++-------------------
5 files changed, 155 insertions(+), 186 deletions(-)
diff --git a/docs/layer/examples/other.md b/docs/layer/examples/other.md
index fa4341b8..2d607b1e 100644
--- a/docs/layer/examples/other.md
+++ b/docs/layer/examples/other.md
@@ -68,7 +68,7 @@ layui.use(function(){
}
]
},
- hideFooter: true // 是否隐藏底部栏 --- 2.8+
+ footer: false // 是否显示底部栏 --- 2.8.16+
});
},
'test-tips-photos': function(){
@@ -98,4 +98,4 @@ layui.use(function(){
}
})
});
-
\ No newline at end of file
+
diff --git a/docs/layer/index.md b/docs/layer/index.md
index a91be9d5..9ec0acc9 100644
--- a/docs/layer/index.md
+++ b/docs/layer/index.md
@@ -248,9 +248,9 @@ layer.prompt({
| 私有属性 | 描述 | 类型 | 默认值 |
| --- | --- | --- | --- |
| photos | 图片层的数据源,格式详见下述示例。 | object | - |
-| hideFooter 2.8+ | 是否隐藏底部栏 | boolean | `false` |
+| toolbar 2.8.16+ | 是否显示顶部工具栏 | boolean | `true` |
+| footer 2.8.16+ | 是否隐藏底部栏 | boolean | `true` |
| tab | 图片层切换后的回调函数,返回的参数见下述示例 | function | - |
-| toolbar 2.8.16+ | 是否显示顶部工具栏 | boolean | `false` |
该方法用于弹出图片层,基于 `type: 1`(即 `page` 层)的自定义内容。
diff --git a/examples/layer.html b/examples/layer.html
index 78ee296e..e7ac981a 100644
--- a/examples/layer.html
+++ b/examples/layer.html
@@ -1,20 +1,15 @@
-
-
-
-
-layer 弹层 - layui
-
-
-
-
+
+
+ layer 弹层 - layui
+
+
@@ -224,7 +219,9 @@ layui.use(['layer', 'util'], function(layer, util){
// 相册层
layer.photos({
- photos: '#photos' //$('#photos')
+ photos: '#photos', // $('#photos')
+ // toolbar: false,
+ // footer: false
});
//动态追加
diff --git a/src/css/modules/layer.css b/src/css/modules/layer.css
index 8b9dfb27..937ae235 100644
--- a/src/css/modules/layer.css
+++ b/src/css/modules/layer.css
@@ -238,29 +238,28 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;}
.layui-layer-tabmain .layui-layer-tabli{display:none;}
.layui-layer-tabmain .layui-layer-tabli.layui-this{display: block;}
-/* photo模式 */
+/* photos */
.layui-layer-photos{background: none; box-shadow: none;}
-.layui-layer-photos .layui-layer-content{overflow:hidden; text-align: center;}
-.layui-layer-photos .layui-layer-phimg img{position: relative; width:100%; display: inline-block; *display:inline; *zoom:1; vertical-align:top;}
-.layui-layer-imgprev, .layui-layer-imgnext{position: fixed; top: 50%; width: 52px; height: 52px; line-height: 52px; margin-top: -26px; cursor: pointer; font-size: 52px; color: #717171;}
-.layui-layer-imgprev{left: 32px;}
-.layui-layer-imgnext{right: 32px;}
-.layui-layer-imgprev:hover,
-.layui-layer-imgnext:hover{color: #959595;}
-.layui-layer-imgbar{position: fixed; left:0; right: 0; bottom:0; width:100%; height: 40px; line-height: 40px; background-color:#000\9; filter:Alpha(opacity=60); background-color: rgba(2,0,0,.35); color: #fff; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-size:0;}
-.layui-layer-imgtit{/*position:absolute; left:20px;*/}
-.layui-layer-imgtit *{display:inline-block; *display:inline; *zoom:1; vertical-align:top; padding: 0 5px; font-size:12px; color: #fff;}
-.layui-layer-imgtit h3{max-width:65%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-weight: 300;}
-.layui-layer-imgtit a:hover{color: #fff; text-decoration: underline;}
-.layui-layer-imgtit em{font-style: normal;}
+.layui-layer-photos .layui-layer-content{overflow: visible; text-align: center;}
+.layui-layer-photos .layer-layer-photos-main img{position: relative; width:100%; display: inline-block; *display:inline; *zoom:1; vertical-align:top;}
+.layui-layer-photos-prev,
+.layui-layer-photos-next{position: fixed; top: 50%; width: 52px; height: 52px; line-height: 52px; margin-top: -26px; cursor: pointer; font-size: 52px; color: #717171;}
+.layui-layer-photos-prev{left: 32px;}
+.layui-layer-photos-next{right: 32px;}
+.layui-layer-photos-prev:hover,
+.layui-layer-photos-next:hover{color: #959595;}
+
+.layui-layer-photos-toolbar{position: fixed; left: 0; right: 0; bottom: 0; width: 100%; height: 52px; line-height: 52px; background-color: #000\9; filter: Alpha(opacity=60); background-color: rgba(0,0,0,.32); color: #fff; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-size:0;}
+.layui-layer-photos-toolbar > *{display:inline-block; vertical-align: top; padding: 0 16px; font-size: 12px; color: #fff; *display:inline; *zoom: 1;}
+.layui-layer-photos-toolbar *{font-size: 12px;}
+.layui-layer-photos-header{top: 0; bottom: auto;}
+.layui-layer-photos-header > span{cursor: pointer;}
+.layui-layer-photos-header > span:hover{background-color: rgba(51,51,51,.32);}
+.layui-layer-photos-header .layui-icon{font-size: 18px;}
+.layui-layer-photos-footer > h3{max-width: 65%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}
+.layui-layer-photos-footer a:hover{text-decoration: underline;}
+.layui-layer-photos-footer em{font-style: normal;}
-/*photo工具栏*/
-.layui-layer-images-toolbar{position: fixed;top: 0;left: 0;right: 0;height: 40px;background-color: #000\9;filter: Alpha(opacity=60);background-color: rgba(2,0,0,.35);display: flex;align-items: center;justify-content: center;color: white;}
-.layui-layer-images-toolbar .layer-images-tool-item{position: relative;width: auto;height: 100%;display: flex;align-items: center;}
-.layui-layer-images-toolbar .layer-images-tool-item span{padding: 8px 10px; transition: all .4s;cursor: pointer;}
-.layui-layer-images-toolbar .layer-images-tool-item span:hover{background-color: rgba(64, 64, 64, 0.67);}
-.layui-layer-images-toolbar .layer-images-tool-item span i{font-size: 22px;}
-.layui-layer-photos .layui-layer-content.layui-layer-images-toolbar-mode{overflow: visible !important;}
/* 关闭动画 */
@-webkit-keyframes layer-bounceOut {
diff --git a/src/modules/layer.js b/src/modules/layer.js
index 6c211917..fe2aab1f 100644
--- a/src/modules/layer.js
+++ b/src/modules/layer.js
@@ -1,4 +1,4 @@
-/**
+/**
* layer
* 通用 Web 弹出层组件
*/
@@ -1353,9 +1353,9 @@ layer.prompt = function(options, yes){
layer.tab = function(options){
options = options || {};
- var tab = options.tab || {}
- ,THIS = 'layui-this'
- ,success = options.success;
+ var tab = options.tab || {};
+ var THIS = 'layui-this';
+ var success = options.success;
delete options.success;
@@ -1398,10 +1398,16 @@ layer.tab = function(options){
}, options));
};
-// 相册层
+// 图片层
layer.photos = function(options, loop, key){
var dict = {};
- options = options || {};
+
+ // 默认属性
+ options = $.extend(true, {
+ toolbar: true,
+ footer: true
+ }, options);
+
if(!options.photos) return;
// 若 photos 并非选择器或 jQuery 对象,则为普通 object
@@ -1409,11 +1415,10 @@ layer.photos = function(options, loop, key){
var photos = isObject ? options.photos : {};
var data = photos.data || [];
var start = photos.start || 0;
+ var success = options.success;
dict.imgIndex = (start|0) + 1;
options.img = options.img || 'img';
-
- var success = options.success;
delete options.success;
// 若 options.photos 不是一个对象
@@ -1450,8 +1455,7 @@ layer.photos = function(options, loop, key){
});
// 不直接弹出
- if(!loop) return;
-
+ if (!loop) return;
} else if (data.length === 0){
return layer.msg('没有图片');
}
@@ -1499,103 +1503,88 @@ layer.photos = function(options, loop, key){
}
dict.isNumber = function (n) {
- return typeof n === 'number' && !isNaN(n);
- }
-
- dict.getTransform = function(options){
- var transforms = [];
- var rotate = options.rotate;
- var scaleX = options.scaleX;
-
- if (dict.isNumber(rotate) && rotate !== 0) {
- transforms.push('rotate(' + rotate + 'deg)');
- }
-
- if (dict.isNumber(scaleX) && scaleX !== 1) {
- transforms.push('scaleX(' + scaleX + ')');
- }
-
- return transforms.length ? transforms.join(' ') : 'none';
- }
+ return typeof n === 'number' && !isNaN(n);
+ }
+
+ dict.image = {};
+
+ dict.getTransform = function(opts){
+ var transforms = [];
+ var rotate = opts.rotate;
+ var scaleX = opts.scaleX;
+ var scale = opts.scale;
+
+ if (dict.isNumber(rotate) && rotate !== 0) {
+ transforms.push('rotate(' + rotate + 'deg)');
+ }
+
+ if (dict.isNumber(scaleX) && scaleX !== 1) {
+ transforms.push('scaleX(' + scaleX + ')');
+ }
+
+ if (dict.isNumber(scale)) {
+ transforms.push('scale(' + scale + ')');
+ }
+
+ return transforms.length ? transforms.join(' ') : 'none';
+ }
// 一些动作
- dict.event = function(layero, index){
- /*
- dict.bigimg.hover(function(){
- dict.imgsee.show();
- }, function(){
- dict.imgsee.hide();
- });
- */
-
- dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){
+ dict.event = function(layero, index, that){
+ dict.main.find('.layui-layer-photos-prev').on('click', function(event){
event.preventDefault();
dict.imgprev(true);
});
- dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){
+ dict.main.find('.layui-layer-photos-next').on('click', function(event){
event.preventDefault();
dict.imgnext(true);
});
$(document).on('keyup', dict.keyup);
- var scalexFlag = true;
- //工具栏事件
- layero.off('click').on('click','*[toolbar-event]', function () {
- var othis = $(this), event = othis.attr('toolbar-event');
- switch (event) {
- case 'rotate':
- dict.image.rotate = ((dict.image.rotate || 0) + Number(othis.attr('data-option'))) % 360;
- dict.imgElem.css({
- transform: dict.getTransform(dict.image)
- });
- break;
- case 'scalex':
- if (scalexFlag){
- dict.image.scaleX = -1;
- scalexFlag = false;
- }else {
- dict.image.scaleX = 1;
- scalexFlag = true;
- }
- scalexFlag !== scalexFlag;
- dict.imgElem.css({
- transform: dict.getTransform(dict.image)
- });
- break;
- case 'zoom':
- var ratio = Number(othis.attr('data-option'));
- if (ratio < 0) {
- ratio = 1 / (1 - ratio);
- } else {
- ratio = 1 + ratio;
- }
- dict.image.width = dict.image.width * ratio;
- dict.image.height = dict.image.height * ratio;
- dict.imgElem.css({
- width: dict.image.width,
- height: dict.image.height,
- transform: dict.getTransform(dict.image)
- });
- break;
- case 'reset':
- scalexFlag = true;
- dict.image.scaleX = 1;
- dict.image.rotate = 0;
- dict.image.width = dict.image.oldWidth;
- dict.image.height = dict.image.oldHeight;
- dict.imgElem.css({
- width: dict.image.oldWidth,
- height: dict.image.oldHeight,
- transform: 'none'
- });
- break;
- case 'close':
- layer.close(index);
- break;
- }
- });
+ // 头部工具栏事件
+ layero.off('click').on('click','*[toolbar-event]', function () {
+ var othis = $(this), event = othis.attr('toolbar-event');
+ switch (event) {
+ case 'rotate':
+ dict.image.rotate = ((dict.image.rotate || 0) + Number(othis.attr('data-option'))) % 360;
+ dict.imgElem.css({
+ transform: dict.getTransform(dict.image)
+ });
+ break;
+ case 'scalex':
+ dict.image.scaleX = dict.image.scaleX === -1 ? 1 : -1;
+ dict.imgElem.css({
+ transform: dict.getTransform(dict.image)
+ });
+ break;
+ case 'zoom':
+ var ratio = Number(othis.attr('data-option'));
+ dict.image.scale = (dict.image.scale || 1) + ratio;
+ // 缩小状态最小值
+ if (ratio < 0 && dict.image.scale < 0 - ratio) {
+ dict.image.scale = 0 - ratio;
+ }
+ dict.imgElem.css({
+ transform: dict.getTransform(dict.image)
+ });
+ break;
+ case 'reset':
+ dict.image.scaleX = 1;
+ dict.image.scale = 1;
+ dict.image.rotate = 0;
+ dict.imgElem.css({
+ transform: 'none'
+ });
+ break;
+ case 'close':
+ layer.close(index);
+ break;
+ }
+ that.offset();
+ that.auto(index);
+ });
};
@@ -1648,81 +1637,65 @@ layer.photos = function(options, loop, key){
imgarea[1] = imgarea[1]/wh[1];
}
}
- dict.image = {
- oldWidth : imgarea[0],
- oldHeight : imgarea[1],
- width : imgarea[0],
- height : imgarea[1],
- };
+
return [imgarea[0]+'px', imgarea[1]+'px'];
}(),
title: false,
shade: 0.9,
shadeClose: true,
closeBtn: false,
- move: '.layui-layer-phimg img',
+ move: '.layer-layer-photos-main img',
moveType: 1,
scrollbar: false,
moveOut: true,
anim: 5,
isOutAnim: false,
skin: 'layui-layer-photos' + skin('photos'),
- content: ''
- + '

'
+ content: '
'
+ + '

'
+ function(){
- var arr = ['
'];
+ var arr = ['
'];
// 左右箭头翻页
- if(data.length > 1){
- arr.push(['
'
- ,''
- ,''
- ,'
'].join(''));
+ if (data.length > 1) {
+ arr.push(['
',
+ '',
+ '',
+ '
'].join(''));
+ }
+
+ // 头部工具栏
+ if (options.toolbar) {
+ arr.push([
+ ''
+ ].join(''));
}
// 底部栏
- if(!options.hideFooter){
- arr.push(['
'
- ,'
'
- ,'
'+ alt +'
'
- ,'
'+ dict.imgIndex +' / '+ data.length +''
- ,'
查看原图'
- ,'
'
- ,'
'].join(''));
- }
- //工具栏
- if (options.toolbar){
- arr.push([
- '
'
- ].join(''));
+ if (options.footer) {
+ arr.push([''].join(''));
}
arr.push('
');
return arr.join('');
}()
+'
',
- success: function(layero, index){
- dict.bigimg = layero.find('.layui-layer-phimg');
- dict.imgsee = layero.find('.layui-layer-imgbar');
- if (options.toolbar){
- layero.find('.layui-layer-content').addClass('layui-layer-images-toolbar-mode');
- dict.imgElem = dict.bigimg.find('img');
- dict.imgElem.css({
- width : dict.image.width,
- height : dict.image.height
- });
- }
- dict.event(layero, index);
+ success: function(layero, index, that){
+ dict.main = layero.find('.layer-layer-photos-main');
+ dict.footer = layero.find('.layui-layer-photos-footer');
+ dict.imgElem = dict.main.children('img');
+ dict.event(layero, index, that);
options.tab && options.tab(data[start], layero);
typeof success === 'function' && success(layero);
}, end: function(){
From 03d53713eaa6800afd87a3cad7808b405c4737ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Thu, 24 Aug 2023 10:17:09 +0800
Subject: [PATCH 15/37] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20code=20=E6=B5=8B?=
=?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
examples/code.html | 2 ++
1 file changed, 2 insertions(+)
diff --git a/examples/code.html b/examples/code.html
index b3b30490..d4e40e65 100644
--- a/examples/code.html
+++ b/examples/code.html
@@ -116,6 +116,8 @@ layui.use('code', function(){
// 通用实例,根据元素属性定制化参数
layui.code({
//about: 'code' // 右上角默认显示 code
+ tools: ['tips'],
+ preview: true
});
// custom more about
From 33fb2874a6d55bcf6781e077c9d1365fa490c05f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Mon, 28 Aug 2023 11:01:54 +0800
Subject: [PATCH 16/37] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20`laydate.close()`=20?=
=?UTF-8?q?=E6=96=87=E6=A1=A3=E4=B9=A6=E5=86=99=E9=94=99=E8=AF=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/laydate/index.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/laydate/index.md b/docs/laydate/index.md
index 6768a17b..989c7723 100644
--- a/docs/laydate/index.md
+++ b/docs/laydate/index.md
@@ -34,7 +34,7 @@ toc: true
| [laydate.render(options)](#render) | laydate 组件渲染,核心方法。 |
| [laydate.hint(id, opts)](#hint)
2.8+ | 在对应的 laydate 组件面板上弹出提示层。 |
| [laydate.getInst(id)](#getInst)
2.8+ | 获取组件对应的渲染实例。 |
-| [laydate.unbind(id)](#close)
2.8+ | 对目标元素解除当前实例的绑定。 |
+| [laydate.unbind(id)](#unbind)
2.8+ | 对目标元素解除当前实例的绑定。 |
| [laydate.close(id)](#close)
2.7+ | 关闭日期面板。 |
| [laydate.getEndDate(month, year)](#getEndDate) | 获取某月的最后一天。 |
@@ -160,7 +160,7 @@ laydate.render({
// 其他属性 …
});
// 关闭对应的日期面板
-laydate.cllose('test');
+laydate.close('test');
```
获取某月的最后一天
From a4e2d69774e40816af01aa878f68391888213f8a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Mon, 28 Aug 2023 11:02:18 +0800
Subject: [PATCH 17/37] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20layer=20=E6=B5=8B?=
=?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
examples/layer.html | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/examples/layer.html b/examples/layer.html
index e7ac981a..ab878860 100644
--- a/examples/layer.html
+++ b/examples/layer.html
@@ -25,10 +25,10 @@
-
更多例子
+
更多例子
-
+
content 指向放置在页面的一段隐藏元素
@@ -43,8 +43,8 @@
From 5c9a22f88eb356249c1ff5b541167cb0df98a83e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Mon, 28 Aug 2023 11:02:50 +0800
Subject: [PATCH 18/37] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20table=20=E7=A4=BA?=
=?UTF-8?q?=E4=BE=8B=E7=BB=86=E8=8A=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/table/detail/demo.md | 3 +--
docs/table/examples/css.md | 2 +-
docs/table/examples/demo.md | 4 ++--
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/docs/table/detail/demo.md b/docs/table/detail/demo.md
index f4c32833..ab6b3a82 100644
--- a/docs/table/detail/demo.md
+++ b/docs/table/detail/demo.md
@@ -198,5 +198,4 @@
更多示例
-> - [🎉 分享:在 table 组件中使用 select/dropdown/laydate 等组件实现多样化编辑](https://gitee.com/layui/layui/issues/I5JBUE)
-> - 不定期分享在 [Gitee Issues](https://gitee.com/layui/layui/issues)
\ No newline at end of file
+> - 🎉 不定期分享在 [Gitee Issues](https://gitee.com/layui/layui/issues)
diff --git a/docs/table/examples/css.md b/docs/table/examples/css.md
index aa01f4f3..8a0d6451 100644
--- a/docs/table/examples/css.md
+++ b/docs/table/examples/css.md
@@ -80,4 +80,4 @@
});
-
\ No newline at end of file
+