mirror of https://github.com/layui/layui
commit
6cb2aa6cfa
|
@ -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
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -92,7 +92,7 @@
|
|||
|
||||
- `true` 自动滚动,鼠标移入会暂停、移出重新恢复
|
||||
- `false` 不自动滚动
|
||||
- `alway` 始终自动滚动,不受鼠标移入移出影响 <sup>2.7+</sup>
|
||||
- `always` 始终自动滚动,不受鼠标移入移出影响 <sup>2.7+</sup>
|
||||
|
||||
|
||||
</td>
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<td>alpha</td>
|
||||
<td>
|
||||
|
||||
是否开启透明度。当同时开启 `format: 'rga'` 时,`color` 值将采用 `rgba` 格式。
|
||||
是否开启透明度。当同时开启 `format: 'rgb'` 时,`color` 值将采用 `rgba` 格式。
|
||||
|
||||
</td>
|
||||
<td>boolean</td>
|
||||
|
@ -174,4 +174,4 @@ close: function(value){
|
|||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
|
|
|
@ -59,4 +59,4 @@ layui.use(function(){
|
|||
|
||||
## 兼容性
|
||||
|
||||
> colorpicker 组件支持 `Chrome,Edge,Firefox` 等所有高级浏览器,不支持 IE10 低版本浏览器。
|
||||
> colorpicker 组件支持 `Chrome,Edge,Firefox` 等所有高级浏览器,不支持 IE10 低版本浏览器。
|
||||
|
|
|
@ -249,11 +249,12 @@ shortcuts: [
|
|||
- 若为 `string` 类型,必须和 `format` 设置的格式对应;
|
||||
- 若为 `date` 对象类型,则可通过操作 `new Date()` 来对选项值进行相应的返回计算;
|
||||
- 若为 `array` 类型,则数组成员可填写开始日期和结束日期。
|
||||
- 若为 `function` 类型,返回值同上。<sup>2.8.16+</sup>
|
||||
|
||||
详细用法可参考: [#示例](#demo-shortcut)
|
||||
|
||||
</td>
|
||||
<td>string<br>date<br>array</td>
|
||||
<td>string<br>date<br>array<br>function</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -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 <p style="text-align: center;">到</p> 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;
|
||||
}()
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
|
|
@ -34,7 +34,7 @@ toc: true
|
|||
| [laydate.render(options)](#render) | laydate 组件渲染,核心方法。 |
|
||||
| [laydate.hint(id, opts)](#hint) <sup>2.8+</sup> | 在对应的 laydate 组件面板上弹出提示层。 |
|
||||
| [laydate.getInst(id)](#getInst) <sup>2.8+</sup> | 获取组件对应的渲染实例。 |
|
||||
| [laydate.unbind(id)](#close) <sup>2.8+</sup> | 对目标元素解除当前实例的绑定。 |
|
||||
| [laydate.unbind(id)](#unbind) <sup>2.8+</sup> | 对目标元素解除当前实例的绑定。 |
|
||||
| [laydate.close(id)](#close) <sup>2.7+</sup> | 关闭日期面板。 |
|
||||
| [laydate.getEndDate(month, year)](#getEndDate) | 获取某月的最后一天。 |
|
||||
|
||||
|
@ -160,7 +160,7 @@ laydate.render({
|
|||
// 其他属性 …
|
||||
});
|
||||
// 关闭对应的日期面板
|
||||
laydate.cllose('test');
|
||||
laydate.close('test');
|
||||
```
|
||||
|
||||
<h3 id="getEndDate" lay-pid="api" class="ws-anchor ws-bold">获取某月的最后一天</h3>
|
||||
|
|
|
@ -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(){
|
|||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
@ -248,9 +248,9 @@ layer.prompt({
|
|||
| 私有属性 | 描述 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| photos | 图片层的数据源,格式详见下述示例。 | object | - |
|
||||
| hideFooter <sup>2.8+</sup> | 是否隐藏底部栏 | boolean | `false` |
|
||||
| toolbar <sup>2.8.16+</sup> | 是否显示顶部工具栏 | boolean | `true` |
|
||||
| footer <sup>2.8.16+</sup> | 是否隐藏底部栏 | boolean | `true` |
|
||||
| tab | 图片层切换后的回调函数,返回的参数见下述示例 | function | - |
|
||||
| toolbar <sup>2.8.16+</sup> | 是否显示顶部工具栏 | boolean | `false` |
|
||||
|
||||
该方法用于弹出图片层,基于 `type: 1`(即 `page` 层)的自定义内容。
|
||||
|
||||
|
|
|
@ -198,5 +198,4 @@
|
|||
|
||||
<h3 id="more-examples" class="ws-anchor ws-bold">更多示例</h3>
|
||||
|
||||
> - [🎉 分享:在 table 组件中使用 select/dropdown/laydate 等组件实现多样化编辑](https://gitee.com/layui/layui/issues/I5JBUE)
|
||||
> - 不定期分享在 [Gitee Issues](https://gitee.com/layui/layui/issues)
|
||||
> - 🎉 不定期分享在 [Gitee Issues](https://gitee.com/layui/layui/issues)
|
||||
|
|
|
@ -80,4 +80,4 @@
|
|||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -75,7 +75,7 @@ layui.use(['table', 'dropdown'], function(){
|
|||
{field:'username', width:80, title: '用户'},
|
||||
{field:'email', title:'邮箱 <i class="layui-icon layui-icon-tips layui-font-14" lay-event="email-tips" title="该字段开启了编辑功能" style="margin-left: 5px;"></i>', fieldTitle: '邮箱', hide: 0, width:150, edit: 'text'},
|
||||
{field:'sex', width:80, title: '性别', sort: true},
|
||||
{field:'sign', title: '签名', edit: 'textarea', minWidth: 260, expandedWidth: 260, style: '-moz-box-align: start;', totalRow: '{{!人物:<span class="layui-badge-rim">唐代:{{= d.TOTAL_ROW.era.tang }} </span> <span class="layui-badge-rim">宋代:{{= d.TOTAL_ROW.era.song }}</span> <span class="layui-badge-rim">现代:{{= d.TOTAL_ROW.era.xian }}</span>!}}'},
|
||||
{field:'sign', title: '签名', edit: 'textarea', minWidth: 260, expandedWidth: 260, totalRow: '{{!人物:<span class="layui-badge-rim">唐代:{{= d.TOTAL_ROW.era.tang }} </span> <span class="layui-badge-rim">宋代:{{= d.TOTAL_ROW.era.song }}</span> <span class="layui-badge-rim">现代:{{= d.TOTAL_ROW.era.xian }}</span>!}}'},
|
||||
{field:'experience', width: 100, title: '积分', sort: true, totalRow: '{{!{{= d.TOTAL_NUMS }} 😊!}}'},
|
||||
{field:'checkin', title:'打卡', width: 100, sort: true, totalRow: '{{!{{= parseInt(d.TOTAL_NUMS) }} 次!}}'},
|
||||
{field:'ip', title:'IP', width: 120},
|
||||
|
@ -368,4 +368,4 @@ layui.use(['table', 'dropdown'], function(){
|
|||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -103,7 +103,7 @@ treeTable.render({
|
|||
| --- | --- | --- | --- |
|
||||
| isSimpleData | 是否简单数据模式 | boolean | `false` |
|
||||
| rootPid | 用于设置根节点的 `pid` 属性值 | string | `null` |
|
||||
| cascade | 用于设置复选的级联方式。支持以下可选值:<ul><li><code>all</code> : 所有节点联动</li><li><code>parent</code> : 仅对父节点联动</li><li><code>children</code> : 仅对子节点联动</li></ul> | string | `all` |
|
||||
| cascade | 用于设置复选的级联方式。支持以下可选值:<ul><li><code>all</code> : 所有节点联动</li><li><code>parent</code> : 仅对父节点联动</li><li><code>children</code> : 仅对子节点联动</li><li><code>none</code> <sup>2.8.16+</sup> : 不做任何联动</li></ul> | string | `all` |
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -175,4 +175,4 @@ treeTable.render({
|
|||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
|
|
|
@ -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
|
||||
});
|
||||
|
|
|
@ -11,6 +11,40 @@ toc: true
|
|||
|
||||
> 导读:📑 [Layui 2.8 《升级指南》](/notes/2.8/upgrade-guide.html) · 📑 [Layui 新版文档站上线初衷](/notes/2.8/news.html)
|
||||
|
||||
|
||||
<h2 id="2.8.16" class="ws-anchor">
|
||||
2.8.16
|
||||
<span class="layui-badge-rim">2023-08-30</span>
|
||||
</h2>
|
||||
|
||||
- #### layer
|
||||
- 新增 `photos` 的 `toolbar` 属性,用于开启图片旋转 放大 缩小 还原等头部工具栏 # 1339
|
||||
- 调整 `photos` 的 属性名: `hideFooter → footer`,用于是否开启底部栏
|
||||
- #### table
|
||||
- 优化 初始化时的样式渲染及多行模式的内容结构
|
||||
- 优化 `size` 为 `sm` / `lg` 时的展开状态
|
||||
- 优化 无数据时的导出和打印功能提示 # 1337
|
||||
- 优化 数据项为禁用状态的选中状态 # 1328
|
||||
- 优化 `table.renderData()` 方法执行了多余排序的问题 # 1358
|
||||
- #### treeTable
|
||||
- 修复 部分操作之后 `radio` 列选中状态丢失的问题 # 1358
|
||||
- 修复 `data` 模式下排序之后出现节点结构错乱的问题 # 1358/I7TXXL
|
||||
- 优化 `data.cascade` 属性,新增 `none` 可选值,即操作节点时不做任何联动 # 1358
|
||||
- 优化 数据项为禁用状态时的全选复选框的状态 # 1329
|
||||
- 优化 异步加载字节点为空时的展开状态 # 1326
|
||||
- #### laydate
|
||||
- 优化 `shortcuts.value` 快捷选项的赋值属性,支持函数类型 # 1324
|
||||
- #### rate
|
||||
- 优化 代码书写格式 # 1343
|
||||
- #### code
|
||||
- 修复 自定义工具栏出现的报错问题 # 1342
|
||||
- 优化 复制功能,以兼容非安全域下复制失败的问题 #1356
|
||||
- 优化 预览区未能显示滚动条的问题 # 1359
|
||||
|
||||
### 下载: [layui-v2.8.16.zip](https://gitee.com/layui/layui/attach_files/1511975/download)
|
||||
|
||||
---
|
||||
|
||||
<h2 id="2.8.15" class="ws-anchor">
|
||||
2.8.15
|
||||
<span class="layui-badge-rim">2023-08-16</span>
|
||||
|
@ -553,4 +587,4 @@ toc: true
|
|||
|
||||
<h2 id="2.7.x" lay-toc="{href: '/2.7/docs/base/changelog.html'}">2.7.x</h2>
|
||||
|
||||
[前往查看](/2.7/docs/base/changelog.html) `2.7.x` 及更早前版本更新日志
|
||||
[前往查看](/2.7/docs/base/changelog.html) `2.7.x` 及更早前版本更新日志
|
||||
|
|
|
@ -116,6 +116,8 @@ layui.use('code', function(){
|
|||
// 通用实例,根据元素属性定制化参数
|
||||
layui.code({
|
||||
//about: 'code' // 右上角默认显示 code
|
||||
tools: ['tips'],
|
||||
preview: true
|
||||
});
|
||||
|
||||
// custom more about
|
||||
|
|
|
@ -1,20 +1,15 @@
|
|||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>layer 弹层 - layui</title>
|
||||
|
||||
<link rel="stylesheet" href="../src/css/layui.css">
|
||||
|
||||
<style>
|
||||
body{padding: 100px;}
|
||||
|
||||
#photos li{float: left; margin: 0 1px 1px;}
|
||||
#photos img{max-height: 38px;}
|
||||
</style>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>layer 弹层 - layui</title>
|
||||
<link rel="stylesheet" href="../src/css/layui.css">
|
||||
<style>
|
||||
body{padding: 100px;}
|
||||
#photos li{float: left; margin: 0 1px 1px;}
|
||||
#photos img{max-height: 38px;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
@ -30,10 +25,10 @@ body{padding: 100px;}
|
|||
<button class="layui-btn" lay-on="test8">Tab</button>
|
||||
<button class="layui-btn" lay-on="test9">Photo</button>
|
||||
<button class="layui-btn" lay-on="testTime">自动关闭</button>
|
||||
<a href="https://layui.gitee.io/v2/demo/layer.html" target="_blank" class="layui-btn">更多例子</a>
|
||||
<a href="https://layui.dev/docs/2.8/layer/" target="_blank" class="layui-btn">更多例子</a>
|
||||
</div>
|
||||
|
||||
<div id="test11111" style="display: none; padding: 20px;">
|
||||
<div id="test11111" style="display: none; padding: 16px;">
|
||||
content 指向放置在页面的一段隐藏元素
|
||||
</div>
|
||||
|
||||
|
@ -48,8 +43,8 @@ body{padding: 100px;}
|
|||
|
||||
<script>
|
||||
var LAYUI_GLOBAL = {
|
||||
//path: '../src/'
|
||||
//,layerPath: '../release/layer/src/'
|
||||
// path: '../src/',
|
||||
// layerPath: '../release/layer/src/'
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -224,7 +219,9 @@ layui.use(['layer', 'util'], function(layer, util){
|
|||
|
||||
// 相册层
|
||||
layer.photos({
|
||||
photos: '#photos' //$('#photos')
|
||||
photos: '#photos', // $('#photos')
|
||||
// toolbar: false,
|
||||
// footer: false
|
||||
});
|
||||
|
||||
//动态追加
|
||||
|
|
|
@ -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'
|
||||
});
|
||||
|
||||
|
|
|
@ -45,6 +45,11 @@ layui.use(['treeTable'], function(){
|
|||
]],
|
||||
page: true
|
||||
});
|
||||
|
||||
// 单元格工具事件
|
||||
treeTable.on('row(test)', function (obj) {
|
||||
console.log(obj);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "layui",
|
||||
"version": "2.8.15",
|
||||
"version": "2.8.16",
|
||||
"description": "Classic modular Front-End UI library",
|
||||
"main": "dist/layui.js",
|
||||
"license": "MIT",
|
||||
|
|
|
@ -1136,7 +1136,9 @@ select.layui-table-edit{padding: 0 0 0 10px; border-color: #d2d2d2;}
|
|||
.layui-table-grid-down:hover{background-color: #fbfbfb;}
|
||||
|
||||
.layui-table-expanded{height: 95px;}
|
||||
.layui-table-expanded .layui-table-cell{height: auto; max-height: 95px; white-space: normal; text-overflow: clip;}
|
||||
.layui-table-expanded .layui-table-cell,
|
||||
.layui-table-view .layui-table[lay-size="sm"] .layui-table-expanded .layui-table-cell,
|
||||
.layui-table-view .layui-table[lay-size="lg"] .layui-table-expanded .layui-table-cell{height: auto; max-height: 94px; white-space: normal; text-overflow: clip;}
|
||||
.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;}
|
||||
|
|
|
@ -35,7 +35,7 @@ html #layuicss-skincodecss{display:none; position: absolute; width:1989px;}
|
|||
.layui-code-preview > .layui-code > .layui-code-title{display: none;}
|
||||
.layui-code-preview .layui-code-item{display: none;}
|
||||
.layui-code-preview .layui-code-view > .layui-code-ol > li{}
|
||||
.layui-code-item-preview{position: relative; padding: 16px;}
|
||||
.layui-code-item-preview{position: relative; padding: 16px; overflow: auto;}
|
||||
.layui-code-item-preview > iframe{position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none;}
|
||||
|
||||
/* 工具栏 */
|
||||
|
@ -57,4 +57,4 @@ html #layuicss-skincodecss{display:none; position: absolute; width:1989px;}
|
|||
.layui-code-full .layui-code-item{width: 100% !important; border-width: 0 !important; border-top-width: 1px !important;}
|
||||
.layui-code-full .layui-code-item,
|
||||
.layui-code-full .layui-code-ol,
|
||||
.layui-code-full .layui-code-ul{height: calc(100vh - 51px) !important; box-sizing: border-box;}
|
||||
.layui-code-full .layui-code-ul{height: calc(100vh - 51px) !important; box-sizing: border-box;}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
};
|
||||
|
||||
var Layui = function(){
|
||||
this.v = '2.8.15'; // Layui 版本号
|
||||
this.v = '2.8.16'; // Layui 版本号
|
||||
};
|
||||
|
||||
// 识别预先可能定义的指定全局对象
|
||||
|
|
|
@ -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 = $([
|
||||
'<button class="layui-icon '+ ELEM_ARROW +'" lay-type="sub">'+ (options.anim === 'updown' ? '' : '') +'</button>'
|
||||
,'<button class="layui-icon '+ ELEM_ARROW +'" lay-type="add">'+ (options.anim === 'updown' ? '' : '') +'</button>'
|
||||
'<button class="layui-icon '+ ELEM_ARROW +'" lay-type="sub">'+ (options.anim === 'updown' ? '' : '') +'</button>',
|
||||
'<button class="layui-icon '+ ELEM_ARROW +'" lay-type="add">'+ (options.anim === 'updown' ? '' : '') +'</button>'
|
||||
].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 = $(['<div class="'+ ELEM_IND +'"><ul>'
|
||||
,function(){
|
||||
// 模板
|
||||
var tplInd = that.elemInd = $(['<div class="'+ ELEM_IND +'"><ul>',
|
||||
function(){
|
||||
var li = [];
|
||||
layui.each(that.elemItem, function(index){
|
||||
li.push('<li'+ (options.index === index ? ' class="layui-this"' : '') +'></li>');
|
||||
});
|
||||
return li.join('');
|
||||
}()
|
||||
,'</ul></div>'].join(''));
|
||||
}(),
|
||||
'</ul></div>'].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);
|
||||
};
|
||||
|
|
|
@ -104,19 +104,27 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){
|
|||
className: 'file-b',
|
||||
title: ['复制代码'],
|
||||
event: function(el, type){
|
||||
typeof options.onCopy === 'function' ? options.onCopy(finalCode) : function(){
|
||||
var text = util.unescape(finalCode);
|
||||
try {
|
||||
navigator.clipboard.writeText(text).then(function(){
|
||||
layer.msg('已复制', {icon: 1});
|
||||
});
|
||||
} catch(e) {
|
||||
var textarea = document.createElement('textarea');
|
||||
textarea.value = text;
|
||||
textarea.style.position = 'absolute';
|
||||
textarea.style.opacity = '0';
|
||||
document.body.appendChild(textarea);
|
||||
textarea.select();
|
||||
try {
|
||||
navigator.clipboard.writeText(util.unescape(finalCode)).then(function(){
|
||||
layer.msg('已复制', {
|
||||
icon: 1
|
||||
});
|
||||
});
|
||||
} catch(e) {
|
||||
layer.msg('复制失败', {
|
||||
icon: 2
|
||||
});
|
||||
document.execCommand('copy');
|
||||
layer.msg('已复制', {icon: 1});
|
||||
} catch(err) {
|
||||
layer.msg('复制失败', {icon: 2});
|
||||
}
|
||||
}();
|
||||
textarea.remove();
|
||||
}
|
||||
typeof options.onCopy === 'function' && options.onCopy(text);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -209,12 +217,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(
|
||||
'<i class="layui-icon layui-icon-'+ className +'" data-type="'+ v +'" title="'+ title[0] +'"></i>'
|
||||
);
|
||||
|
@ -302,10 +310,9 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){
|
|||
if(options.skin === 'notepad') options.skin = 'dark';
|
||||
othis.removeClass('layui-code-dark layui-code-light');
|
||||
othis.addClass('layui-code-'+ options.skin);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 转义 HTML 标签
|
||||
if(options.encode) html = util.escape(html); // 编码
|
||||
|
@ -369,4 +376,4 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){
|
|||
// 若为源码版,则自动加载该组件依赖的 css 文件
|
||||
if(!layui['layui.all']){
|
||||
layui.addcss('modules/code.css?v=3', 'skincodecss');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,32 +111,54 @@
|
|||
return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight);
|
||||
};
|
||||
|
||||
// 获取 style rules
|
||||
lay.getStyleRules = function(style, callback) {
|
||||
if (!style) return;
|
||||
|
||||
var sheet = style.sheet || style.styleSheet || {};
|
||||
var rules = sheet.cssRules || sheet.rules;
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
layui.each(rules, function(i, item){
|
||||
if (callback(item)) return true;
|
||||
});
|
||||
}
|
||||
|
||||
return rules;
|
||||
};
|
||||
|
||||
// 创建 style 样式
|
||||
lay.style = function(options){
|
||||
options = options || {};
|
||||
|
||||
var style = lay.elem('style');
|
||||
var styleText = options.text || '';
|
||||
var target = options.target || lay('body')[0];
|
||||
var target = options.target;
|
||||
|
||||
if(!styleText) return;
|
||||
if (!styleText) return;
|
||||
|
||||
// 添加样式
|
||||
if('styleSheet' in style){
|
||||
if ('styleSheet' in style) {
|
||||
style.setAttribute('type', 'text/css');
|
||||
style.styleSheet.cssText = styleText;
|
||||
} else {
|
||||
style.innerHTML = styleText;
|
||||
}
|
||||
|
||||
lay.style.index = lay.style.index || 0;
|
||||
lay.style.index++;
|
||||
|
||||
var id = style.id = 'LAY-STYLE-'+ (options.id || 'DF-'+ lay.style.index)
|
||||
var styleElem = lay(target).find('#'+ id);
|
||||
|
||||
styleElem[0] && styleElem.remove();
|
||||
lay(target).append(style);
|
||||
// ID
|
||||
style.id = 'LAY-STYLE-'+ (options.id || function(index) {
|
||||
lay.style.index++;
|
||||
return 'DF-'+ index;
|
||||
}(lay.style.index || 0));
|
||||
|
||||
// 是否向目标容器中追加 style 元素
|
||||
if (target) {
|
||||
var styleElem = lay(target).find('#'+ style.id);
|
||||
styleElem[0] && styleElem.remove();
|
||||
lay(target).append(style);
|
||||
}
|
||||
|
||||
return style;
|
||||
};
|
||||
|
||||
// 元素定位
|
||||
|
@ -467,4 +489,4 @@
|
|||
});
|
||||
}
|
||||
|
||||
}(window, window.document); // gulp build: lay-footer
|
||||
}(window, window.document); // gulp build: lay-footer
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -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: '<div class="layui-layer-phimg">'
|
||||
+ '<img src="'+ data[start].src +'" alt="'+ alt +'" layer-pid="'+ data[start].pid +'">'
|
||||
content: '<div class="layer-layer-photos-main">'
|
||||
+ '<img src="'+ data[start].src +'" alt="'+ alt +'" layer-pid="'+ (data[start].pid || '') +'">'
|
||||
+ function(){
|
||||
var arr = ['<div class="layui-layer-imgsee">'];
|
||||
var arr = ['<div class="layui-layer-photos-pointer">'];
|
||||
|
||||
// 左右箭头翻页
|
||||
if(data.length > 1){
|
||||
arr.push(['<div class="layui-layer-imguide">'
|
||||
,'<span class="layui-icon layui-icon-left layui-layer-iconext layui-layer-imgprev"></span>'
|
||||
,'<span class="layui-icon layui-icon-right layui-layer-iconext layui-layer-imgnext"></span>'
|
||||
,'</div>'].join(''));
|
||||
if (data.length > 1) {
|
||||
arr.push(['<div class="layer-layer-photos-page">',
|
||||
'<span class="layui-icon layui-icon-left layui-layer-photos-prev"></span>',
|
||||
'<span class="layui-icon layui-icon-right layui-layer-photos-next"></span>',
|
||||
'</div>'].join(''));
|
||||
}
|
||||
|
||||
// 头部工具栏
|
||||
if (options.toolbar) {
|
||||
arr.push([
|
||||
'<div class="layui-layer-photos-toolbar layui-layer-photos-header">',
|
||||
'<span toolbar-event="rotate" data-option="90" title="旋转"><i class="layui-icon layui-icon-refresh"></i></span>',
|
||||
'<span toolbar-event="scalex" title="变换"><i class="layui-icon layui-icon-slider"></i></span>',
|
||||
'<span toolbar-event="zoom" data-option="0.1" title="放大"><i class="layui-icon layui-icon-add-circle"></i></span>',
|
||||
'<span toolbar-event="zoom" data-option="-0.1" title="缩小"><i class="layui-icon layui-icon-reduce-circle"></i></span>',
|
||||
'<span toolbar-event="reset" title="还原"><i class="layui-icon layui-icon-refresh-1"></i></span>',
|
||||
'<span toolbar-event="close" title="关闭"><i class="layui-icon layui-icon-close"></i></span>',
|
||||
'</div>'
|
||||
].join(''));
|
||||
}
|
||||
|
||||
// 底部栏
|
||||
if(!options.hideFooter){
|
||||
arr.push(['<div class="layui-layer-imgbar">'
|
||||
,'<div class="layui-layer-imgtit">'
|
||||
,'<h3>'+ alt +'</h3>'
|
||||
,'<em>'+ dict.imgIndex +' / '+ data.length +'</em>'
|
||||
,'<a href="'+ data[start].src +'" target="_blank">查看原图</a>'
|
||||
,'</div>'
|
||||
,'</div>'].join(''));
|
||||
}
|
||||
//工具栏
|
||||
if (options.toolbar){
|
||||
arr.push([
|
||||
'<div class="layui-layer-images-toolbar">',
|
||||
'<div class="layer-images-tool-item">',
|
||||
'<span toolbar-event="rotate" data-option="-15" title="向左旋转15°" style="transform: scaleX(-1);"><i class="layui-icon layui-icon-refresh rotate"></i></span>',
|
||||
'<span toolbar-event="rotate" data-option="15" title="向右旋转15°"><i class="layui-icon layui-icon-refresh"></i></span>',
|
||||
'<span toolbar-event="scalex" title="翻转"><i class="layui-icon layui-icon-slider"></i></span>',
|
||||
'<span toolbar-event="zoom" data-option="0.1" title="放大图片"><i class="layui-icon layui-icon-add-circle"></i></span>',
|
||||
'<span toolbar-event="zoom" data-option="-0.1" title="缩小图片"><i class="layui-icon layui-icon-reduce-circle"></i></span>',
|
||||
'<span toolbar-event="reset" title="重置图片"><i class="layui-icon layui-icon-refresh-1"></i></span>',
|
||||
'<span toolbar-event="close" title="关闭"><i class="layui-icon layui-icon-close"></i></span>',
|
||||
'</div>',
|
||||
'</div>'
|
||||
].join(''));
|
||||
if (options.footer) {
|
||||
arr.push(['<div class="layui-layer-photos-toolbar layui-layer-photos-footer">',
|
||||
'<h3>'+ alt +'</h3>',
|
||||
'<em>'+ dict.imgIndex +' / '+ data.length +'</em>',
|
||||
'<a href="'+ data[start].src +'" target="_blank">查看原图</a>',
|
||||
'</div>'].join(''));
|
||||
}
|
||||
|
||||
arr.push('</div>');
|
||||
return arr.join('');
|
||||
}()
|
||||
+'</div>',
|
||||
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(){
|
||||
|
|
|
@ -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 += '</ul>' + (options.text ? ('<span class="layui-inline">'+ options.value + '星') : '') + '</span>';
|
||||
|
||||
//开始插入替代元素
|
||||
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);
|
||||
})
|
||||
})
|
||||
|
|
|
@ -258,29 +258,6 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
,'<div class="layui-table-column layui-table-page layui-hide">'
|
||||
,'<div class="layui-inline layui-table-pageview" id="layui-table-page{{=d.index}}"></div>'
|
||||
,'</div>'
|
||||
|
||||
,'<style>'
|
||||
,'{{# layui.each(d.data.cols, function(i1, item1){'
|
||||
,'layui.each(item1, function(i2, item2){ }}'
|
||||
,'.laytable-cell-{{=d.index}}-{{=i1}}-{{=i2}}{ '
|
||||
,'{{# if(item2.width){ }}'
|
||||
,'width: {{=item2.width}}px;'
|
||||
,'{{# } }}'
|
||||
,' }'
|
||||
,'{{# });'
|
||||
,'}); }}'
|
||||
,'{{# if(d.data.lineStyle){'
|
||||
,'var cellClassName = ".layui-table-view-"+ d.index +" .layui-table-body .layui-table .layui-table-cell";'
|
||||
,'}}'
|
||||
,'{{= cellClassName }}{'
|
||||
,'display: -webkit-box; -webkit-box-align: center; -moz-box-align: start; white-space: normal; {{- d.data.lineStyle }} '
|
||||
,'}'
|
||||
,'{{= cellClassName }}:hover{overflow: auto;}'
|
||||
,'{{# } }}'
|
||||
,'{{# if(d.data.css){ }}'
|
||||
,'{{- d.data.css }}'
|
||||
,'{{# } }}'
|
||||
,'</style>'
|
||||
].join('');
|
||||
|
||||
var _WIN = $(window);
|
||||
|
@ -385,13 +362,14 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
options.height = $(that.parentDiv).height() - that.parentHeightGap;
|
||||
}
|
||||
|
||||
//开始插入替代元素
|
||||
// 开始插入替代元素
|
||||
var othis = options.elem;
|
||||
var hasRender = othis.next('.' + ELEM_VIEW);
|
||||
|
||||
//主容器
|
||||
// 主容器
|
||||
var reElem = that.elem = $('<div></div>');
|
||||
|
||||
// 添加 className
|
||||
reElem.addClass(function(){
|
||||
var arr = [
|
||||
ELEM_VIEW,
|
||||
|
@ -418,11 +396,14 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
index: that.index //索引
|
||||
}));
|
||||
|
||||
//生成替代元素
|
||||
hasRender[0] && hasRender.remove(); //如果已经渲染,则Rerender
|
||||
// 初始化样式
|
||||
that.renderStyle();
|
||||
|
||||
// 生成替代元素
|
||||
hasRender[0] && hasRender.remove(); // 如果已经渲染,则 Rerender
|
||||
othis.after(reElem);
|
||||
|
||||
//各级容器
|
||||
// 各级容器
|
||||
that.layTool = reElem.find(ELEM_TOOL);
|
||||
that.layBox = reElem.find(ELEM_BOX);
|
||||
that.layHeader = reElem.find(ELEM_HEADER);
|
||||
|
@ -443,11 +424,11 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
// 让表格平铺
|
||||
that.fullSize();
|
||||
|
||||
that.pullData(that.page); //请求数据
|
||||
that.events(); //事件
|
||||
that.pullData(that.page); // 请求数据
|
||||
that.events(); // 事件
|
||||
};
|
||||
|
||||
//根据列类型,定制化参数
|
||||
// 根据列类型,定制化参数
|
||||
Class.prototype.initOpts = function(item){
|
||||
var that = this
|
||||
var options = that.config;
|
||||
|
@ -458,7 +439,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
numbers: 60
|
||||
};
|
||||
|
||||
//让 type 参数兼容旧版本
|
||||
// 让 type 参数兼容旧版本
|
||||
if(item.checkbox) item.type = "checkbox";
|
||||
if(item.space) item.type = "space";
|
||||
if(!item.type) item.type = "normal";
|
||||
|
@ -553,6 +534,60 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
|
||||
};
|
||||
|
||||
// 初始化样式
|
||||
Class.prototype.renderStyle = function() {
|
||||
var that = this;
|
||||
var options = that.config;
|
||||
var index = that.index;
|
||||
var text = [];
|
||||
|
||||
// 单元格宽度
|
||||
layui.each(options.cols, function(i1, item1) {
|
||||
layui.each(item1, function(i2, item2) {
|
||||
var key = [index, i1, i2].join('-');
|
||||
var val = item2.width ? ['width: ', item2.width, 'px'].join('') : '';
|
||||
text.push('.laytable-cell-'+ key +'{'+ val +'}');
|
||||
});
|
||||
});
|
||||
|
||||
// 自定义行样式
|
||||
(function (lineStyle) {
|
||||
if (!lineStyle) return;
|
||||
var trClassName = '.layui-table-view-'+ index +' .layui-table-body .layui-table tr';
|
||||
var rules = lineStyle.split(';');
|
||||
var cellMaxHeight = 'none';
|
||||
|
||||
// 计算单元格最大高度
|
||||
layui.each(rules, function(i, rule) {
|
||||
rule = rule.split(':');
|
||||
if (rule[0] === 'height') {
|
||||
var val = parseFloat(rule[1]);
|
||||
if (!isNaN(val)) cellMaxHeight = (val - 1) + 'px';
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// 多行相关样式
|
||||
layui.each([
|
||||
'{'+ lineStyle +'}',
|
||||
'.layui-table-cell{height: auto; max-height: '+ cellMaxHeight +'; white-space: normal; text-overflow: clip;}',
|
||||
'> td:hover > .layui-table-cell{overflow: auto;}'
|
||||
], function(i, val) {
|
||||
text.push(trClassName + ' ' + val);
|
||||
});
|
||||
})(options.lineStyle);
|
||||
|
||||
// 自定义 css 属性
|
||||
if (options.css) text.push(options.css);
|
||||
|
||||
// 生成 style
|
||||
lay.style({
|
||||
target: that.elem[0],
|
||||
text: text.join(''),
|
||||
id: 'DF-'+ index
|
||||
});
|
||||
};
|
||||
|
||||
// 初始工具栏
|
||||
Class.prototype.renderToolbar = function(){
|
||||
var that = this
|
||||
|
@ -784,7 +819,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
|
||||
// 给未分配宽的列平均分配宽
|
||||
if(item3.width === 0){
|
||||
that.getCssRule(item3.key, function(item){
|
||||
that.cssRules(item3.key, function(item){
|
||||
item.style.width = Math.floor(function(){
|
||||
if(autoWidth < minWidth) return minWidth;
|
||||
if(autoWidth > maxWidth) return maxWidth;
|
||||
|
@ -795,7 +830,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
|
||||
// 给设定百分比的列分配列宽
|
||||
else if(/\d+%$/.test(item3.width)){
|
||||
that.getCssRule(item3.key, function(item){
|
||||
that.cssRules(item3.key, function(item){
|
||||
var width = Math.floor((parseFloat(item3.width) / 100) * cntrWidth);
|
||||
width < minWidth && (width = minWidth);
|
||||
width > maxWidth && (width = maxWidth);
|
||||
|
@ -805,7 +840,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
|
||||
// 给拥有普通 width 值的列分配最新列宽
|
||||
else {
|
||||
that.getCssRule(item3.key, function(item){
|
||||
that.cssRules(item3.key, function(item){
|
||||
item.style.width = item3.width + 'px';
|
||||
});
|
||||
}
|
||||
|
@ -828,7 +863,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
var th = getEndTh();
|
||||
var key = th.data('key');
|
||||
|
||||
that.getCssRule(key, function(item){
|
||||
that.cssRules(key, function(item){
|
||||
var width = item.style.width || th.outerWidth();
|
||||
item.style.width = (parseFloat(width) + patchNums) + 'px';
|
||||
|
||||
|
@ -966,7 +1001,8 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
curr: curr,
|
||||
count: res[response.countName],
|
||||
type: opts.type,
|
||||
}), sort(), done(res, 'renderData');
|
||||
sort: true
|
||||
}), done(res, 'renderData');
|
||||
} else if(options.url){ // Ajax请求
|
||||
var params = {};
|
||||
// 当 page 开启,默认自动传递 page、limit 参数
|
||||
|
@ -1662,20 +1698,19 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
}
|
||||
};
|
||||
|
||||
// 获取 cssRule
|
||||
Class.prototype.getCssRule = function(key, callback){
|
||||
// 获取对应单元格的 cssRules
|
||||
Class.prototype.cssRules = function(key, callback){
|
||||
var that = this;
|
||||
var style = that.elem.children('style')[0];
|
||||
var sheet = style.sheet || style.styleSheet || {};
|
||||
var rules = sheet.cssRules || sheet.rules;
|
||||
layui.each(rules, function(i, item){
|
||||
if(item.selectorText === ('.laytable-cell-'+ key)){
|
||||
|
||||
lay.getStyleRules(style, function(item){
|
||||
if (item.selectorText === ('.laytable-cell-'+ key)) {
|
||||
return callback(item), true;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
//让表格铺满
|
||||
// 让表格铺满
|
||||
Class.prototype.fullSize = function(){
|
||||
var that = this;
|
||||
var options = that.config;
|
||||
|
@ -1818,6 +1853,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
that.layTool.on('click', '*[lay-event]', function(e){
|
||||
var othis = $(this);
|
||||
var events = othis.attr('lay-event');
|
||||
var data = table.cache[options.id];
|
||||
var openPanel = function(sets){
|
||||
var list = $(sets.list);
|
||||
var panel = $('<ul class="' + ELEM_TOOL_PANEL + '"></ul>');
|
||||
|
@ -1845,7 +1881,6 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
|
||||
switch(events){
|
||||
case 'LAYTABLE_COLS': // 筛选列
|
||||
if (!table.cache[options.id].length) return layer.msg('暂时没有数据,不能使用筛选列功能!', {icon: 5});
|
||||
openPanel({
|
||||
list: function(){
|
||||
var lis = [];
|
||||
|
@ -1891,11 +1926,11 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
});
|
||||
break;
|
||||
case 'LAYTABLE_EXPORT': // 导出
|
||||
if (!table.cache[options.id].length) return layer.msg('暂时没有数据,不能使用导出功能!', {icon: 5});
|
||||
if (!data.length) return layer.tips('当前表格无数据', this, {tips: 3});
|
||||
if(device.ie){
|
||||
layer.tips('导出功能不支持 IE,请用 Chrome 等高级浏览器导出', this, {
|
||||
tips: 3
|
||||
})
|
||||
});
|
||||
} else {
|
||||
openPanel({
|
||||
list: function(){
|
||||
|
@ -1914,7 +1949,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
}
|
||||
break;
|
||||
case 'LAYTABLE_PRINT': // 打印
|
||||
if (!table.cache[options.id].length) return layer.msg('暂时没有数据,不能使用打印功能!', {icon: 5});
|
||||
if (!data.length) return layer.tips('当前表格无数据', this, {tips: 3});
|
||||
var printWin = window.open('about:blank', '_blank');
|
||||
var style = ['<style>',
|
||||
'body{font-size: 12px; color: #5F5F5F;}',
|
||||
|
@ -2002,7 +2037,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
e.preventDefault();
|
||||
dict.offset = [e.clientX, e.clientY]; //记录初始坐标
|
||||
|
||||
that.getCssRule(key, function(item){
|
||||
that.cssRules(key, function(item){
|
||||
var width = item.style.width || othis.outerWidth();
|
||||
dict.rule = item;
|
||||
dict.ruleWidth = parseFloat(width);
|
||||
|
@ -2061,7 +2096,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
delete thisTable.eventMoveElem;
|
||||
|
||||
// 列拖拽宽度后的事件
|
||||
thatTable.getCssRule(key, function(item){
|
||||
thatTable.cssRules(key, function(item){
|
||||
col.width = parseFloat(item.style.width);
|
||||
layui.event.call(th[0], MOD_NAME, 'colResized('+ filter +')', {
|
||||
col: col,
|
||||
|
@ -2433,7 +2468,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
that.elem.find('.'+ ELEM_CELL_C).trigger('click');
|
||||
|
||||
// 设置当前单元格展开宽度
|
||||
that.getCssRule(key, function(item){
|
||||
that.cssRules(key, function(item){
|
||||
var width = item.style.width;
|
||||
var expandedWidth = col.expandedWidth || (that.elem.width() / 3);
|
||||
|
||||
|
@ -2443,7 +2478,9 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
elemCellClose.data('cell-width', width);
|
||||
item.style.width = expandedWidth + 'px';
|
||||
|
||||
that.scrollPatch(); // 滚动条补丁
|
||||
setTimeout(function(){
|
||||
that.scrollPatch(); // 滚动条补丁
|
||||
});
|
||||
});
|
||||
|
||||
// 设置当前单元格展开样式
|
||||
|
@ -2458,7 +2495,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||
elemCellClose.on('click', function(){
|
||||
var $this = $(this);
|
||||
that.setRowActive(index, ELEM_EXPAND, true); // 移除单元格展开样式
|
||||
that.getCssRule(key, function(item){
|
||||
that.cssRules(key, function(item){
|
||||
item.style.width = $this.data('cell-width'); // 恢复单元格展开前的宽度
|
||||
that.resize(); // 滚动条补丁
|
||||
});
|
||||
|
|
|
@ -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) {
|
||||
|
@ -189,6 +190,9 @@ layui.define(['table'], function (exports) {
|
|||
indeterminate: !checkStatus.isAll && checkStatus.data.length
|
||||
})
|
||||
}
|
||||
if (!isRenderData && thatOptionsTemp.autoSort && thatOptionsTemp.initSort && thatOptionsTemp.initSort.type) {
|
||||
treeTable.sort(id);
|
||||
}
|
||||
|
||||
that.renderTreeTable(tableView);
|
||||
|
||||
|
@ -204,7 +208,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'; // 超出范围的都重置为全联动
|
||||
}
|
||||
|
||||
|
@ -602,10 +606,6 @@ layui.define(['table'], function (exports) {
|
|||
}, true);
|
||||
}
|
||||
});
|
||||
treeTableThat.updateStatus(childNodes, function (d) {
|
||||
d['LAY_HIDE'] = false;
|
||||
});
|
||||
options.hasNumberCol && formatNumber(tableId);
|
||||
} else {
|
||||
var asyncSetting = treeOptions.async || {};
|
||||
var asyncUrl = asyncSetting.url || options.url;
|
||||
|
@ -763,11 +763,6 @@ layui.define(['table'], function (exports) {
|
|||
tableViewElem.find(childNodesFlat.map(function (value, index, array) {
|
||||
return 'tr[lay-data-index="' + value[LAY_DATA_INDEX] + '"]'
|
||||
}).join(',')).addClass(HIDE);
|
||||
|
||||
treeTableThat.updateStatus(childNodes, function (d) {
|
||||
d['LAY_HIDE'] = true;
|
||||
});
|
||||
options.hasNumberCol && formatNumber(tableId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -908,7 +903,7 @@ layui.define(['table'], function (exports) {
|
|||
d[idKey] !== undefined && (that.status.expand[d[idKey]] = true);
|
||||
}
|
||||
});
|
||||
if (options.initSort && options.initSort.type && (!options.url || options.autoSort)) {
|
||||
if (options.initSort && options.initSort.type && options.autoSort) {
|
||||
return treeTable.sort(id);
|
||||
}
|
||||
var trAll = table.getTrHtml(id, tableDataFlat);
|
||||
|
@ -1037,14 +1032,13 @@ layui.define(['table'], function (exports) {
|
|||
});
|
||||
} else {
|
||||
debounceFn('renderTreeTable-' + tableId, function () {
|
||||
options.hasNumberCol && formatNumber(tableId);
|
||||
options.hasNumberCol && formatNumber(that);
|
||||
form.render($('.layui-table-tree[lay-id="' + tableId + '"]'));
|
||||
}, 0)();
|
||||
}
|
||||
}
|
||||
|
||||
var formatNumber = function (id) {
|
||||
var that = getThisTable(id);
|
||||
var formatNumber = function (that) {
|
||||
var options = that.getOptions();
|
||||
var tableViewElem = options.elem.next();
|
||||
|
||||
|
@ -1125,7 +1119,8 @@ layui.define(['table'], function (exports) {
|
|||
Class.prototype.getTableData = function () {
|
||||
var that = this;
|
||||
var options = that.getOptions();
|
||||
return options.url ? table.cache[options.id] : options.data;
|
||||
// return options.url ? table.cache[options.id] : options.data;
|
||||
return table.cache[options.id];
|
||||
}
|
||||
|
||||
treeTable.updateStatus = function (id, statusObj, data) {
|
||||
|
@ -1146,7 +1141,7 @@ layui.define(['table'], function (exports) {
|
|||
if(!that) return;
|
||||
|
||||
var options = that.getOptions();
|
||||
if (!options.url || options.autoSort) {
|
||||
if (options.autoSort) {
|
||||
that.initData();
|
||||
treeTable.renderData(id);
|
||||
}
|
||||
|
@ -1252,7 +1247,7 @@ layui.define(['table'], function (exports) {
|
|||
layui.each(table.cache[id], function (i4, item4) {
|
||||
tableView.find('tr[data-level="0"][lay-data-index="' + item4[LAY_DATA_INDEX] + '"]').attr('data-index', i4);
|
||||
})
|
||||
options.hasNumberCol && formatNumber(id);
|
||||
options.hasNumberCol && formatNumber(that);
|
||||
|
||||
// 重新适配尺寸
|
||||
treeTable.resize(id);
|
||||
|
@ -1548,6 +1543,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();
|
||||
|
@ -1730,7 +1728,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(','));
|
||||
|
|
|
@ -236,7 +236,7 @@ layui.define(['lay','layer'], function(exports){
|
|||
data: formData,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
dataType: 'json',
|
||||
// dataType: 'json',
|
||||
headers: options.headers || {},
|
||||
success: function(res){ // 成功回调
|
||||
options.unified ? (successful += that.fileLength) : successful++;
|
||||
|
|
Loading…
Reference in New Issue