mirror of https://github.com/layui/layui
commit
b0b3937483
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -77,7 +77,7 @@ layui.use(function(){
|
|||
|
||||
// 原生 select 事件
|
||||
var tableViewElem = this.elem.next();
|
||||
tableViewElem.off('change').on('change', '.select-demo-primary', function(){
|
||||
tableViewElem.find('.select-demo-primary').on('change', function(){
|
||||
var value = this.value; // 获取选中项 value
|
||||
var data = table.getRowData(options.id, this); // 获取当前行数据(如 id 等字段,以作为数据修改的索引)
|
||||
|
||||
|
|
|
@ -10,25 +10,28 @@ toc: true
|
|||
<h2 id="2.9.x" lay-toc="{title: '2.9.x'}"></h2>
|
||||
|
||||
<h2 id="2.9.0" class="ws-anchor">
|
||||
2.9.0-beta.1
|
||||
2.9.0-rc.1
|
||||
<span class="layui-badge-rim">预览版</span>
|
||||
<span class="layui-badge-rim">2023-11-20</span>
|
||||
<span class="layui-badge-rim">2023-11-22</span>
|
||||
</h2>
|
||||
|
||||
`2.9.x` 对 `2.8.18` 向下兼容,可覆盖升级。
|
||||
|
||||
- #### table
|
||||
- 修复 `complete` 属性导致 `$.ajaxSetup()` 的 `complete` 失效的问题 [#1423](https://github.com/layui/layui/pull/1423)
|
||||
- 修复 单元格展开再收缩后,当列通过拖拽改变过宽度,列存在概率性错位的问题 [#28347fc](https://github.com/layui/layui/commit/28347fcf8f97912d6c90d81931f9ed5527dc3627)
|
||||
- 修复 `complete` 属性导致 `$.ajaxSetup()` 的 `complete` 失效的问题 [#1423](https://github.com/layui/layui/pull/1423) [@Sight-wcg](https://github.com/Sight-wcg)
|
||||
- 修复 单元格展开再收缩后,当列通过拖拽改变过宽度,列存在概率性错位的问题 [28347fc](https://github.com/layui/layui/commit/28347fcf8f97912d6c90d81931f9ed5527dc3627)
|
||||
- 修复 合计行单元格展开异常的问题 [#I8FH3K](https://gitee.com/layui/layui/issues/I8FH3K)
|
||||
- 优化 `height` 属性高度铺满语法中不支持浮点型数值的问题 [#I8DSPH](https://gitee.com/layui/layui/issues/I8DSPH)
|
||||
- 优化 关闭单元格多行展开状态后,悬停状态样式未移除的问题 [#1425](https://github.com/layui/layui/pull/1425)
|
||||
- 优化 关闭单元格多行展开状态后,悬停状态样式未移除的问题 [#1425](https://github.com/layui/layui/pull/1425) [@Sight-wcg](https://github.com/Sight-wcg)
|
||||
- 优化 在末行展开单元格后,出现的固定列水平未对其的问题 [#85add62](https://github.com/layui/layui/commit/85add6230c73c72d1a03de2564cab12c98db57f6)
|
||||
- #### util
|
||||
- 优化 `util.on()` 方法,提升参数的灵活性和代码的可读性 [#d74abb4](https://github.com/layui/layui/commit/d74abb453cb45ea5d2eb69f0ed7250caf0ab0088)
|
||||
- 优化 `util.on()` 方法,提升参数的灵活性和代码的可读性 [d74abb4](https://github.com/layui/layui/commit/d74abb453cb45ea5d2eb69f0ed7250caf0ab0088) / [92c8580](https://github.com/layui/layui/commit/92c85805c2558bf384292d7adf783d8453cd895a)
|
||||
- #### colorpicker
|
||||
- 优化 colorpicker 内部输入框取值,移除字符串两侧的空白字符 [#1427](https://github.com/layui/layui/pull/1427)
|
||||
- #### 其他
|
||||
- 优化 `lay.clipboard.writeText()` 逻辑,以适配无写入权限时的场景 [#1421](https://github.com/layui/layui/pull/1421)
|
||||
- 优化 `lay.clipboard.writeText()` 逻辑,以适配无写入权限时的场景 [#1421](https://github.com/layui/layui/pull/1421) [@Sight-wcg](https://github.com/Sight-wcg)
|
||||
|
||||
### 下载: [layui-v2.9.0-beta.1.zip](https://gitee.com/layui/layui/attach_files/1587087/download)
|
||||
### 下载: [layui-v2.9.0-beta.1.zip](https://gitee.com/layui/layui/attach_files/1589824/download)
|
||||
|
||||
---
|
||||
|
||||
|
|
|
@ -18,6 +18,13 @@ body{padding: 50px;}
|
|||
<button class="layui-btn" lay-on="e3">事件3</button>
|
||||
<button class="layui-btn" lay-active="e4">事件4</button>
|
||||
|
||||
<br><br>
|
||||
|
||||
<div id="ID-util-on-test">
|
||||
<button class="layui-btn" lay-on="e1">新的容器 - 事件1</button>
|
||||
<button class="layui-btn" lay-on="e5">新的容器 - 事件5</button>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div id="test"></div>
|
||||
|
@ -120,6 +127,20 @@ layui.use(['lay', 'util', 'layer'], function(){
|
|||
trigger: 'mouseenter'
|
||||
});
|
||||
|
||||
// 自定义触发事件的委托元素
|
||||
util.on({
|
||||
// 此处与委托在 body 上的事件共用了 e1 名称,以测试事件冒泡
|
||||
e1: function(othis, e){
|
||||
this.innerHTML = 'click: '+ (Math.random()*100000 | 0);
|
||||
layui.stope(e); // 阻止事件冒泡
|
||||
},
|
||||
e5: function(othis) {
|
||||
this.innerHTML = 'click: '+ (Math.random()*100000 | 0);
|
||||
}
|
||||
}, {
|
||||
elem: '#ID-util-on-test'
|
||||
});
|
||||
|
||||
|
||||
// 倒计时
|
||||
var countdown = util.countdown({
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "layui",
|
||||
"version": "2.9.0-beta.1",
|
||||
"version": "2.9.0-rc.1",
|
||||
"description": "Classic modular Front-End UI library",
|
||||
"keywords": [
|
||||
"layui",
|
||||
|
|
|
@ -872,11 +872,11 @@ hr.layui-border-black{border-width: 0 0 1px;}
|
|||
.layui-form-checkbox:hover > div{background-color: #c2c2c2;}
|
||||
.layui-form-checkbox > i{position: absolute; right: 0; top: 0; width: 30px; height: 100%; border: 1px solid #d2d2d2; border-left: none; border-radius: 0 2px 2px 0; color: #fff; color: rgba(255,255,255,0); font-size: 20px; text-align: center; box-sizing: border-box;}
|
||||
.layui-form-checkbox:hover > i{border-color: #c2c2c2; color: #c2c2c2;}
|
||||
.layui-form-checked,
|
||||
.layui-form-checked,
|
||||
.layui-form-checked:hover{border-color: #16b777;}
|
||||
.layui-form-checked > div,
|
||||
.layui-form-checked > div,
|
||||
.layui-form-checked:hover > div{background-color: #16b777;}
|
||||
.layui-form-checked > i,
|
||||
.layui-form-checked > i,
|
||||
.layui-form-checked:hover > i{color: #16b777;}
|
||||
.layui-form-item .layui-form-checkbox{margin-top: 4px;}
|
||||
.layui-form-checkbox.layui-checkbox-disabled > div{background-color: #eee !important;}
|
||||
|
@ -1176,6 +1176,7 @@ select.layui-table-edit{padding: 0 0 0 10px; border-color: #d2d2d2;}
|
|||
.layui-table-cell-c{position: absolute; bottom: -10px; right: 50%; margin-right: -9px; width: 20px; height: 20px; line-height: 18px; cursor: pointer; text-align: center; background-color: #fff; border: 1px solid #eee; border-radius: 50%; z-index: 1000; transition: 0.3s all; font-size: 14px;}
|
||||
.layui-table-cell-c:hover{border-color: #16b777;}
|
||||
.layui-table-expanded td:hover .layui-table-cell{overflow: auto;}
|
||||
.layui-table-main > .layui-table > tbody > tr:last-child > td > .layui-table-cell-c{bottom: 0;}
|
||||
|
||||
/* 单元格 TIPS 展开风格 */
|
||||
body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-shadow: 0 1px 6px rgba(0,0,0,.12);}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
};
|
||||
|
||||
var Layui = function(){
|
||||
this.v = '2.9.0-beta.1'; // Layui 版本号
|
||||
this.v = '2.9.0-rc.1'; // Layui 版本号
|
||||
};
|
||||
|
||||
// 识别预先可能定义的指定全局对象
|
||||
|
|
|
@ -434,7 +434,7 @@ layui.define(['jquery', 'lay'], function(exports){
|
|||
}
|
||||
|
||||
//回调更改的颜色
|
||||
options.change && options.change(that.elemPicker.find('.' + PICKER_INPUT).find('input').val());
|
||||
options.change && options.change($.trim(that.elemPicker.find('.' + PICKER_INPUT).find('input').val()));
|
||||
}
|
||||
|
||||
//拖拽元素
|
||||
|
@ -614,7 +614,7 @@ layui.define(['jquery', 'lay'], function(exports){
|
|||
|
||||
//确认
|
||||
,confirm: function(othis, change){
|
||||
var value = elemPickerInput.val()
|
||||
var value = $.trim(elemPickerInput.val())
|
||||
,colorValue
|
||||
,hsb;
|
||||
|
||||
|
|
|
@ -410,25 +410,36 @@ layui.define('jquery', function(exports){
|
|||
|
||||
var elem = options.elem = $(options.elem);
|
||||
var attrSelector = '['+ attr +']';
|
||||
var CALLBACK = 'UTIL_ON_CALLBACK';
|
||||
var DATANAME = 'UTIL_ON_DATA'; // 缓存在委托元素上的 data-* 属性名
|
||||
|
||||
if (!elem[0]) return; // 若委托元素不存在
|
||||
|
||||
// 根据 attr 记录事件集合
|
||||
events = util.on[attr] = $.extend(true, util.on[attr], events) || {};
|
||||
// 初始化 data 默认值,以委托元素为存储单元
|
||||
if (!elem.data(DATANAME)) {
|
||||
elem.data(DATANAME, {
|
||||
events: {},
|
||||
callbacks: {}
|
||||
});
|
||||
}
|
||||
|
||||
// 清除事件委托
|
||||
util.on[CALLBACK] = util.on[CALLBACK] || {};
|
||||
elem.off(options.trigger, attrSelector, util.on[CALLBACK][attr]);
|
||||
// 读取 data 缓存
|
||||
var dataCache = elem.data(DATANAME);
|
||||
var callbacks = dataCache.callbacks;
|
||||
|
||||
// 根据 attr 记录事件集合
|
||||
events = $.extend(true, dataCache.events, events) || {};
|
||||
|
||||
// 清除事件委托,避免重复绑定
|
||||
elem.off(options.trigger, attrSelector, callbacks[attr]);
|
||||
|
||||
// 绑定事件委托
|
||||
elem.on(
|
||||
options.trigger,
|
||||
attrSelector,
|
||||
util.on[CALLBACK][attr] = function() {
|
||||
callbacks[attr] = function(e) {
|
||||
var othis = $(this);
|
||||
var key = othis.attr(attr);
|
||||
typeof events[key] === 'function' && events[key].call(this, othis);
|
||||
typeof events[key] === 'function' && events[key].call(this, othis, e);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue