mirror of https://github.com/layui/layui
commit
4299b87515
|
@ -23,7 +23,7 @@ body:
|
|||
- type: input
|
||||
attributes:
|
||||
label: 浏览器
|
||||
placeholder: 如:Chrome 116.0.5845.111(正式版本) (64 位)
|
||||
placeholder: 如:Chrome x.x.x.x(正式版本)(64 位)
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
|
|
|
@ -2,4 +2,4 @@ blank_issues_enabled: false
|
|||
contact_links:
|
||||
- name: 📄 官方文档
|
||||
url: https://layui.dev/
|
||||
about: 建议你在创建 Issue 之前,仔细查阅 Layui 开发文档,以便对其有更深入的了解,和更好地分析问题。
|
||||
about: 建议在创建 Issue 之前,仔细查阅 Layui 开发文档,以便对其有更深入的了解,和更好地分析问题。
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
name: 😇 问题反馈
|
||||
description: 使用 Layui 过程中遇到的 Bug、异常或其他困惑。
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
**系统提示**:此处只接受 Layui 相关技术问题,其他如 layuiAdmin 或 LayIM 等主题相关问题请勿在此反馈。
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: 议题条件
|
||||
options:
|
||||
- label: 我确认已查看官方使用文档:**https://layui.dev** ,但没有找到相关解决方案。
|
||||
required: true
|
||||
- label: 我确认已在 **Issues** 中搜索过类似的问题,但没有找到相关解决方案。
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: 版本号
|
||||
placeholder: 请提供您当前使用的 Layui 版本号
|
||||
description: 若不清楚,可打开 `layui.js`,头部注释有对应的版本号
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: 浏览器
|
||||
placeholder: 如:Chrome x.x.x.x(正式版本)(64 位)
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: type
|
||||
attributes:
|
||||
label: 问题类型
|
||||
options:
|
||||
- 疑是 BUG
|
||||
- 报错提示
|
||||
- 功能困惑
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: 问题描述
|
||||
placeholder: 请提供详细的问题描述和操作步骤等信息,以便我们也能够更轻松地将问题复现。
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: 业务代码
|
||||
description: 直接粘贴问题对应的 `HTML,CSS,JavaScript` 等代码到下面的文本框,无需书写 `Markdown`
|
||||
placeholder: 请提供与该问题对应的业务代码片段,以便我们更好地排查问题。
|
||||
render: auto
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: 截图补充
|
||||
placeholder: 如上述仍然无法准确地表述问题,可提供必要的截图(可直接粘贴上传)
|
||||
- type: input
|
||||
attributes:
|
||||
label: 演示地址
|
||||
description: 若能提供 Stackblitz, CodePen 或自主搭建的页面演示地址,将更有助于解决问题
|
||||
placeholder: URL
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: 友好承诺
|
||||
options:
|
||||
- label: 我承诺将本着相互尊重、理解和友善的态度进行交流,共同维护 Layui 良好的社区氛围。
|
||||
required: true
|
|
@ -1,8 +1,5 @@
|
|||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: 😇 问题反馈
|
||||
url: https://gitee.com/layui/layui/issues
|
||||
about: 使用 Layui 过程中遇到的 Bug、异常或其他功能困惑。
|
||||
- name: 📄 官方文档
|
||||
url: https://layui.dev/
|
||||
about: 建议您在创建 Issue 之前,仔细查阅 Layui 开发文档,以便对其有更深入的了解,和更好地分析问题。
|
||||
about: 建议在创建 Issue 之前,仔细查阅 Layui 开发文档,以便对其有更深入的了解,和更好地分析问题。
|
||||
|
|
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
|
@ -388,7 +388,7 @@ layer.closeAll('tips'); // 关闭所有的 tips 层
|
|||
`layer.closeLast(type, callback);`
|
||||
|
||||
- 参数 `type` : 弹层的类型。可选值:`dialog,page,iframe,loading,tips`
|
||||
- 参数 `callback` : 关闭弹层后的回调函数
|
||||
- 参数 `callback` <sup>2.9+</sup>: 关闭弹层后的回调函数
|
||||
|
||||
该方法用于关闭最近一次打开的对应类型的层。
|
||||
|
||||
|
|
|
@ -200,6 +200,20 @@ limitTemplet: function(item) {
|
|||
skipText: ['Go to', '', 'Confirm']
|
||||
```
|
||||
|
||||
</td>
|
||||
<td>array</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>countText <sup>2.9.1+</sup></td>
|
||||
<td>
|
||||
|
||||
用于自定义总数区域文本,如:
|
||||
|
||||
```
|
||||
countText: ['Total ','']
|
||||
```
|
||||
|
||||
</td>
|
||||
<td>array</td>
|
||||
<td>-</td>
|
||||
|
|
|
@ -123,6 +123,17 @@
|
|||
- `height: 'full-30'` 设置相对可视屏幕的高度铺满。这是一个特定的语法格式:`full` 表示铺满;后面的数字表示当前 table 之外的元素占用的高度,如:表格头部到页面最顶部*加*表格底部距离页面最底部的“距离和”
|
||||
- `height: '#id-30'` 设置相对父元素的高度铺满,其中 `#id` 即父元素的 ID 选择器,其计算原理和上述 `full` 相同。
|
||||
|
||||
**函数写法** <sup>2.9.1+</sup>
|
||||
|
||||
当需要动态改变表格高度时建议使用,如下以等效 `full-xx` 的写法为例:
|
||||
|
||||
```
|
||||
height: function(){
|
||||
var otherHeight = $('#search-content').outerHeight(); // 自定义其他区域的高度
|
||||
return $(window).height() - otherHeight; // 返回 number 类型
|
||||
}
|
||||
```
|
||||
|
||||
</td>
|
||||
<td>number<br>string</td>
|
||||
<td>-</td>
|
||||
|
|
|
@ -345,7 +345,7 @@ console.log(checkStatus.isAll ) // 表格是否全选
|
|||
| opts | 描述 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| type | 选中方式。可选值: `checkbox,radio` | string | `checkbox` |
|
||||
| index | 选中行的下标。即数据的所在数组下标(`0` 开头)。<br>可设置 `all` 表示全选。 | number<br>string | - |
|
||||
| index | 选中行的下标。支持以下几种情况:<ul><li>若值为 `number` 类型,则表示行所在的数组下标(`0` 开头)</li><li>若值为 `array` 类型 <sup>2.9.1+</sup>,则表示批量下标。</li><li>若值为 `string` 类型,则可设置 `all` 操作全选。</li></ul> | number<br>array<br>string | - |
|
||||
| checked | 选中状态值。 <ul><li>若传递该属性,则赋值固定值。</li><li>若不传递该属性(默认),则 `checkbox` 将在 `true\|false` 中自动切换值,而 `radio` 将赋值 `true` 固定值。<sup>2.8.4+</sup></li></ul> | boolean | - |
|
||||
|
||||
该方法用于设置行的选中样式及相关的特定属性值 `LAY_CHECKED`。
|
||||
|
@ -363,10 +363,15 @@ table.setRowChecked('test', {
|
|||
index: 0, // 选中行的下标。 0 表示第一行
|
||||
});
|
||||
|
||||
// 批量选中行
|
||||
table.setRowChecked('test', {
|
||||
index: [1,3,5] // 2.9.1+
|
||||
});
|
||||
|
||||
// 取消选中行
|
||||
table.setRowChecked('test', {
|
||||
index: 'all', // 所有行
|
||||
checked: false
|
||||
checked: false // 此处若设置 true,则表示全选
|
||||
});
|
||||
```
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ util.openWin({
|
|||
|
||||
| options | 描述 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| elem | 触发事件的委托元素 | string \| HTMLElement \| jQuery | - |
|
||||
| elem | 触发事件的委托元素 | string \| HTMLElement \| JQuery | - |
|
||||
| trigger | 事件触发的方式 | string | `click` |
|
||||
|
||||
<pre class="layui-code" lay-options="{preview: true, codeStyle: 'height: 535px;', layout: ['code', 'preview'], tools: ['full']}">
|
||||
|
|
|
@ -9,13 +9,41 @@ 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
|
||||
<span class="layui-badge-rim" style="color: #16b777;">稳定版</span>
|
||||
<span class="layui-badge-rim">2023-11-29</span>
|
||||
<h2 id="2.9.1" class="ws-anchor">
|
||||
2.9.1
|
||||
<!-- <span class="layui-badge-rim" style="color: #16b777;">稳定版</span> -->
|
||||
<span class="layui-badge-rim">2023-12-11</span>
|
||||
</h2>
|
||||
|
||||
`2.9.x` 对 `2.8.18` 向下兼容,可覆盖升级。
|
||||
`2.9.x` 是对 `2.8.18` 的进一步完善,旨在打造一个可长期用于生产环境的稳定版本。对 `2.8.x` 向下兼容,可覆盖升级。
|
||||
|
||||
- #### table
|
||||
- 增强 `height` 选项,支持函数 #1437 @Sight-wcg
|
||||
- 增强 `table.setRowChecked()` 方法,支持批量选中 [7c12ddf]
|
||||
- 修复 全选时,禁用行仍有选中样式的问题 #1436 @Sight-wcg
|
||||
- 修复 `templet` 模板字符中的一些特殊 laytpl 界定符被转义的问题 #1438 @Sight-wcg
|
||||
- #### layer
|
||||
- 修复 `iframe` 层在某些情况出现异常纵向滚动条的问题 [8f0c87f]
|
||||
- 优化 `layer.tips` 在触发元素高度较小时的定位 #1439 @Sight-wcg
|
||||
- #### treeTable
|
||||
- 修复 `treeTable.reloadData()` 在某些情况下报错的问题 [3f148a9]
|
||||
- #### laydate
|
||||
- 清除 内部 `MODE_NAME` 变量重复声明 #1441 @mek1986
|
||||
- #### laypage
|
||||
- 新增 `countText` 选项,用于自定义数据总数区域文本 #1444 @Sight-wcg
|
||||
- #### nav
|
||||
- 修复 IE8 下子菜单背景色问题 #1445 @Sight-wcg
|
||||
- #### util
|
||||
- 优化 `util.on()` 在特殊情况下的用法问题 [3b78139]
|
||||
|
||||
### 下载: [layui-v2.9.1.zip](https://gitee.com/layui/layui/attach_files/1608279/download)
|
||||
|
||||
---
|
||||
|
||||
<h2 id="2.9.0" class="ws-anchor">
|
||||
2.9.0
|
||||
<span class="layui-badge-rim">2023-11-29</span>
|
||||
</h2>
|
||||
|
||||
- #### table
|
||||
- 修复 `complete` 属性导致 `$.ajaxSetup()` 的 `complete` 失效的问题 #1423 @Sight-wcg
|
||||
|
@ -23,7 +51,7 @@ toc: true
|
|||
- 修复 合计行单元格展开异常的问题 #Gitee-I8FH3K
|
||||
- 优化 `height` 属性高度铺满语法中不支持浮点型数值的问题 #Gitee-I8DSPH
|
||||
- 优化 关闭单元格多行展开状态后,悬停状态样式未移除的问题 #1425 @Sight-wcg
|
||||
- 优化 在末行展开单元格后,出现的固定列水平未对其的问题 [85add62]
|
||||
- 优化 在末行展开单元格后,出现的固定列水平未对齐的问题 [85add62]
|
||||
- 优化 当数据值为 `0,undefined,null` 且开启列模板,编辑单元格会带入模板字符的问题 [1d408f0]
|
||||
- #### util
|
||||
- 优化 `util.on()` 方法,提升参数的灵活性和代码的可读性 [d74abb4] [92c8580]
|
||||
|
@ -71,11 +99,14 @@ toc: true
|
|||
nodeValue = nodeValue.replace(types[i].rule, function(s, s1, s2) {
|
||||
return '<a href="'+ types[i].href + s2 +'" target="_blank">'+ s1 + s2 +'</a>';
|
||||
});
|
||||
node.matched = true;
|
||||
}
|
||||
}
|
||||
sNode.innerHTML = nodeValue;
|
||||
node.parentNode.insertBefore(sNode, node);
|
||||
node.parentNode.removeChild(node);
|
||||
if (node.matched) {
|
||||
sNode.innerHTML = nodeValue;
|
||||
node.parentNode.insertBefore(sNode, node);
|
||||
node.parentNode.removeChild(node);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -136,11 +136,11 @@ layui.use(['laytpl', 'util'], function(){
|
|||
var util = layui.util;
|
||||
var $ = layui.$;
|
||||
|
||||
//获取模板和数据
|
||||
// 获取模板和数据
|
||||
var get = function(type){
|
||||
return {
|
||||
template: $('#demoTPL1').val() //获取模板
|
||||
,data: function(){ //获取数据
|
||||
template: $('#demoTPL1').val(), // 获取模板
|
||||
data: function(){ // 获取数据
|
||||
try {
|
||||
return JSON.parse($('#demoData1').val());
|
||||
} catch(e){
|
||||
|
@ -152,52 +152,58 @@ layui.use(['laytpl', 'util'], function(){
|
|||
|
||||
var data = get();
|
||||
|
||||
//耗时计算
|
||||
// 耗时计算
|
||||
var startTime = new Date().getTime(), timer = function(startTime, title){
|
||||
var endTime = new Date().getTime();
|
||||
$('#demoViewTime').html((title || '模板解析耗时:')+ (endTime - startTime) + 'ms');
|
||||
};
|
||||
|
||||
//渲染模板
|
||||
// 全局设置
|
||||
/*laytpl.config({
|
||||
open: '<%',
|
||||
close: '%>'
|
||||
});*/
|
||||
|
||||
// 渲染模板
|
||||
var thisTpl = laytpl(data.template);
|
||||
|
||||
//执行渲染
|
||||
// 执行渲染
|
||||
thisTpl.render(data.data, function(view){
|
||||
timer(startTime);
|
||||
$('#demoView1').html(view);
|
||||
});
|
||||
|
||||
//编辑
|
||||
// 编辑
|
||||
$('.laytpl-demo textarea').on('input', function(){
|
||||
var data = get();
|
||||
if(!data.data) return;
|
||||
|
||||
//计算模板渲染耗时
|
||||
// 计算模板渲染耗时
|
||||
var startTime = new Date().getTime();
|
||||
|
||||
//若模板有变化,则重新解析模板;若模板没变,数据有变化,则从模板缓存中直接渲染(效率大增)
|
||||
// 若模板有变化,则重新解析模板;若模板没变,数据有变化,则从模板缓存中直接渲染(效率大增)
|
||||
if(this.id === 'demoTPL1'){
|
||||
thisTpl.parse(data.template, data.data); //解析模板
|
||||
thisTpl.parse(data.template, data.data); // 解析模板
|
||||
}
|
||||
|
||||
//执行渲染
|
||||
// 执行渲染
|
||||
thisTpl.render(data.data, function(view){
|
||||
timer(startTime);
|
||||
$('#demoView1').html(view);
|
||||
});
|
||||
});
|
||||
|
||||
//事件
|
||||
util.event('lay-on', {
|
||||
//性能测试
|
||||
// 事件
|
||||
util.on({
|
||||
// 性能测试
|
||||
test1: function(){
|
||||
var dataLen = 1000 //数据量
|
||||
,renderTimes = 1000; //渲染次数
|
||||
var dataLen = 1000 // 数据量
|
||||
var renderTimes = 1000; // 渲染次数
|
||||
|
||||
//初始化数据
|
||||
// 初始化数据
|
||||
var data = {
|
||||
title: '性能测试'
|
||||
,items: function(items){
|
||||
title: '性能测试',
|
||||
items: function(items){
|
||||
for(var i = 0; i < dataLen; i++){
|
||||
items.push({
|
||||
index: i
|
||||
|
@ -209,7 +215,7 @@ layui.use(['laytpl', 'util'], function(){
|
|||
}([])
|
||||
};
|
||||
|
||||
//模板
|
||||
// 模板
|
||||
var startTime = new Date();
|
||||
for(var j = 0; j < renderTimes; j++){
|
||||
var template = document.getElementById('laytplTestTpl').innerHTML;
|
||||
|
|
|
@ -222,13 +222,22 @@ layui.use(['table', 'dropdown'], function(){
|
|||
},{
|
||||
id: 'unchecked',
|
||||
title: '取消选中某行'
|
||||
},{
|
||||
id: 'mult-checked',
|
||||
title: '同时选中多个'
|
||||
},{
|
||||
id: 'reset-checked',
|
||||
title: '给选中行取消选中状态'
|
||||
}],
|
||||
// 菜单被点击的事件
|
||||
click: function(obj){
|
||||
if(obj.id === 'reset-checked'){
|
||||
click: function(obj) {
|
||||
if (obj.id === 'mult-checked') {
|
||||
// 同时选中多个
|
||||
table.setRowChecked(id, {
|
||||
index: [3, 4, 5], // 2.9.1+
|
||||
checked: true
|
||||
});
|
||||
} else if(obj.id === 'reset-checked') {
|
||||
// 给选中行取消选中状态
|
||||
table.setRowChecked(id, {
|
||||
index: 'all',
|
||||
|
|
|
@ -16,7 +16,8 @@ body{padding: 50px;}
|
|||
<button class="layui-btn" lay-on="e1">事件1</button>
|
||||
<button class="layui-btn" lay-on="e2">事件2</button>
|
||||
<button class="layui-btn" lay-on="e3">事件3</button>
|
||||
<button class="layui-btn" lay-active="e4">事件4</button>
|
||||
<button class="layui-btn" lay-active="e4">hover: active - 事件4</button>
|
||||
<button class="layui-btn" lay-active1="e4">hover: active1 - 事件4</button>
|
||||
|
||||
<br><br>
|
||||
|
||||
|
@ -108,7 +109,7 @@ layui.use(['lay', 'util', 'layer'], function(){
|
|||
}
|
||||
});
|
||||
|
||||
// 事件集的替换和增加
|
||||
// Test: 事件集的替换和增加
|
||||
util.on({
|
||||
e1: function(othis){ // 重置事件 e1
|
||||
alert(othis.html() + ' - replace')
|
||||
|
@ -121,8 +122,19 @@ layui.use(['lay', 'util', 'layer'], function(){
|
|||
// 自定义触发事件的元素属性名、自定义触发事件的方式
|
||||
util.on('lay-active', {
|
||||
e4: layui.throttle(function(othis) {
|
||||
layer.tips(othis.html(), this);
|
||||
}, 3000) // 3s 内不重复执行
|
||||
layer.tips(othis.html(), this, { tips: 3 });
|
||||
}, 3000), // 3s 内不重复执行
|
||||
e5: function() {
|
||||
console.log(111);
|
||||
}
|
||||
}, {
|
||||
trigger: 'mouseenter'
|
||||
});
|
||||
// Test: 不同属性、相同值
|
||||
util.on('lay-active1', {
|
||||
e4: function(othis) {
|
||||
this.innerHTML = 'hover: '+ (Math.random()*100000 | 0);
|
||||
}
|
||||
}, {
|
||||
trigger: 'mouseenter'
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "layui",
|
||||
"version": "2.9.0",
|
||||
"version": "2.9.1",
|
||||
"description": "Classic modular Front-End UI library",
|
||||
"keywords": [
|
||||
"layui",
|
||||
|
|
|
@ -1319,7 +1319,7 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
|
|||
.layui-nav-itemed>a{color: #fff !important;}
|
||||
.layui-nav-tree .layui-nav-bar{background-color: #16baaa;}
|
||||
|
||||
.layui-nav-tree .layui-nav-child{position: relative; z-index: 0; top: 0; border: none; background-color: rgba(0,0,0,.3); box-shadow: none;}
|
||||
.layui-nav-tree .layui-nav-child{position: relative; z-index: 0; top: 0; border: none; background: none; background-color: rgba(0,0,0,.3); box-shadow: none;}
|
||||
.layui-nav-tree .layui-nav-child dd{margin: 0;}
|
||||
.layui-nav-tree .layui-nav-child a{color: #fff; color: rgba(255,255,255,.7);}
|
||||
.layui-nav-tree .layui-nav-child a:hover{background: none; color: #fff;}
|
||||
|
|
|
@ -260,7 +260,6 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;}
|
|||
.layui-layer-photos-footer a:hover{text-decoration: underline;}
|
||||
.layui-layer-photos-footer em{font-style: normal;}
|
||||
|
||||
|
||||
/* 关闭动画 */
|
||||
@-webkit-keyframes layer-bounceOut {
|
||||
100% {opacity: 0; -webkit-transform: scale(.7); transform: scale(.7)}
|
||||
|
@ -273,9 +272,3 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;}
|
|||
0% {-webkit-transform: scale(1); -ms-transform: scale(1);transform: scale(1);}
|
||||
}
|
||||
.layer-anim-close{-webkit-animation-name: layer-bounceOut; animation-name: layer-bounceOut; -webkit-animation-fill-mode: both; animation-fill-mode: both; -webkit-animation-duration:.2s; animation-duration:.2s;}
|
||||
|
||||
@media screen and (max-width: 1100px) {
|
||||
.layui-layer-iframe{overflow-y: auto; -webkit-overflow-scrolling: touch;}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
};
|
||||
|
||||
var Layui = function(){
|
||||
this.v = '2.9.0'; // Layui 版本号
|
||||
this.v = '2.9.1'; // Layui 版本号
|
||||
};
|
||||
|
||||
// 识别预先可能定义的指定全局对象
|
||||
|
|
|
@ -948,7 +948,11 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
|||
return that;
|
||||
};
|
||||
|
||||
// 主动触发验证 --- elem 即要验证的区域表单选择器 / return true or false
|
||||
/**
|
||||
* 主动触发验证
|
||||
* @param {(string|HTMLElement|JQuery)} elem - 要验证的区域表单元素
|
||||
* @return {boolean} 返回结果。若验证通过,返回 `true`, 否则返回 `false`
|
||||
*/
|
||||
Form.prototype.validate = function(elem) {
|
||||
var that = this;
|
||||
var intercept; // 拦截标识
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -671,13 +671,15 @@ Class.pt.tips = function(){
|
|||
};
|
||||
|
||||
// 辨别 tips 的方位
|
||||
// 21 为箭头大小 8*2 + 箭头相对父元素的top偏移 5
|
||||
goal.where = [function(){ // 上
|
||||
goal.autoLeft();
|
||||
goal.tipTop = goal.top - layArea[1] - 10;
|
||||
tipsG.removeClass('layui-layer-TipsB').addClass('layui-layer-TipsT').css('border-right-color', config.tips[1]);
|
||||
}, function(){ // 右
|
||||
goal.tipLeft = goal.left + goal.width + 10;
|
||||
goal.tipTop = goal.top;
|
||||
goal.tipTop = goal.top - (goal.height * 0.75 < 21 ? 21 - goal.height * 0.5 : 0);
|
||||
goal.tipTop = Math.max(goal.tipTop, 0);
|
||||
tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]);
|
||||
}, function(){ // 下
|
||||
goal.autoLeft();
|
||||
|
@ -685,7 +687,8 @@ Class.pt.tips = function(){
|
|||
tipsG.removeClass('layui-layer-TipsT').addClass('layui-layer-TipsB').css('border-right-color', config.tips[1]);
|
||||
}, function(){ // 左
|
||||
goal.tipLeft = goal.left - layArea[0] - 10;
|
||||
goal.tipTop = goal.top;
|
||||
goal.tipTop = goal.top - (goal.height * 0.75 < 21 ? 21 - goal.height * 0.5 : 0);
|
||||
goal.tipTop = Math.max(goal.tipTop, 0);
|
||||
tipsG.removeClass('layui-layer-TipsR').addClass('layui-layer-TipsL').css('border-bottom-color', config.tips[1]);
|
||||
}];
|
||||
goal.where[guide-1]();
|
||||
|
|
|
@ -152,7 +152,10 @@ layui.define(function(exports){
|
|||
}(),
|
||||
|
||||
// 数据总数
|
||||
count: '<span class="layui-laypage-count">共 '+ config.count +' 条</span>',
|
||||
count: function(){
|
||||
var countText = typeof config.countText === 'object' ? config.countText : ['共 ', ' 条'];
|
||||
return '<span class="layui-laypage-count">'+ countText[0] + config.count + countText[1] +'</span>'
|
||||
}(),
|
||||
|
||||
// 每页条数
|
||||
limit: function(){
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/**
|
||||
* laytpl 轻量模板引擎
|
||||
*/
|
||||
|
||||
|
|
|
@ -77,6 +77,16 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
return config || null;
|
||||
};
|
||||
|
||||
// lay 函数可以处理 Selector,HTMLElement,JQuery 类型
|
||||
// 无效的 CSS 选择器字符串,会抛出 SyntaxError 异常,此时直接返回 laytpl 模板字符串
|
||||
var resolveTplStr = function(templet){
|
||||
try{
|
||||
return lay(templet).html();
|
||||
}catch{
|
||||
return templet;
|
||||
}
|
||||
}
|
||||
|
||||
// 解析自定义模板数据
|
||||
var parseTempData = function(obj){
|
||||
obj = obj || {};
|
||||
|
@ -97,9 +107,9 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
if(templet){
|
||||
content = typeof templet === 'function'
|
||||
? templet.call(item3, obj.tplData, obj.obj)
|
||||
: laytpl($(templet).html() || String(content)).render($.extend({
|
||||
LAY_COL: item3
|
||||
}, obj.tplData));
|
||||
: laytpl(resolveTplStr(templet) || String(content)).render($.extend({
|
||||
LAY_COL: item3
|
||||
}, obj.tplData));
|
||||
}
|
||||
|
||||
// 是否只返回文本
|
||||
|
@ -360,6 +370,9 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
that.parentHeightGap = parentDiv.pop();
|
||||
that.parentDiv = parentDiv.join("-");
|
||||
options.height = $(that.parentDiv).height() - (parseFloat(that.parentHeightGap) || 0);
|
||||
} else if (typeof options.height === "function"){
|
||||
that.customHeightFunc = options.height;
|
||||
options.height = that.customHeightFunc();
|
||||
}
|
||||
|
||||
// 开始插入替代元素
|
||||
|
@ -1557,9 +1570,16 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
Class.prototype.setRowChecked = function(opts){
|
||||
var that = this;
|
||||
var options = that.config;
|
||||
var tr = that.layBody.find('tr'+ (
|
||||
opts.index === 'all' ? '' : '[data-index="'+ opts.index +'"]'
|
||||
));
|
||||
var isCheckAll = opts.index === 'all'; // 是否操作全部
|
||||
var isCheckMult = layui.type(opts.index) === 'array'; // 是否操作多个
|
||||
|
||||
// 匹配行元素
|
||||
var tr = function(tr) {
|
||||
return isCheckAll ? tr : tr.filter(isCheckMult ? function() {
|
||||
var dataIndex = $(this).data('index');
|
||||
return opts.index.indexOf(dataIndex) !== -1;
|
||||
} : '[data-index="'+ opts.index +'"]');
|
||||
}(that.layBody.find('tr'));
|
||||
|
||||
// 默认属性
|
||||
opts = $.extend({
|
||||
|
@ -1569,20 +1589,34 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
// 同步数据选中属性值
|
||||
var thisData = table.cache[that.key];
|
||||
var existChecked = 'checked' in opts;
|
||||
|
||||
// 若为单选框,则单向选中;若为复选框,则切换选中。
|
||||
var getChecked = function(value){
|
||||
// 若为单选框,则单向选中;若为复选框,则切换选中。
|
||||
return opts.type === 'radio' ? true : (existChecked ? opts.checked : !value)
|
||||
};
|
||||
|
||||
// 设置数据选中属性
|
||||
// 设置选中状态
|
||||
layui.each(thisData, function(i, item){
|
||||
if(layui.type(item) === 'array' || item[options.disabledName]) return; // 空项
|
||||
if(Number(opts.index) === i || opts.index === 'all'){
|
||||
// 绕过空项和禁用项
|
||||
if(layui.type(item) === 'array' || item[options.disabledName]) return;
|
||||
|
||||
// 匹配条件
|
||||
var matched = isCheckAll || (
|
||||
isCheckMult ? opts.index.indexOf(i) !== -1 : Number(opts.index) === i
|
||||
);
|
||||
|
||||
// 设置匹配项的选中值
|
||||
if(matched){
|
||||
// 标记数据选中状态
|
||||
var checked = item[options.checkName] = getChecked(item[options.checkName]);
|
||||
tr[checked ? 'addClass' : 'removeClass'](ELEM_CHECKED); // 标记当前选中行背景色
|
||||
|
||||
// 标记当前行背景色
|
||||
var currTr = tr.filter('[data-index="'+ i +'"]');
|
||||
currTr[checked ? 'addClass' : 'removeClass'](ELEM_CHECKED);
|
||||
|
||||
// 若为 radio 类型,则取消其他行选中背景色
|
||||
if(opts.type === 'radio'){
|
||||
tr.siblings().removeClass(ELEM_CHECKED);
|
||||
currTr.siblings().removeClass(ELEM_CHECKED);
|
||||
}
|
||||
} else if(opts.type === 'radio') {
|
||||
delete item[options.checkName];
|
||||
|
@ -1727,15 +1761,19 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
var options = that.config;
|
||||
var height = options.height;
|
||||
var bodyHeight;
|
||||
var MIN_HEIGHT = 135;
|
||||
|
||||
if(that.fullHeightGap){
|
||||
height = _WIN.height() - that.fullHeightGap;
|
||||
if(height < 135) height = 135;
|
||||
if(height < MIN_HEIGHT) height = MIN_HEIGHT;
|
||||
// that.elem.css('height', height);
|
||||
} else if (that.parentDiv && that.parentHeightGap) {
|
||||
height = $(that.parentDiv).height() - that.parentHeightGap;
|
||||
if (height < 135) height = 135;
|
||||
if(height < MIN_HEIGHT) height = MIN_HEIGHT;
|
||||
// that.elem.css("height", height);
|
||||
} else if (that.customHeightFunc) {
|
||||
height = that.customHeightFunc();
|
||||
if(height < MIN_HEIGHT) height = MIN_HEIGHT;
|
||||
}
|
||||
|
||||
// 如果多级表头,则填补表头高度
|
||||
|
|
|
@ -93,7 +93,7 @@ layui.define(['table'], function (exports) {
|
|||
var updateCache = function (id, childrenKey, data) {
|
||||
var tableCache = table.cache[id];
|
||||
layui.each(data || tableCache, function (index, item) {
|
||||
var itemDataIndex = item[LAY_DATA_INDEX];
|
||||
var itemDataIndex = item[LAY_DATA_INDEX] || '';
|
||||
if (itemDataIndex.indexOf('-') !== -1) {
|
||||
tableCache[itemDataIndex] = item
|
||||
}
|
||||
|
|
|
@ -427,7 +427,7 @@ layui.define('jquery', function(exports){
|
|||
var callbacks = dataCache.callbacks;
|
||||
|
||||
// 根据 attr 记录事件集合
|
||||
events = $.extend(true, dataCache.events, events) || {};
|
||||
events = dataCache.events[attr] = $.extend(true, dataCache.events[attr], events);
|
||||
|
||||
// 清除事件委托,避免重复绑定
|
||||
elem.off(options.trigger, attrSelector, callbacks[attr]);
|
||||
|
|
Loading…
Reference in New Issue