├── .gitignore ├── _config.yml ├── ads.txt ├── favicon.ico ├── robots.txt ├── images ├── eleTree-1.png ├── eleTree-2.png ├── eleTree-3.png ├── eleTree-4.png ├── eleTree-5.png ├── eleTree-6.png └── eleTree-10.png ├── layui ├── font │ ├── iconfont.eot │ ├── iconfont.ttf │ ├── iconfont.woff │ └── iconfont.woff2 ├── images │ ├── face │ │ ├── 0.gif │ │ ├── 1.gif │ │ ├── 10.gif │ │ ├── 11.gif │ │ ├── 12.gif │ │ ├── 13.gif │ │ ├── 14.gif │ │ ├── 15.gif │ │ ├── 16.gif │ │ ├── 17.gif │ │ ├── 18.gif │ │ ├── 19.gif │ │ ├── 2.gif │ │ ├── 20.gif │ │ ├── 21.gif │ │ ├── 22.gif │ │ ├── 23.gif │ │ ├── 24.gif │ │ ├── 25.gif │ │ ├── 26.gif │ │ ├── 27.gif │ │ ├── 28.gif │ │ ├── 29.gif │ │ ├── 3.gif │ │ ├── 30.gif │ │ ├── 31.gif │ │ ├── 32.gif │ │ ├── 33.gif │ │ ├── 34.gif │ │ ├── 35.gif │ │ ├── 36.gif │ │ ├── 37.gif │ │ ├── 38.gif │ │ ├── 39.gif │ │ ├── 4.gif │ │ ├── 40.gif │ │ ├── 41.gif │ │ ├── 42.gif │ │ ├── 43.gif │ │ ├── 44.gif │ │ ├── 45.gif │ │ ├── 46.gif │ │ ├── 47.gif │ │ ├── 48.gif │ │ ├── 49.gif │ │ ├── 5.gif │ │ ├── 50.gif │ │ ├── 51.gif │ │ ├── 52.gif │ │ ├── 53.gif │ │ ├── 54.gif │ │ ├── 55.gif │ │ ├── 56.gif │ │ ├── 57.gif │ │ ├── 58.gif │ │ ├── 59.gif │ │ ├── 6.gif │ │ ├── 60.gif │ │ ├── 61.gif │ │ ├── 62.gif │ │ ├── 63.gif │ │ ├── 64.gif │ │ ├── 65.gif │ │ ├── 66.gif │ │ ├── 67.gif │ │ ├── 68.gif │ │ ├── 69.gif │ │ ├── 7.gif │ │ ├── 70.gif │ │ ├── 71.gif │ │ ├── 8.gif │ │ └── 9.gif │ └── forkme_right_red_aa0000.png ├── css │ ├── modules │ │ ├── layer │ │ │ └── default │ │ │ │ ├── icon.png │ │ │ │ ├── icon-ext.png │ │ │ │ ├── loading-0.gif │ │ │ │ ├── loading-1.gif │ │ │ │ └── loading-2.gif │ │ ├── laydate │ │ │ └── default │ │ │ │ ├── font.css │ │ │ │ └── laydate.css │ │ └── code.css │ └── layui.mobile.css ├── lay │ ├── modules │ │ ├── mobile │ │ │ ├── layim-mobile-open.js │ │ │ ├── upload-mobile.js │ │ │ └── layer-mobile.js │ │ ├── code.js │ │ ├── laytpl.js │ │ ├── flow.js │ │ ├── rate.js │ │ ├── util.js │ │ ├── carousel.js │ │ ├── laypage.js │ │ ├── transfer.js │ │ ├── slider.js │ │ ├── upload.js │ │ ├── element.js │ │ ├── form.js │ │ ├── tree.js │ │ ├── colorpicker.js │ │ └── layedit.js │ └── mymodules │ │ ├── dropdown.js │ │ └── scrollBar.js └── layui.js ├── eleTree ├── README.md ├── tree.json └── eleTree.css ├── README.md ├── scrollBar ├── scrollBar.css ├── README.md └── index.html ├── LICENSE ├── cascader ├── cascader.css ├── README.md └── index.html ├── index.html ├── dropdown ├── README.md ├── dropdown.css └── index.html ├── eFlowChart ├── README.md └── index.html └── step ├── index.html ├── README.md └── step.css /.gitignore: -------------------------------------------------------------------------------- 1 | eleTree/1.html -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /ads.txt: -------------------------------------------------------------------------------- 1 | google.com, pub-2229355551485035, DIRECT, f08c47fec0942fa0 -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/favicon.ico -------------------------------------------------------------------------------- /robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Allow: / 3 | Disallow: /eleTree/1.html 4 | Disallow: .gitignore -------------------------------------------------------------------------------- /images/eleTree-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/images/eleTree-1.png -------------------------------------------------------------------------------- /images/eleTree-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/images/eleTree-2.png -------------------------------------------------------------------------------- /images/eleTree-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/images/eleTree-3.png -------------------------------------------------------------------------------- /images/eleTree-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/images/eleTree-4.png -------------------------------------------------------------------------------- /images/eleTree-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/images/eleTree-5.png -------------------------------------------------------------------------------- /images/eleTree-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/images/eleTree-6.png -------------------------------------------------------------------------------- /images/eleTree-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/images/eleTree-10.png -------------------------------------------------------------------------------- /layui/font/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/font/iconfont.eot -------------------------------------------------------------------------------- /layui/font/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/font/iconfont.ttf -------------------------------------------------------------------------------- /layui/font/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/font/iconfont.woff -------------------------------------------------------------------------------- /layui/font/iconfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/font/iconfont.woff2 -------------------------------------------------------------------------------- /layui/images/face/0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/0.gif -------------------------------------------------------------------------------- /layui/images/face/1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/1.gif -------------------------------------------------------------------------------- /layui/images/face/10.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/10.gif -------------------------------------------------------------------------------- /layui/images/face/11.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/11.gif -------------------------------------------------------------------------------- /layui/images/face/12.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/12.gif -------------------------------------------------------------------------------- /layui/images/face/13.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/13.gif -------------------------------------------------------------------------------- /layui/images/face/14.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/14.gif -------------------------------------------------------------------------------- /layui/images/face/15.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/15.gif -------------------------------------------------------------------------------- /layui/images/face/16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/16.gif -------------------------------------------------------------------------------- /layui/images/face/17.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/17.gif -------------------------------------------------------------------------------- /layui/images/face/18.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/18.gif -------------------------------------------------------------------------------- /layui/images/face/19.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/19.gif -------------------------------------------------------------------------------- /layui/images/face/2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/2.gif -------------------------------------------------------------------------------- /layui/images/face/20.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/20.gif -------------------------------------------------------------------------------- /layui/images/face/21.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/21.gif -------------------------------------------------------------------------------- /layui/images/face/22.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/22.gif -------------------------------------------------------------------------------- /layui/images/face/23.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/23.gif -------------------------------------------------------------------------------- /layui/images/face/24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/24.gif -------------------------------------------------------------------------------- /layui/images/face/25.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/25.gif -------------------------------------------------------------------------------- /layui/images/face/26.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/26.gif -------------------------------------------------------------------------------- /layui/images/face/27.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/27.gif -------------------------------------------------------------------------------- /layui/images/face/28.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/28.gif -------------------------------------------------------------------------------- /layui/images/face/29.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/29.gif -------------------------------------------------------------------------------- /layui/images/face/3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/3.gif -------------------------------------------------------------------------------- /layui/images/face/30.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/30.gif -------------------------------------------------------------------------------- /layui/images/face/31.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/31.gif -------------------------------------------------------------------------------- /layui/images/face/32.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/32.gif -------------------------------------------------------------------------------- /layui/images/face/33.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/33.gif -------------------------------------------------------------------------------- /layui/images/face/34.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/34.gif -------------------------------------------------------------------------------- /layui/images/face/35.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/35.gif -------------------------------------------------------------------------------- /layui/images/face/36.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/36.gif -------------------------------------------------------------------------------- /layui/images/face/37.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/37.gif -------------------------------------------------------------------------------- /layui/images/face/38.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/38.gif -------------------------------------------------------------------------------- /layui/images/face/39.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/39.gif -------------------------------------------------------------------------------- /layui/images/face/4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/4.gif -------------------------------------------------------------------------------- /layui/images/face/40.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/40.gif -------------------------------------------------------------------------------- /layui/images/face/41.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/41.gif -------------------------------------------------------------------------------- /layui/images/face/42.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/42.gif -------------------------------------------------------------------------------- /layui/images/face/43.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/43.gif -------------------------------------------------------------------------------- /layui/images/face/44.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/44.gif -------------------------------------------------------------------------------- /layui/images/face/45.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/45.gif -------------------------------------------------------------------------------- /layui/images/face/46.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/46.gif -------------------------------------------------------------------------------- /layui/images/face/47.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/47.gif -------------------------------------------------------------------------------- /layui/images/face/48.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/48.gif -------------------------------------------------------------------------------- /layui/images/face/49.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/49.gif -------------------------------------------------------------------------------- /layui/images/face/5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/5.gif -------------------------------------------------------------------------------- /layui/images/face/50.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/50.gif -------------------------------------------------------------------------------- /layui/images/face/51.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/51.gif -------------------------------------------------------------------------------- /layui/images/face/52.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/52.gif -------------------------------------------------------------------------------- /layui/images/face/53.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/53.gif -------------------------------------------------------------------------------- /layui/images/face/54.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/54.gif -------------------------------------------------------------------------------- /layui/images/face/55.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/55.gif -------------------------------------------------------------------------------- /layui/images/face/56.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/56.gif -------------------------------------------------------------------------------- /layui/images/face/57.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/57.gif -------------------------------------------------------------------------------- /layui/images/face/58.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/58.gif -------------------------------------------------------------------------------- /layui/images/face/59.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/59.gif -------------------------------------------------------------------------------- /layui/images/face/6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/6.gif -------------------------------------------------------------------------------- /layui/images/face/60.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/60.gif -------------------------------------------------------------------------------- /layui/images/face/61.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/61.gif -------------------------------------------------------------------------------- /layui/images/face/62.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/62.gif -------------------------------------------------------------------------------- /layui/images/face/63.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/63.gif -------------------------------------------------------------------------------- /layui/images/face/64.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/64.gif -------------------------------------------------------------------------------- /layui/images/face/65.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/65.gif -------------------------------------------------------------------------------- /layui/images/face/66.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/66.gif -------------------------------------------------------------------------------- /layui/images/face/67.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/67.gif -------------------------------------------------------------------------------- /layui/images/face/68.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/68.gif -------------------------------------------------------------------------------- /layui/images/face/69.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/69.gif -------------------------------------------------------------------------------- /layui/images/face/7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/7.gif -------------------------------------------------------------------------------- /layui/images/face/70.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/70.gif -------------------------------------------------------------------------------- /layui/images/face/71.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/71.gif -------------------------------------------------------------------------------- /layui/images/face/8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/8.gif -------------------------------------------------------------------------------- /layui/images/face/9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/face/9.gif -------------------------------------------------------------------------------- /layui/css/modules/layer/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/css/modules/layer/default/icon.png -------------------------------------------------------------------------------- /layui/images/forkme_right_red_aa0000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/images/forkme_right_red_aa0000.png -------------------------------------------------------------------------------- /layui/css/modules/layer/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/css/modules/layer/default/icon-ext.png -------------------------------------------------------------------------------- /layui/css/modules/layer/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/css/modules/layer/default/loading-0.gif -------------------------------------------------------------------------------- /layui/css/modules/layer/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/css/modules/layer/default/loading-1.gif -------------------------------------------------------------------------------- /layui/css/modules/layer/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hsiangleev/layuiExtend/HEAD/layui/css/modules/layer/default/loading-2.gif -------------------------------------------------------------------------------- /eleTree/README.md: -------------------------------------------------------------------------------- 1 | ## 基于layui的tree重写 2 | 3 | 1. [文档](https://layuiextend.hsianglee.cn/eletree/) 4 | 2. [示例](https://layuiextend.hsianglee.cn/eletree/test.html) 5 | 3. [备用文档](http://layuiextend2.hsianglee.cn/eleTree/) -------------------------------------------------------------------------------- /layui/lay/modules/mobile/layim-mobile-open.js: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | @Name:layim mobile 开源包 4 | @Author:贤心 5 | @License:MIT 6 | 7 | */ 8 | 9 | layui.define(function(exports){ 10 | exports('layim-mobile', layui.v); 11 | }); -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## layui框架扩展 2 | 3 | [文档地址](https://layuiextend.hsianglee.cn) 4 | 5 | 1. [基于layui的步骤条面板](https://layuiextend.hsianglee.cn/step) 6 | 2. [基于layui的无限级联选择器](https://layuiextend.hsianglee.cn/cascader) 7 | 3. [基于layui重写tree](https://layuiextend.hsianglee.cn/eleTree) 8 | 4. [下拉菜单(主要解决table中的下拉菜单不显示)](https://layuiextend.hsianglee.cn/dropdown) 9 | 5. [滚动条插件](https://layuiextend.hsianglee.cn/scrollBar) 10 | 5. [程序流程图插件](https://layuiextend.hsianglee.cn/eFlowChart) 11 | 12 | 13 | [备用文档地址](http://layuiextend2.hsianglee.cn) -------------------------------------------------------------------------------- /layui/css/modules/laydate/default/font.css: -------------------------------------------------------------------------------- 1 | /** 图标字体 **/ 2 | @font-face {font-family: 'laydate-icon'; 3 | src: url('./font/iconfont.eot'); 4 | src: url('./font/iconfont.eot#iefix') format('embedded-opentype'), 5 | url('./font/iconfont.svg#iconfont') format('svg'), 6 | url('./font/iconfont.woff') format('woff'), 7 | url('./font/iconfont.ttf') format('truetype'); 8 | } 9 | 10 | .laydate-icon{ 11 | font-family:"laydate-icon" !important; 12 | font-size: 16px; 13 | font-style: normal; 14 | -webkit-font-smoothing: antialiased; 15 | -moz-osx-font-smoothing: grayscale; 16 | } -------------------------------------------------------------------------------- /scrollBar/scrollBar.css: -------------------------------------------------------------------------------- 1 | html{ 2 | touch-action:pan-y; 3 | } 4 | .urp-scroll{ 5 | width: 300px; 6 | height: 400px; 7 | outline: 1px solid #ccc; 8 | margin: 30px auto; 9 | overflow: hidden; 10 | padding-right: 5px; 11 | position: relative; 12 | touch-action: none; /* 控制台报错问题 Ignored attempt to cancel a touchmove event with cancelable=false */ 13 | } 14 | .urp-scrollBar{ 15 | width: 5px; 16 | height: 100%; 17 | position: absolute; 18 | right: 0; 19 | top: 0; 20 | } 21 | .urp-scrollBar-body{ 22 | width: 100%; 23 | height: 30%; 24 | border-radius: 7px; 25 | position: absolute; 26 | top: 0px; 27 | } -------------------------------------------------------------------------------- /scrollBar/README.md: -------------------------------------------------------------------------------- 1 | ## 滚动条 2 | 3 | #### **html元素** 4 | ----------------- 5 | ```javascript 6 |
7 |
8 | 9 |
10 |
11 | ``` 12 | 13 | #### **js引用** 14 | ----------------- 15 | ```javascript 16 | layui.use(['jquery','scrollBar'], function(){ 17 | var $ = layui.jquery; 18 | var scrollBar = layui.scrollBar; 19 | var s=scrollBar({ 20 | el: ".scroll", 21 | color: "#888", 22 | width: "7px" 23 | }) 24 | s.resetHeight(); // 重新计算滚动条高度 25 | }); 26 | ``` 27 | 28 | #### **step.render()参数说明** 29 | > + el:外层容器 30 | > + color:颜色,默认#aaa 31 | > + width:滚动条宽度,默认6px 32 | 33 | #### **外部可以使用的函数说明** 34 | > + resetHeight():重新计算滚动条高度 35 | -------------------------------------------------------------------------------- /layui/css/modules/code.css: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none} -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 李祥 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /layui/lay/modules/code.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var a=layui.$,l="http://www.layui.com/doc/modules/code.html";e("code",function(e){var t=[];e=e||{},e.elem=a(e.elem||".layui-code"),e.about=!("about"in e)||e.about,e.elem.each(function(){t.push(this)}),layui.each(t.reverse(),function(t,i){var c=a(i),o=c.html();(c.attr("lay-encode")||e.encode)&&(o=o.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")),c.html('
  1. '+o.replace(/[\r\t\n]+/g,"
  2. ")+"
"),c.find(">.layui-code-h3")[0]||c.prepend('

'+(c.attr("lay-title")||e.title||"code")+(e.about?'layui.code':"")+"

");var d=c.find(">.layui-code-ol");c.addClass("layui-box layui-code-view"),(c.attr("lay-skin")||e.skin)&&c.addClass("layui-code-"+(c.attr("lay-skin")||e.skin)),(d.find("li").length/100|0)>0&&d.css("margin-left",(d.find("li").length/100|0)+"px"),(c.attr("lay-height")||e.height)&&d.css("max-height",c.attr("lay-height")||e.height)})})}).addcss("modules/code.css","skincodecss"); -------------------------------------------------------------------------------- /cascader/cascader.css: -------------------------------------------------------------------------------- 1 | /* #region 级联选择器 */ 2 | .layui-input-block>i{ 3 | position: absolute; 4 | top: 10px; 5 | right: 10px; 6 | cursor: pointer; 7 | } 8 | .urp-cascader-content{ 9 | white-space: nowrap; 10 | background: #fff; 11 | border: 1px solid #e4e7ed; 12 | border-right: 0px; 13 | border-radius: 2px; 14 | box-shadow: 0 2px 12px 0 rgba(0,0,0,.1); 15 | position: absolute; 16 | left: 0px; 17 | top: 100%; 18 | margin-top: 12px; 19 | } 20 | ul.urp-cascader-child{ 21 | display: inline-block; 22 | vertical-align: top; 23 | height: 204px; 24 | overflow: auto; 25 | border-right: 1px solid #e4e7ed; 26 | background-color: #fff; 27 | box-sizing: border-box; 28 | margin: 0; 29 | padding: 6px 0; 30 | min-width: 135px; 31 | } 32 | ul.urp-cascader-child>li>i{ 33 | float: right; 34 | } 35 | ul.urp-cascader-child>li{ 36 | font-size: 14px; 37 | padding: 8px 20px; 38 | position: relative; 39 | white-space: nowrap; 40 | overflow: hidden; 41 | text-overflow: ellipsis; 42 | color: #606266; 43 | height: 34px; 44 | line-height: 1.5; 45 | box-sizing: border-box; 46 | cursor: pointer; 47 | outline: none; 48 | } 49 | ul.urp-cascader-child li.active{ 50 | color: #409eff; 51 | } 52 | ul.urp-cascader-child>li:hover{ 53 | background-color: #f5f5f5; 54 | } 55 | 56 | ul.urp-cascader-child:first-of-type:after{ 57 | content: ""; 58 | position: absolute; 59 | top: -5px; 60 | left: 35px; 61 | z-index: -1; 62 | display: inline-block; 63 | width: 10px; 64 | height: 10px; 65 | background-color: #fff; 66 | transform: rotate(45deg); 67 | border: 1px solid #e4e7ed; 68 | } 69 | /* #endregion */ 70 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | layui扩展 10 | 11 | 28 | 29 | 30 | 38 | 47 | 48 | -------------------------------------------------------------------------------- /layui/lay/modules/laytpl.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},c={exp:function(e){return new RegExp(e,"g")},query:function(e,c,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return n((c||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error:";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)}); -------------------------------------------------------------------------------- /layui/lay/modules/flow.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="加载更多",h=l('
'+d+"
");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),!i&&f.width()&&(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;su)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)}); -------------------------------------------------------------------------------- /dropdown/README.md: -------------------------------------------------------------------------------- 1 | ## 下拉菜单 2 | 3 | #### **html元素** 4 | ----------------- 5 | ```javascript 6 |
7 | 11 | 31 |
32 | ``` 33 | 34 | #### **说明** 35 | > + 默认左对齐,给 .urp-dropdown添加 .urp-dropdown-right类右对齐 36 | > + 默认为关闭状态,给 .urp-dropdown添加 .open类则初始打开 37 | 38 | 39 | ## table中使用 40 | #### **html模板** 41 | ```javascript 42 |
43 | 46 |
47 | ``` 48 | #### **js触发事件** 49 | ```javascript 50 | // 需引入dropdown模块 51 | table.render({ 52 | elem: "#demo" 53 | // ... 54 | , done: function (res) { 55 | // 表格下拉菜单初始化 56 | dropdown("#demo", res.data, function (data) { 57 | // 拼接数组(几个数组代表几个按钮) 58 | var options = [ 59 | { 60 | title: "查看", // 按钮显示内容 61 | icon: "layui-icon-form", // 图标样式 62 | url: "http://baidu.com", // 按钮跳转地址(与event二选一) 63 | event: function () { 64 | // 按钮触发事件 65 | } 66 | } 67 | ]; 68 | return options; 69 | }) 70 | } 71 | }); 72 | ``` 73 | 74 | #### dropdown参数 75 | > + 第一个参数为table选择器,若页面只有一个表格下拉菜单则可省略 76 | > + 第一个参数为table的数据,参数必需 77 | > + 第一个参数为回调函数,可以编辑按钮信息,函数需返回一个数组options,参数必需 -------------------------------------------------------------------------------- /cascader/README.md: -------------------------------------------------------------------------------- 1 | ## 基于layui的无限级联选择器 2 | 3 | #### **html元素** 4 | ----------------- 5 | ```javascript 6 |
7 | 8 |
9 | 10 |
11 |
12 | ``` 13 | 14 | #### **js引用** 15 | ----------------- 16 | ```javascript 17 | layui.use(['form',"jquery","cascader"], function(){ 18 | var $ = layui.jquery; 19 | var cascader = layui.cascader; 20 | 21 | var data = [ 22 | { 23 | value: 'A', 24 | label: 'a', 25 | children: [ 26 | { 27 | value: 'AA1', 28 | label: 'aa1', 29 | }, 30 | { 31 | value: 'BB1', 32 | label: 'bb1' 33 | } 34 | ] 35 | }, 36 | { 37 | value: 'B', 38 | label: 'b', 39 | } 40 | ] 41 | var cas=cascader({ 42 | elem: "#a", 43 | data: data, 44 | // url: "/aa", 45 | // type: "post", 46 | // triggerType: "change", 47 | // showLastLevels: true, 48 | // where: { 49 | // a: "aaa" 50 | // }, 51 | value: ["A", "AA1"], 52 | success: function (valData,labelData) { 53 | console.log(valData); 54 | console.log(labelData); 55 | } 56 | }); 57 | 58 | cas.reload({}) // 重载 59 | }); 60 | ``` 61 | 62 | #### **cascader参数说明** 63 | > + elem:input容器 64 | > + data:需要的静态数据,类型为数组, 65 | > + url:异步获取的数据,类型为数组,(data与url两个参数二选一) 66 | > + type:异步获取的方式,默认get,可省略 67 | > + where:异步传入的参数,可省略 68 | > + triggerType:触发方式,不填或其他都为click,可选参数"change",即鼠标移入触发 69 | > + showLastLevels:输入框是否只显示最后一级,默认false,即全显示 70 | > + value:传入的初始值,类型为数组,值为data的value值 71 | > + changeOnSelect:是否选中即改变,默认false(可以选择非叶子节点) 72 | > + success:回调函数,选择完成之后的回调函数,返回值第一个参数为value数组,第二个参数为label数组 73 | > + lazy:是否开启懒加载功能 74 | > + lazyLoad:懒加载回调函数,仅在lazy为true时有效,有两个参数node和callback函数,node为当前点击的节点数据,callback函数需要把新数据和node节点同时传递回去,即callback(newArray,node); 75 | 76 | #### **cascader函数说明** 77 | > + cas.reload(): 可重新渲染数据,或赋初值 78 | 79 | 80 | -------------------------------------------------------------------------------- /eleTree/tree.json: -------------------------------------------------------------------------------- 1 | { 2 | "code": 0, 3 | "data": [ 4 | { 5 | "id": 1, 6 | "label": "安徽省", 7 | "children": [ 8 | { 9 | "id": 2, 10 | "label": "马鞍山市", 11 | "disabled": true, 12 | "children": [ 13 | { 14 | "id": 3, 15 | "label": "和县" 16 | }, 17 | { 18 | "id": 4, 19 | "label": "花山区", 20 | "checked": true 21 | } 22 | ] 23 | }, 24 | { 25 | "id": 22, 26 | "label": "淮北市", 27 | "children": [ 28 | { 29 | "id": 23, 30 | "label": "濉溪县" 31 | }, 32 | { 33 | "id": 24, 34 | "label": "相山区", 35 | "checked": true 36 | } 37 | ] 38 | } 39 | ] 40 | }, 41 | { 42 | "id": 5, 43 | "label": "河南省", 44 | "children": [ 45 | { 46 | "id": 6, 47 | "label": "郑州市" 48 | } 49 | ] 50 | }, 51 | { 52 | "id": 10, 53 | "label": "江苏省", 54 | "children": [ 55 | { 56 | "id": 11, 57 | "label": "苏州市" 58 | }, 59 | { 60 | "id": 12, 61 | "label": "南京市", 62 | "children": [ 63 | { 64 | "id": 13, 65 | "label": "姑苏区" 66 | }, 67 | { 68 | "id": 14, 69 | "label": "相城区" 70 | } 71 | ] 72 | } 73 | ] 74 | } 75 | ] 76 | } -------------------------------------------------------------------------------- /eFlowChart/README.md: -------------------------------------------------------------------------------- 1 | ## 程序流程图 2 | 3 | **[示例](https://layuiextend.hsianglee.cn/eFlowChart)** 4 | 5 | #### 使用方式: 6 | 1. 引入eFlowChart模块 7 | 2. 使用: 8 | ```javascript 9 | // // html 10 | layui.eFlowChart.render({ 11 | el: "#cvs", 12 | data: [ 13 | // ... 14 | ], 15 | bdColor: "#ff4200", 16 | bgColor: "#ddd", 17 | textFont: "14px serif", 18 | textColor: "#666", 19 | arrowSize: { 20 | x: 15, 21 | y: 15, 22 | distance: 8 23 | }, 24 | nodeType: { 25 | drawOval: ["StartNode","EndNode"], 26 | drawLineArrow: ["Line"], 27 | drawRect: ["ProcNode"], 28 | drawRiamond: ["CondNode"], 29 | drawLineRect: ["ChildNode"], 30 | drawRadiusRect: ["ConfNode"], 31 | }, 32 | event: { 33 | click: function(d) { 34 | console.log(d) 35 | }, 36 | mouseenter: function(d) { 37 | console.log(d) 38 | }, 39 | mouseleave: function(d) { 40 | console.log(d) 41 | } 42 | } 43 | }) 44 | ``` 45 | 3. render参数说明: 46 | * el: canvas容器 47 | * bdColor: 默认边框颜色(可省略) 48 | * bgColor: 默认背景颜色(可省略) 49 | * textFont: 默认字体,大小和样式(可省略) 50 | * textColor: 默认字体颜色(可省略) 51 | * arrowSize: 默认箭头大小(可省略) 52 | * data: 流程图数据,类型为数组 53 | * nodeType: 节点类型对应的图形 54 | * event: 节点事件 55 | 4. arrowSize数据格式说明: 56 | * x,y为相对箭头顶点坐标,x/y越大,角度越大 57 | * distance: 在箭头反方向到顶点的距离,数字越大,箭头面积越大 58 | 5. data数据格式说明: 59 | * 箭头的数据格式为起始节点坐标,和末尾节点坐标,示例:{xStart: 100, yStart: 530, xEnd: 100, yEnd: 590}, 60 | * 圆,椭圆,矩形,菱形,圆角矩形和双竖线的矩形的数据格式都为矩形左上角坐标和矩形的宽高,示例:{x: 170, y: 20, width: 60, height: 60} 61 | * 所有节点均支持的字段: 62 | * text:文本 63 | * bdColor: 当前节点的边框颜色 64 | * bgColor: 当前节点的背景颜色 65 | * type: 当前节点类型,与nodeType字段里面的值对应 66 | * textColor: 当前节点的字体颜色 67 | * 额外参数: 68 | * radius: 圆角矩形的圆角半径 69 | * distance: 双竖线的矩形的两条竖线距离左右的宽度 70 | 6. nodeType数据格式说明(目前只支持6种): 71 | * drawOval: [], 绘制圆或椭圆(数组内容为data节点的type类型) 72 | * drawLineArrow: [], 绘制箭头 73 | * drawRect: [], 绘制矩形 74 | * drawRiamond: [], 绘制菱形 75 | * drawLineRect: [], 绘制双竖线矩形 76 | * drawRadiusRect: [], 绘制圆角矩形 77 | 7. event参数说明: 78 | * click: 点击事件,返回值为点击的节点对象 79 | * mouseenter和mouseleave为一对,组成hover事件,即鼠标移入移出事件,返回值为点击的节点对象 -------------------------------------------------------------------------------- /layui/lay/modules/rate.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var a=layui.jquery,i={config:{},index:layui.rate?layui.rate.index+1e4:0,set:function(e){var i=this;return i.config=a.extend({},i.config,e),i},on:function(e,a){return layui.onevent.call(this,n,e,a)}},l=function(){var e=this,a=e.config;return{setvalue:function(a){e.setvalue.call(e,a)},config:a}},n="rate",t="layui-rate",o="layui-icon-rate",s="layui-icon-rate-solid",u="layui-icon-rate-half",r="layui-icon-rate-solid layui-icon-rate-half",c="layui-icon-rate-solid layui-icon-rate",f="layui-icon-rate layui-icon-rate-half",v=function(e){var l=this;l.index=++i.index,l.config=a.extend({},l.config,i.config,e),l.render()};v.prototype.config={length:5,text:!1,readonly:!1,half:!1,value:0,theme:""},v.prototype.render=function(){var e=this,i=e.config,l=i.theme?'style="color: '+i.theme+';"':"";i.elem=a(i.elem),parseInt(i.value)!==i.value&&(i.half||(i.value=Math.ceil(i.value)-i.value<.5?Math.ceil(i.value):Math.floor(i.value)));for(var n='"+(i.text?''+i.value+"星":"")+"";var c=i.elem,f=c.next("."+t);f[0]&&f.remove(),e.elemTemp=a(n),i.span=e.elemTemp.next("span"),i.setText&&i.setText(i.value),c.html(e.elemTemp),c.addClass("layui-inline"),i.readonly||e.action()},v.prototype.setvalue=function(e){var a=this,i=a.config;i.value=e,a.render()},v.prototype.action=function(){var e=this,i=e.config,l=e.elemTemp,n=l.find("i").width();l.children("li").each(function(e){var t=e+1,v=a(this);v.on("click",function(e){if(i.value=t,i.half){var o=e.pageX-a(this).offset().left;o<=n/2&&(i.value=i.value-.5)}i.text&&l.next("span").text(i.value+"星"),i.choose&&i.choose(i.value),i.setText&&i.setText(i.value)}),v.on("mousemove",function(e){if(l.find("i").each(function(){a(this).addClass(o).removeClass(r)}),l.find("i:lt("+t+")").each(function(){a(this).addClass(s).removeClass(f)}),i.half){var c=e.pageX-a(this).offset().left;c<=n/2&&v.children("i").addClass(u).removeClass(s)}}),v.on("mouseleave",function(){l.find("i").each(function(){a(this).addClass(o).removeClass(r)}),l.find("i:lt("+Math.floor(i.value)+")").each(function(){a(this).addClass(s).removeClass(f)}),i.half&&parseInt(i.value)!==i.value&&l.children("li:eq("+Math.floor(i.value)+")").children("i").addClass(u).removeClass(c)})})},v.prototype.events=function(){var e=this;e.config},i.render=function(e){var a=new v(e);return l.call(a)},e(n,i)}); -------------------------------------------------------------------------------- /step/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | layui扩展步骤条面板 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |
条目1
17 |
条目2
18 |
条目3
19 |
条目4
20 |
条目5
21 |
22 |
23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
32 |
33 |
34 | 35 | 36 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /step/README.md: -------------------------------------------------------------------------------- 1 | ## 基于layui的步骤条面板 2 | 3 | #### **html元素** 4 | ----------------- 5 | ```javascript 6 |
7 |
8 |
条目1
9 |
条目2
10 |
条目3
11 |
条目4
12 |
13 |
14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 |
24 |
25 | ``` 26 | 27 | #### **js引用** 28 | ----------------- 29 | ```javascript 30 | layui.use(['jquery','step'], function(){ 31 | var $ = layui.jquery; 32 | var step = layui.step; 33 | step.render({ 34 | elem: '.layui-step', 35 | // title: ["第一步","第二步","第三步","第四步"], 36 | description: ["aaa","bbb","ccc","ddd"], 37 | // currentStep: 2, 38 | // disabledStep: [1,3], 39 | // canIconClick: true, 40 | isOpenStepLevel: true, 41 | iconClickCallback: function(index) { 42 | console.log(index) 43 | } 44 | }); 45 | $(".goFirst").on("click",function() { 46 | step.goFirst(); 47 | }) 48 | $(".prev").on("click",function() { 49 | step.prev(); 50 | }) 51 | $(".next").on("click",function() { 52 | step.next(); 53 | }) 54 | $(".goLast").on("click",function() { 55 | step.goLast(); 56 | }) 57 | $(".goStep").on("click",function() { 58 | step.goStep(2); 59 | }) 60 | $(".disabled").on("click",function() { 61 | step.disabled(3); 62 | }) 63 | $(".abled").on("click",function() { 64 | step.abled(3); 65 | }) 66 | }); 67 | ``` 68 | 69 | #### **说明** 70 | > + 每一个 .layui-step-content-item代表一个tab页面,高度默认最小值为满屏 71 | > + 按扭区默认悬浮固定在右下角,可自行设置,内部的按钮个数可以自定义 72 | > + 按钮禁用与解禁的位置(i)必须在当前步数之后,即禁用时,该位置应尚未走到 73 | 74 | #### **更换风格样式** 75 | > + 给最外层容器添加class样式 layui-step-line 76 | 77 | #### **step.render()参数说明** 78 | > + elem:外层容器 79 | > + title:步骤条下方文字说明,类型为数组,可省略,默认["第一步","第二步","第三步","。。。"] 80 | > + currentStep:初始时是第几步,可省略,默认第一步 81 | > + canIconClick:上方步骤条是否可以点击,可省略,默认false 82 | > + description:步骤条下方描述性文字,类型为数组,可省略 83 | > + isOpenStepLevel:是否严格按照步骤条顺序执行,即未走过的步骤不可点,走过的可点,可省略,若开启则默认canIconClick字段关闭 84 | > + disabledStep:初始禁用的步骤,类型为数组,可省略 85 | > + iconClickCallback:通过点击icon步骤跳转页面的回调函数,参数为当前页面index 86 | 87 | 88 | #### **外部可以使用的函数说明** 89 | > + render():初始渲染界面 90 | > + goStep(i):跳到第几步 91 | > + goFirst():跳到第1步 92 | > + goLast():跳到最后1步 93 | > + prev():跳到上一步 94 | > + next():跳到下一步 95 | > + disabled(i):禁用某一步 96 | > + abled(i):解除某一步的禁用 97 | 98 | 99 | #### **外部可使用的变量说明** 100 | > + currentStep:获取当前是第几步 101 | -------------------------------------------------------------------------------- /layui/lay/modules/util.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var t=layui.$,i={fixbar:function(e){var i,n,a="layui-fixbar",o="layui-fixbar-top",r=t(document),l=t("body");e=t.extend({showHeight:200},e),e.bar1=e.bar1===!0?"":e.bar1,e.bar2=e.bar2===!0?"":e.bar2,e.bgcolor=e.bgcolor?"background-color:"+e.bgcolor:"";var c=[e.bar1,e.bar2,""],u=t(['"].join("")),g=u.find("."+o),s=function(){var t=r.scrollTop();t>=e.showHeight?i||(g.show(),i=1):i&&(g.hide(),i=0)};t("."+a)[0]||("object"==typeof e.css&&u.css(e.css),l.append(u),s(),u.find("li").on("click",function(){var i=t(this),n=i.attr("lay-type");"top"===n&&t("html,body").animate({scrollTop:0},200),e.click&&e.click.call(this,n)}),r.on("scroll",function(){clearTimeout(n),n=setTimeout(function(){s()},100)}))},countdown:function(e,t,i){var n=this,a="function"==typeof t,o=new Date(e).getTime(),r=new Date(!t||a?(new Date).getTime():t).getTime(),l=o-r,c=[Math.floor(l/864e5),Math.floor(l/36e5)%24,Math.floor(l/6e4)%60,Math.floor(l/1e3)%60];a&&(i=t);var u=setTimeout(function(){n.countdown(e,r+1e3,i)},1e3);return i&&i(l>0?c:[0,0,0,0],t,u),l<=0&&clearTimeout(u),u},timeAgo:function(e,t){var i=this,n=[[],[]],a=(new Date).getTime()-new Date(e).getTime();return a>26784e5?(a=new Date(e),n[0][0]=i.digit(a.getFullYear(),4),n[0][1]=i.digit(a.getMonth()+1),n[0][2]=i.digit(a.getDate()),t||(n[1][0]=i.digit(a.getHours()),n[1][1]=i.digit(a.getMinutes()),n[1][2]=i.digit(a.getSeconds())),n[0].join("-")+" "+n[1].join(":")):a>=864e5?(a/1e3/60/60/24|0)+"天前":a>=36e5?(a/1e3/60/60|0)+"小时前":a>=18e4?(a/1e3/60|0)+"分钟前":a<0?"未来":"刚刚"},digit:function(e,t){var i="";e=String(e),t=t||2;for(var n=e.length;n/g,">").replace(/'/g,"'").replace(/"/g,""")},event:function(e,n,a){var o=t("body");return a=a||"click",n=i.event[e]=t.extend(!0,i.event[e],n)||{},i.event.UTIL_EVENT_CALLBACK=i.event.UTIL_EVENT_CALLBACK||{},o.off(a,"*["+e+"]",i.event.UTIL_EVENT_CALLBACK[e]),i.event.UTIL_EVENT_CALLBACK[e]=function(){var i=t(this),a=i.attr(e);"function"==typeof n[a]&&n[a].call(this,i)},o.on(a,"*["+e+"]",i.event.UTIL_EVENT_CALLBACK[e]),n}};!function(e,t,i){"$:nomunge";function n(){a=t[l](function(){o.each(function(){var t=e(this),i=t.width(),n=t.height(),a=e.data(this,u);(i!==a.w||n!==a.h)&&t.trigger(c,[a.w=i,a.h=n])}),n()},r[g])}var a,o=e([]),r=e.resize=e.extend(e.resize,{}),l="setTimeout",c="resize",u=c+"-special-event",g="delay",s="throttleWindow";r[g]=250,r[s]=!0,e.event.special[c]={setup:function(){if(!r[s]&&this[l])return!1;var t=e(this);o=o.add(t),e.data(this,u,{w:t.width(),h:t.height()}),1===o.length&&n()},teardown:function(){if(!r[s]&&this[l])return!1;var t=e(this);o=o.not(t),t.removeData(u),o.length||clearTimeout(a)},add:function(t){function n(t,n,o){var r=e(this),l=e.data(this,u)||{};l.w=n!==i?n:r.width(),l.h=o!==i?o:r.height(),a.apply(this,arguments)}if(!r[s]&&this[l])return!1;var a;return e.isFunction(t)?(a=t,n):(a=t.handler,void(t.handler=n))}}}(t,window),e("util",i)}); -------------------------------------------------------------------------------- /layui/lay/modules/carousel.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",l=">*[carousel-item]>*",o="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(l),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(clearInterval(e.timer),e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['",'"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['
    ',function(){var i=[];return layui.each(e.elemItem,function(e){i.push("")}),i.join("")}(),"
"].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-(t.height()/2)),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){var t=i(this),a=t.index();a>n.index?e.slide("add",a-n.index):aa{ 151 | display: block; 152 | padding: 0 1em; 153 | text-decoration: none; 154 | width: auto; 155 | color: #000; 156 | white-space: nowrap; 157 | line-height: 2.4em; 158 | text-shadow: 1px 1px 0 #fff; 159 | border-radius: 1px; 160 | } 161 | #tree-menu li>a:hover{ 162 | background-color: #e8eff7; 163 | box-shadow: 0 0 2px #0a6aa1; 164 | } 165 | .tree-menu-bg{ 166 | background-color: #ccc; 167 | } 168 | /* #endregion */ -------------------------------------------------------------------------------- /layui/lay/modules/laypage.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define(function(e){"use strict";var a=document,t="getElementById",n="getElementsByTagName",i="laypage",r="layui-disabled",u=function(e){var a=this;a.config=e||{},a.config.index=++s.index,a.render(!0)};u.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return void 0===e.elem.length?2:3},u.prototype.view=function(){var e=this,a=e.config,t=a.groups="groups"in a?0|a.groups:5;a.layout="object"==typeof a.layout?a.layout:["prev","page","next"],a.count=0|a.count,a.curr=0|a.curr||1,a.limits="object"==typeof a.limits?a.limits:[10,20,30,40,50],a.limit=0|a.limit||10,a.pages=Math.ceil(a.count/a.limit)||1,a.curr>a.pages&&(a.curr=a.pages),t<0?t=1:t>a.pages&&(t=a.pages),a.prev="prev"in a?a.prev:"上一页",a.next="next"in a?a.next:"下一页";var n=a.pages>t?Math.ceil((a.curr+(t>1?1:0))/(t>0?t:1)):1,i={prev:function(){return a.prev?''+a.prev+"":""}(),page:function(){var e=[];if(a.count<1)return"";n>1&&a.first!==!1&&0!==t&&e.push(''+(a.first||1)+"");var i=Math.floor((t-1)/2),r=n>1?a.curr-i:1,u=n>1?function(){var e=a.curr+(t-i-1);return e>a.pages?a.pages:e}():t;for(u-r2&&e.push('');r<=u;r++)r===a.curr?e.push('"+r+""):e.push(''+r+"");return a.pages>t&&a.pages>u&&a.last!==!1&&(u+1…'),0!==t&&e.push(''+(a.last||a.pages)+"")),e.join("")}(),next:function(){return a.next?''+a.next+"":""}(),count:'共 '+a.count+" 条",limit:function(){var e=['"}(),refresh:['','',""].join(""),skip:function(){return['到第','','页',""].join("")}()};return['
',function(){var e=[];return layui.each(a.layout,function(a,t){i[t]&&e.push(i[t])}),e.join("")}(),"
"].join("")},u.prototype.jump=function(e,a){if(e){var t=this,i=t.config,r=e.children,u=e[n]("button")[0],l=e[n]("input")[0],p=e[n]("select")[0],c=function(){var e=0|l.value.replace(/\s|\D/g,"");e&&(i.curr=e,t.render())};if(a)return c();for(var o=0,y=r.length;oi.pages||(i.curr=e,t.render())});p&&s.on(p,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),u&&s.on(u,"click",function(){c()})}},u.prototype.skip=function(e){if(e){var a=this,t=e[n]("input")[0];t&&s.on(t,"keyup",function(t){var n=this.value,i=t.keyCode;/^(37|38|39|40)$/.test(i)||(/\D/.test(n)&&(this.value=n.replace(/\D/,"")),13===i&&a.jump(e,!0))})}},u.prototype.render=function(e){var n=this,i=n.config,r=n.type(),u=n.view();2===r?i.elem&&(i.elem.innerHTML=u):3===r?i.elem.html(u):a[t](i.elem)&&(a[t](i.elem).innerHTML=u),i.jump&&i.jump(i,e);var s=a[t]("layui-laypage-"+i.index);n.jump(s),i.hash&&!e&&(location.hash="!"+i.hash+"="+i.curr),n.skip(s)};var s={render:function(e){var a=new u(e);return a.index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(e,a,t){return e.attachEvent?e.attachEvent("on"+a,function(a){a.target=a.srcElement,t.call(e,a)}):e.addEventListener(a,t,!1),this}};e(i,s)}); -------------------------------------------------------------------------------- /dropdown/dropdown.css: -------------------------------------------------------------------------------- 1 | /* #region 下拉菜单 */ 2 | .urp-dropdown{ 3 | position: relative; 4 | display: inline-block; 5 | } 6 | .urp-dropdown .urp-dropdown-btn{ 7 | position: relative; 8 | } 9 | .urp-dropdown .urp-dropdown-btn>i.layui-icon{ 10 | font-size: 12px; 11 | position: relative; 12 | top: 1px; 13 | left: 2px; 14 | } 15 | .urp-dropdown .urp-dropdown-btn + ul.urp-dropdown-menu{ 16 | border: 1px solid #ddd; 17 | background-color: #fff; 18 | position: absolute; 19 | top: 48px; 20 | left: 0; 21 | box-shadow: 2px 2px 2px #ddd; 22 | display: none; 23 | z-index: 1000; 24 | } 25 | .urp-dropdown .urp-dropdown-btn.layui-btn-xs + ul.urp-dropdown-menu{ 26 | top: 32px; 27 | } 28 | .urp-dropdown .urp-dropdown-btn.layui-btn-sm + ul.urp-dropdown-menu{ 29 | top: 40px; 30 | } 31 | .urp-dropdown .urp-dropdown-btn.layui-btn-lg + ul.urp-dropdown-menu{ 32 | top: 54px; 33 | } 34 | 35 | 36 | .urp-dropdown.open .urp-dropdown-btn + ul.urp-dropdown-menu{ 37 | display: block; 38 | } 39 | .urp-dropdown.urp-dropdown-right .urp-dropdown-btn + ul.urp-dropdown-menu{ 40 | left: auto; 41 | right: 0px; 42 | } 43 | .urp-dropdown .urp-dropdown-btn + ul.urp-dropdown-menu::after{ 44 | position: absolute; 45 | top: -7px; 46 | left: 10px; 47 | right: auto; 48 | display: inline-block!important; 49 | border-right: 7px solid transparent; 50 | border-bottom: 7px solid #fff; 51 | border-left: 7px solid transparent; 52 | content: ''; 53 | } 54 | .urp-dropdown.urp-dropdown-right .urp-dropdown-btn + ul.urp-dropdown-menu::after{ 55 | right: 10px; 56 | left: auto; 57 | } 58 | .urp-dropdown .urp-dropdown-btn + ul.urp-dropdown-menu::before{ 59 | position: absolute; 60 | top: -8px; 61 | left: 9px; 62 | right: auto; 63 | display: inline-block!important; 64 | border-right: 8px solid transparent; 65 | border-bottom: 8px solid #ddd; 66 | border-left: 8px solid transparent; 67 | content: ''; 68 | } 69 | .urp-dropdown.urp-dropdown-right .urp-dropdown-btn + ul.urp-dropdown-menu::before{ 70 | right: 9px; 71 | left: auto; 72 | } 73 | .urp-dropdown .urp-dropdown-btn + ul.urp-dropdown-menu li a{ 74 | padding: 8px 16px; 75 | color: #6f6f6f; 76 | text-decoration: none; 77 | display: block; 78 | clear: both; 79 | font-weight: 300; 80 | line-height: 18px; 81 | font-size: 14px; 82 | min-width: 80px; 83 | white-space: nowrap; 84 | } 85 | .urp-dropdown .urp-dropdown-btn + ul.urp-dropdown-menu li a:hover{ 86 | background-color: #f2f2f2; 87 | } 88 | 89 | 90 | 91 | .urp-dropdown-menu-table { 92 | position: fixed; 93 | top: 0px; 94 | right: 0px; 95 | border: 1px solid #ddd; 96 | background-color: #fff; 97 | box-shadow: 2px 2px 2px #ddd; 98 | z-index: 1000; 99 | } 100 | ul.urp-dropdown-menu-table::after{ 101 | position: absolute; 102 | top: -7px; 103 | display: inline-block!important; 104 | border-right: 7px solid transparent; 105 | border-bottom: 7px solid #fff; 106 | border-left: 7px solid transparent; 107 | content: ''; 108 | right: 10px; 109 | } 110 | ul.urp-dropdown-menu-table.urp-dropdown-menu-table-top { 111 | box-shadow: 2px -2px 2px #ddd; 112 | } 113 | ul.urp-dropdown-menu-table.urp-dropdown-menu-table-top::after { 114 | border-top: 7px solid #fff; 115 | border-bottom: none; 116 | bottom: -7px; 117 | top: auto; 118 | } 119 | ul.urp-dropdown-menu-table.urp-dropdown-menu-table-top::before { 120 | border-top: 8px solid #ddd; 121 | border-bottom: none; 122 | bottom: -8px; 123 | top: auto; 124 | } 125 | ul.urp-dropdown-menu-table::before{ 126 | position: absolute; 127 | top: -8px; 128 | display: inline-block!important; 129 | border-right: 8px solid transparent; 130 | border-bottom: 8px solid #ddd; 131 | border-left: 8px solid transparent; 132 | content: ''; 133 | right: 9px; 134 | } 135 | ul.urp-dropdown-menu-table li a{ 136 | padding: 8px 16px; 137 | color: #6f6f6f; 138 | text-decoration: none; 139 | display: block; 140 | clear: both; 141 | font-weight: 300; 142 | line-height: 18px; 143 | font-size: 14px; 144 | min-width: 80px; 145 | white-space: nowrap; 146 | } 147 | ul.urp-dropdown-menu-table li a:hover{ 148 | background-color: #f2f2f2; 149 | } 150 | /* #endregion */ -------------------------------------------------------------------------------- /layui/lay/mymodules/dropdown.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @Name: layui.dropdown 基于layui的下拉菜单 3 | * @Author: 李祥 4 | * @License:MIT 5 | * 最近修改时间: 2018/11/16 6 | */ 7 | 8 | layui.define(["jquery"], function (exports) { 9 | var $ = layui.jquery; 10 | // 记录dropdown的上一次点击的按钮dom 11 | var dropdownTarget = ""; 12 | var dropdown = function (elem, data, callback) { 13 | var $elem=null; 14 | if(typeof elem ==="string"){ 15 | $elem=$(elem).next(".layui-border-box").find(".urp-dropdown-table .urp-dropdown-btn"); 16 | }else{ 17 | callback=data; 18 | data=elem; 19 | $elem=$(".urp-dropdown-table .urp-dropdown-btn"); 20 | } 21 | 22 | $elem.off("click").on("click", function (event) { 23 | var index = $(this).parents("tr").attr("data-index"); 24 | var d = data[index]; 25 | var event = event || window.event; 26 | 27 | var options = callback(d); 28 | if (Object.prototype.toString.call(options) !== "[object Array]") { 29 | layui.hint().error('dropdown回调参数错误(格式应为数组)'); 30 | return; 31 | } 32 | layui.stope(event); 33 | // 点击的按钮dom 34 | var target = event.target || event.srcElement; 35 | target = $(target).parents(".urp-dropdown-table").children(".urp-dropdown-btn").get(0); 36 | if ($(".urp-dropdown-menu-table").length > 0) { 37 | $(".urp-dropdown-menu-table").remove(); 38 | // 判断两次点击的是否是同一个按钮 39 | if ((dropdownTarget.get(0)).isEqualNode($(target).parents("tr").get(0))) { 40 | return; 41 | } 42 | } 43 | // 下拉菜单拼接 44 | var str = '
    '; 45 | options.forEach(function (val, index) { 46 | var icon = val.icon || ""; 47 | if (icon.indexOf("fa-") > -1) { 48 | icon = icon.indexOf("fa ") === -1 ? ("fa " + icon) : icon; 49 | } else { 50 | icon = icon.indexOf("layui-icon ") === -1 ? ("layui-icon " + icon) : icon; 51 | } 52 | var title = val.title || "按钮" + (index + 1); 53 | var url = val.url || "javascript:;"; 54 | str += '
  • ' + title + '
  • ' 55 | }) 56 | str += '
'; 57 | $(document.body).append(str); 58 | // 位置与事件绑定 59 | $(".urp-dropdown-menu-table").css({ 60 | right: $(document.body).width() - $(target).offset().left - $(target).width() - 11, 61 | top: $(target).offset().top + $(target).height() + 10 - $(document).scrollTop() 62 | }).find("li").each(function (index, item) { 63 | options[index]["event"] && $(item).off().on("click", options[index]["event"]) 64 | }) 65 | // 判断是否需要朝上 66 | if ($(document.body).height() < $(target).offset().top + 50 + $(".urp-dropdown-menu-table").height()) { 67 | $(".urp-dropdown-menu-table").addClass("urp-dropdown-menu-table-top").css({ 68 | top: $(target).offset().top - $(".urp-dropdown-menu-table").height() - 10 - $(document).scrollTop() 69 | }) 70 | } 71 | // 更新上一次按钮dom 72 | dropdownTarget = $(target).parents("tr"); 73 | 74 | }) 75 | } 76 | var documentEvent=function() { 77 | $(document.body).on("click", '.urp-dropdown:not(.urp-dropdown-table)', function (event) { 78 | event.stopPropagation(); 79 | var onOff = true; 80 | // 判断当前是否打开,是的话,直接关闭,否则先关闭所有的,再打开当前的 81 | if ($(this).hasClass("open")) { 82 | onOff = false; 83 | } 84 | $(".urp-dropdown").removeClass("open"); 85 | if (onOff) { 86 | $(this).addClass("open"); 87 | } 88 | }) 89 | $(document.body).on("click", function () { 90 | $(".urp-dropdown").removeClass("open"); 91 | $(".urp-dropdown-menu-table").remove(); 92 | }); 93 | // 滚动移除 94 | window.addEventListener("scroll",function() { 95 | $(".urp-dropdown-menu-table").remove(); 96 | },true); 97 | } 98 | documentEvent(); 99 | 100 | 101 | exports('dropdown', dropdown); 102 | }) -------------------------------------------------------------------------------- /layui/lay/modules/mobile/upload-mobile.js: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | @Title: layui.upload 单文件上传 - 全浏览器兼容版 4 | @Author: 贤心 5 | @License:MIT 6 | 7 | */ 8 | 9 | layui.define(['layer-mobile', 'zepto'] , function(exports){ 10 | "use strict"; 11 | 12 | var $ = layui.zepto; 13 | var layer = layui['layer-mobile']; 14 | var device = layui.device(); 15 | 16 | var elemDragEnter = 'layui-upload-enter'; 17 | var elemIframe = 'layui-upload-iframe'; 18 | 19 | var msgConf = { 20 | icon: 2 21 | ,shift: 6 22 | }, fileType = { 23 | file: '文件' 24 | ,video: '视频' 25 | ,audio: '音频' 26 | }; 27 | 28 | layer.msg = function(content){ 29 | return layer.open({ 30 | content: content || '' 31 | ,skin: 'msg' 32 | ,time: 2 //2秒后自动关闭 33 | }); 34 | }; 35 | 36 | var Upload = function(options){ 37 | this.options = options; 38 | }; 39 | 40 | //初始化渲染 41 | Upload.prototype.init = function(){ 42 | var that = this, options = that.options; 43 | var body = $('body'), elem = $(options.elem || '.layui-upload-file'); 44 | var iframe = $(''); 45 | 46 | //插入iframe 47 | $('#'+elemIframe)[0] || body.append(iframe); 48 | 49 | return elem.each(function(index, item){ 50 | item = $(item); 51 | var form = '
'; 52 | 53 | var type = item.attr('lay-type') || options.type; //获取文件类型 54 | 55 | //包裹ui元素 56 | if(!options.unwrap){ 57 | form = '
' + form + ''+ ( 58 | item.attr('lay-title') || options.title|| ('上传'+ (fileType[type]||'图片') ) 59 | ) +'
'; 60 | } 61 | 62 | form = $(form); 63 | 64 | //拖拽支持 65 | if(!options.unwrap){ 66 | form.on('dragover', function(e){ 67 | e.preventDefault(); 68 | $(this).addClass(elemDragEnter); 69 | }).on('dragleave', function(){ 70 | $(this).removeClass(elemDragEnter); 71 | }).on('drop', function(){ 72 | $(this).removeClass(elemDragEnter); 73 | }); 74 | } 75 | 76 | //如果已经实例化,则移除包裹元素 77 | if(item.parent('form').attr('target') === elemIframe){ 78 | if(options.unwrap){ 79 | item.unwrap(); 80 | } else { 81 | item.parent().next().remove(); 82 | item.unwrap().unwrap(); 83 | } 84 | }; 85 | 86 | //包裹元素 87 | item.wrap(form); 88 | 89 | //触发上传 90 | item.off('change').on('change', function(){ 91 | that.action(this, type); 92 | }); 93 | }); 94 | }; 95 | 96 | //提交上传 97 | Upload.prototype.action = function(input, type){ 98 | var that = this, options = that.options, val = input.value; 99 | var item = $(input), ext = item.attr('lay-ext') || options.ext || ''; //获取支持上传的文件扩展名; 100 | 101 | if(!val){ 102 | return; 103 | }; 104 | 105 | //校验文件 106 | switch(type){ 107 | case 'file': //一般文件 108 | if(ext && !RegExp('\\w\\.('+ ext +')$', 'i').test(escape(val))){ 109 | layer.msg('不支持该文件格式', msgConf); 110 | return input.value = ''; 111 | } 112 | break; 113 | case 'video': //视频文件 114 | if(!RegExp('\\w\\.('+ (ext||'avi|mp4|wma|rmvb|rm|flash|3gp|flv') +')$', 'i').test(escape(val))){ 115 | layer.msg('不支持该视频格式', msgConf); 116 | return input.value = ''; 117 | } 118 | break; 119 | case 'audio': //音频文件 120 | if(!RegExp('\\w\\.('+ (ext||'mp3|wav|mid') +')$', 'i').test(escape(val))){ 121 | layer.msg('不支持该音频格式', msgConf); 122 | return input.value = ''; 123 | } 124 | break; 125 | default: //图片文件 126 | if(!RegExp('\\w\\.('+ (ext||'jpg|png|gif|bmp|jpeg') +')$', 'i').test(escape(val))){ 127 | layer.msg('不支持该图片格式', msgConf); 128 | return input.value = ''; 129 | } 130 | break; 131 | } 132 | 133 | options.before && options.before(input); 134 | item.parent().submit(); 135 | 136 | var iframe = $('#'+elemIframe), timer = setInterval(function() { 137 | var res; 138 | try { 139 | res = iframe.contents().find('body').text(); 140 | } catch(e) { 141 | layer.msg('上传接口存在跨域', msgConf); 142 | clearInterval(timer); 143 | } 144 | if(res){ 145 | clearInterval(timer); 146 | iframe.contents().find('body').html(''); 147 | try { 148 | res = JSON.parse(res); 149 | } catch(e){ 150 | res = {}; 151 | return layer.msg('请对上传接口返回JSON字符', msgConf); 152 | } 153 | typeof options.success === 'function' && options.success(res, input); 154 | } 155 | }, 30); 156 | 157 | input.value = ''; 158 | }; 159 | 160 | //暴露接口 161 | exports('upload-mobile', function(options){ 162 | var upload = new Upload(options = options || {}); 163 | upload.init(); 164 | }); 165 | }); 166 | 167 | -------------------------------------------------------------------------------- /dropdown/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | layui扩展下拉选择dropdown 10 | 11 | 12 | 13 | 14 |
15 | 19 | 39 |
40 | 41 |
42 | 43 | 50 | 51 | 52 | 123 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /scrollBar/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | layui扩展滚动条scrollBar 11 | 12 | 13 | 14 | 19 | 20 | 21 |
22 |
23 | Lorem ipsum dolor sit, amet consectetur adipisicing elit. Mollitia, ipsa praesentium. Praesentium nihil quam asperiores. Incidunt ullam totam aliquam quibusdam perferendis ab, numquam alias vitae similique magni aspernatur provident deleniti nulla accusantium reprehenderit molestiae eveniet iure? Praesentium consectetur, necessitatibus et cum voluptas saepe dolorem nobis eos repudiandae tempore totam inventore corrupti illo nemo nam non alias magnam laudantium qui. Consectetur, pariatur quae ratione eligendi ea aut. Cumque eveniet doloribus necessitatibus, aperiam laboriosam qui modi quia, suscipit harum beatae sequi earum sunt praesentium quam officia id consectetur accusantium reiciendis nisi vitae sed odio perferendis accusamus? Distinctio exercitationem cumque aperiam rem natus doloremque iure soluta sint adipisci veniam. Voluptatibus nam pariatur velit animi, praesentium, odit sed inventore minus et voluptate necessitatibus repellat assumenda dolore quibusdam vero, quis nesciunt reiciendis debitis? Sequi at ab illo impedit omnis necessitatibus eius totam nemo perferendis neque, facere aliquam! Sunt optio consectetur autem aut animi quas fugit a nam, ad accusantium numquam eos natus assumenda aspernatur voluptas officiis saepe repudiandae aliquid provident doloremque architecto. Est explicabo delectus minus nemo qui molestias neque quas laboriosam optio fugit vitae, minima perspiciatis aspernatur enim dolor vero veniam labore iure error a quaerat earum at ducimus? Ipsam, harum quisquam? Repudiandae saepe ducimus id quia ex dignissimos suscipit iure, dolorem, cum quo voluptate doloremque maxime sapiente voluptatum blanditiis sint architecto facere voluptas modi assumenda. Ea, aliquam? Nisi at odit dolore architecto tempore delectus libero? Minus iure voluptate inventore quas optio, dolore aperiam sapiente officia aspernatur similique a saepe distinctio, aliquid quae. Harum veritatis facere ex ut, rerum aspernatur sint, beatae, enim odio libero illo quibusdam amet! Vero dolorem ratione odio quo dolores enim et. Quo dolor amet harum nemo ex dolore dolores, voluptatem ad asperiores. Perferendis nesciunt id saepe quam nam accusamus ex nisi praesentium nihil ducimus consectetur ab, eveniet eligendi, eos reprehenderit harum maiores hic tempora minus obcaecati. Corporis earum voluptates molestiae doloribus, mollitia velit quidem iste error quae illo magni cupiditate, incidunt deleniti nihil eveniet veritatis rem non odio. Voluptates blanditiis officia ipsa mollitia. Voluptatibus quos veritatis repellat, eaque esse perspiciatis praesentium. Ratione debitis maxime laborum laboriosam. Quo error illum nostrum cum eos asperiores quaerat sed necessitatibus quae suscipit officiis minima quibusdam incidunt nihil, voluptates nisi beatae dolorum. Sint, sunt! Impedit, distinctio modi quisquam similique voluptates nisi quaerat blanditiis iusto doloribus delectus sapiente eum officia cum doloremque iure laboriosam! Sequi dolorum repudiandae quo quod vel amet vitae architecto consectetur aliquid assumenda, ipsa quasi possimus expedita esse. Culpa, ea enim doloribus nulla iusto similique iure cumque ipsa corrupti minima neque fugiat, suscipit eius, magni voluptas est provident? Sint alias, libero architecto enim tempore consequuntur modi, repudiandae iste ex in, natus a. Temporibus assumenda voluptas natus aliquid deleniti quia expedita sequi maiores, porro dignissimos exercitationem accusantium itaque architecto a! Rerum voluptates quisquam nam hic at fugit, soluta odit, minus ad quas laudantium illo repellat unde adipisci. Aspernatur et ratione quae temporibus aliquid alias vel, beatae veritatis laudantium numquam dolorem accusantium? Ipsa, accusamus rem. Aliquid odit magnam totam amet voluptas dolorem, nostrum laudantium. 24 |
25 |
26 | 27 | 28 | 29 | 45 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /step/step.css: -------------------------------------------------------------------------------- 1 | /* #region 步骤条面板 */ 2 | html,body{ 3 | width: 100%; 4 | height: 100%; 5 | } 6 | .layui-step{ 7 | width: 100%; 8 | height: 100%; 9 | position: relative; 10 | background-color: #fff; 11 | } 12 | 13 | .layui-step-title { 14 | width: 100%; 15 | padding-top: 20px; 16 | } 17 | .layui-step-title-item{ 18 | min-height: 60px; 19 | float: left; 20 | background-color: #fff; 21 | text-align: center; 22 | position: relative; 23 | } 24 | .layui-step-title-item::after{ 25 | content: ""; 26 | width: 100%; 27 | display: inline-block; 28 | height: 2px; 29 | background-color: #ccc; 30 | position: absolute; 31 | top: 14px; 32 | left: 0px; 33 | } 34 | .layui-step-title-item.step-finish::after{ 35 | background-color: #26C281; 36 | } 37 | .layui-step-title-item.step-current::after{ 38 | background-color: #32c5d2; 39 | } 40 | .layui-step-title-item.step-disabled::after{ 41 | background-color: #ccc; 42 | } 43 | .layui-step-title-item.step-first::after{ 44 | width: 50%; 45 | left: 50%; 46 | } 47 | .layui-step-title-item.step-last::after{ 48 | width: 50%; 49 | right: 50%; 50 | } 51 | .layui-step-title-item.step-finish .step-icon{ 52 | background-color: #26C281; 53 | color: #fff; 54 | } 55 | .layui-step-title-item.step-current .step-icon{ 56 | background-color: #32c5d2; 57 | color: #fff; 58 | border: 1px solid #32c5d2; 59 | } 60 | .layui-step-title-item.step-disabled .step-icon{ 61 | background-color: #ccc; 62 | color: #fff; 63 | border: 1px solid #ccc; 64 | cursor: not-allowed; 65 | } 66 | .layui-step-title-item.step-disabled .step-text{ 67 | color: #bbb; 68 | } 69 | .layui-step-title-item.step-disabled .step-description{ 70 | color: #ddd; 71 | } 72 | .step-icon{ 73 | height: 26px; 74 | width: 26px; 75 | z-index: 1; 76 | color: #26C281; 77 | cursor: pointer; 78 | text-align: center; 79 | position: relative; 80 | border-radius: 50%; 81 | display: inline-block; 82 | background: #ffffff; 83 | border: 1px solid #26C281; 84 | } 85 | .step-icon>i{ 86 | position: absolute; 87 | top: 5px; 88 | font-style: normal; 89 | left: 9px; 90 | } 91 | .step-text{ 92 | font-weight: bolder; 93 | color: #555555; 94 | margin-bottom: 10px; 95 | padding: 0px 15px; 96 | } 97 | .step-description{ 98 | color: #aaa; 99 | font-weight: 300; 100 | padding: 0px 15px; 101 | } 102 | 103 | .layui-step-content{ 104 | width: 100%; 105 | min-height: calc(100% - 105px); 106 | position: relative; 107 | margin-top: 20px; 108 | background-color: #eef1f5; 109 | } 110 | .layui-step-content-item{ 111 | width: 100%; 112 | position: relative; 113 | padding: 15px 0px; 114 | top: 0px; 115 | left: 0px; 116 | display: none; 117 | } 118 | .layui-step-content-item .content-item-before{ 119 | content: " "; 120 | width: 20px; 121 | height: 20px; 122 | background-color: #eef1f5; 123 | position: absolute; 124 | top: -10px; 125 | transform: rotate(45deg); 126 | } 127 | 128 | .layui-step-btn{ 129 | position: fixed; 130 | top: calc(100% - 40px); 131 | right: 0px; 132 | } 133 | 134 | .layui-step.layui-step-line .layui-step-title-item{ 135 | background-color: #eef1f5; 136 | text-align: left; 137 | height: 40px; 138 | min-height: 40px; 139 | box-sizing: border-box; 140 | } 141 | .layui-step.layui-step-line .layui-step-title-item::after{ 142 | content: ""; 143 | width: 0px; 144 | display: inline-block; 145 | height: 0px; 146 | background-color: transparent; 147 | position: absolute; 148 | top: 0px; 149 | left: 99.99%; 150 | 151 | border-style: solid dashed dashed; 152 | border-color: transparent transparent transparent #eef1f5; 153 | border-width: 20px; 154 | } 155 | .layui-step.layui-step-line .layui-step-title-item.step-first::before{ 156 | border: 0px; 157 | } 158 | .layui-step.layui-step-line .layui-step-title-item.step-first{ 159 | padding-left: 10px; 160 | } 161 | .layui-step.layui-step-line .layui-step-title-item::before{ 162 | content: ""; 163 | width: 0px; 164 | display: inline-block; 165 | height: 0px; 166 | background-color: transparent; 167 | position: absolute; 168 | top: 0px; 169 | left: auto; 170 | right: 99.99%; 171 | 172 | border-style: solid dashed dashed; 173 | border-color: #eef1f5 #eef1f5 #eef1f5 transparent; 174 | border-width: 20px; 175 | } 176 | .layui-step.layui-step-line .layui-step-title-item.step-last::after{ 177 | border: 0px; 178 | } 179 | .layui-step.layui-step-line .layui-step-title-item .step-icon{ 180 | float: left; 181 | margin-top: 7px; 182 | } 183 | .layui-step.layui-step-line .layui-step-title-item .step-text{ 184 | float: left; 185 | margin: 10px 0 0 0; 186 | color: #26C281; 187 | } 188 | .layui-step.layui-step-line .layui-step-title-item .step-description{ 189 | float: left; 190 | margin: 10px 0 0 0; 191 | color: #26C281; 192 | } 193 | .layui-step.layui-step-line .layui-step-title-item.step-current .step-text, 194 | .layui-step.layui-step-line .layui-step-title-item.step-current .step-description { 195 | color: #32c5d2; 196 | } 197 | .layui-step.layui-step-line .layui-step-title-item.step-disabled .step-text{ 198 | color: #ccc; 199 | } 200 | @media screen and (max-width: 768px) { 201 | .layui-step.layui-step-line .layui-step-title-item .step-text{ 202 | display: none; 203 | } 204 | .layui-step.layui-step-line .layui-step-title-item .step-description{ 205 | display: none; 206 | } 207 | } 208 | /* #endregion */ -------------------------------------------------------------------------------- /eFlowChart/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | layui扩展程序流程图示例 10 | 11 | 12 | 17 | 18 | 19 | 20 | 21 | 22 | 94 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /layui/lay/modules/transfer.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define(["laytpl","form"],function(e){"use strict";var a=layui.$,t=layui.laytpl,n=layui.form,i="transfer",l={config:{},index:layui[i]?layui[i].index+1e4:0,set:function(e){var t=this;return t.config=a.extend({},t.config,e),t},on:function(e,a){return layui.onevent.call(this,i,e,a)}},r=function(){var e=this,a=e.config,t=a.id||e.index;return r.that[t]=e,r.config[t]=a,{config:a,reload:function(a){e.reload.call(e,a)},getData:function(){return e.getData.call(e)}}},c="layui-hide",o="layui-btn-disabled",d="layui-none",s="layui-transfer-box",u="layui-transfer-header",h="layui-transfer-search",f="layui-transfer-active",y="layui-transfer-data",p=function(e){return e=e||{},['
','
','","
","{{# if(d.data.showSearch){ }}",'","{{# } }}",'
    ',"
    "].join("")},v=['
    ',p({index:0,checkAllName:"layTransferLeftCheckAll"}),'
    ','",'","
    ",p({index:1,checkAllName:"layTransferRightCheckAll"}),"
    "].join(""),x=function(e){var t=this;t.index=++l.index,t.config=a.extend({},t.config,l.config,e),t.render()};x.prototype.config={title:["列表一","列表二"],width:200,height:360,data:[],value:[],showSearch:!1,id:"",text:{none:"无数据",searchNone:"无匹配数据"}},x.prototype.reload=function(e){var t=this;layui.each(e,function(e,a){a.constructor===Array&&delete t.config[e]}),t.config=a.extend(!0,{},t.config,e),t.render()},x.prototype.render=function(){var e=this,n=e.config,i=e.elem=a(t(v).render({data:n,index:e.index})),l=n.elem=a(n.elem);l[0]&&(n.data=n.data||[],n.value=n.value||[],e.key=n.id||e.index,l.html(e.elem),e.layBox=e.elem.find("."+s),e.layHeader=e.elem.find("."+u),e.laySearch=e.elem.find("."+h),e.layData=i.find("."+y),e.layBtn=i.find("."+f+" .layui-btn"),e.layBox.css({width:n.width,height:n.height}),e.layData.css({height:function(){return n.height-e.layHeader.outerHeight()-e.laySearch.outerHeight()-2}()}),e.renderData(),e.events())},x.prototype.renderData=function(){var e=this,a=(e.config,[{checkName:"layTransferLeftCheck",views:[]},{checkName:"layTransferRightCheck",views:[]}]);e.parseData(function(e){var t=e.selected?1:0,n=["
  • ",'',"
  • "].join("");a[t].views.push(n),delete e.selected}),e.layData.eq(0).html(a[0].views.join("")),e.layData.eq(1).html(a[1].views.join("")),e.renderCheckBtn()},x.prototype.renderForm=function(e){n.render(e,"LAY-transfer-"+this.index)},x.prototype.renderCheckBtn=function(e){var t=this,n=t.config;e=e||{},t.layBox.each(function(i){var l=a(this),r=l.find("."+y),d=l.find("."+u).find('input[type="checkbox"]'),s=r.find('input[type="checkbox"]'),h=0,f=!1;if(s.each(function(){var e=a(this).data("hide");(this.checked||this.disabled||e)&&h++,this.checked&&!e&&(f=!0)}),d.prop("checked",f&&h===s.length),t.layBtn.eq(i)[f?"removeClass":"addClass"](o),!e.stopNone){var p=r.children("li:not(."+c+")").length;t.noneView(r,p?"":n.text.none)}}),t.renderForm("checkbox")},x.prototype.noneView=function(e,t){var n=a('

    '+(t||"")+"

    ");e.find("."+d)[0]&&e.find("."+d).remove(),t.replace(/\s/g,"")&&e.append(n)},x.prototype.setValue=function(){var e=this,t=e.config,n=[];return e.layBox.eq(1).find("."+y+' input[type="checkbox"]').each(function(){var e=a(this).data("hide");e||n.push(this.value)}),t.value=n,e},x.prototype.parseData=function(e){var t=this,n=t.config,i=[];return layui.each(n.data,function(t,l){l=("function"==typeof n.parseData?n.parseData(l):l)||l,i.push(l=a.extend({},l)),layui.each(n.value,function(e,a){a==l.value&&(l.selected=!0)}),e&&e(l)}),n.data=i,t},x.prototype.getData=function(e){var a=this,t=a.config,n=[];return a.setValue(),layui.each(e||t.value,function(e,a){layui.each(t.data,function(e,t){delete t.selected,a==t.value&&n.push(t)})}),n},x.prototype.events=function(){var e=this,t=e.config;e.elem.on("click",'input[lay-filter="layTransferCheckbox"]+',function(){var t=a(this).prev(),n=t[0].checked,i=t.parents("."+s).eq(0).find("."+y);t[0].disabled||("all"===t.attr("lay-type")&&i.find('input[type="checkbox"]').each(function(){this.disabled||(this.checked=n)}),e.renderCheckBtn({stopNone:!0}))}),e.layBtn.on("click",function(){var n=a(this),i=n.data("index"),l=e.layBox.eq(i),r=[];if(!n.hasClass(o)){e.layBox.eq(i).each(function(t){var n=a(this),i=n.find("."+y);i.children("li").each(function(){var t=a(this),n=t.find('input[type="checkbox"]'),i=n.data("hide");n[0].checked&&!i&&(n[0].checked=!1,l.siblings("."+s).find("."+y).append(t.clone()),t.remove(),r.push(n[0].value)),e.setValue()})}),e.renderCheckBtn();var c=l.siblings("."+s).find("."+h+" input");""===c.val()||c.trigger("keyup"),t.onchange&&t.onchange(e.getData(r),i)}}),e.laySearch.find("input").on("keyup",function(){var n=this.value,i=a(this).parents("."+h).eq(0).siblings("."+y),l=i.children("li");l.each(function(){var e=a(this),t=e.find('input[type="checkbox"]'),i=t[0].title.indexOf(n)!==-1;e[i?"removeClass":"addClass"](c),t.data("hide",!i)}),e.renderCheckBtn();var r=l.length===i.children("li."+c).length;e.noneView(i,r?t.text.searchNone:"")})},r.that={},r.config={},l.reload=function(e,a){var t=r.that[e];return t.reload(a),r.call(t)},l.getData=function(e){var a=r.that[e];return a.getData()},l.render=function(e){var a=new x(e);return r.call(a)},e(i,l)}); -------------------------------------------------------------------------------- /layui/lay/modules/mobile/layer-mobile.js: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | @Name:layer mobile v2.0.0 弹层组件移动版 4 | @Author:贤心 5 | @Site:http://layer.layui.com/mobie/ 6 | @License:MIT 7 | 8 | */ 9 | 10 | layui.define(function(exports){ 11 | 12 | "use strict"; 13 | 14 | var win = window, doc = document, query = 'querySelectorAll', claname = 'getElementsByClassName', S = function(s){ 15 | return doc[query](s); 16 | }; 17 | 18 | //默认配置 19 | var config = { 20 | type: 0 21 | ,shade: true 22 | ,shadeClose: true 23 | ,fixed: true 24 | ,anim: 'scale' //默认动画类型 25 | }; 26 | 27 | var ready = { 28 | extend: function(obj){ 29 | var newobj = JSON.parse(JSON.stringify(config)); 30 | for(var i in obj){ 31 | newobj[i] = obj[i]; 32 | } 33 | return newobj; 34 | }, 35 | timer: {}, end: {} 36 | }; 37 | 38 | //点触事件 39 | ready.touch = function(elem, fn){ 40 | elem.addEventListener('click', function(e){ 41 | fn.call(this, e); 42 | }, false); 43 | }; 44 | 45 | var index = 0, classs = ['layui-m-layer'], Layer = function(options){ 46 | var that = this; 47 | that.config = ready.extend(options); 48 | that.view(); 49 | }; 50 | 51 | Layer.prototype.view = function(){ 52 | var that = this, config = that.config, layerbox = doc.createElement('div'); 53 | 54 | that.id = layerbox.id = classs[0] + index; 55 | layerbox.setAttribute('class', classs[0] + ' ' + classs[0]+(config.type || 0)); 56 | layerbox.setAttribute('index', index); 57 | 58 | //标题区域 59 | var title = (function(){ 60 | var titype = typeof config.title === 'object'; 61 | return config.title 62 | ? '

    '+ (titype ? config.title[0] : config.title) +'

    ' 63 | : ''; 64 | }()); 65 | 66 | //按钮区域 67 | var button = (function(){ 68 | typeof config.btn === 'string' && (config.btn = [config.btn]); 69 | var btns = (config.btn || []).length, btndom; 70 | if(btns === 0 || !config.btn){ 71 | return ''; 72 | } 73 | btndom = ''+ config.btn[0] +'' 74 | if(btns === 2){ 75 | btndom = ''+ config.btn[1] +'' + btndom; 76 | } 77 | return '
    '+ btndom + '
    '; 78 | }()); 79 | 80 | if(!config.fixed){ 81 | config.top = config.hasOwnProperty('top') ? config.top : 100; 82 | config.style = config.style || ''; 83 | config.style += ' top:'+ ( doc.body.scrollTop + config.top) + 'px'; 84 | } 85 | 86 | if(config.type === 2){ 87 | config.content = '

    '+ (config.content||'') +'

    '; 88 | } 89 | 90 | if(config.skin) config.anim = 'up'; 91 | if(config.skin === 'msg') config.shade = false; 92 | 93 | layerbox.innerHTML = (config.shade ? '
    ' : '') 94 | +'
    ' 95 | +'
    ' 96 | +'
    ' 97 | + title 98 | +'
    '+ config.content +'
    ' 99 | + button 100 | +'
    ' 101 | +'
    ' 102 | +'
    '; 103 | 104 | if(!config.type || config.type === 2){ 105 | var dialogs = doc[claname](classs[0] + config.type), dialen = dialogs.length; 106 | if(dialen >= 1){ 107 | layer.close(dialogs[0].getAttribute('index')) 108 | } 109 | } 110 | 111 | document.body.appendChild(layerbox); 112 | var elem = that.elem = S('#'+that.id)[0]; 113 | config.success && config.success(elem); 114 | 115 | that.index = index++; 116 | that.action(config, elem); 117 | }; 118 | 119 | Layer.prototype.action = function(config, elem){ 120 | var that = this; 121 | 122 | //自动关闭 123 | if(config.time){ 124 | ready.timer[that.index] = setTimeout(function(){ 125 | layer.close(that.index); 126 | }, config.time*1000); 127 | } 128 | 129 | //确认取消 130 | var btn = function(){ 131 | var type = this.getAttribute('type'); 132 | if(type == 0){ 133 | config.no && config.no(); 134 | layer.close(that.index); 135 | } else { 136 | config.yes ? config.yes(that.index) : layer.close(that.index); 137 | } 138 | }; 139 | if(config.btn){ 140 | var btns = elem[claname]('layui-m-layerbtn')[0].children, btnlen = btns.length; 141 | for(var ii = 0; ii < btnlen; ii++){ 142 | ready.touch(btns[ii], btn); 143 | } 144 | } 145 | 146 | //点遮罩关闭 147 | if(config.shade && config.shadeClose){ 148 | var shade = elem[claname]('layui-m-layershade')[0]; 149 | ready.touch(shade, function(){ 150 | layer.close(that.index, config.end); 151 | }); 152 | } 153 | 154 | config.end && (ready.end[that.index] = config.end); 155 | }; 156 | 157 | var layer = { 158 | v: '2.0 m', 159 | index: index, 160 | 161 | //核心方法 162 | open: function(options){ 163 | var o = new Layer(options || {}); 164 | return o.index; 165 | }, 166 | 167 | close: function(index){ 168 | var ibox = S('#'+classs[0]+index)[0]; 169 | if(!ibox) return; 170 | ibox.innerHTML = ''; 171 | doc.body.removeChild(ibox); 172 | clearTimeout(ready.timer[index]); 173 | delete ready.timer[index]; 174 | typeof ready.end[index] === 'function' && ready.end[index](); 175 | delete ready.end[index]; 176 | }, 177 | 178 | //关闭所有layer层 179 | closeAll: function(){ 180 | var boxs = doc[claname](classs[0]); 181 | for(var i = 0, len = boxs.length; i < len; i++){ 182 | layer.close((boxs[0].getAttribute('index')|0)); 183 | } 184 | } 185 | }; 186 | 187 | exports('layer-mobile', layer); 188 | 189 | }); -------------------------------------------------------------------------------- /layui/lay/modules/slider.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var i=layui.jquery,t={config:{},index:layui.slider?layui.slider.index+1e4:0,set:function(e){var t=this;return t.config=i.extend({},t.config,e),t},on:function(e,i){return layui.onevent.call(this,n,e,i)}},a=function(){var e=this,i=e.config;return{setValue:function(i,t){return e.slide("set",i,t||0)},config:i}},n="slider",l="layui-disabled",s="layui-slider",r="layui-slider-bar",o="layui-slider-wrap",u="layui-slider-wrap-btn",d="layui-slider-tips",v="layui-slider-input",c="layui-slider-input-txt",m="layui-slider-input-btn",p="layui-slider-hover",f=function(e){var a=this;a.index=++t.index,a.config=i.extend({},a.config,t.config,e),a.render()};f.prototype.config={type:"default",min:0,max:100,value:0,step:1,showstep:!1,tips:!0,input:!1,range:!1,height:200,disabled:!1,theme:"#009688"},f.prototype.render=function(){var e=this,t=e.config;if(t.step<1&&(t.step=1),t.maxt.min?a:t.min,t.value[1]=n>t.min?n:t.min,t.value[0]=t.value[0]>t.max?t.max:t.value[0],t.value[1]=t.value[1]>t.max?t.max:t.value[1];var r=Math.floor((t.value[0]-t.min)/(t.max-t.min)*100),v=Math.floor((t.value[1]-t.min)/(t.max-t.min)*100),m=v-r+"%";r+="%",v+="%"}else{"object"==typeof t.value&&(t.value=Math.min.apply(null,t.value)),t.valuet.max&&(t.value=t.max);var m=Math.floor((t.value-t.min)/(t.max-t.min)*100)+"%"}var p=t.disabled?"#c2c2c2":t.theme,f='
    '+(t.tips?'
    ':"")+'
    '+(t.range?'
    ':"")+"
    ",h=i(t.elem),y=h.next("."+s);if(y[0]&&y.remove(),e.elemTemp=i(f),t.range?(e.elemTemp.find("."+o).eq(0).data("value",t.value[0]),e.elemTemp.find("."+o).eq(1).data("value",t.value[1])):e.elemTemp.find("."+o).data("value",t.value),h.html(e.elemTemp),"vertical"===t.type&&e.elemTemp.height(t.height+"px"),t.showstep){for(var g=(t.max-t.min)/t.step,b="",x=1;x')}e.elemTemp.append(b)}if(t.input&&!t.range){var w=i('
    ');h.css("position","relative"),h.append(w),h.find("."+c).children("input").val(t.value),"vertical"===t.type?w.css({left:0,top:-48}):e.elemTemp.css("margin-right",w.outerWidth()+15)}t.disabled?(e.elemTemp.addClass(l),e.elemTemp.find("."+u).addClass(l)):e.slide(),e.elemTemp.find("."+u).on("mouseover",function(){var a="vertical"===t.type?t.height:e.elemTemp[0].offsetWidth,n=e.elemTemp.find("."+o),l="vertical"===t.type?a-i(this).parent()[0].offsetTop-n.height():i(this).parent()[0].offsetLeft,s=l/a*100,r=i(this).parent().data("value"),u=t.setTips?t.setTips(r):r;e.elemTemp.find("."+d).html(u),"vertical"===t.type?e.elemTemp.find("."+d).css({bottom:s+"%","margin-bottom":"20px",display:"inline-block"}):e.elemTemp.find("."+d).css({left:s+"%",display:"inline-block"})}).on("mouseout",function(){e.elemTemp.find("."+d).css("display","none")})},f.prototype.slide=function(e,t,a){var n=this,l=n.config,s=n.elemTemp,f=function(){return"vertical"===l.type?l.height:s[0].offsetWidth},h=s.find("."+o),y=s.next("."+v),g=y.children("."+c).children("input").val(),b=100/((l.max-l.min)/Math.ceil(l.step)),x=function(e,i){e=Math.ceil(e)*b>100?Math.ceil(e)*b:Math.round(e)*b,e=e>100?100:e,h.eq(i).css("vertical"===l.type?"bottom":"left",e+"%");var t=T(h[0].offsetLeft),a=l.range?T(h[1].offsetLeft):0;"vertical"===l.type?(s.find("."+d).css({bottom:e+"%","margin-bottom":"20px"}),t=T(f()-h[0].offsetTop-h.height()),a=l.range?T(f()-h[1].offsetTop-h.height()):0):s.find("."+d).css("left",e+"%"),t=t>100?100:t,a=a>100?100:a;var n=Math.min(t,a),o=Math.abs(t-a);"vertical"===l.type?s.find("."+r).css({height:o+"%",bottom:n+"%"}):s.find("."+r).css({width:o+"%",left:n+"%"});var u=l.min+Math.round((l.max-l.min)*e/100);if(g=u,y.children("."+c).children("input").val(g),h.eq(i).data("value",u),u=l.setTips?l.setTips(u):u,s.find("."+d).html(u),l.range){var v=[h.eq(0).data("value"),h.eq(1).data("value")];v[0]>v[1]&&v.reverse()}l.change&&l.change(l.range?v:u)},T=function(e){var i=e/f()*100/b,t=Math.round(i)*b;return e==f()&&(t=Math.ceil(i)*b),t},w=i(['
    f()&&(r=f());var o=r/f()*100/b;x(o,e),t.addClass(p),s.find("."+d).show(),i.preventDefault()},o=function(){t.removeClass(p),s.find("."+d).hide()};M(r,o)})}),s.on("click",function(e){var t=i("."+u);if(!t.is(event.target)&&0===t.has(event.target).length&&t.length){var a,n="vertical"===l.type?f()-e.clientY+i(this).offset().top:e.clientX-i(this).offset().left;n<0&&(n=0),n>f()&&(n=f());var s=n/f()*100/b;a=l.range?"vertical"===l.type?Math.abs(n-parseInt(i(h[0]).css("bottom")))>Math.abs(n-parseInt(i(h[1]).css("bottom")))?1:0:Math.abs(n-h[0].offsetLeft)>Math.abs(n-h[1].offsetLeft)?1:0:0,x(s,a),e.preventDefault()}}),y.hover(function(){var e=i(this);e.children("."+m).fadeIn("fast")},function(){var e=i(this);e.children("."+m).fadeOut("fast")}),y.children("."+m).children("i").each(function(e){i(this).on("click",function(){g=1==e?g-l.stepl.max?l.max:Number(g)+l.step;var i=(g-l.min)/(l.max-l.min)*100/b;x(i,0)})});var q=function(){var e=this.value;e=isNaN(e)?0:e,e=el.max?l.max:e,this.value=e;var i=(e-l.min)/(l.max-l.min)*100/b;x(i,0)};y.children("."+c).children("input").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),q.call(this))}).on("change",q)},f.prototype.events=function(){var e=this;e.config},t.render=function(e){var i=new f(e);return a.call(i)},e(n,t)}); -------------------------------------------------------------------------------- /layui/lay/modules/upload.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("layer",function(e){"use strict";var t=layui.$,i=layui.layer,n=layui.hint(),o=layui.device(),a={config:{},set:function(e){var i=this;return i.config=t.extend({},i.config,e),i},on:function(e,t){return layui.onevent.call(this,r,e,t)}},l=function(){var e=this;return{upload:function(t){e.upload.call(e,t)},reload:function(t){e.reload.call(e,t)},config:e.config}},r="upload",u="layui-upload-file",c="layui-upload-form",f="layui-upload-iframe",s="layui-upload-choose",p=function(e){var i=this;i.config=t.extend({},i.config,a.config,e),i.render()};p.prototype.config={accept:"images",exts:"",auto:!0,bindAction:"",url:"",field:"file",acceptMime:"",method:"post",data:{},drag:!0,size:0,number:0,multiple:!1},p.prototype.render=function(e){var i=this,e=i.config;e.elem=t(e.elem),e.bindAction=t(e.bindAction),i.file(),i.events()},p.prototype.file=function(){var e=this,i=e.config,n=e.elemFile=t(['"].join("")),a=i.elem.next();(a.hasClass(u)||a.hasClass(c))&&a.remove(),o.ie&&o.ie<10&&i.elem.wrap('
    '),e.isFile()?(e.elemFile=i.elem,i.field=i.elem[0].name):i.elem.after(n),o.ie&&o.ie<10&&e.initIE()},p.prototype.initIE=function(){var e=this,i=e.config,n=t(''),o=t(['
    ',"
    "].join(""));t("#"+f)[0]||t("body").append(n),i.elem.next().hasClass(c)||(e.elemFile.wrap(o),i.elem.next("."+c).append(function(){var e=[];return layui.each(i.data,function(t,i){i="function"==typeof i?i():i,e.push('')}),e.join("")}()))},p.prototype.msg=function(e){return i.msg(e,{icon:2,shift:6})},p.prototype.isFile=function(){var e=this.config.elem[0];if(e)return"input"===e.tagName.toLocaleLowerCase()&&"file"===e.type},p.prototype.preview=function(e){var t=this;window.FileReader&&layui.each(t.chooseFiles,function(t,i){var n=new FileReader;n.readAsDataURL(i),n.onload=function(){e&&e(t,i,this.result)}})},p.prototype.upload=function(e,i){var n,a=this,l=a.config,r=a.elemFile[0],u=function(){var i=0,n=0,o=e||a.files||a.chooseFiles||r.files,u=function(){l.multiple&&i+n===a.fileLength&&"function"==typeof l.allDone&&l.allDone({total:a.fileLength,successful:i,aborted:n})};layui.each(o,function(e,o){var r=new FormData;r.append(l.field,o),layui.each(l.data,function(e,t){t="function"==typeof t?t():t,r.append(e,t)});var c={url:l.url,type:"post",data:r,contentType:!1,processData:!1,dataType:"json",headers:l.headers||{},success:function(t){i++,d(e,t),u()},error:function(){n++,a.msg("请求上传接口出现异常"),m(e),u()}};"function"==typeof l.progress&&(c.xhr=function(){var e=t.ajaxSettings.xhr();return e.upload.addEventListener("progress",function(e){if(e.lengthComputable){var t=Math.floor(e.loaded/e.total*100);l.progress(t,l.item[0],e)}}),e}),t.ajax(c)})},c=function(){var e=t("#"+f);a.elemFile.parent().submit(),clearInterval(p.timer),p.timer=setInterval(function(){var t,i=e.contents().find("body");try{t=i.text()}catch(n){a.msg("获取上传后的响应信息出现异常"),clearInterval(p.timer),m()}t&&(clearInterval(p.timer),i.html(""),d(0,t))},30)},d=function(e,t){if(a.elemFile.next("."+s).remove(),r.value="","object"!=typeof t)try{t=JSON.parse(t)}catch(i){return t={},a.msg("请对上传接口返回有效JSON")}"function"==typeof l.done&&l.done(t,e||0,function(e){a.upload(e)})},m=function(e){l.auto&&(r.value=""),"function"==typeof l.error&&l.error(e||0,function(e){a.upload(e)})},h=l.exts,v=function(){var t=[];return layui.each(e||a.chooseFiles,function(e,i){t.push(i.name)}),t}(),g={preview:function(e){a.preview(e)},upload:function(e,t){var i={};i[e]=t,a.upload(i)},pushFile:function(){return a.files=a.files||{},layui.each(a.chooseFiles,function(e,t){a.files[e]=t}),a.files},resetFile:function(e,t,i){var n=new File([t],i);a.files=a.files||{},a.files[e]=n}},y=function(){if("choose"!==i&&!l.auto||(l.choose&&l.choose(g),"choose"!==i))return l.before&&l.before(g),o.ie?o.ie>9?u():c():void u()};if(v=0===v.length?r.value.match(/[^\/\\]+\..+/g)||[]||"":v,0!==v.length){switch(l.accept){case"file":if(h&&!RegExp("\\w\\.("+h+")$","i").test(escape(v)))return a.msg("选择的文件中包含不支持的格式"),r.value="";break;case"video":if(!RegExp("\\w\\.("+(h||"avi|mp4|wma|rmvb|rm|flash|3gp|flv")+")$","i").test(escape(v)))return a.msg("选择的视频中包含不支持的格式"),r.value="";break;case"audio":if(!RegExp("\\w\\.("+(h||"mp3|wav|mid")+")$","i").test(escape(v)))return a.msg("选择的音频中包含不支持的格式"),r.value="";break;default:if(layui.each(v,function(e,t){RegExp("\\w\\.("+(h||"jpg|png|gif|bmp|jpeg$")+")","i").test(escape(t))||(n=!0)}),n)return a.msg("选择的图片中包含不支持的格式"),r.value=""}if(a.fileLength=function(){var t=0,i=e||a.files||a.chooseFiles||r.files;return layui.each(i,function(){t++}),t}(),l.number&&a.fileLength>l.number)return a.msg("同时最多只能上传的数量为:"+l.number);if(l.size>0&&!(o.ie&&o.ie<10)){var F;if(layui.each(a.chooseFiles,function(e,t){if(t.size>1024*l.size){var i=l.size/1024;i=i>=1?i.toFixed(2)+"MB":l.size+"KB",r.value="",F=i}}),F)return a.msg("文件不能超过"+F)}y()}},p.prototype.reload=function(e){e=e||{},delete e.elem,delete e.bindAction;var i=this,e=i.config=t.extend({},i.config,a.config,e),n=e.elem.next();n.attr({name:e.name,accept:e.acceptMime,multiple:e.multiple})},p.prototype.events=function(){var e=this,i=e.config,a=function(t){e.chooseFiles={},layui.each(t,function(t,i){var n=(new Date).getTime();e.chooseFiles[n+"-"+t]=i})},l=function(t,n){var o=e.elemFile,a=t.length>1?t.length+"个文件":(t[0]||{}).name||o[0].value.match(/[^\/\\]+\..+/g)||[]||"";o.next().hasClass(s)&&o.next().remove(),e.upload(null,"choose"),e.isFile()||i.choose||o.after(''+a+"")};i.elem.off("upload.start").on("upload.start",function(){var o=t(this),a=o.attr("lay-data");if(a)try{a=new Function("return "+a)(),e.config=t.extend({},i,a)}catch(l){n.error("Upload element property lay-data configuration item has a syntax error: "+a)}e.config.item=o,e.elemFile[0].click()}),o.ie&&o.ie<10||i.elem.off("upload.over").on("upload.over",function(){var e=t(this);e.attr("lay-over","")}).off("upload.leave").on("upload.leave",function(){var e=t(this);e.removeAttr("lay-over")}).off("upload.drop").on("upload.drop",function(n,o){var r=t(this),u=o.originalEvent.dataTransfer.files||[];r.removeAttr("lay-over"),a(u),i.auto?e.upload(u):l(u)}),e.elemFile.off("upload.change").on("upload.change",function(){var t=this.files||[];a(t),i.auto?e.upload():l(t)}),i.bindAction.off("upload.action").on("upload.action",function(){e.upload()}),i.elem.data("haveEvents")||(e.elemFile.on("change",function(){t(this).trigger("upload.change")}),i.elem.on("click",function(){e.isFile()||t(this).trigger("upload.start")}),i.drag&&i.elem.on("dragover",function(e){e.preventDefault(),t(this).trigger("upload.over")}).on("dragleave",function(e){t(this).trigger("upload.leave")}).on("drop",function(e){e.preventDefault(),t(this).trigger("upload.drop",e)}),i.bindAction.on("click",function(){t(this).trigger("upload.action")}),i.elem.data("haveEvents",!0))},a.render=function(e){var t=new p(e);return l.call(t)},e(r,a)}); -------------------------------------------------------------------------------- /layui/lay/modules/element.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(t){"use strict";var a=layui.$,i=(layui.hint(),layui.device()),e="element",l="layui-this",n="layui-show",s=function(){this.config={}};s.prototype.set=function(t){var i=this;return a.extend(!0,i.config,t),i},s.prototype.on=function(t,a){return layui.onevent.call(this,e,t,a)},s.prototype.tabAdd=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.children(".layui-tab-bar"),o=l.children(".layui-tab-content"),r='
  • "+(i.title||"unnaming")+"
  • ";return s[0]?s.before(r):n.append(r),o.append('
    '+(i.content||"")+"
    "),f.hideTabMore(!0),f.tabAuto(),this},s.prototype.tabDelete=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.find('>li[lay-id="'+i+'"]');return f.tabDelete(null,s),this},s.prototype.tabChange=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.find('>li[lay-id="'+i+'"]');return f.tabClick.call(s[0],null,null,s),this},s.prototype.tab=function(t){t=t||{},b.on("click",t.headerElem,function(i){var e=a(this).index();f.tabClick.call(this,i,e,null,t)})},s.prototype.progress=function(t,i){var e="layui-progress",l=a("."+e+"[lay-filter="+t+"]"),n=l.find("."+e+"-bar"),s=n.find("."+e+"-text");return n.css("width",i),s.text(i),this};var o=".layui-nav",r="layui-nav-item",c="layui-nav-bar",u="layui-nav-tree",d="layui-nav-child",y="layui-nav-more",h="layui-anim layui-anim-upbit",f={tabClick:function(t,i,s,o){o=o||{};var r=s||a(this),i=i||r.parent().children("li").index(r),c=o.headerElem?r.parent():r.parents(".layui-tab").eq(0),u=o.bodyElem?a(o.bodyElem):c.children(".layui-tab-content").children(".layui-tab-item"),d=r.find("a"),y=c.attr("lay-filter");"javascript:;"!==d.attr("href")&&"_blank"===d.attr("target")||(r.addClass(l).siblings().removeClass(l),u.eq(i).addClass(n).siblings().removeClass(n)),layui.event.call(this,e,"tab("+y+")",{elem:c,index:i})},tabDelete:function(t,i){var n=i||a(this).parent(),s=n.index(),o=n.parents(".layui-tab").eq(0),r=o.children(".layui-tab-content").children(".layui-tab-item"),c=o.attr("lay-filter");n.hasClass(l)&&(n.next()[0]?f.tabClick.call(n.next()[0],null,s+1):n.prev()[0]&&f.tabClick.call(n.prev()[0],null,s-1)),n.remove(),r.eq(s).remove(),setTimeout(function(){f.tabAuto()},50),layui.event.call(this,e,"tabDelete("+c+")",{elem:o,index:s})},tabAuto:function(){var t="layui-tab-more",e="layui-tab-bar",l="layui-tab-close",n=this;a(".layui-tab").each(function(){var s=a(this),o=s.children(".layui-tab-title"),r=(s.children(".layui-tab-content").children(".layui-tab-item"),'lay-stope="tabmore"'),c=a('');if(n===window&&8!=i.ie&&f.hideTabMore(!0),s.attr("lay-allowClose")&&o.find("li").each(function(){var t=a(this);if(!t.find("."+l)[0]){var i=a('');i.on("click",f.tabDelete),t.append(i)}}),"string"!=typeof s.attr("lay-unauto"))if(o.prop("scrollWidth")>o.outerWidth()+1){if(o.find("."+e)[0])return;o.append(c),s.attr("overflow",""),c.on("click",function(a){o[this.title?"removeClass":"addClass"](t),this.title=this.title?"":"收缩"})}else o.find("."+e).remove(),s.removeAttr("overflow")})},hideTabMore:function(t){var i=a(".layui-tab-title");t!==!0&&"tabmore"===a(t.target).attr("lay-stope")||(i.removeClass("layui-tab-more"),i.find(".layui-tab-bar").attr("title",""))},clickThis:function(){var t=a(this),i=t.parents(o),n=i.attr("lay-filter"),s=t.parent(),c=t.siblings("."+d),y="string"==typeof s.attr("lay-unselect");"javascript:;"!==t.attr("href")&&"_blank"===t.attr("target")||y||c[0]||(i.find("."+l).removeClass(l),s.addClass(l)),i.hasClass(u)&&(c.removeClass(h),c[0]&&(s["none"===c.css("display")?"addClass":"removeClass"](r+"ed"),"all"===i.attr("lay-shrink")&&s.siblings().removeClass(r+"ed"))),layui.event.call(this,e,"nav("+n+")",t)},collapse:function(){var t=a(this),i=t.find(".layui-colla-icon"),l=t.siblings(".layui-colla-content"),s=t.parents(".layui-collapse").eq(0),o=s.attr("lay-filter"),r="none"===l.css("display");if("string"==typeof s.attr("lay-accordion")){var c=s.children(".layui-colla-item").children("."+n);c.siblings(".layui-colla-title").children(".layui-colla-icon").html(""),c.removeClass(n)}l[r?"addClass":"removeClass"](n),i.html(r?"":""),layui.event.call(this,e,"collapse("+o+")",{title:t,content:l,show:r})}};s.prototype.init=function(t,e){var l=function(){return e?'[lay-filter="'+e+'"]':""}(),s={tab:function(){f.tabAuto.call({})},nav:function(){var t=200,e={},s={},p={},b=function(l,o,r){var c=a(this),f=c.find("."+d);o.hasClass(u)?l.css({top:c.position().top,height:c.children("a").outerHeight(),opacity:1}):(f.addClass(h),l.css({left:c.position().left+parseFloat(c.css("marginLeft")),top:c.position().top+c.height()-l.height()}),e[r]=setTimeout(function(){l.css({width:c.width(),opacity:1})},i.ie&&i.ie<10?0:t),clearTimeout(p[r]),"block"===f.css("display")&&clearTimeout(s[r]),s[r]=setTimeout(function(){f.addClass(n),c.find("."+y).addClass(y+"d")},300))};a(o+l).each(function(i){var l=a(this),o=a(''),h=l.find("."+r);l.find("."+c)[0]||(l.append(o),h.on("mouseenter",function(){b.call(this,o,l,i)}).on("mouseleave",function(){l.hasClass(u)||(clearTimeout(s[i]),s[i]=setTimeout(function(){l.find("."+d).removeClass(n),l.find("."+y).removeClass(y+"d")},300))}),l.on("mouseleave",function(){clearTimeout(e[i]),p[i]=setTimeout(function(){l.hasClass(u)?o.css({height:0,top:o.position().top+o.height()/2,opacity:0}):o.css({width:0,left:o.position().left+o.width()/2,opacity:0})},t)})),h.find("a").each(function(){var t=a(this),i=(t.parent(),t.siblings("."+d));i[0]&&!t.children("."+y)[0]&&t.append(''),t.off("click",f.clickThis).on("click",f.clickThis)})})},breadcrumb:function(){var t=".layui-breadcrumb";a(t+l).each(function(){var t=a(this),i="lay-separator",e=t.attr(i)||"/",l=t.find("a");l.next("span["+i+"]")[0]||(l.each(function(t){t!==l.length-1&&a(this).after(""+e+"")}),t.css("visibility","visible"))})},progress:function(){var t="layui-progress";a("."+t+l).each(function(){var i=a(this),e=i.find(".layui-progress-bar"),l=e.attr("lay-percent");e.css("width",function(){return/^.+\/.+$/.test(l)?100*new Function("return "+l)()+"%":l}()),i.attr("lay-showPercent")&&setTimeout(function(){e.html(''+l+"")},350)})},collapse:function(){var t="layui-collapse";a("."+t+l).each(function(){var t=a(this).find(".layui-colla-item");t.each(function(){var t=a(this),i=t.find(".layui-colla-title"),e=t.find(".layui-colla-content"),l="none"===e.css("display");i.find(".layui-colla-icon").remove(),i.append(''+(l?"":"")+""),i.off("click",f.collapse).on("click",f.collapse)})})}};return s[t]?s[t]():layui.each(s,function(t,a){a()})},s.prototype.render=s.prototype.init;var p=new s,b=a(document);p.render();var v=".layui-tab-title li";b.on("click",v,f.tabClick),b.on("click",f.hideTabMore),a(window).on("resize",f.tabAuto),t(e,p)}); -------------------------------------------------------------------------------- /layui/layui.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;!function(e){"use strict";var t=document,n={modules:{},status:{},timeout:10,event:{}},o=function(){this.v="2.5.6"},r=function(){var e=t.currentScript?t.currentScript.src:function(){for(var e,n=t.scripts,o=n.length-1,r=o;r>0;r--)if("interactive"===n[r].readyState){e=n[r].src;break}return e||n[o].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),a=function(t){e.console&&console.error&&console.error("Layui hint: "+t)},i="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),u={layer:"modules/layer",laydate:"modules/laydate",laypage:"modules/laypage",laytpl:"modules/laytpl",layim:"modules/layim",layedit:"modules/layedit",form:"modules/form",upload:"modules/upload",transfer:"modules/transfer",tree:"modules/tree",table:"modules/table",element:"modules/element",rate:"modules/rate",colorpicker:"modules/colorpicker",slider:"modules/slider",carousel:"modules/carousel",flow:"modules/flow",util:"modules/util",code:"modules/code",jquery:"modules/jquery",mobile:"modules/mobile","layui.all":"../layui.all"};o.prototype.cache=n,o.prototype.define=function(e,t){var o=this,r="function"==typeof e,a=function(){var e=function(e,t){layui[e]=t,n.status[e]=!0};return"function"==typeof t&&t(function(o,r){e(o,r),n.callback[o]=function(){t(e)}}),this};return r&&(t=e,e=[]),!layui["layui.all"]&&layui["layui.mobile"]?a.call(o):(o.use(e,a),o)},o.prototype.use=function(e,o,l){function s(e,t){var o="PLaySTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/;("load"===e.type||o.test((e.currentTarget||e.srcElement).readyState))&&(n.modules[d]=t,y.removeChild(v),function r(){return++m>1e3*n.timeout/4?a(d+" is not a valid module"):void(n.status[d]?c():setTimeout(r,4))}())}function c(){l.push(layui[d]),e.length>1?p.use(e.slice(1),o,l):"function"==typeof o&&o.apply(layui,l)}var p=this,f=n.dir=n.dir?n.dir:r,y=t.getElementsByTagName("head")[0];e="string"==typeof e?[e]:e,window.jQuery&&jQuery.fn.on&&(p.each(e,function(t,n){"jquery"===n&&e.splice(t,1)}),layui.jquery=layui.$=jQuery);var d=e[0],m=0;if(l=l||[],n.host=n.host||(f.match(/\/\/([\s\S]+?)\//)||["//"+location.host+"/"])[0],0===e.length||layui["layui.all"]&&u[d]||!layui["layui.all"]&&layui["layui.mobile"]&&u[d])return c(),p;var h=(u[d]?f+"lay/":/^\{\/\}/.test(p.modules[d])?"":n.base||"")+(p.modules[d]||d)+".js";if(h=h.replace(/^\{\/\}/,""),!n.modules[d]&&layui[d]&&(n.modules[d]=h),n.modules[d])!function g(){return++m>1e3*n.timeout/4?a(d+" is not a valid module"):void("string"==typeof n.modules[d]&&n.status[d]?c():setTimeout(g,4))}();else{var v=t.createElement("script");v.async=!0,v.charset="utf-8",v.src=h+function(){var e=n.version===!0?n.v||(new Date).getTime():n.version||"";return e?"?v="+e:""}(),y.appendChild(v),!v.attachEvent||v.attachEvent.toString&&v.attachEvent.toString().indexOf("[native code")<0||i?v.addEventListener("load",function(e){s(e,h)},!1):v.attachEvent("onreadystatechange",function(e){s(e,h)}),n.modules[d]=h}return p},o.prototype.getStyle=function(t,n){var o=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return o[o.getPropertyValue?"getPropertyValue":"getAttribute"](n)},o.prototype.link=function(e,o,r){var i=this,u=t.createElement("link"),l=t.getElementsByTagName("head")[0];"string"==typeof o&&(r=o);var s=(r||e).replace(/\.|\//g,""),c=u.id="layuicss-"+s,p=0;return u.rel="stylesheet",u.href=e+(n.debug?"?v="+(new Date).getTime():""),u.media="all",t.getElementById(c)||l.appendChild(u),"function"!=typeof o?i:(function f(){return++p>1e3*n.timeout/100?a(e+" timeout"):void(1989===parseInt(i.getStyle(t.getElementById(c),"width"))?function(){o()}():setTimeout(f,100))}(),i)},n.callback={},o.prototype.factory=function(e){if(layui[e])return"function"==typeof n.callback[e]?n.callback[e]:null},o.prototype.addcss=function(e,t,o){return layui.link(n.dir+"css/"+e,t,o)},o.prototype.img=function(e,t,n){var o=new Image;return o.src=e,o.complete?t(o):(o.onload=function(){o.onload=null,"function"==typeof t&&t(o)},void(o.onerror=function(e){o.onerror=null,"function"==typeof n&&n(e)}))},o.prototype.config=function(e){e=e||{};for(var t in e)n[t]=e[t];return this},o.prototype.modules=function(){var e={};for(var t in u)e[t]=u[t];return e}(),o.prototype.extend=function(e){var t=this;e=e||{};for(var n in e)t[n]||t.modules[n]?a("模块名 "+n+" 已被占用"):t.modules[n]=e[n];return t},o.prototype.router=function(e){var t=this,e=e||location.hash,n={path:[],search:{},hash:(e.match(/[^#](#.*$)/)||[])[1]||""};return/^#\//.test(e)?(e=e.replace(/^#\//,""),n.href="/"+e,e=e.replace(/([^#])(#.*$)/,"$1").split("/")||[],t.each(e,function(e,t){/^\w+=/.test(t)?function(){t=t.split("="),n.search[t[0]]=t[1]}():n.path.push(t)}),n):n},o.prototype.url=function(e){var t=this,n={pathname:function(){var t=e?function(){var t=(e.match(/\.[^.]+?\/.+/)||[])[0]||"";return t.replace(/^[^\/]+/,"").replace(/\?.+/,"")}():location.pathname;return t.replace(/^\//,"").split("/")}(),search:function(){var n={},o=(e?(e.match(/\?.+/)||[])[0]||"":location.search).replace(/^\?+/,"").split("&");return t.each(o,function(e,t){var o=t.indexOf("="),r=function(){return o<0?t.substr(0,t.length):0!==o&&t.substr(0,o)}();r&&(n[r]=o>0?t.substr(o+1):null)}),n}(),hash:t.router(function(){return e?(e.match(/#.+/)||[])[0]||"":location.hash}())};return n},o.prototype.data=function(t,n,o){if(t=t||"layui",o=o||localStorage,e.JSON&&e.JSON.parse){if(null===n)return delete o[t];n="object"==typeof n?n:{key:n};try{var r=JSON.parse(o[t])}catch(a){var r={}}return"value"in n&&(r[n.key]=n.value),n.remove&&delete r[n.key],o[t]=JSON.stringify(r),n.key?r[n.key]:r}},o.prototype.sessionData=function(e,t){return this.data(e,t,sessionStorage)},o.prototype.device=function(t){var n=navigator.userAgent.toLowerCase(),o=function(e){var t=new RegExp(e+"/([^\\s\\_\\-]+)");return e=(n.match(t)||[])[1],e||!1},r={os:function(){return/windows/.test(n)?"windows":/linux/.test(n)?"linux":/iphone|ipod|ipad|ios/.test(n)?"ios":/mac/.test(n)?"mac":void 0}(),ie:function(){return!!(e.ActiveXObject||"ActiveXObject"in e)&&((n.match(/msie\s(\d+)/)||[])[1]||"11")}(),weixin:o("micromessenger")};return t&&!r[t]&&(r[t]=o(t)),r.android=/android/.test(n),r.ios="ios"===r.os,r.mobile=!(!r.android&&!r.ios),r},o.prototype.hint=function(){return{error:a}},o.prototype.each=function(e,t){var n,o=this;if("function"!=typeof t)return o;if(e=e||[],e.constructor===Object){for(n in e)if(t.call(e[n],n,e[n]))break}else for(n=0;na?1:rli,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{background-color:#f8f8f8!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} -------------------------------------------------------------------------------- /cascader/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | layui扩展无限级联选择器cascader 10 | 11 | 12 | 13 | 14 | 15 | 16 |
    17 | 18 |
    19 | 20 |
    21 |
    22 |
    23 | 24 |
    25 | 26 |
    27 |
    28 | 29 | 30 | 31 | 32 | 183 | 192 | 193 | 194 | -------------------------------------------------------------------------------- /layui/lay/mymodules/scrollBar.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @Name: 滚动条 3 | * @Author: 李祥 4 | * @License:MIT 5 | * 最近修改时间: 2019/06/17 6 | */ 7 | 8 | /** 9 | * 使用: 10 | var s=scrollBar({ 11 | el: ".scroll", 12 | color: "#888", 13 | width: "7px" 14 | }) 15 | s.resetHeight(); // 重新计算滚动条高度 16 | * 17 | */ 18 | 19 | layui.define(["jquery"], function (exports) { 20 | var $ = layui.jquery; 21 | 22 | function ScrollBar(options) { 23 | this.options = options; // 获取传入的数据 24 | this.contentEL = $(options.el); 25 | this.wrapEl = ""; 26 | this.rate = 0; 27 | this.scrollBarBodyHeight = 0; 28 | this.maxCurrent = 0; 29 | this.y = 0; 30 | this.pageY = 0; 31 | this.current = 0; 32 | 33 | this.scrollBarEL = ""; 34 | this.scrollBarBodyEL = ""; 35 | 36 | this.color = this.options.color || "#aaa"; 37 | this.width = this.options.width || "6px"; 38 | 39 | this.init(); 40 | } 41 | 42 | ScrollBar.prototype = { 43 | constructor: ScrollBar, 44 | init: function () { 45 | this.wrapEl = this.contentEL.parent().addClass("urp-scroll").append( 46 | '
    ' + 47 | '
    ' + 48 | '
    ' 49 | ); 50 | 51 | var res = new RegExp(/[A-Za-z]+$/); 52 | var pRight = this.width; 53 | if (res.exec(this.width)[0] === "px") { 54 | pRight = parseFloat(this.width) + 10 + "px" 55 | } 56 | this.contentEL.css("padding-right", pRight); 57 | this.scrollBarEL = this.wrapEl.children(".urp-scrollBar"); 58 | this.scrollBarBodyEL = this.scrollBarEL.children(".urp-scrollBar-body"); 59 | this.countHeight(); 60 | this.event(); 61 | }, 62 | countHeight: function () { 63 | this.rate = this.wrapEl.height() / this.contentEL.height(); 64 | if (this.rate > 1) { 65 | this.rate = 1; 66 | this.scrollBarEL.css("opacity", 0); 67 | } else { 68 | this.scrollBarEL.css("opacity", 1); 69 | } 70 | this.scrollBarBodyHeight = this.scrollBarEL.height() * this.rate; 71 | this.scrollBarBodyEL.css("height", this.scrollBarBodyHeight); 72 | // 重新计算最大位置 73 | this.maxCurrent = this.scrollBarEL.height() - this.scrollBarBodyHeight; 74 | // 如果当前的位置超出最大位置,则重置当前位置为最大位置 75 | this.current = this.current > this.maxCurrent ? this.maxCurrent : this.current; 76 | this.scrollFn(); 77 | }, 78 | scrollFn: function () { 79 | if (this.current < 0) { 80 | this.current = 0; 81 | } 82 | if (this.current > this.maxCurrent) { 83 | this.current = this.maxCurrent; 84 | } 85 | this.scrollBarBodyEL.css("top", this.current + "px"); 86 | this.wrapEl.scrollTop(this.current / this.rate); 87 | this.scrollBarEL.css("top", this.current / this.rate + "px"); 88 | }, 89 | down: function (type, e) { 90 | var clientY = 0, moveType, endType; 91 | if (type === "mouse") { 92 | // 滚动条拖拽滚动 93 | this.y = e.clientY - this.wrapEl.offset().top - this.scrollBarBodyEL.position().top + $(document).scrollTop(); 94 | moveType = "mousemove"; 95 | endType = "mouseup"; 96 | } else if (type === "touch") { 97 | // 滚动条手势滚动 98 | this.y = e.originalEvent.touches[0].clientY - this.wrapEl.offset().top - this.scrollBarBodyEL.position().top + $(document).scrollTop(); 99 | moveType = "touchmove"; 100 | endType = "touchend"; 101 | } else { 102 | // 页面手势滚动 103 | this.pageY = e.originalEvent.touches[0].pageY; 104 | moveType = "touchmove"; 105 | endType = "touchend"; 106 | } 107 | var scrollFn = this.throttle(this.move.bind(this, type)); 108 | $(document).on(moveType + ".move", scrollFn); 109 | $(document).on(endType + ".up", function () { 110 | $(document).off(".move").off(".up"); 111 | }) 112 | }, 113 | move: function (type, e) { 114 | var clientY = 0; 115 | e.preventDefault(); 116 | if (type === "mouse") { 117 | this.current = e.clientY - this.y - this.wrapEl.offset().top + $(document).scrollTop(); 118 | } else if (type === "touch") { 119 | this.current = e.originalEvent.touches[0].clientY - this.y - this.wrapEl.offset().top + $(document).scrollTop(); 120 | } else { 121 | this.current = this.current - (e.originalEvent.touches[0].pageY - this.pageY) / 10; 122 | } 123 | this.scrollFn(); 124 | window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty(); 125 | }, 126 | event: function () { 127 | var that = this; 128 | this.scrollBarBodyEL.on("mousedown", this.down.bind(this, "mouse")); 129 | this.scrollBarBodyEL.on("touchstart", this.down.bind(this, "touch")); 130 | this.contentEL.on("touchstart", this.down.bind(this, "contentTouch")); 131 | this.scrollBarBodyEL.on("click", function (e) { 132 | e.stopPropagation(); 133 | }); 134 | this.scrollBarEL.on("click", function (e) { 135 | var y = e.clientY - that.wrapEl.offset().top + $(document).scrollTop(); 136 | // 判断点击的是上面还是下面 137 | if (y > that.current) { 138 | that.current += that.scrollBarBodyHeight; 139 | } else { 140 | that.current -= that.scrollBarBodyHeight; 141 | } 142 | that.scrollFn(); 143 | }) 144 | 145 | var f = function (e) { 146 | var value = e.originalEvent.wheelDelta || -e.originalEvent.detail; 147 | that.current = value > 0 ? that.current - 15 : that.current + 15; 148 | that.scrollFn(); 149 | 150 | if (that.current >= that.maxCurrent || that.current <= 0) { 151 | // 滚动到最大最小时,重新绑定事件,相当于移除preventDefault 152 | that.wrapEl.off("mousewheel DOMMouseScroll", f).on("mousewheel DOMMouseScroll", f); 153 | } else { 154 | e.preventDefault(); 155 | } 156 | } 157 | this.wrapEl.on("mousewheel DOMMouseScroll", f); 158 | 159 | var scrollFn = this.throttle(function () { 160 | that.countHeight(); 161 | }); 162 | $(window).on("resize", scrollFn); 163 | }, 164 | // 节流函数 165 | throttle: function (callback, time) { 166 | var timer = null; 167 | var firstTime = true; 168 | return function () { 169 | var args = arguments; 170 | var _self = this; 171 | if (firstTime) { 172 | callback.apply(_self, args); 173 | return firstTime = false; 174 | } 175 | if (timer) { 176 | return false; 177 | } 178 | timer = setTimeout(function () { 179 | clearTimeout(timer); 180 | timer = null; 181 | callback.apply(_self, args); 182 | }, time || 50) 183 | 184 | } 185 | } 186 | } 187 | 188 | 189 | exports('scrollBar', function (options) { 190 | var inst = new ScrollBar(options); 191 | var obj = { 192 | resetHeight: inst.countHeight.bind(inst) 193 | } 194 | return obj; 195 | }); 196 | }) -------------------------------------------------------------------------------- /layui/lay/modules/form.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("layer",function(e){"use strict";var t=layui.$,i=layui.layer,a=layui.hint(),n=layui.device(),l="form",r=".layui-form",s="layui-this",o="layui-hide",c="layui-disabled",u=function(){this.config={verify:{required:[/[\S]+/,"必填项不能为空"],phone:[/^1\d{10}$/,"请输入正确的手机号"],email:[/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,"邮箱格式不正确"],url:[/(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/,"链接格式不正确"],number:function(e){if(!e||isNaN(e))return"只能填写数字"},date:[/^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/,"日期格式不正确"],identity:[/(^\d{15}$)|(^\d{17}(x|X|\d)$)/,"请输入正确的身份证号"]}}};u.prototype.set=function(e){var i=this;return t.extend(!0,i.config,e),i},u.prototype.verify=function(e){var i=this;return t.extend(!0,i.config.verify,e),i},u.prototype.on=function(e,t){return layui.onevent.call(this,l,e,t)},u.prototype.val=function(e,i){var a=this,n=t(r+'[lay-filter="'+e+'"]');return n.each(function(e,a){var n=t(this);layui.each(i,function(e,t){var i,a=n.find('[name="'+e+'"]');a[0]&&(i=a[0].type,"checkbox"===i?a[0].checked=t:"radio"===i?a.each(function(){this.value==t&&(this.checked=!0)}):a.val(t))})}),f.render(null,e),a.getValue(e)},u.prototype.getValue=function(e,i){i=i||t(r+'[lay-filter="'+e+'"]').eq(0);var a={},n={},l=i.find("input,select,textarea");return layui.each(l,function(e,t){if(t.name=(t.name||"").replace(/^\s*|\s*&/,""),t.name){if(/^.*\[\]$/.test(t.name)){var i=t.name.match(/^(.*)\[\]$/g)[0];a[i]=0|a[i],t.name=t.name.replace(/^(.*)\[\]$/,"$1["+a[i]++ +"]")}/^checkbox|radio$/.test(t.type)&&!t.checked||(n[t.name]=t.value)}}),n},u.prototype.render=function(e,i){var n=this,u=t(r+function(){return i?'[lay-filter="'+i+'"]':""}()),d={select:function(){var e,i="请选择",a="layui-form-select",n="layui-select-title",r="layui-select-none",d="",f=u.find("select"),v=function(i,l){t(i.target).parent().hasClass(n)&&!l||(t("."+a).removeClass(a+"ed "+a+"up"),e&&d&&e.val(d)),e=null},y=function(i,u,f){var y,p=t(this),m=i.find("."+n),k=m.find("input"),g=i.find("dl"),x=g.children("dd"),b=this.selectedIndex;if(!u){var C=function(){var e=i.offset().top+i.outerHeight()+5-h.scrollTop(),t=g.outerHeight();b=p[0].selectedIndex,i.addClass(a+"ed"),x.removeClass(o),y=null,x.eq(b).addClass(s).siblings().removeClass(s),e+t>h.height()&&e>=t&&i.addClass(a+"up"),T()},w=function(e){i.removeClass(a+"ed "+a+"up"),k.blur(),y=null,e||$(k.val(),function(e){var i=p[0].selectedIndex;e&&(d=t(p[0].options[i]).html(),0===i&&d===k.attr("placeholder")&&(d=""),k.val(d||""))})},T=function(){var e=g.children("dd."+s);if(e[0]){var t=e.position().top,i=g.height(),a=e.height();t>i&&g.scrollTop(t+g.scrollTop()-i+a-5),t<0&&g.scrollTop(t+g.scrollTop()-5)}};m.on("click",function(e){i.hasClass(a+"ed")?w():(v(e,!0),C()),g.find("."+r).remove()}),m.find(".layui-edge").on("click",function(){k.focus()}),k.on("keyup",function(e){var t=e.keyCode;9===t&&C()}).on("keydown",function(e){var t=e.keyCode;9===t&&w();var i=function(t,a){var n,l;e.preventDefault();var r=function(){var e=g.children("dd."+s);if(g.children("dd."+o)[0]&&"next"===t){var i=g.children("dd:not(."+o+",."+c+")"),n=i.eq(0).index();if(n>=0&&n无匹配项

    '):g.find("."+r).remove()},"keyup"),""===t&&g.find("."+r).remove(),void T())};f&&k.on("keyup",q).on("blur",function(i){var a=p[0].selectedIndex;e=k,d=t(p[0].options[a]).html(),0===a&&d===k.attr("placeholder")&&(d=""),setTimeout(function(){$(k.val(),function(e){d||k.val("")},"blur")},200)}),x.on("click",function(){var e=t(this),a=e.attr("lay-value"),n=p.attr("lay-filter");return!e.hasClass(c)&&(e.hasClass("layui-select-tips")?k.val(""):(k.val(e.text()),e.addClass(s)),e.siblings().removeClass(s),p.val(a).removeClass("layui-form-danger"),layui.event.call(this,l,"select("+n+")",{elem:p[0],value:a,othis:i}),w(!0),!1)}),i.find("dl>dt").on("click",function(e){return!1}),t(document).off("click",v).on("click",v)}};f.each(function(e,l){var r=t(this),o=r.next("."+a),u=this.disabled,d=l.value,f=t(l.options[l.selectedIndex]),v=l.options[0];if("string"==typeof r.attr("lay-ignore"))return r.show();var h="string"==typeof r.attr("lay-search"),p=v?v.value?i:v.innerHTML||i:i,m=t(['
    ','
    ','','
    ','
    ',function(e){var t=[];return layui.each(e,function(e,a){0!==e||a.value?"optgroup"===a.tagName.toLowerCase()?t.push("
    "+a.label+"
    "):t.push('
    '+a.innerHTML+"
    "):t.push('
    '+(a.innerHTML||i)+"
    ")}),0===t.length&&t.push('
    没有选项
    '),t.join("")}(r.find("*"))+"
    ","
    "].join(""));o[0]&&o.remove(),r.after(m),y.call(this,m,u,h)})},checkbox:function(){var e={checkbox:["layui-form-checkbox","layui-form-checked","checkbox"],_switch:["layui-form-switch","layui-form-onswitch","switch"]},i=u.find("input[type=checkbox]"),a=function(e,i){var a=t(this);e.on("click",function(){var t=a.attr("lay-filter"),n=(a.attr("lay-text")||"").split("|");a[0].disabled||(a[0].checked?(a[0].checked=!1,e.removeClass(i[1]).find("em").text(n[1])):(a[0].checked=!0,e.addClass(i[1]).find("em").text(n[0])),layui.event.call(a[0],l,i[2]+"("+t+")",{elem:a[0],value:a[0].value,othis:e}))})};i.each(function(i,n){var l=t(this),r=l.attr("lay-skin"),s=(l.attr("lay-text")||"").split("|"),o=this.disabled;"switch"===r&&(r="_"+r);var u=e[r]||e.checkbox;if("string"==typeof l.attr("lay-ignore"))return l.show();var d=l.next("."+u[0]),f=t(['
    ",function(){var e=n.title.replace(/\s/g,""),t={checkbox:[e?""+n.title+"":"",''].join(""),_switch:""+((n.checked?s[0]:s[1])||"")+""};return t[r]||t.checkbox}(),"
    "].join(""));d[0]&&d.remove(),l.after(f),a.call(this,f,u)})},radio:function(){var e="layui-form-radio",i=["",""],a=u.find("input[type=radio]"),n=function(a){var n=t(this),s="layui-anim-scaleSpring";a.on("click",function(){var o=n[0].name,c=n.parents(r),u=n.attr("lay-filter"),d=c.find("input[name="+o.replace(/(\.|#|\[|\])/g,"\\$1")+"]");n[0].disabled||(layui.each(d,function(){var a=t(this).next("."+e);this.checked=!1,a.removeClass(e+"ed"),a.find(".layui-icon").removeClass(s).html(i[1])}),n[0].checked=!0,a.addClass(e+"ed"),a.find(".layui-icon").addClass(s).html(i[0]),layui.event.call(n[0],l,"radio("+u+")",{elem:n[0],value:n[0].value,othis:a}))})};a.each(function(a,l){var r=t(this),s=r.next("."+e),o=this.disabled;if("string"==typeof r.attr("lay-ignore"))return r.show();s[0]&&s.remove();var u=t(['
    ',''+i[l.checked?0:1]+"","
    "+function(){var e=l.title||"";return"string"==typeof r.next().attr("lay-radio")&&(e=r.next().html(),r.next().remove()),e}()+"
    ","
    "].join(""));r.after(u),n.call(this,u)})}};return e?d[e]?d[e]():a.error("不支持的"+e+"表单渲染"):layui.each(d,function(e,t){t()}),n};var d=function(){var e=null,a=f.config.verify,s="layui-form-danger",o={},c=t(this),u=c.parents(r),d=u.find("*[lay-verify]"),v=c.parents("form")[0],h=c.attr("lay-filter");return layui.each(d,function(l,r){var o=t(this),c=o.attr("lay-verify").split("|"),u=o.attr("lay-verType"),d=o.val();if(o.removeClass(s),layui.each(c,function(t,l){var c,f="",v="function"==typeof a[l];if(a[l]){var c=v?f=a[l](d,r):!a[l][0].test(d);if(f=f||a[l][1],"required"===l&&(f=o.attr("lay-reqText")||f),c)return"tips"===u?i.tips(f,function(){return"string"==typeof o.attr("lay-ignore")||"select"!==r.tagName.toLowerCase()&&!/^checkbox|radio$/.test(r.type)?o:o.next()}(),{tips:1}):"alert"===u?i.alert(f,{title:"提示",shadeClose:!0}):i.msg(f,{icon:5,shift:6}),n.android||n.ios||setTimeout(function(){r.focus()},7),o.addClass(s),e=!0}}),e)return e}),!e&&(o=f.getValue(null,u),layui.event.call(this,l,"submit("+h+")",{elem:this,form:v,field:o}))},f=new u,v=t(document),h=t(window);f.render(),v.on("reset",r,function(){var e=t(this).attr("lay-filter");setTimeout(function(){f.render(null,e)},50)}),v.on("submit",r,d).on("click","*[lay-submit]",d),e(l,f)}); -------------------------------------------------------------------------------- /layui/css/layui.mobile.css: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | blockquote,body,button,dd,div,dl,dt,form,h1,h2,h3,h4,h5,h6,input,legend,li,ol,p,td,textarea,th,ul{margin:0;padding:0;-webkit-tap-highlight-color:rgba(0,0,0,0)}html{font:12px 'Helvetica Neue','PingFang SC',STHeitiSC-Light,Helvetica,Arial,sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}a,button,input{-webkit-tap-highlight-color:rgba(255,0,0,0)}a{text-decoration:none;background:0 0}a:active,a:hover{outline:0}table{border-collapse:collapse;border-spacing:0}li{list-style:none}b,strong{font-weight:700}h1,h2,h3,h4,h5,h6{font-weight:500}address,cite,dfn,em,var{font-style:normal}dfn{font-style:italic}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}img{border:0;vertical-align:bottom}.layui-inline,input,label{vertical-align:middle}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0;outline:0}button,select{text-transform:none}select{-webkit-appearance:none;border:none}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}@font-face{font-family:layui-icon;src:url(../font/iconfont.eot?v=1.0.7);src:url(../font/iconfont.eot?v=1.0.7#iefix) format('embedded-opentype'),url(../font/iconfont.woff?v=1.0.7) format('woff'),url(../font/iconfont.ttf?v=1.0.7) format('truetype'),url(../font/iconfont.svg?v=1.0.7#iconfont) format('svg')}.layui-icon{font-family:layui-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.layui-box,.layui-box *{-webkit-box-sizing:content-box!important;-moz-box-sizing:content-box!important;box-sizing:content-box!important}.layui-border-box,.layui-border-box *{-webkit-box-sizing:border-box!important;-moz-box-sizing:border-box!important;box-sizing:border-box!important}.layui-inline{position:relative;display:inline-block;*display:inline;*zoom:1}.layui-edge,.layui-upload-iframe{position:absolute;width:0;height:0}.layui-edge{border-style:dashed;border-color:transparent;overflow:hidden}.layui-elip{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-unselect{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-disabled,.layui-disabled:active{background-color:#d2d2d2!important;color:#fff!important;cursor:not-allowed!important}.layui-circle{border-radius:100%}.layui-show{display:block!important}.layui-hide{display:none!important}.layui-upload-iframe{border:0;visibility:hidden}.layui-upload-enter{border:1px solid #009E94;background-color:#009E94;color:#fff;-webkit-transform:scale(1.1);transform:scale(1.1)}@-webkit-keyframes layui-m-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes layui-m-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}.layui-m-anim-scale{animation-name:layui-m-anim-scale;-webkit-animation-name:layui-m-anim-scale}@-webkit-keyframes layui-m-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layui-m-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}.layui-m-anim-up{-webkit-animation-name:layui-m-anim-up;animation-name:layui-m-anim-up}@-webkit-keyframes layui-m-anim-left{0%{-webkit-transform:translateX(100%);transform:translateX(100%)}100%{-webkit-transform:translateX(0);transform:translateX(0)}}@keyframes layui-m-anim-left{0%{-webkit-transform:translateX(100%);transform:translateX(100%)}100%{-webkit-transform:translateX(0);transform:translateX(0)}}.layui-m-anim-left{-webkit-animation-name:layui-m-anim-left;animation-name:layui-m-anim-left}@-webkit-keyframes layui-m-anim-right{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}100%{-webkit-transform:translateX(0);transform:translateX(0)}}@keyframes layui-m-anim-right{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}100%{-webkit-transform:translateX(0);transform:translateX(0)}}.layui-m-anim-right{-webkit-animation-name:layui-m-anim-right;animation-name:layui-m-anim-right}@-webkit-keyframes layui-m-anim-lout{0%{-webkit-transform:translateX(0);transform:translateX(0)}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}}@keyframes layui-m-anim-lout{0%{-webkit-transform:translateX(0);transform:translateX(0)}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}}.layui-m-anim-lout{-webkit-animation-name:layui-m-anim-lout;animation-name:layui-m-anim-lout}@-webkit-keyframes layui-m-anim-rout{0%{-webkit-transform:translateX(0);transform:translateX(0)}100%{-webkit-transform:translateX(100%);transform:translateX(100%)}}@keyframes layui-m-anim-rout{0%{-webkit-transform:translateX(0);transform:translateX(0)}100%{-webkit-transform:translateX(100%);transform:translateX(100%)}}.layui-m-anim-rout{-webkit-animation-name:layui-m-anim-rout;animation-name:layui-m-anim-rout}.layui-m-layer{position:relative;z-index:19891014}.layui-m-layer *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.layui-m-layermain,.layui-m-layershade{position:fixed;left:0;top:0;width:100%;height:100%}.layui-m-layershade{background-color:rgba(0,0,0,.7);pointer-events:auto}.layui-m-layermain{display:table;font-family:Helvetica,arial,sans-serif;pointer-events:none}.layui-m-layermain .layui-m-layersection{display:table-cell;vertical-align:middle;text-align:center}.layui-m-layerchild{position:relative;display:inline-block;text-align:left;background-color:#fff;font-size:14px;border-radius:5px;box-shadow:0 0 8px rgba(0,0,0,.1);pointer-events:auto;-webkit-overflow-scrolling:touch;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.2s;animation-duration:.2s}.layui-m-layer0 .layui-m-layerchild{width:90%;max-width:640px}.layui-m-layer1 .layui-m-layerchild{border:none;border-radius:0}.layui-m-layer2 .layui-m-layerchild{width:auto;max-width:260px;min-width:40px;border:none;background:0 0;box-shadow:none;color:#fff}.layui-m-layerchild h3{padding:0 10px;height:60px;line-height:60px;font-size:16px;font-weight:400;border-radius:5px 5px 0 0;text-align:center}.layui-m-layerbtn span,.layui-m-layerchild h3{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-m-layercont{padding:50px 30px;line-height:22px;text-align:center}.layui-m-layer1 .layui-m-layercont{padding:0;text-align:left}.layui-m-layer2 .layui-m-layercont{text-align:center;padding:0;line-height:0}.layui-m-layer2 .layui-m-layercont i{width:25px;height:25px;margin-left:8px;display:inline-block;background-color:#fff;border-radius:100%;-webkit-animation:layui-m-anim-loading 1.4s infinite ease-in-out;animation:layui-m-anim-loading 1.4s infinite ease-in-out;-webkit-animation-fill-mode:both;animation-fill-mode:both}.layui-m-layerbtn,.layui-m-layerbtn span{position:relative;text-align:center;border-radius:0 0 5px 5px}.layui-m-layer2 .layui-m-layercont p{margin-top:20px}@-webkit-keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}@keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}.layui-m-layer2 .layui-m-layercont i:first-child{margin-left:0;-webkit-animation-delay:-.32s;animation-delay:-.32s}.layui-m-layer2 .layui-m-layercont i.layui-m-layerload{-webkit-animation-delay:-.16s;animation-delay:-.16s}.layui-m-layer2 .layui-m-layercont>div{line-height:22px;padding-top:7px;margin-bottom:20px;font-size:14px}.layui-m-layerbtn{display:box;display:-moz-box;display:-webkit-box;width:100%;height:50px;line-height:50px;font-size:0;border-top:1px solid #D0D0D0;background-color:#F2F2F2}.layui-m-layerbtn span{display:block;-moz-box-flex:1;box-flex:1;-webkit-box-flex:1;font-size:14px;cursor:pointer}.layui-m-layerbtn span[yes]{color:#40AFFE}.layui-m-layerbtn span[no]{border-right:1px solid #D0D0D0;border-radius:0 0 0 5px}.layui-m-layerbtn span:active{background-color:#F6F6F6}.layui-m-layerend{position:absolute;right:7px;top:10px;width:30px;height:30px;border:0;font-weight:400;background:0 0;cursor:pointer;-webkit-appearance:none;font-size:30px}.layui-m-layerend::after,.layui-m-layerend::before{position:absolute;left:5px;top:15px;content:'';width:18px;height:1px;background-color:#999;transform:rotate(45deg);-webkit-transform:rotate(45deg);border-radius:3px}.layui-m-layerend::after{transform:rotate(-45deg);-webkit-transform:rotate(-45deg)}body .layui-m-layer .layui-m-layer-footer{position:fixed;width:95%;max-width:100%;margin:0 auto;left:0;right:0;bottom:10px;background:0 0}.layui-m-layer-footer .layui-m-layercont{padding:20px;border-radius:5px 5px 0 0;background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn{display:block;height:auto;background:0 0;border-top:none}.layui-m-layer-footer .layui-m-layerbtn span{background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn span[no]{color:#FD482C;border-top:1px solid #c2c2c2;border-radius:0 0 5px 5px}.layui-m-layer-footer .layui-m-layerbtn span[yes]{margin-top:10px;border-radius:5px}body .layui-m-layer .layui-m-layer-msg{width:auto;max-width:90%;margin:0 auto;bottom:-150px;background-color:rgba(0,0,0,.7);color:#fff}.layui-m-layer-msg .layui-m-layercont{padding:10px 20px} -------------------------------------------------------------------------------- /layui/lay/modules/tree.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("form",function(e){"use strict";var i=layui.$,a=layui.form,n=layui.layer,t="tree",r={config:{},index:layui[t]?layui[t].index+1e4:0,set:function(e){var a=this;return a.config=i.extend({},a.config,e),a},on:function(e,i){return layui.onevent.call(this,t,e,i)}},l=function(){var e=this,i=e.config,a=i.id||e.index;return l.that[a]=e,l.config[a]=i,{config:i,reload:function(i){e.reload.call(e,i)},getChecked:function(){return e.getChecked.call(e)},setChecked:function(i){return e.setChecked.call(e,i)}}},c="layui-hide",d="layui-disabled",s="layui-tree-set",o="layui-tree-iconClick",h="layui-icon-addition",u="layui-icon-subtraction",p="layui-tree-entry",f="layui-tree-main",y="layui-tree-txt",v="layui-tree-pack",C="layui-tree-spread",k="layui-tree-setLineShort",m="layui-tree-showLine",x="layui-tree-lineExtend",b=function(e){var a=this;a.index=++r.index,a.config=i.extend({},a.config,r.config,e),a.render()};b.prototype.config={data:[],showCheckbox:!1,showLine:!0,accordion:!1,onlyIconControl:!1,isJump:!1,edit:!1,text:{defaultNodeName:"未命名",none:"无数据"}},b.prototype.reload=function(e){var a=this;layui.each(e,function(e,i){i.constructor===Array&&delete a.config[e]}),a.config=i.extend(!0,{},a.config,e),a.render()},b.prototype.render=function(){var e=this,a=e.config;e.checkids=[];var n=i('
    ');e.tree(n);var t=a.elem=i(a.elem);if(t[0]){if(e.key=a.id||e.index,e.elem=n,e.elemNone=i('
    '+a.text.none+"
    "),t.html(e.elem),0==e.elem.find(".layui-tree-set").length)return e.elem.append(e.elemNone);a.showCheckbox&&e.renderForm("checkbox"),e.elem.find(".layui-tree-set").each(function(){var e=i(this);e.parent(".layui-tree-pack")[0]||e.addClass("layui-tree-setHide"),!e.next()[0]&&e.parents(".layui-tree-pack").eq(1).hasClass("layui-tree-lineExtend")&&e.addClass(k),e.next()[0]||e.parents(".layui-tree-set").eq(0).next()[0]||e.addClass(k)}),e.events()}},b.prototype.renderForm=function(e){a.render(e,"LAY-tree-"+this.index)},b.prototype.tree=function(e,a){var n=this,t=n.config,r=a||t.data;layui.each(r,function(a,r){var l=r.children&&r.children.length>0,o=i('
    '),h=i(['
    ','
    ','
    ',function(){return t.showLine?l?'':'':''}(),function(){return t.showCheckbox?'':""}(),function(){return t.isJump&&r.href?''+(r.title||r.label||t.text.defaultNodeName)+"":''+(r.title||r.label||t.text.defaultNodeName)+""}(),"
    ",function(){if(!t.edit)return"";var e={add:'',update:'',del:''},i=['
    '];return t.edit===!0&&(t.edit=["update","del"]),"object"==typeof t.edit?(layui.each(t.edit,function(a,n){i.push(e[n]||"")}),i.join("")+"
    "):void 0}(),"
    "].join(""));l&&(h.append(o),n.tree(o,r.children)),e.append(h),h.prev("."+s)[0]&&h.prev().children(".layui-tree-pack").addClass("layui-tree-showLine"),l||h.parent(".layui-tree-pack").addClass("layui-tree-lineExtend"),n.spread(h,r),t.showCheckbox&&(r.checked&&n.checkids.push(r.id),n.checkClick(h,r)),t.edit&&n.operate(h,r)})},b.prototype.spread=function(e,a){var n=this,t=n.config,r=e.children("."+p),l=r.children("."+f),c=r.find("."+o),k=r.find("."+y),m=t.onlyIconControl?c:l,x="";m.on("click",function(i){var a=e.children("."+v),n=m.children(".layui-icon")[0]?m.children(".layui-icon"):m.find(".layui-tree-icon").children(".layui-icon");if(a[0]){if(e.hasClass(C))e.removeClass(C),a.slideUp(200),n.removeClass(u).addClass(h);else if(e.addClass(C),a.slideDown(200),n.addClass(u).removeClass(h),t.accordion){var r=e.siblings("."+s);r.removeClass(C),r.children("."+v).slideUp(200),r.find(".layui-tree-icon").children(".layui-icon").removeClass(u).addClass(h)}}else x="normal"}),k.on("click",function(){var n=i(this);n.hasClass(d)||(x=e.hasClass(C)?t.onlyIconControl?"open":"close":t.onlyIconControl?"close":"open",t.click&&t.click({elem:e,state:x,data:a}))})},b.prototype.setCheckbox=function(e,i,a){var n=this,t=(n.config,a.prop("checked"));if(!a.prop("disabled")){if("object"==typeof i.children||e.find("."+v)[0]){var r=e.find("."+v).find('input[same="layuiTreeCheck"]');r.each(function(){this.disabled||(this.checked=t)})}var l=function(e){if(e.parents("."+s)[0]){var i,a=e.parent("."+v),n=a.parent(),r=a.prev().find('input[same="layuiTreeCheck"]');t?r.prop("checked",t):(a.find('input[same="layuiTreeCheck"]').each(function(){this.checked&&(i=!0)}),i||r.prop("checked",!1)),l(n)}};l(e),n.renderForm("checkbox")}},b.prototype.checkClick=function(e,a){var n=this,t=n.config,r=e.children("."+p),l=r.children("."+f);l.on("click",'input[same="layuiTreeCheck"]+',function(r){layui.stope(r);var l=i(this).prev(),c=l.prop("checked");l.prop("disabled")||(n.setCheckbox(e,a,l),t.oncheck&&t.oncheck({elem:e,checked:c,data:a}))})},b.prototype.operate=function(e,a){var t=this,r=t.config,l=e.children("."+p),d=l.children("."+f);l.children(".layui-tree-btnGroup").on("click",".layui-icon",function(l){layui.stope(l);var f=i(this).data("type"),b=e.children("."+v),g={data:a,type:f,elem:e};if("add"==f){b[0]||(r.showLine?(d.find("."+o).addClass("layui-tree-icon"),d.find("."+o).children(".layui-icon").addClass(h).removeClass("layui-icon-file")):d.find(".layui-tree-iconArrow").removeClass(c),e.append('
    '));var w=r.operate&&r.operate(g),N={};if(N.title=r.text.defaultNodeName,N.id=w,t.tree(e.children("."+v),[N]),r.showLine)if(b[0])b.hasClass(x)||b.addClass(x),e.find("."+v).each(function(){i(this).children("."+s).last().addClass(k)}),b.children("."+s).last().prev().hasClass(k)?b.children("."+s).last().prev().removeClass(k):b.children("."+s).last().removeClass(k),!e.parent("."+v)[0]&&e.next()[0]&&b.children("."+s).last().removeClass(k);else{var T=e.siblings("."+s),L=1,A=e.parent("."+v);layui.each(T,function(e,a){i(a).children("."+v)[0]||(L=0)}),1==L?(T.children("."+v).addClass(m),T.children("."+v).children("."+s).removeClass(k),e.children("."+v).addClass(m),A.removeClass(x),A.children("."+s).last().children("."+v).children("."+s).last().addClass(k)):e.children("."+v).children("."+s).addClass(k)}if(!r.showCheckbox)return;if(d.find('input[same="layuiTreeCheck"]')[0].checked){var I=e.children("."+v).children("."+s).last();I.find('input[same="layuiTreeCheck"]')[0].checked=!0}t.renderForm("checkbox")}else if("update"==f){var F=d.children("."+y).html();d.children("."+y).html(""),d.append(''),d.children(".layui-tree-editInput").val(F).focus();var j=function(e){var i=e.val().trim();i=i?i:r.text.defaultNodeName,e.remove(),d.children("."+y).html(i),g.data.title=i,r.operate&&r.operate(g)};d.children(".layui-tree-editInput").blur(function(){j(i(this))}),d.children(".layui-tree-editInput").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),j(i(this)))})}else n.confirm('确认删除该节点 "'+(a.title||"")+'" 吗?',function(a){if(r.operate&&r.operate(g),g.status="remove",n.close(a),!e.prev("."+s)[0]&&!e.next("."+s)[0]&&!e.parent("."+v)[0])return e.remove(),void t.elem.append(t.elemNone);if(e.siblings("."+s).children("."+p)[0]){if(r.showCheckbox){var l=function(e){if(e.parents("."+s)[0]){var a=e.siblings("."+s).children("."+p),n=e.parent("."+v).prev(),r=n.find('input[same="layuiTreeCheck"]')[0],c=1,d=0;0==r.checked&&(a.each(function(e,a){var n=i(a).find('input[same="layuiTreeCheck"]')[0];0!=n.checked||n.disabled||(c=0),n.disabled||(d=1)}),1==c&&1==d&&(r.checked=!0,t.renderForm("checkbox"),l(n.parent("."+s))))}};l(e)}if(r.showLine){var d=e.siblings("."+s),h=1,f=e.parent("."+v);layui.each(d,function(e,a){i(a).children("."+v)[0]||(h=0)}),1==h?(b[0]||(f.removeClass(x),d.children("."+v).addClass(m),d.children("."+v).children("."+s).removeClass(k)),e.next()[0]?f.children("."+s).last().children("."+v).children("."+s).last().addClass(k):e.prev().children("."+v).children("."+s).last().addClass(k),e.next()[0]||e.parents("."+s)[1]||e.parents("."+s).eq(0).next()[0]||e.prev("."+s).addClass(k)):!e.next()[0]&&e.hasClass(k)&&e.prev().addClass(k)}}else{var y=e.parent("."+v).prev();if(r.showLine){y.find("."+o).removeClass("layui-tree-icon"),y.find("."+o).children(".layui-icon").removeClass(u).addClass("layui-icon-file");var w=y.parents("."+v).eq(0);w.addClass(x),w.children("."+s).each(function(){i(this).children("."+v).children("."+s).last().addClass(k)})}else y.find(".layui-tree-iconArrow").addClass(c);e.parents("."+s).eq(0).removeClass(C),e.parent("."+v).remove()}e.remove()})})},b.prototype.events=function(){var e=this,a=e.config;e.elem.find(".layui-tree-checkedFirst");e.setChecked(e.checkids),e.elem.find(".layui-tree-search").on("keyup",function(){var n=i(this),t=n.val(),r=n.nextAll(),l=[];r.find("."+y).each(function(){var e=i(this).parents("."+p);if(i(this).html().indexOf(t)!=-1){l.push(i(this).parent());var a=function(e){e.addClass("layui-tree-searchShow"),e.parent("."+v)[0]&&a(e.parent("."+v).parent("."+s))};a(e.parent("."+s))}}),r.find("."+p).each(function(){var e=i(this).parent("."+s);e.hasClass("layui-tree-searchShow")||e.addClass(c)}),0==r.find(".layui-tree-searchShow").length&&e.elem.append(e.elemNone),a.onsearch&&a.onsearch({elem:l})}),e.elem.find(".layui-tree-search").on("keydown",function(){i(this).nextAll().find("."+p).each(function(){var e=i(this).parent("."+s);e.removeClass("layui-tree-searchShow "+c)}),i(".layui-tree-emptyText")[0]&&i(".layui-tree-emptyText").remove()})},b.prototype.getChecked=function(){var e=this,a=e.config,n=[],t=[];e.elem.find(".layui-form-checked").each(function(){n.push(i(this).prev()[0].value)});var r=function(e,a){layui.each(e,function(e,t){layui.each(n,function(e,n){if(t.id==n){var l=i.extend({},t);return delete l.children,a.push(l),t.children&&(l.children=[],r(t.children,l.children)),!0}})})};return r(i.extend({},a.data),t),t},b.prototype.setChecked=function(e){var a=this;a.config;a.elem.find("."+s).each(function(a,n){var t=i(this).data("id"),r=i(n).children("."+p).find('input[same="layuiTreeCheck"]'),l=r.next();if("number"==typeof e){if(t==e)return r[0].checked||l.click(),!1}else"object"==typeof e&&layui.each(e,function(e,i){if(i==t&&!r[0].checked)return l.click(),!0})})},l.that={},l.config={},r.reload=function(e,i){var a=l.that[e];return a.reload(i),l.call(a)},r.getChecked=function(e){var i=l.that[e];return i.getChecked()},r.setChecked=function(e,i){var a=l.that[e];return a.setChecked(i)},r.render=function(e){var i=new b(e);return l.call(i)},e(t,r)}); -------------------------------------------------------------------------------- /layui/lay/modules/colorpicker.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var i=layui.jquery,o={config:{},index:layui.colorpicker?layui.colorpicker.index+1e4:0,set:function(e){var o=this;return o.config=i.extend({},o.config,e),o},on:function(e,i){return layui.onevent.call(this,"colorpicker",e,i)}},r=function(){var e=this,i=e.config;return{config:i}},t="colorpicker",n="layui-show",l="layui-colorpicker",c=".layui-colorpicker-main",a="layui-icon-down",s="layui-icon-close",f="layui-colorpicker-trigger-span",d="layui-colorpicker-trigger-i",u="layui-colorpicker-side",p="layui-colorpicker-side-slider",g="layui-colorpicker-basis",v="layui-colorpicker-alpha-bgcolor",h="layui-colorpicker-alpha-slider",m="layui-colorpicker-basis-cursor",b="layui-colorpicker-main-input",k=function(e){var i={h:0,s:0,b:0},o=Math.min(e.r,e.g,e.b),r=Math.max(e.r,e.g,e.b),t=r-o;return i.b=r,i.s=0!=r?255*t/r:0,0!=i.s?e.r==r?i.h=(e.g-e.b)/t:e.g==r?i.h=2+(e.b-e.r)/t:i.h=4+(e.r-e.g)/t:i.h=-1,r==o&&(i.h=0),i.h*=60,i.h<0&&(i.h+=360),i.s*=100/255,i.b*=100/255,i},y=function(e){var e=e.indexOf("#")>-1?e.substring(1):e;if(3==e.length){var i=e.split("");e=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]}e=parseInt(e,16);var o={r:e>>16,g:(65280&e)>>8,b:255&e};return k(o)},x=function(e){var i={},o=e.h,r=255*e.s/100,t=255*e.b/100;if(0==r)i.r=i.g=i.b=t;else{var n=t,l=(255-r)*t/255,c=(n-l)*(o%60)/60;360==o&&(o=0),o<60?(i.r=n,i.b=l,i.g=l+c):o<120?(i.g=n,i.b=l,i.r=n-c):o<180?(i.g=n,i.r=l,i.b=l+c):o<240?(i.b=n,i.r=l,i.g=n-c):o<300?(i.b=n,i.g=l,i.r=l+c):o<360?(i.r=n,i.g=l,i.b=n-c):(i.r=0,i.g=0,i.b=0)}return{r:Math.round(i.r),g:Math.round(i.g),b:Math.round(i.b)}},C=function(e){var o=x(e),r=[o.r.toString(16),o.g.toString(16),o.b.toString(16)];return i.each(r,function(e,i){1==i.length&&(r[e]="0"+i)}),r.join("")},P=function(e){var i=/[0-9]{1,3}/g,o=e.match(i)||[];return{r:o[0],g:o[1],b:o[2]}},B=i(window),w=i(document),D=function(e){var r=this;r.index=++o.index,r.config=i.extend({},r.config,o.config,e),r.render()};D.prototype.config={color:"",size:null,alpha:!1,format:"hex",predefine:!1,colors:["#009688","#5FB878","#1E9FFF","#FF5722","#FFB800","#01AAED","#999","#c00","#ff8c00","#ffd700","#90ee90","#00ced1","#1e90ff","#c71585","rgb(0, 186, 189)","rgb(255, 120, 0)","rgb(250, 212, 0)","#393D49","rgba(0,0,0,.5)","rgba(255, 69, 0, 0.68)","rgba(144, 240, 144, 0.5)","rgba(31, 147, 255, 0.73)"]},D.prototype.render=function(){var e=this,o=e.config,r=i(['
    ',"",'3&&(o.alpha&&"rgb"==o.format||(e="#"+C(k(P(o.color))))),"background: "+e):e}()+'">','',"","","
    "].join("")),t=i(o.elem);o.size&&r.addClass("layui-colorpicker-"+o.size),t.addClass("layui-inline").html(e.elemColorBox=r),e.color=e.elemColorBox.find("."+f)[0].style.background,e.events()},D.prototype.renderPicker=function(){var e=this,o=e.config,r=e.elemColorBox[0],t=e.elemPicker=i(['
    ','
    ','
    ','
    ','
    ','
    ',"
    ",'
    ','
    ',"
    ","
    ",'
    ','
    ','
    ',"
    ","
    ",function(){if(o.predefine){var e=['
    '];return layui.each(o.colors,function(i,o){e.push(['
    ','
    ',"
    "].join(""))}),e.push("
    "),e.join("")}return""}(),'
    ','
    ','',"
    ",'
    ','','',"","
    "].join(""));e.elemColorBox.find("."+f)[0];i(c)[0]&&i(c).data("index")==e.index?e.removePicker(D.thisElemInd):(e.removePicker(D.thisElemInd),i("body").append(t)),D.thisElemInd=e.index,D.thisColor=r.style.background,e.position(),e.pickerEvents()},D.prototype.removePicker=function(e){var o=this;o.config;return i("#layui-colorpicker"+(e||o.index)).remove(),o},D.prototype.position=function(){var e=this,i=e.config,o=e.bindElem||e.elemColorBox[0],r=e.elemPicker[0],t=o.getBoundingClientRect(),n=r.offsetWidth,l=r.offsetHeight,c=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},a=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},s=5,f=t.left,d=t.bottom;f-=(n-o.offsetWidth)/2,d+=s,f+n+s>a("width")?f=a("width")-n-s:fa()&&(d=t.top>l?t.top-l:a()-l,d-=2*s),i.position&&(r.style.position=i.position),r.style.left=f+("fixed"===i.position?0:c(1))+"px",r.style.top=d+("fixed"===i.position?0:c())+"px"},D.prototype.val=function(){var e=this,i=(e.config,e.elemColorBox.find("."+f)),o=e.elemPicker.find("."+b),r=i[0],t=r.style.backgroundColor;if(t){var n=k(P(t)),l=i.attr("lay-type");if(e.select(n.h,n.s,n.b),"torgb"===l&&o.find("input").val(t),"rgba"===l){var c=P(t);if(3==(t.match(/[0-9]{1,3}/g)||[]).length)o.find("input").val("rgba("+c.r+", "+c.g+", "+c.b+", 1)"),e.elemPicker.find("."+h).css("left",280);else{o.find("input").val(t);var a=280*t.slice(t.lastIndexOf(",")+1,t.length-1);e.elemPicker.find("."+h).css("left",a)}e.elemPicker.find("."+v)[0].style.background="linear-gradient(to right, rgba("+c.r+", "+c.g+", "+c.b+", 0), rgb("+c.r+", "+c.g+", "+c.b+"))"}}else e.select(0,100,100),o.find("input").val(""),e.elemPicker.find("."+v)[0].style.background="",e.elemPicker.find("."+h).css("left",280)},D.prototype.side=function(){var e=this,o=e.config,r=e.elemColorBox.find("."+f),t=r.attr("lay-type"),n=e.elemPicker.find("."+u),l=e.elemPicker.find("."+p),c=e.elemPicker.find("."+g),y=e.elemPicker.find("."+m),C=e.elemPicker.find("."+v),w=e.elemPicker.find("."+h),D=l[0].offsetTop/180*360,E=100-(y[0].offsetTop+3)/180*100,H=(y[0].offsetLeft+3)/260*100,W=Math.round(w[0].offsetLeft/280*100)/100,j=e.elemColorBox.find("."+d),F=e.elemPicker.find(".layui-colorpicker-pre").children("div"),L=function(i,n,l,c){e.select(i,n,l);var f=x({h:i,s:n,b:l});if(j.addClass(a).removeClass(s),r[0].style.background="rgb("+f.r+", "+f.g+", "+f.b+")","torgb"===t&&e.elemPicker.find("."+b).find("input").val("rgb("+f.r+", "+f.g+", "+f.b+")"),"rgba"===t){var d=0;d=280*c,w.css("left",d),e.elemPicker.find("."+b).find("input").val("rgba("+f.r+", "+f.g+", "+f.b+", "+c+")"),r[0].style.background="rgba("+f.r+", "+f.g+", "+f.b+", "+c+")",C[0].style.background="linear-gradient(to right, rgba("+f.r+", "+f.g+", "+f.b+", 0), rgb("+f.r+", "+f.g+", "+f.b+"))"}o.change&&o.change(e.elemPicker.find("."+b).find("input").val())},M=i(['
    t&&(r=t);var l=r/180*360;D=l,L(l,H,E,W),e.preventDefault()};Y(r),e.preventDefault()}),n.on("click",function(e){var o=e.clientY-i(this).offset().top;o<0&&(o=0),o>this.offsetHeight&&(o=this.offsetHeight);var r=o/180*360;D=r,L(r,H,E,W),e.preventDefault()}),y.on("mousedown",function(e){var i=this.offsetTop,o=this.offsetLeft,r=e.clientY,t=e.clientX,n=function(e){var n=i+(e.clientY-r),l=o+(e.clientX-t),a=c[0].offsetHeight-3,s=c[0].offsetWidth-3;n<-3&&(n=-3),n>a&&(n=a),l<-3&&(l=-3),l>s&&(l=s);var f=(l+3)/260*100,d=100-(n+3)/180*100;E=d,H=f,L(D,f,d,W),e.preventDefault()};layui.stope(e),Y(n),e.preventDefault()}),c.on("mousedown",function(e){var o=e.clientY-i(this).offset().top-3+B.scrollTop(),r=e.clientX-i(this).offset().left-3+B.scrollLeft();o<-3&&(o=-3),o>this.offsetHeight-3&&(o=this.offsetHeight-3),r<-3&&(r=-3),r>this.offsetWidth-3&&(r=this.offsetWidth-3);var t=(r+3)/260*100,n=100-(o+3)/180*100;E=n,H=t,L(D,t,n,W),e.preventDefault(),y.trigger(e,"mousedown")}),w.on("mousedown",function(e){var i=this.offsetLeft,o=e.clientX,r=function(e){var r=i+(e.clientX-o),t=C[0].offsetWidth;r<0&&(r=0),r>t&&(r=t);var n=Math.round(r/280*100)/100;W=n,L(D,H,E,n),e.preventDefault()};Y(r),e.preventDefault()}),C.on("click",function(e){var o=e.clientX-i(this).offset().left;o<0&&(o=0),o>this.offsetWidth&&(o=this.offsetWidth);var r=Math.round(o/280*100)/100;W=r,L(D,H,E,r),e.preventDefault()}),F.each(function(){i(this).on("click",function(){i(this).parent(".layui-colorpicker-pre").addClass("selected").siblings().removeClass("selected");var e,o=this.style.backgroundColor,r=k(P(o)),t=o.slice(o.lastIndexOf(",")+1,o.length-1);D=r.h,H=r.s,E=r.b,3==(o.match(/[0-9]{1,3}/g)||[]).length&&(t=1),W=t,e=280*t,L(r.h,r.s,r.b,t)})})},D.prototype.select=function(e,i,o,r){var t=this,n=(t.config,C({h:e,s:100,b:100})),l=C({h:e,s:i,b:o}),c=e/360*180,a=180-o/100*180-3,s=i/100*260-3;t.elemPicker.find("."+p).css("top",c),t.elemPicker.find("."+g)[0].style.background="#"+n,t.elemPicker.find("."+m).css({top:a,left:s}),"change"!==r&&t.elemPicker.find("."+b).find("input").val("#"+l)},D.prototype.pickerEvents=function(){var e=this,o=e.config,r=e.elemColorBox.find("."+f),t=e.elemPicker.find("."+b+" input"),n={clear:function(i){r[0].style.background="",e.elemColorBox.find("."+d).removeClass(a).addClass(s),e.color="",o.done&&o.done(""),e.removePicker()},confirm:function(i,n){var l=t.val(),c=l,f={};if(l.indexOf(",")>-1){if(f=k(P(l)),e.select(f.h,f.s,f.b),r[0].style.background=c="#"+C(f),(l.match(/[0-9]{1,3}/g)||[]).length>3&&"rgba"===r.attr("lay-type")){var u=280*l.slice(l.lastIndexOf(",")+1,l.length-1);e.elemPicker.find("."+h).css("left",u),r[0].style.background=l,c=l}}else f=y(l),r[0].style.background=c="#"+C(f),e.elemColorBox.find("."+d).removeClass(s).addClass(a);return"change"===n?(e.select(f.h,f.s,f.b,n),void(o.change&&o.change(c))):(e.color=l,o.done&&o.done(l),void e.removePicker())}};e.elemPicker.on("click","*[colorpicker-events]",function(){var e=i(this),o=e.attr("colorpicker-events");n[o]&&n[o].call(this,e)}),t.on("keyup",function(e){var o=i(this);n.confirm.call(this,o,13===e.keyCode?null:"change")})},D.prototype.events=function(){var e=this,o=e.config,r=e.elemColorBox.find("."+f);e.elemColorBox.on("click",function(){e.renderPicker(),i(c)[0]&&(e.val(),e.side())}),o.elem[0]&&!e.elemColorBox[0].eventHandler&&(w.on("click",function(o){if(!i(o.target).hasClass(l)&&!i(o.target).parents("."+l)[0]&&!i(o.target).hasClass(c.replace(/\./g,""))&&!i(o.target).parents(c)[0]&&e.elemPicker){if(e.color){var t=k(P(e.color));e.select(t.h,t.s,t.b)}else e.elemColorBox.find("."+d).removeClass(a).addClass(s);r[0].style.background=e.color||"",e.removePicker()}}),B.on("resize",function(){return!(!e.elemPicker||!i(c)[0])&&void e.position()}),e.elemColorBox[0].eventHandler=!0)},o.render=function(e){var i=new D(e);return r.call(i)},e(t,o)}); -------------------------------------------------------------------------------- /layui/lay/modules/layedit.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define(["layer","form"],function(t){"use strict";var e=layui.$,i=layui.layer,a=layui.form,l=(layui.hint(),layui.device()),n="layedit",o="layui-show",r="layui-disabled",c=function(){var t=this;t.index=0,t.config={tool:["strong","italic","underline","del","|","left","center","right","|","link","unlink","face","image"],hideTool:[],height:280}};c.prototype.set=function(t){var i=this;return e.extend(!0,i.config,t),i},c.prototype.on=function(t,e){return layui.onevent(n,t,e)},c.prototype.build=function(t,i){i=i||{};var a=this,n=a.config,r="layui-layedit",c=e("string"==typeof t?"#"+t:t),u="LAY_layedit_"+ ++a.index,d=c.next("."+r),y=e.extend({},n,i),f=function(){var t=[],e={};return layui.each(y.hideTool,function(t,i){e[i]=!0}),layui.each(y.tool,function(i,a){C[a]&&!e[a]&&t.push(C[a])}),t.join("")}(),m=e(['
    ','
    '+f+"
    ",'
    ','',"
    ","
    "].join(""));return l.ie&&l.ie<8?c.removeClass("layui-hide").addClass(o):(d[0]&&d.remove(),s.call(a,m,c[0],y),c.addClass("layui-hide").after(m),a.index)},c.prototype.getContent=function(t){var e=u(t);if(e[0])return d(e[0].document.body.innerHTML)},c.prototype.getText=function(t){var i=u(t);if(i[0])return e(i[0].document.body).text()},c.prototype.setContent=function(t,i,a){var l=u(t);l[0]&&(a?e(l[0].document.body).append(i):e(l[0].document.body).html(i),layedit.sync(t))},c.prototype.sync=function(t){var i=u(t);if(i[0]){var a=e("#"+i[1].attr("textarea"));a.val(d(i[0].document.body.innerHTML))}},c.prototype.getSelection=function(t){var e=u(t);if(e[0]){var i=m(e[0].document);return document.selection?i.text:i.toString()}};var s=function(t,i,a){var l=this,n=t.find("iframe");n.css({height:a.height}).on("load",function(){var o=n.contents(),r=n.prop("contentWindow"),c=o.find("head"),s=e([""].join("")),u=o.find("body");c.append(s),u.attr("contenteditable","true").css({"min-height":a.height}).html(i.value||""),y.apply(l,[r,n,i,a]),g.call(l,r,t,a)})},u=function(t){var i=e("#LAY_layedit_"+t),a=i.prop("contentWindow");return[a,i]},d=function(t){return 8==l.ie&&(t=t.replace(/<.+>/g,function(t){return t.toLowerCase()})),t},y=function(t,a,n,o){var r=t.document,c=e(r.body);c.on("keydown",function(t){var e=t.keyCode;if(13===e){var a=m(r),l=p(a),n=l.parentNode;if("pre"===n.tagName.toLowerCase()){if(t.shiftKey)return;return i.msg("请暂时用shift+enter"),!1}r.execCommand("formatBlock",!1,"

    ")}}),e(n).parents("form").on("submit",function(){var t=c.html();8==l.ie&&(t=t.replace(/<.+>/g,function(t){return t.toLowerCase()})),n.value=t}),c.on("paste",function(e){r.execCommand("formatBlock",!1,"

    "),setTimeout(function(){f.call(t,c),n.value=c.html()},100)})},f=function(t){var i=this;i.document;t.find("*[style]").each(function(){var t=this.style.textAlign;this.removeAttribute("style"),e(this).css({"text-align":t||""})}),t.find("table").addClass("layui-table"),t.find("script,link").remove()},m=function(t){return t.selection?t.selection.createRange():t.getSelection().getRangeAt(0)},p=function(t){return t.endContainer||t.parentElement().childNodes[0]},v=function(t,i,a){var l=this.document,n=document.createElement(t);for(var o in i)n.setAttribute(o,i[o]);if(n.removeAttribute("text"),l.selection){var r=a.text||i.text;if("a"===t&&!r)return;r&&(n.innerHTML=r),a.pasteHTML(e(n).prop("outerHTML")),a.select()}else{var r=a.toString()||i.text;if("a"===t&&!r)return;r&&(n.innerHTML=r),a.deleteContents(),a.insertNode(n)}},h=function(t,i){var a=this.document,l="layedit-tool-active",n=p(m(a)),o=function(e){return t.find(".layedit-tool-"+e)};i&&i[i.hasClass(l)?"removeClass":"addClass"](l),t.find(">i").removeClass(l),o("unlink").addClass(r),e(n).parents().each(function(){var t=this.tagName.toLowerCase(),e=this.style.textAlign;"b"!==t&&"strong"!==t||o("b").addClass(l),"i"!==t&&"em"!==t||o("i").addClass(l),"u"===t&&o("u").addClass(l),"strike"===t&&o("d").addClass(l),"p"===t&&("center"===e?o("center").addClass(l):"right"===e?o("right").addClass(l):o("left").addClass(l)),"a"===t&&(o("link").addClass(l),o("unlink").removeClass(r))})},g=function(t,a,l){var n=t.document,o=e(n.body),c={link:function(i){var a=p(i),l=e(a).parent();b.call(o,{href:l.attr("href"),target:l.attr("target")},function(e){var a=l[0];"A"===a.tagName?a.href=e.url:v.call(t,"a",{target:e.target,href:e.url,text:e.url},i)})},unlink:function(t){n.execCommand("unlink")},face:function(e){x.call(this,function(i){v.call(t,"img",{src:i.src,alt:i.alt},e)})},image:function(a){var n=this;layui.use("upload",function(o){var r=l.uploadImage||{};o.render({url:r.url,method:r.type,elem:e(n).find("input")[0],done:function(e){0==e.code?(e.data=e.data||{},v.call(t,"img",{src:e.data.src,alt:e.data.title},a)):i.msg(e.msg||"上传失败")}})})},code:function(e){k.call(o,function(i){v.call(t,"pre",{text:i.code,"lay-lang":i.lang},e)})},help:function(){i.open({type:2,title:"帮助",area:["600px","380px"],shadeClose:!0,shade:.1,skin:"layui-layer-msg",content:["http://www.layui.com/about/layedit/help.html","no"]})}},s=a.find(".layui-layedit-tool"),u=function(){var i=e(this),a=i.attr("layedit-event"),l=i.attr("lay-command");if(!i.hasClass(r)){o.focus();var u=m(n);u.commonAncestorContainer;l?(n.execCommand(l),/justifyLeft|justifyCenter|justifyRight/.test(l)&&n.execCommand("formatBlock",!1,"

    "),setTimeout(function(){o.focus()},10)):c[a]&&c[a].call(this,u),h.call(t,s,i)}},d=/image/;s.find(">i").on("mousedown",function(){var t=e(this),i=t.attr("layedit-event");d.test(i)||u.call(this)}).on("click",function(){var t=e(this),i=t.attr("layedit-event");d.test(i)&&u.call(this)}),o.on("click",function(){h.call(t,s),i.close(x.index)})},b=function(t,e){var l=this,n=i.open({type:1,id:"LAY_layedit_link",area:"350px",shade:.05,shadeClose:!0,moveType:1,title:"超链接",skin:"layui-layer-msg",content:['

      ','
    • ','','
      ','',"
      ","
    • ",'
    • ','','
      ','",'","
      ","
    • ",'
    • ','','',"
    • ","
    "].join(""),success:function(t,n){var o="submit(layedit-link-yes)";a.render("radio"),t.find(".layui-btn-primary").on("click",function(){i.close(n),l.focus()}),a.on(o,function(t){i.close(b.index),e&&e(t.field)})}});b.index=n},x=function(t){var a=function(){var t=["[微笑]","[嘻嘻]","[哈哈]","[可爱]","[可怜]","[挖鼻]","[吃惊]","[害羞]","[挤眼]","[闭嘴]","[鄙视]","[爱你]","[泪]","[偷笑]","[亲亲]","[生病]","[太开心]","[白眼]","[右哼哼]","[左哼哼]","[嘘]","[衰]","[委屈]","[吐]","[哈欠]","[抱抱]","[怒]","[疑问]","[馋嘴]","[拜拜]","[思考]","[汗]","[困]","[睡]","[钱]","[失望]","[酷]","[色]","[哼]","[鼓掌]","[晕]","[悲伤]","[抓狂]","[黑线]","[阴险]","[怒骂]","[互粉]","[心]","[伤心]","[猪头]","[熊猫]","[兔子]","[ok]","[耶]","[good]","[NO]","[赞]","[来]","[弱]","[草泥马]","[神马]","[囧]","[浮云]","[给力]","[围观]","[威武]","[奥特曼]","[礼物]","[钟]","[话筒]","[蜡烛]","[蛋糕]"],e={};return layui.each(t,function(t,i){e[i]=layui.cache.dir+"images/face/"+t+".gif"}),e}();return x.hide=x.hide||function(t){"face"!==e(t.target).attr("layedit-event")&&i.close(x.index)},x.index=i.tips(function(){var t=[];return layui.each(a,function(e,i){t.push('
  • '+e+'
  • ')}),'
      '+t.join("")+"
    "}(),this,{tips:1,time:0,skin:"layui-box layui-util-face",maxWidth:500,success:function(l,n){l.css({marginTop:-4,marginLeft:-10}).find(".layui-clear>li").on("click",function(){t&&t({src:a[this.title],alt:this.title}),i.close(n)}),e(document).off("click",x.hide).on("click",x.hide)}})},k=function(t){var e=this,l=i.open({type:1,id:"LAY_layedit_code",area:"550px",shade:.05,shadeClose:!0,moveType:1,title:"插入代码",skin:"layui-layer-msg",content:['
      ','
    • ','','
      ','","
      ","
    • ",'
    • ','','
      ','',"
      ","
    • ",'
    • ','','',"
    • ","
    "].join(""),success:function(l,n){var o="submit(layedit-code-yes)";a.render("select"),l.find(".layui-btn-primary").on("click",function(){i.close(n),e.focus()}),a.on(o,function(e){i.close(k.index),t&&t(e.field)})}});k.index=l},C={html:'',strong:'',italic:'',underline:'',del:'',"|":'',left:'',center:'',right:'',link:'',unlink:'',face:'',image:'',code:'',help:''},w=new c;t(n,w)}); --------------------------------------------------------------------------------