├── test
├── README.md
└── lay
│ └── modules
│ ├── code.js
│ └── laytpl.js
├── dist
├── font
│ ├── iconfont.eot
│ ├── iconfont.ttf
│ ├── iconfont.woff
│ └── iconfont.woff2
├── images
│ └── face
│ │ ├── 0.gif
│ │ ├── 1.gif
│ │ ├── 2.gif
│ │ ├── 3.gif
│ │ ├── 4.gif
│ │ ├── 5.gif
│ │ ├── 6.gif
│ │ ├── 7.gif
│ │ ├── 8.gif
│ │ ├── 9.gif
│ │ ├── 10.gif
│ │ ├── 11.gif
│ │ ├── 12.gif
│ │ ├── 13.gif
│ │ ├── 14.gif
│ │ ├── 15.gif
│ │ ├── 16.gif
│ │ ├── 17.gif
│ │ ├── 18.gif
│ │ ├── 19.gif
│ │ ├── 20.gif
│ │ ├── 21.gif
│ │ ├── 22.gif
│ │ ├── 23.gif
│ │ ├── 24.gif
│ │ ├── 25.gif
│ │ ├── 26.gif
│ │ ├── 27.gif
│ │ ├── 28.gif
│ │ ├── 29.gif
│ │ ├── 30.gif
│ │ ├── 31.gif
│ │ ├── 32.gif
│ │ ├── 33.gif
│ │ ├── 34.gif
│ │ ├── 35.gif
│ │ ├── 36.gif
│ │ ├── 37.gif
│ │ ├── 38.gif
│ │ ├── 39.gif
│ │ ├── 40.gif
│ │ ├── 41.gif
│ │ ├── 42.gif
│ │ ├── 43.gif
│ │ ├── 44.gif
│ │ ├── 45.gif
│ │ ├── 46.gif
│ │ ├── 47.gif
│ │ ├── 48.gif
│ │ ├── 49.gif
│ │ ├── 50.gif
│ │ ├── 51.gif
│ │ ├── 52.gif
│ │ ├── 53.gif
│ │ ├── 54.gif
│ │ ├── 55.gif
│ │ ├── 56.gif
│ │ ├── 57.gif
│ │ ├── 58.gif
│ │ ├── 59.gif
│ │ ├── 60.gif
│ │ ├── 61.gif
│ │ ├── 62.gif
│ │ ├── 63.gif
│ │ ├── 64.gif
│ │ ├── 65.gif
│ │ ├── 66.gif
│ │ ├── 67.gif
│ │ ├── 68.gif
│ │ ├── 69.gif
│ │ ├── 70.gif
│ │ └── 71.gif
├── css
│ └── modules
│ │ ├── layer
│ │ └── default
│ │ │ ├── icon.png
│ │ │ ├── icon-ext.png
│ │ │ ├── loading-0.gif
│ │ │ ├── loading-1.gif
│ │ │ └── loading-2.gif
│ │ └── code.css
├── lay
│ └── modules
│ │ ├── code.js
│ │ ├── laytpl.js
│ │ ├── flow.js
│ │ ├── rate.js
│ │ ├── util.js
│ │ ├── carousel.js
│ │ ├── laypage.js
│ │ ├── transfer.js
│ │ ├── slider.js
│ │ ├── upload.js
│ │ └── element.js
└── layui.js
├── src
├── 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
├── css
│ └── modules
│ │ ├── layer
│ │ └── default
│ │ │ ├── icon.png
│ │ │ ├── icon-ext.png
│ │ │ ├── loading-0.gif
│ │ │ ├── loading-1.gif
│ │ │ └── loading-2.gif
│ │ ├── laydate
│ │ └── default
│ │ │ └── font.css
│ │ └── code.css
└── lay
│ ├── all-mobile.js
│ ├── modules
│ ├── mobile
│ │ ├── layim-mobile-open.js
│ │ └── layer-mobile.js
│ ├── mobile.js
│ ├── code.js
│ ├── laytpl.js
│ ├── flow.js
│ └── rate.js
│ └── all.js
├── examples
├── js
│ ├── index.js
│ └── child
│ │ └── test.js
├── extends
│ ├── mod2.js
│ ├── mod1.js
│ └── temp.js
├── json
│ ├── upload
│ │ └── demoLayEdit.json
│ └── table
│ │ ├── demo2.json
│ │ ├── demo3.json
│ │ └── demo1.json
├── extend.html
├── responsive.html
├── slider.html
├── layedit.html
├── all.html
├── rate.html
├── util.html
├── transfer.html
├── colorpicker.html
├── admin.html
├── xingzuo.html
├── flow.html
├── layer.html
├── code.html
├── carousel.html
├── laypage.html
├── button.html
└── tree.html
├── doc
├── Git仓库.url
├── README.md
├── 快速上手.url
└── 在线演示.url
├── karma.conf.unit.js
├── .gitignore
├── bower.json
├── .travis.yml
├── LICENSE
├── CHANGELOG.md
├── package.json
├── karma.conf.sauce.js
├── README.md
├── karma.conf.base.js
└── gulpfile.js
/test/README.md:
--------------------------------------------------------------------------------
1 | # 说明
2 | 自动化测试用例,由 @xuexb 维护
3 |
--------------------------------------------------------------------------------
/dist/font/iconfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/font/iconfont.eot
--------------------------------------------------------------------------------
/dist/font/iconfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/font/iconfont.ttf
--------------------------------------------------------------------------------
/dist/images/face/0.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/0.gif
--------------------------------------------------------------------------------
/dist/images/face/1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/1.gif
--------------------------------------------------------------------------------
/dist/images/face/2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/2.gif
--------------------------------------------------------------------------------
/dist/images/face/3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/3.gif
--------------------------------------------------------------------------------
/dist/images/face/4.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/4.gif
--------------------------------------------------------------------------------
/dist/images/face/5.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/5.gif
--------------------------------------------------------------------------------
/dist/images/face/6.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/6.gif
--------------------------------------------------------------------------------
/dist/images/face/7.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/7.gif
--------------------------------------------------------------------------------
/dist/images/face/8.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/8.gif
--------------------------------------------------------------------------------
/dist/images/face/9.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/9.gif
--------------------------------------------------------------------------------
/src/font/iconfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/font/iconfont.eot
--------------------------------------------------------------------------------
/src/font/iconfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/font/iconfont.ttf
--------------------------------------------------------------------------------
/src/font/iconfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/font/iconfont.woff
--------------------------------------------------------------------------------
/src/images/face/0.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/0.gif
--------------------------------------------------------------------------------
/src/images/face/1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/1.gif
--------------------------------------------------------------------------------
/src/images/face/10.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/10.gif
--------------------------------------------------------------------------------
/src/images/face/11.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/11.gif
--------------------------------------------------------------------------------
/src/images/face/12.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/12.gif
--------------------------------------------------------------------------------
/src/images/face/13.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/13.gif
--------------------------------------------------------------------------------
/src/images/face/14.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/14.gif
--------------------------------------------------------------------------------
/src/images/face/15.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/15.gif
--------------------------------------------------------------------------------
/src/images/face/16.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/16.gif
--------------------------------------------------------------------------------
/src/images/face/17.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/17.gif
--------------------------------------------------------------------------------
/src/images/face/18.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/18.gif
--------------------------------------------------------------------------------
/src/images/face/19.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/19.gif
--------------------------------------------------------------------------------
/src/images/face/2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/2.gif
--------------------------------------------------------------------------------
/src/images/face/20.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/20.gif
--------------------------------------------------------------------------------
/src/images/face/21.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/21.gif
--------------------------------------------------------------------------------
/src/images/face/22.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/22.gif
--------------------------------------------------------------------------------
/src/images/face/23.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/23.gif
--------------------------------------------------------------------------------
/src/images/face/24.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/24.gif
--------------------------------------------------------------------------------
/src/images/face/25.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/25.gif
--------------------------------------------------------------------------------
/src/images/face/26.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/26.gif
--------------------------------------------------------------------------------
/src/images/face/27.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/27.gif
--------------------------------------------------------------------------------
/src/images/face/28.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/28.gif
--------------------------------------------------------------------------------
/src/images/face/29.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/29.gif
--------------------------------------------------------------------------------
/src/images/face/3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/3.gif
--------------------------------------------------------------------------------
/src/images/face/30.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/30.gif
--------------------------------------------------------------------------------
/src/images/face/31.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/31.gif
--------------------------------------------------------------------------------
/src/images/face/32.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/32.gif
--------------------------------------------------------------------------------
/src/images/face/33.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/33.gif
--------------------------------------------------------------------------------
/src/images/face/34.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/34.gif
--------------------------------------------------------------------------------
/src/images/face/35.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/35.gif
--------------------------------------------------------------------------------
/src/images/face/36.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/36.gif
--------------------------------------------------------------------------------
/src/images/face/37.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/37.gif
--------------------------------------------------------------------------------
/src/images/face/38.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/38.gif
--------------------------------------------------------------------------------
/src/images/face/39.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/39.gif
--------------------------------------------------------------------------------
/src/images/face/4.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/4.gif
--------------------------------------------------------------------------------
/src/images/face/40.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/40.gif
--------------------------------------------------------------------------------
/src/images/face/41.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/41.gif
--------------------------------------------------------------------------------
/src/images/face/42.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/42.gif
--------------------------------------------------------------------------------
/src/images/face/43.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/43.gif
--------------------------------------------------------------------------------
/src/images/face/44.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/44.gif
--------------------------------------------------------------------------------
/src/images/face/45.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/45.gif
--------------------------------------------------------------------------------
/src/images/face/46.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/46.gif
--------------------------------------------------------------------------------
/src/images/face/47.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/47.gif
--------------------------------------------------------------------------------
/src/images/face/48.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/48.gif
--------------------------------------------------------------------------------
/src/images/face/49.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/49.gif
--------------------------------------------------------------------------------
/src/images/face/5.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/5.gif
--------------------------------------------------------------------------------
/src/images/face/50.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/50.gif
--------------------------------------------------------------------------------
/src/images/face/51.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/51.gif
--------------------------------------------------------------------------------
/src/images/face/52.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/52.gif
--------------------------------------------------------------------------------
/src/images/face/53.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/53.gif
--------------------------------------------------------------------------------
/src/images/face/54.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/54.gif
--------------------------------------------------------------------------------
/src/images/face/55.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/55.gif
--------------------------------------------------------------------------------
/src/images/face/56.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/56.gif
--------------------------------------------------------------------------------
/src/images/face/57.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/57.gif
--------------------------------------------------------------------------------
/src/images/face/58.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/58.gif
--------------------------------------------------------------------------------
/src/images/face/59.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/59.gif
--------------------------------------------------------------------------------
/src/images/face/6.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/6.gif
--------------------------------------------------------------------------------
/src/images/face/60.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/60.gif
--------------------------------------------------------------------------------
/src/images/face/61.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/61.gif
--------------------------------------------------------------------------------
/src/images/face/62.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/62.gif
--------------------------------------------------------------------------------
/src/images/face/63.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/63.gif
--------------------------------------------------------------------------------
/src/images/face/64.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/64.gif
--------------------------------------------------------------------------------
/src/images/face/65.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/65.gif
--------------------------------------------------------------------------------
/src/images/face/66.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/66.gif
--------------------------------------------------------------------------------
/src/images/face/67.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/67.gif
--------------------------------------------------------------------------------
/src/images/face/68.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/68.gif
--------------------------------------------------------------------------------
/src/images/face/69.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/69.gif
--------------------------------------------------------------------------------
/src/images/face/7.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/7.gif
--------------------------------------------------------------------------------
/src/images/face/70.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/70.gif
--------------------------------------------------------------------------------
/src/images/face/71.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/71.gif
--------------------------------------------------------------------------------
/src/images/face/8.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/8.gif
--------------------------------------------------------------------------------
/src/images/face/9.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/images/face/9.gif
--------------------------------------------------------------------------------
/dist/font/iconfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/font/iconfont.woff
--------------------------------------------------------------------------------
/dist/font/iconfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/font/iconfont.woff2
--------------------------------------------------------------------------------
/dist/images/face/10.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/10.gif
--------------------------------------------------------------------------------
/dist/images/face/11.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/11.gif
--------------------------------------------------------------------------------
/dist/images/face/12.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/12.gif
--------------------------------------------------------------------------------
/dist/images/face/13.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/13.gif
--------------------------------------------------------------------------------
/dist/images/face/14.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/14.gif
--------------------------------------------------------------------------------
/dist/images/face/15.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/15.gif
--------------------------------------------------------------------------------
/dist/images/face/16.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/16.gif
--------------------------------------------------------------------------------
/dist/images/face/17.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/17.gif
--------------------------------------------------------------------------------
/dist/images/face/18.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/18.gif
--------------------------------------------------------------------------------
/dist/images/face/19.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/19.gif
--------------------------------------------------------------------------------
/dist/images/face/20.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/20.gif
--------------------------------------------------------------------------------
/dist/images/face/21.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/21.gif
--------------------------------------------------------------------------------
/dist/images/face/22.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/22.gif
--------------------------------------------------------------------------------
/dist/images/face/23.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/23.gif
--------------------------------------------------------------------------------
/dist/images/face/24.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/24.gif
--------------------------------------------------------------------------------
/dist/images/face/25.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/25.gif
--------------------------------------------------------------------------------
/dist/images/face/26.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/26.gif
--------------------------------------------------------------------------------
/dist/images/face/27.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/27.gif
--------------------------------------------------------------------------------
/dist/images/face/28.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/28.gif
--------------------------------------------------------------------------------
/dist/images/face/29.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/29.gif
--------------------------------------------------------------------------------
/dist/images/face/30.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/30.gif
--------------------------------------------------------------------------------
/dist/images/face/31.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/31.gif
--------------------------------------------------------------------------------
/dist/images/face/32.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/32.gif
--------------------------------------------------------------------------------
/dist/images/face/33.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/33.gif
--------------------------------------------------------------------------------
/dist/images/face/34.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/34.gif
--------------------------------------------------------------------------------
/dist/images/face/35.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/35.gif
--------------------------------------------------------------------------------
/dist/images/face/36.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/36.gif
--------------------------------------------------------------------------------
/dist/images/face/37.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/37.gif
--------------------------------------------------------------------------------
/dist/images/face/38.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/38.gif
--------------------------------------------------------------------------------
/dist/images/face/39.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/39.gif
--------------------------------------------------------------------------------
/dist/images/face/40.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/40.gif
--------------------------------------------------------------------------------
/dist/images/face/41.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/41.gif
--------------------------------------------------------------------------------
/dist/images/face/42.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/42.gif
--------------------------------------------------------------------------------
/dist/images/face/43.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/43.gif
--------------------------------------------------------------------------------
/dist/images/face/44.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/44.gif
--------------------------------------------------------------------------------
/dist/images/face/45.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/45.gif
--------------------------------------------------------------------------------
/dist/images/face/46.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/46.gif
--------------------------------------------------------------------------------
/dist/images/face/47.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/47.gif
--------------------------------------------------------------------------------
/dist/images/face/48.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/48.gif
--------------------------------------------------------------------------------
/dist/images/face/49.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/49.gif
--------------------------------------------------------------------------------
/dist/images/face/50.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/50.gif
--------------------------------------------------------------------------------
/dist/images/face/51.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/51.gif
--------------------------------------------------------------------------------
/dist/images/face/52.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/52.gif
--------------------------------------------------------------------------------
/dist/images/face/53.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/53.gif
--------------------------------------------------------------------------------
/dist/images/face/54.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/54.gif
--------------------------------------------------------------------------------
/dist/images/face/55.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/55.gif
--------------------------------------------------------------------------------
/dist/images/face/56.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/56.gif
--------------------------------------------------------------------------------
/dist/images/face/57.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/57.gif
--------------------------------------------------------------------------------
/dist/images/face/58.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/58.gif
--------------------------------------------------------------------------------
/dist/images/face/59.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/59.gif
--------------------------------------------------------------------------------
/dist/images/face/60.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/60.gif
--------------------------------------------------------------------------------
/dist/images/face/61.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/61.gif
--------------------------------------------------------------------------------
/dist/images/face/62.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/62.gif
--------------------------------------------------------------------------------
/dist/images/face/63.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/63.gif
--------------------------------------------------------------------------------
/dist/images/face/64.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/64.gif
--------------------------------------------------------------------------------
/dist/images/face/65.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/65.gif
--------------------------------------------------------------------------------
/dist/images/face/66.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/66.gif
--------------------------------------------------------------------------------
/dist/images/face/67.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/67.gif
--------------------------------------------------------------------------------
/dist/images/face/68.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/68.gif
--------------------------------------------------------------------------------
/dist/images/face/69.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/69.gif
--------------------------------------------------------------------------------
/dist/images/face/70.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/70.gif
--------------------------------------------------------------------------------
/dist/images/face/71.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/images/face/71.gif
--------------------------------------------------------------------------------
/src/font/iconfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/font/iconfont.woff2
--------------------------------------------------------------------------------
/dist/css/modules/layer/default/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/css/modules/layer/default/icon.png
--------------------------------------------------------------------------------
/examples/js/index.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | layui.define(function(exports){
4 |
5 | exports('index', {
6 | title: '模块入口'
7 | });
8 | });
--------------------------------------------------------------------------------
/src/css/modules/layer/default/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/css/modules/layer/default/icon.png
--------------------------------------------------------------------------------
/src/css/modules/layer/default/icon-ext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/css/modules/layer/default/icon-ext.png
--------------------------------------------------------------------------------
/dist/css/modules/layer/default/icon-ext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/css/modules/layer/default/icon-ext.png
--------------------------------------------------------------------------------
/dist/css/modules/layer/default/loading-0.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/css/modules/layer/default/loading-0.gif
--------------------------------------------------------------------------------
/dist/css/modules/layer/default/loading-1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/css/modules/layer/default/loading-1.gif
--------------------------------------------------------------------------------
/dist/css/modules/layer/default/loading-2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/dist/css/modules/layer/default/loading-2.gif
--------------------------------------------------------------------------------
/examples/js/child/test.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | layui.define(function(exports){
4 |
5 | exports('test', {
6 | title: '子目录模块加载'
7 | })
8 | });
--------------------------------------------------------------------------------
/src/css/modules/layer/default/loading-0.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/css/modules/layer/default/loading-0.gif
--------------------------------------------------------------------------------
/src/css/modules/layer/default/loading-1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/css/modules/layer/default/loading-1.gif
--------------------------------------------------------------------------------
/src/css/modules/layer/default/loading-2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrazyBoyM/layui/master/src/css/modules/layer/default/loading-2.gif
--------------------------------------------------------------------------------
/doc/Git仓库.url:
--------------------------------------------------------------------------------
1 | [{000214A0-0000-0000-C000-000000000046}]
2 | Prop3=19,11
3 | [InternetShortcut]
4 | URL=https://github.com/sentsin/layui/
5 | IDList=
6 | HotKey=0
7 |
--------------------------------------------------------------------------------
/doc/README.md:
--------------------------------------------------------------------------------
1 | # 注意事项:
2 | * 页面的 HTML 代码必须是 `` 开头
3 | * 除IE6、7外,所有浏览器均支持
4 |
5 | # 在线文档
6 | [http://www.layui.com/doc/](http://www.layui.com/doc/)
7 |
--------------------------------------------------------------------------------
/examples/extends/mod2.js:
--------------------------------------------------------------------------------
1 |
2 | layui.define(['jquery', 'form'], function(exports){
3 | console.log(layui.$)
4 |
5 | exports('mod2', {
6 | name: 'mod2'
7 | })
8 | });
--------------------------------------------------------------------------------
/src/lay/all-mobile.js:
--------------------------------------------------------------------------------
1 | /**
2 |
3 | @Name:用于打包移动完整版
4 | @Author:贤心
5 | @License:LGPL
6 |
7 | */
8 |
9 | layui.define(function(exports){
10 | exports('layui.mobile', layui.v);
11 | });
12 |
--------------------------------------------------------------------------------
/examples/json/upload/demoLayEdit.json:
--------------------------------------------------------------------------------
1 | {
2 | "code": 0
3 | ,"msg": ""
4 | ,"data": {
5 | "src": "http://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"
6 | ,"title": "图片名称"
7 | }
8 | }
--------------------------------------------------------------------------------
/src/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 | });
--------------------------------------------------------------------------------
/doc/快速上手.url:
--------------------------------------------------------------------------------
1 | [{000214A0-0000-0000-C000-000000000046}]
2 | Prop3=19,2
3 | [InternetShortcut]
4 | URL=http://www.layui.com/doc/
5 | IDList=
6 | HotKey=0
7 | IconIndex=0
8 | IconFile=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
9 |
--------------------------------------------------------------------------------
/doc/在线演示.url:
--------------------------------------------------------------------------------
1 | [{000214A0-0000-0000-C000-000000000046}]
2 | Prop3=19,2
3 | [InternetShortcut]
4 | URL=http://www.layui.com/demo/
5 | IDList=
6 | HotKey=0
7 | IconIndex=0
8 | IconFile=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
9 |
--------------------------------------------------------------------------------
/examples/extends/mod1.js:
--------------------------------------------------------------------------------
1 |
2 | layui.define(['mod2', 'layer'], function(exports){
3 | var $ = layui.jquery;
4 |
5 | console.log(layui.mod2, layui.layer, layui.form)
6 |
7 | exports('mod1', {
8 | name: 'mod1'
9 | })
10 | });
--------------------------------------------------------------------------------
/karma.conf.unit.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file karma配置
3 | * @author fe.xiaowu@gmail.com
4 | */
5 |
6 | var base = require('./karma.conf.base.js');
7 |
8 | module.exports = function (config) {
9 | var options = Object.assign(base(config), {});
10 |
11 | config.set(options);
12 | };
13 |
--------------------------------------------------------------------------------
/src/lay/all.js:
--------------------------------------------------------------------------------
1 | /**
2 |
3 | @Name:用于打包PC完整版,即包含layui.js和所有模块的完整合并(该文件不会存在于构建后的目录)
4 | @Author:贤心
5 | @License:LGPL
6 |
7 | */
8 |
9 | layui.define(function(exports){
10 | var cache = layui.cache;
11 | layui.config({
12 | dir: cache.dir.replace(/lay\/dest\/$/, '')
13 | });
14 | exports('layui.all', layui.v);
15 | });
16 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .idea/
3 | .ipr
4 | .iws
5 | *~
6 | ~*
7 | *.diff
8 | *.patch
9 | *.bak
10 | .DS_Store
11 | Thumbs.db
12 | .svn/
13 | *.swp
14 | .nojekyll
15 | .project
16 | .settings/
17 | .npmignore
18 | node_modules/
19 | _site/
20 | run.bat
21 | dir.txt
22 | /**/layim/
23 | /**/layim.js
24 | /**/layim-mobile.js
25 | /**/layim.html
26 | /**/layim.m.html
27 |
28 | release/
29 | build/
30 | rc/
31 |
32 | coverage/
33 | package-lock.json
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "layui",
3 | "main": "dist/layui.js",
4 | "version": "2.5.6",
5 | "homepage": "https://github.com/sentsin/layui",
6 | "authors": [
7 | "sentsin "
8 | ],
9 | "description": "Classic modular front-end component library",
10 | "moduleType": [
11 | "amd",
12 | "globals"
13 | ],
14 | "keywords": [
15 | "layui",
16 | "ui",
17 | "JavaScript Framework",
18 | "toolkit",
19 | "front-end component library"
20 | ],
21 | "license": "MIT"
22 | }
23 |
--------------------------------------------------------------------------------
/examples/extend.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 自定义模块 - layui
7 |
8 |
9 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/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 | }
--------------------------------------------------------------------------------
/src/lay/modules/mobile.js:
--------------------------------------------------------------------------------
1 | /**
2 |
3 | @Name:layui 移动模块入口 | 构建后则为移动模块集合
4 | @Author:贤心
5 | @License:MIT
6 |
7 | */
8 |
9 |
10 | if(!layui['layui.mobile']){
11 | layui.config({
12 | base: layui.cache.dir + 'lay/modules/mobile/'
13 | }).extend({
14 | 'layer-mobile': 'layer-mobile'
15 | ,'zepto': 'zepto'
16 | ,'upload-mobile': 'upload-mobile'
17 | ,'layim-mobile': 'layim-mobile'
18 | });
19 | }
20 |
21 | layui.define([
22 | 'layer-mobile'
23 | ,'zepto'
24 | ,'layim-mobile'
25 | ], function(exports){
26 | exports('mobile', {
27 | layer: layui['layer-mobile'] //弹层
28 | ,layim: layui['layim-mobile'] //WebIM
29 | });
30 | });
--------------------------------------------------------------------------------
/examples/responsive.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | 响应式测试 - Layui
9 |
10 |
13 |
14 |
15 |
16 |
17 |
21 |
22 |
23 |
24 |
25 |
26 | 移动:隐藏
27 | 平板:inline
28 | PC:block
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/dist/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}
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - node
4 | dist: trusty
5 | addons:
6 | sauce_connect:
7 | username: layui
8 | jwt:
9 | secure: "c+I/AGPj+9cdZOtwGv9eFBdFNlo/BtSEnZ/mGXBLM2+FUn8Dptvhqy1XalRBul3sNiCyv2lNtcZPGw0kirI4EjGiXFfqghq9psvwOchkNM+bFxAiH+uRYCVb1ouDbpAh0w4d/nxpB11fPdVNzudwbiI/ii8LNm1sDDnJOklHiuzWBgOVN2jkzNRapacLfto6bWjnyS4r/zElLwnKpXlN6cIJFzYBU1f/RS68xaHwr/9+wvf5gNzL7OmmiIxl+UJJMejoK3G7I6DTiXyosJxsnljSxG0zbDSDL9lzPeQjFClya25ubbCFPv/UADlVAlz5Y4SLIaTUaRWD7tVphpku5S9XBwIopRQBdtp6y1Ebh/F7pDAiuN8lHzvkr6z++ld9nVcSJppSWN/tyibN7b+C7m6TyreVMHFjw+egAbd3wPVgrD30Vswu9vQXyVydcRJiP295VclgaHobdZKEwrqK7mujsOVOlZEoZWm2B+MLGfvYIjhVdpcRGlAZN+VvA+ea93t/poY1LB1/qH0vF2jMNa3ZI6AWrZaaTbToMUEj6QB9tnOGnGvINOGJDamMMB6aeCLaEgZzRqvTYXgzJAi1kYQKkCL//v3Z6od5eDBUVgMEOkTIchPjSDX5lwMedroPwnFql9ArIWnm7mLHQToEArOoKQhSlFOx+sA/nortCL4="
10 | sudo: false
11 | cache:
12 | directories:
13 | - node_modules
14 | script:
15 | - npm run test:cov
16 | - npm run test:sauce
17 | after_script:
18 | - npm install coveralls && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage
19 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 layui
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.
--------------------------------------------------------------------------------
/dist/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(''+o.replace(/[\r\t\n]+/g," ")+" "),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");
--------------------------------------------------------------------------------
/src/css/modules/code.css:
--------------------------------------------------------------------------------
1 | /**
2 |
3 | @Name: layui.code
4 | @Author: 贤心
5 | @Site: http://www.layui.com
6 |
7 | */
8 |
9 | /* 加载就绪标志 */
10 | html #layuicss-skincodecss{display:none; position: absolute; width:1989px;}
11 |
12 | /* 默认风格 */
13 | .layui-code-view{display: block; position: relative; margin: 10px 0; padding: 0; border: 1px solid #e2e2e2; border-left-width: 6px; background-color: #F2F2F2; color: #333; font-family: Courier New; font-size: 12px;}
14 | .layui-code-h3{position: relative; padding: 0 10px; height: 32px; line-height: 32px; border-bottom: 1px solid #e2e2e2; font-size: 12px;}
15 | .layui-code-h3 a{position: absolute; right: 10px; top: 0; color: #999;}
16 | .layui-code-view .layui-code-ol{position: relative; overflow: auto;}
17 | .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;}
18 | .layui-code-view pre{margin: 0;}
19 |
20 | /* notepadd++风格 */
21 | .layui-code-notepad{border: 1px solid #0C0C0C; border-left-color: #3F3F3F; background-color: #0C0C0C; color: #C2BE9E}
22 | .layui-code-notepad .layui-code-h3{border-bottom: none;}
23 | .layui-code-notepad .layui-code-ol li{background-color: #3F3F3F; border-left: none;}
--------------------------------------------------------------------------------
/examples/slider.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 滑块 - layui
7 |
8 |
9 |
10 |
14 |
15 |
16 |
17 |
20 |
21 |
22 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/examples/json/table/demo2.json:
--------------------------------------------------------------------------------
1 | {
2 | "code": 0
3 | ,"msg": ""
4 | ,"count": 66
5 | ,"data": [{
6 | "username": "张小三"
7 | ,"amount": 18
8 | ,"province": "浙江"
9 | ,"city": "杭州"
10 | ,"zone": "西湖区"
11 | ,"street": "西溪街道"
12 | ,"address": "西溪花园"
13 | ,"house": "30栋1单元"
14 | }, {
15 | "username": "李小四"
16 | ,"amount": 39
17 | ,"province": "江苏"
18 | ,"city": "苏州"
19 | ,"zone": "姑苏区"
20 | ,"street": "丝绸路"
21 | ,"address": "天墅之城"
22 | ,"house": "9幢2单元"
23 | }, {
24 | "username": "王小四"
25 | ,"amount": 8
26 | ,"province": "江西"
27 | ,"city": "南昌"
28 | ,"zone": "青山湖区"
29 | ,"street": "艾溪湖办事处"
30 | ,"address": "中兴和园"
31 | ,"house": "1幢3单元"
32 | }, {
33 | "username": "赵小六"
34 | ,"amount": 16
35 | ,"province": "福建"
36 | ,"city": "泉州"
37 | ,"zone": "丰泽区"
38 | ,"street": "南洋街道"
39 | ,"address": "南洋村"
40 | ,"house": "6幢1单元"
41 | }, {
42 | "username": "孙小七"
43 | ,"amount": 12
44 | ,"province": "湖北"
45 | ,"city": "武汉"
46 | ,"zone": "武昌区"
47 | ,"street": "武昌大道"
48 | ,"address": "两湖花园"
49 | ,"house": "16幢2单元"
50 | }, {
51 | "username": "周小八"
52 | ,"amount": 11
53 | ,"province": "安徽"
54 | ,"city": "黄山"
55 | ,"zone": "黄山区"
56 | ,"street": "汤口镇"
57 | ,"address": "温泉村"
58 | ,"house": "21号"
59 | }]
60 | }
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 |
2 | # 更新日志
3 | * [2.5.x](https://www.layui.com/doc/base/changelog.html#2-5-x)
4 | * [2.4.x](https://www.layui.com/doc/base/changelog.html#2-4-x)
5 | * [2.3.0](https://www.layui.com/doc/base/changelog.html#2-3-0)
6 | * [2.2.6](https://www.layui.com/doc/base/changelog.html#2-2-6)
7 | * [2.2.5](https://www.layui.com/doc/base/changelog.html#2-2-5)
8 | * [2.2.4](https://www.layui.com/doc/base/changelog.html#2-2-45)
9 | * [2.2.3](https://www.layui.com/doc/base/changelog.html#2-2-3)
10 | * [2.2.2](https://www.layui.com/doc/base/changelog.html#2-2-2)
11 | * [2.2.1](https://www.layui.com/doc/base/changelog.html#2-2-1)
12 | * [2.2.0](https://www.layui.com/doc/base/changelog.html#2-2-0)
13 | * [2.1.7](https://www.layui.com/doc/base/changelog.html#2-1-7)
14 | * [2.1.6](https://www.layui.com/doc/base/changelog.html#2-1-6)
15 | * [2.1.5](https://www.layui.com/doc/base/changelog.html#2-1-5)
16 | * [2.1.4](https://www.layui.com/doc/base/changelog.html#2-1-4)
17 | * [2.1.3](https://www.layui.com/doc/base/changelog.html#2-1-3)
18 | * [2.1.2](https://www.layui.com/doc/base/changelog.html#2-1-2)
19 | * [2.1.1](https://www.layui.com/doc/base/changelog.html#2-1-1)
20 | * [2.1.0](https://www.layui.com/doc/base/changelog.html#2-1-0)
21 | * [2.0.2](https://www.layui.com/doc/base/changelog.html#2-0-2)
22 | * [2.0.1](https://www.layui.com/doc/base/changelog.html#2-0-1)
23 | * [2.0.0](https://www.layui.com/doc/base/changelog.html#2-0-0)
24 |
--------------------------------------------------------------------------------
/examples/layedit.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 富文本编辑器 - layui
7 |
8 |
9 |
10 |
13 |
14 |
15 |
16 |
27 |
28 |
29 |
30 |
50 |
51 |
--------------------------------------------------------------------------------
/dist/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)});
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "layui-src",
3 | "realname": "layui",
4 | "version": "2.5.6",
5 | "independents": {
6 | "layim": "3.9.1"
7 | },
8 | "description": "Classic modular front-end component library",
9 | "main": "dist/layui.js",
10 | "license": "MIT",
11 | "scripts": {
12 | "test": "karma start karma.conf.unit.js",
13 | "test:cov": "npm test -- --reporters mocha,coverage",
14 | "test:sauce": "karma start karma.conf.sauce.js",
15 | "test:watch": "npm test -- --auto-watch --no-single-run"
16 | },
17 | "repository": {
18 | "type": "git",
19 | "url": "git+ssh://git@github.com/sentsin/layui.git"
20 | },
21 | "author": [
22 | "sentsin "
23 | ],
24 | "homepage": "https://www.layui.com",
25 | "devDependencies": {
26 | "chai": "^4.1.1",
27 | "del": "^2.2.2",
28 | "gulp": "^3.9.1",
29 | "gulp-concat": "^2.6.0 ",
30 | "gulp-header": "^1.8.8",
31 | "gulp-if": "^2.0.1",
32 | "gulp-minify-css": "^1.2.4",
33 | "gulp-rename": "^1.2.2",
34 | "gulp-uglify": "^1.5.4",
35 | "gulp-zip": "^4.0.0",
36 | "karma": "^1.5.0",
37 | "karma-chai": "^0.1.0",
38 | "karma-chai-sinon": "^0.1.5",
39 | "karma-coverage": "^1.1.1",
40 | "karma-mocha": "^1.3.0",
41 | "karma-mocha-reporter": "^2.2.3",
42 | "karma-phantomjs-launcher": "^1.0.4",
43 | "karma-sauce-launcher": "^1.1.0",
44 | "minimist": "^1.2.0",
45 | "mocha": "^3.2.0",
46 | "sinon": "^3.2.1",
47 | "sinon-chai": "^2.13.0"
48 | },
49 | "bugs": {
50 | "url": "https://github.com/sentsin/layui/issues"
51 | },
52 | "directories": {
53 | "doc": "doc",
54 | "example": "examples",
55 | "test": "test"
56 | },
57 | "dependencies": {},
58 | "keywords": [
59 | "layui",
60 | "ui",
61 | "JavaScript Framework",
62 | "toolkit",
63 | "front-end component library"
64 | ]
65 | }
66 |
--------------------------------------------------------------------------------
/dist/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('");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)});
--------------------------------------------------------------------------------
/src/lay/modules/code.js:
--------------------------------------------------------------------------------
1 | /**
2 |
3 | @Name:layui.code 代码修饰器
4 | @Author:贤心
5 | @License:MIT
6 |
7 | */
8 |
9 | layui.define('jquery', function(exports){
10 | "use strict";
11 |
12 | var $ = layui.$;
13 | var about = 'http://www.layui.com/doc/modules/code.html'; //关于信息
14 |
15 | exports('code', function(options){
16 | var elems = [];
17 | options = options || {};
18 | options.elem = $(options.elem||'.layui-code');
19 | options.about = 'about' in options ? options.about : true;
20 |
21 | options.elem.each(function(){
22 | elems.push(this);
23 | });
24 |
25 | layui.each(elems.reverse(), function(index, item){
26 | var othis = $(item), html = othis.html();
27 |
28 | //转义HTML标签
29 | if(othis.attr('lay-encode') || options.encode){
30 | html = html.replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&')
31 | .replace(//g, '>').replace(/'/g, ''').replace(/"/g, '"')
32 | }
33 |
34 | othis.html('' + html.replace(/[\r\t\n]+/g, ' ') + ' ')
35 |
36 | if(!othis.find('>.layui-code-h3')[0]){
37 | othis.prepend(''+ (othis.attr('lay-title')||options.title||'code') + (options.about ? 'layui.code ' : '') + ' ');
38 | }
39 |
40 | var ol = othis.find('>.layui-code-ol');
41 | othis.addClass('layui-box layui-code-view');
42 |
43 | //识别皮肤
44 | if(othis.attr('lay-skin') || options.skin){
45 | othis.addClass('layui-code-' +(othis.attr('lay-skin') || options.skin));
46 | }
47 |
48 | //按行数适配左边距
49 | if((ol.find('li').length/100|0) > 0){
50 | ol.css('margin-left', (ol.find('li').length/100|0) + 'px');
51 | }
52 |
53 | //设置最大高度
54 | if(othis.attr('lay-height') || options.height){
55 | ol.css('max-height', othis.attr('lay-height') || options.height);
56 | }
57 |
58 | });
59 |
60 | });
61 | }).addcss('modules/code.css', 'skincodecss');
--------------------------------------------------------------------------------
/examples/json/table/demo3.json:
--------------------------------------------------------------------------------
1 | {
2 | "status": 200
3 | ,"message": ""
4 | ,"total": 3000000
5 | ,"data": {
6 | "list": [{
7 | "id": "10001"
8 | ,"username": "杜甫3"
9 | ,"email": "xianxin@layui.com"
10 | ,"sex": "男"
11 | ,"city": "浙江杭州"
12 | ,"sign": "鼠标移动到此处,可以通过点击单元格右侧的下拉图标,查看到被隐藏的全部内容。"
13 | ,"experience": "7"
14 | ,"ip": "192.168.0.8"
15 | ,"logins": 0
16 | ,"joinTime": "2016-10-14"
17 | }, {
18 | "id": "10002"
19 | ,"username": "李白3"
20 | ,"email": "xianxin@layui.com"
21 | ,"sex": "男"
22 | ,"city": "浙江杭州"
23 | ,"sign": "君不见,黄河之水天上来,奔流到海不复回。 君不见,高堂明镜悲白发,朝如青丝暮成雪。 人生得意须尽欢,莫使金樽空对月。 天生我材必有用,千金散尽还复来。 烹羊宰牛且为乐,会须一饮三百杯。 岑夫子,丹丘生,将进酒,杯莫停。 与君歌一曲,请君为我倾耳听。(倾耳听 一作:侧耳听) 钟鼓馔玉不足贵,但愿长醉不复醒。(不足贵 一作:何足贵;不复醒 一作:不愿醒/不用醒) 古来圣贤皆寂寞,惟有饮者留其名。(古来 一作:自古;惟 通:唯) 陈王昔时宴平乐,斗酒十千恣欢谑。 主人何为言少钱,径须沽取对君酌。 五花马,千金裘,呼儿将出换美酒,与尔同销万古愁。"
24 | ,"experience": "9"
25 | ,"ip": "192.168.0.8"
26 | ,"logins": "106"
27 | ,"joinTime": "2016-10-14"
28 | ,"LAY_CHECKED": true
29 | }, {
30 | "id": "10003"
31 | ,"username": "王勃"
32 | ,"email": "xianxin@layui.com"
33 | ,"sex": "男"
34 | ,"city": "浙江杭州"
35 | ,"sign": "人生恰似一场修行"
36 | ,"experience": "8"
37 | ,"ip": "192.168.0.8"
38 | ,"logins": "106"
39 | ,"joinTime": "2016-10-14"
40 | }, {
41 | "id": "10004"
42 | ,"username": "李清照"
43 | ,"email": "xianxin@layui.com"
44 | ,"sex": "女"
45 | ,"city": "浙江杭州"
46 | ,"sign": "人生恰似一场修行"
47 | ,"experience": "6"
48 | ,"ip": "192.168.0.8"
49 | ,"logins": "106"
50 | ,"joinTime": "2016-10-14"
51 | }, {
52 | "id": "10005"
53 | ,"username": "冰心"
54 | ,"email": "xianxin@layui.com"
55 | ,"sex": "女"
56 | ,"city": "浙江杭州"
57 | ,"sign": "人生恰似一场修行"
58 | ,"experience": "64"
59 | ,"ip": "192.168.0.8"
60 | ,"logins": "106"
61 | ,"joinTime": "2016-10-14"
62 | }, {
63 | "id": "10006"
64 | ,"username": "贤心"
65 | ,"email": "xianxin@layui.com"
66 | ,"sex": "男"
67 | ,"city": "浙江杭州"
68 | ,"sign": "人生恰似一场修行"
69 | ,"experience": "65"
70 | ,"ip": "192.168.0.8"
71 | ,"logins": "106"
72 | ,"joinTime": "2016-10-14"
73 | }]
74 | }
75 | }
--------------------------------------------------------------------------------
/examples/all.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 完整库使用 - layui
7 |
8 |
9 |
10 |
13 |
14 |
15 |
16 |
17 | 测试弹出式Form
18 |
19 |
20 |
21 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/examples/rate.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 评分 - layui
7 |
8 |
9 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
24 |
25 |
26 |
31 |
32 |
33 |
34 |
显示提示文字
35 |
36 |
37 |
38 |
39 |
40 |
41 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/dist/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='",u=1;u<=i.length;u++){var r=' ";i.half&&parseInt(i.value)!==i.value&&u==Math.ceil(i.value)?n=n+' ":n+=r}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)});
--------------------------------------------------------------------------------
/examples/util.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 工具集 - layui
7 |
8 |
9 |
10 |
13 |
14 |
15 |
16 | 事件1
17 | 事件2
18 | 事件3
19 |
20 | 事件4
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
33 |
34 |
35 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/examples/json/table/demo1.json:
--------------------------------------------------------------------------------
1 | {
2 | "code": 0
3 | ,"msg": ""
4 | ,"count": 3000000
5 | ,"totalRow": {
6 | "experience": "666"
7 | ,"logins": "999"
8 | }
9 | ,"data": [{
10 | "id": "10001"
11 | ,"username": "杜甫"
12 | ,"email": "xianxin@layui.com"
13 | ,"sex": "男"
14 | ,"city": "浙江杭州"
15 | ,"sign": "鼠标移动到此处,可以通过点击单元格右侧的下拉图标,查看到被隐藏的全部内容。"
16 | ,"experience": "7"
17 | ,"ip": "192.168.0.8"
18 | ,"logins": null
19 | ,"joinTime": "2016-10-14"
20 | }, {
21 | "id": "10002"
22 | ,"username": "李白"
23 | ,"email": "xianxin@layui.com"
24 | ,"sex": "男"
25 | ,"city": "浙江杭州"
26 | ,"sign": "君不见,黄河之水天上来,奔流到海不复回。 君不见,高堂明镜悲白发,朝如青丝暮成雪。 人生得意须尽欢,莫使金樽空对月。 天生我材必有用,千金散尽还复来。 烹羊宰牛且为乐,会须一饮三百杯。 岑夫子,丹丘生,将进酒,杯莫停。 与君歌一曲,请君为我倾耳听。(倾耳听 一作:侧耳听) 钟鼓馔玉不足贵,但愿长醉不复醒。(不足贵 一作:何足贵;不复醒 一作:不愿醒/不用醒) 古来圣贤皆寂寞,惟有饮者留其名。(古来 一作:自古;惟 通:唯) 陈王昔时宴平乐,斗酒十千恣欢谑。 主人何为言少钱,径须沽取对君酌。 五花马,千金裘,呼儿将出换美酒,与尔同销万古愁。"
27 | ,"experience": "9"
28 | ,"ip": "192.168.0.8"
29 | ,"logins": "106"
30 | ,"joinTime": "2016-10-14"
31 | ,"LAY_CHECKED": true
32 | }, {
33 | "id": "10003"
34 | ,"username": "王勃"
35 | ,"email": "xianxin@layui.com"
36 | ,"sex": "男"
37 | ,"city": "浙江杭州"
38 | ,"sign": "人生恰似一场修行"
39 | ,"experience": "8"
40 | ,"ip": "192.168.0.8"
41 | ,"logins": null
42 | ,"joinTime": "2016-10-14"
43 | }, {
44 | "id": "10004"
45 | ,"username": "李清照"
46 | ,"email": "xianxin@layui.com"
47 | ,"sex": "女"
48 | ,"city": "浙江杭州"
49 | ,"sign": "人生恰似一场修行"
50 | ,"experience": "6"
51 | ,"ip": "192.168.0.8"
52 | ,"logins": "106"
53 | ,"joinTime": "2016-10-14"
54 | }, {
55 | "id": "10005"
56 | ,"username": "冰心"
57 | ,"email": "xianxin@layui.com"
58 | ,"sex": "女"
59 | ,"city": "浙江杭州"
60 | ,"sign": "人生恰似一场修行"
61 | ,"experience": "64"
62 | ,"ip": "192.168.0.8"
63 | ,"logins": "106"
64 | ,"joinTime": "2016-10-14"
65 | }, {
66 | "id": "10006"
67 | ,"username": "贤心"
68 | ,"email": "xianxin@layui.com"
69 | ,"sex": "男"
70 | ,"city": "浙江杭州"
71 | ,"sign": "人生恰似一场修行"
72 | ,"experience": "65"
73 | ,"ip": "192.168.0.8"
74 | ,"logins": "106"
75 | ,"joinTime": "2016-10-14"
76 | }, {
77 | "id": "10007"
78 | ,"username": "贤心"
79 | ,"email": "xianxin@layui.com"
80 | ,"sex": "男"
81 | ,"city": "浙江杭州"
82 | ,"sign": "人生恰似一场修行"
83 | ,"experience": "49"
84 | ,"ip": "192.168.0.8"
85 | ,"logins": "106"
86 | ,"joinTime": "2016-10-14"
87 | }, {
88 | "id": "10008"
89 | ,"username": "贤心"
90 | ,"email": "xianxin@layui.com"
91 | ,"sex": "男"
92 | ,"city": "浙江杭州"
93 | ,"sign": "人生恰似一场修行"
94 | ,"experience": "5"
95 | ,"ip": "192.168.0.8"
96 | ,"logins": "106"
97 | ,"joinTime": "2016-10-14"
98 | }]
99 | }
--------------------------------------------------------------------------------
/examples/transfer.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 穿梭框
7 |
8 |
9 |
13 |
14 |
15 |
16 |
17 | 获取右侧数据
18 | 重载实例
19 |
20 |
21 |
22 |
23 |
24 |
25 |
33 |
34 |
35 |
36 |
37 |
38 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/examples/colorpicker.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 颜色选择器 - layui
7 |
8 |
9 |
10 |
14 |
15 |
16 |
17 |
18 |
24 |
25 |
28 |
29 |
32 |
33 |
36 |
37 |
40 |
41 |
44 |
45 |
46 |
47 |
106 |
107 |
--------------------------------------------------------------------------------
/examples/admin.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | layout 后台大布局 - Layui
9 |
10 |
11 |
12 |
13 |
43 |
44 |
70 |
71 |
75 |
76 |
80 |
81 |
82 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/karma.conf.sauce.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file karma配置
3 | * @author fe.xiaowu@gmail.com
4 | */
5 |
6 | var base = require('./karma.conf.base.js');
7 |
8 | var customLaunchers = {
9 | // Safari
10 | sl_ios_safari: {
11 | base: 'SauceLabs',
12 | browserName: 'Safari'
13 | },
14 |
15 | // 安卓浏览器
16 | // sl_android_4_4: {
17 | // base: 'SauceLabs',
18 | // browserName: 'android',
19 | // version: '4.4'
20 | // },
21 | // sl_android_5: {
22 | // base: 'SauceLabs',
23 | // browserName: 'android',
24 | // version: '5'
25 | // },
26 | sl_android_6: {
27 | base: 'SauceLabs',
28 | browserName: 'android',
29 | version: '6'
30 | },
31 |
32 | // chrome
33 | sl_ios_chrome: {
34 | base: 'SauceLabs',
35 | browserName: 'chrome'
36 | },
37 |
38 | // sl_ie_8: {
39 | // base: 'SauceLabs',
40 | // browserName: 'internet explorer',
41 | // version: '8'
42 | // },
43 | sl_ie_9: {
44 | base: 'SauceLabs',
45 | browserName: 'internet explorer',
46 | version: '9'
47 | },
48 | sl_ie_10: {
49 | base: 'SauceLabs',
50 | browserName: 'internet explorer',
51 | version: '10'
52 | },
53 | sl_ie_11: {
54 | base: 'SauceLabs',
55 | browserName: 'internet explorer',
56 | version: '11'
57 | },
58 |
59 | sl_edga: {
60 | base: 'SauceLabs',
61 | browserName: 'microsoftedge',
62 | // platform: 'Windows 10'
63 | },
64 |
65 | // sl_firefox: {
66 | // base: 'SauceLabs',
67 | // browserName: 'firefox'
68 | // }
69 | };
70 |
71 | // 不支持本地运行
72 | if (!process.env.TRAVIS) {
73 | console.error('不支持本地运行, 请使用 npm run test!');
74 | process.exit(1);
75 | }
76 |
77 | // 变量检查
78 | if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) {
79 | console.error('---------------');
80 | console.error('Make sure the SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are set.');
81 | console.error('---------------');
82 | process.exit(1);
83 | }
84 |
85 | module.exports = function (config) {
86 | var options = Object.assign(base(config), {
87 | reporters: ['mocha', 'saucelabs'],
88 | sauceLabs: {
89 | 'testName': 'layui',
90 | 'recordVideo': false,
91 | 'recordScreenshots': false,
92 | 'startConnect': false,
93 | 'connectOptions': {
94 | 'no-ssl-bump-domains': 'all'
95 | },
96 | 'public': 'public',
97 | 'build': 'layui-build-' + process.env.TRAVIS_BUILD_NUMBER,
98 | 'tunnelIdentifier': process.env.TRAVIS_JOB_NUMBER
99 | },
100 | customLaunchers: customLaunchers,
101 | browsers: Object.keys(customLaunchers),
102 | captureTimeout: 1000 * 60 * 5,
103 | browserNoActivityTimeout: 1000 * 60 * 5,
104 | browserDisconnectTolerance: 3,
105 | browserDisconnectTimeout: 10000
106 | });
107 |
108 | config.set(options);
109 | };
110 |
--------------------------------------------------------------------------------
/examples/xingzuo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 星座配对
7 |
8 |
9 |
10 |
11 |
12 |
13 |
54 |
55 |
56 |
57 |
58 | 你
59 |
60 | 天秤座
61 | 处女座
62 | 水瓶座
63 | 双子座
64 | 双鱼座
65 | 白羊座
66 |
67 |
68 |
69 |
70 |
103 |
104 |
--------------------------------------------------------------------------------
/examples/flow.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 流加载 - layui
7 |
8 |
9 |
10 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/examples/layer.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | layer弹层 - layui
9 |
10 |
11 |
12 |
15 |
16 |
17 |
18 | Alert
19 | Confirm
20 | Msg
21 | Tips
22 | Page
23 | Iframe
24 | Prompt
25 | Tab
26 | 更多例子
27 |
28 |
29 | 123
30 |
31 |
32 |
33 |
34 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/examples/code.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 代码修饰器 - layui
7 |
8 |
9 |
10 |
14 |
15 |
16 |
17 |
18 | //路由
19 | LAY.fn.router = function(hash){
20 | var hashs = (hash || location.hash).replace(/^#/, '').split('/') || [];
21 | var item, param = {
22 | dir: []
23 | };
24 | for(var i = 0; i < hashs.length; i++){
25 | item = hashs[i].split('=');
26 | /^\w+=/.test(hashs[i]) ? function(){
27 | if(item[0] !== 'dir'){
28 | param[item[0]] = item[1];
29 | }
30 | }() : param.dir.push(hashs[i]);
31 | item = null;
32 | }
33 | return param;
34 | };
35 |
36 |
37 |
38 | //路由
39 | LAY.fn.router = function(hash){
40 | var hashs = (hash || location.hash).replace(/^#/, '').split('/') || [];
41 | var item, param = {
42 | dir: []
43 | };
44 | for(var i = 0; i < hashs.length; i++){
45 | item = hashs[i].split('=');
46 | /^\w+=/.test(hashs[i]) ? function(){
47 | if(item[0] !== 'dir'){
48 | param[item[0]] = item[1];
49 | }
50 | }() : param.dir.push(hashs[i]);
51 | item = null;
52 | }
53 | return param;
54 | };
55 |
56 |
57 |
58 | var hashs = (hash || location.hash).replace(/^#/, '').split('/') || [];
59 | var item, param = {
60 | dir: []
61 | };
62 |
63 | //代码中的代码
64 | var hashs = (hash || location.hash).replace(/^#/, '').split('/') || [];
65 | var item, param = {
66 | dir: []
67 | };
68 |
69 |
70 |
71 |
72 | //路由
73 | LAY.fn.router = function(hash){
74 | var hashs = (hash || location.hash).replace(/^#/, '').split('/') || [];
75 | var item, param = {
76 | dir: []
77 | };
78 | for(var i = 0; i < hashs.length; i++){
79 | item = hashs[i].split('=');
80 | /^\w+=/.test(hashs[i]) ? function(){
81 | if(item[0] !== 'dir'){
82 | param[item[0]] = item[1];
83 | }
84 | }() : param.dir.push(hashs[i]);
85 | item = null;
86 | }
87 | return param;
88 | };
89 |
90 | //代码中的代码
91 | var hashs = (hash || location.hash).replace(/^#/, '').split('/') || [];
92 | var item, param = {
93 | dir: []
94 | };
95 |
96 | //代码中的代码
97 | var hashs = (hash || location.hash).replace(/^#/, '').split('/') || [];
98 | var item, param = {
99 | dir: []
100 | };
101 |
102 | //代码中的代码
103 | var hashs = (hash || location.hash).replace(/^#/, '').split('/') || [];
104 | var item, param = {
105 | dir: []
106 | };
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 | 123
116 |
117 |
118 |
119 |
120 |
121 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/examples/extends/temp.js:
--------------------------------------------------------------------------------
1 | /**
2 |
3 | @Name:layui.modDemo XX组件
4 | @Author:贤心
5 | @License:MIT
6 |
7 | */
8 |
9 | layui.define(['laytpl'], function(exports){
10 | "use strict";
11 |
12 | var $ = layui.$
13 | ,laytpl = layui.laytpl
14 |
15 | //模块名
16 | ,MOD_NAME = 'modDemo'
17 |
18 | //外部接口
19 | ,modeDemo = {
20 | config: {}
21 | ,index: layui[MOD_NAME] ? (layui[MOD_NAME].index + 10000) : 0
22 |
23 | //设置全局项
24 | ,set: function(options){
25 | var that = this;
26 | that.config = $.extend({}, that.config, options);
27 | return that;
28 | }
29 |
30 | //事件监听
31 | ,on: function(events, callback){
32 | return layui.onevent.call(this, MOD_NAME, events, callback);
33 | }
34 | }
35 |
36 | //操作当前实例
37 | ,thisModule = function(){
38 | var that = this
39 | ,options = that.config
40 | ,id = options.id || that.index;
41 |
42 | thisModule.that[id] = that; //记录当前实例对象
43 | thisModule.config[id] = options; //记录当前实例配置项
44 |
45 | return {
46 | config: options
47 | //重置实例
48 | ,reload: function(options){
49 | that.reload.call(that, options);
50 | }
51 | }
52 | }
53 |
54 | //获取当前实例配置项
55 | ,getThisModuleConfig = function(id){
56 | var config = thisModule.config[id];
57 | if(!config) hint.error('The ID option was not found in the '+ MOD_NAME +' instance');
58 | return config || null;
59 | }
60 |
61 | //字符常量
62 | ,ELEM = 'layui-modeDemo'
63 |
64 |
65 | //主模板
66 | ,TPL_MAIN = [''
67 |
68 | ,'
'].join('')
69 |
70 | //构造器
71 | ,Class = function(options){
72 | var that = this;
73 | that.index = ++transfer.index;
74 | that.config = $.extend({}, that.config, transfer.config, options);
75 | that.render();
76 | };
77 |
78 | //默认配置
79 | Class.prototype.config = {
80 |
81 | };
82 |
83 | //重载实例
84 | Class.prototype.reload = function(options){
85 | var that = this;
86 |
87 | layui.each(options, function(key, item){
88 | if(item.constructor === Array) delete that.config[key];
89 | });
90 |
91 | that.config = $.extend(true, {}, that.config, options);
92 | that.render();
93 | };
94 |
95 | //渲染
96 | Class.prototype.render = function(){
97 | var that = this
98 | ,options = that.config;
99 |
100 | //解析模板
101 | that.elem = $(TPL_MAIN);
102 |
103 | var othis = options.elem = $(options.elem);
104 | if(!othis[0]) return;
105 |
106 | //索引
107 | that.key = options.id || that.index;
108 |
109 | //插入组件结构
110 | othis.html(that.elem);
111 |
112 | that.events(); //事件
113 | };
114 |
115 | //事件
116 | Class.prototype.events = function(){
117 | var that = this;
118 |
119 |
120 | };
121 |
122 |
123 |
124 | //记录所有实例
125 | thisModule.that = {}; //记录所有实例对象
126 | thisModule.config = {}; //记录所有实例配置项
127 |
128 | //重载实例
129 | modeDemo.reload = function(id, options){
130 | var that = thisModule.that[id];
131 | that.reload(options);
132 |
133 | return thisModule.call(that);
134 | };
135 |
136 | //核心入口
137 | modeDemo.render = function(options){
138 | var inst = new Class(options);
139 | return thisTransfer.call(inst);
140 | };
141 |
142 | exports(MOD_NAME, modeDemo);
143 | });
144 |
--------------------------------------------------------------------------------
/examples/carousel.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 轮播组件 - layui
7 |
8 |
9 |
10 |
20 |
21 |
22 |
23 |
24 |
25 |
条目1
26 |
条目2
27 |
条目3
28 |
条目4
29 |
30 |
31 |
32 |
33 |
34 |
40 |
41 |
42 |
43 |
44 |
45 |
条目1
46 |
条目2
47 |
条目3
48 |
条目4
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/dist/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(['',e.bar1?''+c[0]+" ":"",e.bar2?''+c[1]+" ":"",''+c[2]+" "," "].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)});
--------------------------------------------------------------------------------
/src/lay/modules/laytpl.js:
--------------------------------------------------------------------------------
1 | /**
2 |
3 | @Name : layui.laytpl 模板引擎
4 | @Author:贤心
5 | @License:MIT
6 |
7 | */
8 |
9 | layui.define(function(exports){
10 |
11 | "use strict";
12 |
13 | var config = {
14 | open: '{{',
15 | close: '}}'
16 | };
17 |
18 | var tool = {
19 | exp: function(str){
20 | return new RegExp(str, 'g');
21 | },
22 | //匹配满足规则内容
23 | query: function(type, _, __){
24 | var types = [
25 | '#([\\s\\S])+?', //js语句
26 | '([^{#}])*?' //普通字段
27 | ][type || 0];
28 | return exp((_||'') + config.open + types + config.close + (__||''));
29 | },
30 | escape: function(html){
31 | return String(html||'').replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&')
32 | .replace(//g, '>').replace(/'/g, ''').replace(/"/g, '"');
33 | },
34 | error: function(e, tplog){
35 | var error = 'Laytpl Error:';
36 | typeof console === 'object' && console.error(error + e + '\n'+ (tplog || ''));
37 | return error + e;
38 | }
39 | };
40 |
41 | var exp = tool.exp, Tpl = function(tpl){
42 | this.tpl = tpl;
43 | };
44 |
45 | Tpl.pt = Tpl.prototype;
46 |
47 | window.errors = 0;
48 |
49 | //编译模版
50 | Tpl.pt.parse = function(tpl, data){
51 | var that = this, tplog = tpl;
52 | var jss = exp('^'+config.open+'#', ''), jsse = exp(config.close+'$', '');
53 |
54 | tpl = tpl.replace(/\s+|\r|\t|\n/g, ' ')
55 | .replace(exp(config.open+'#'), config.open+'# ')
56 | .replace(exp(config.close+'}'), '} '+config.close).replace(/\\/g, '\\\\')
57 |
58 | //不匹配指定区域的内容
59 | .replace(exp(config.open + '!(.+?)!' + config.close), function(str){
60 | str = str.replace(exp('^'+ config.open + '!'), '')
61 | .replace(exp('!'+ config.close), '')
62 | .replace(exp(config.open + '|' + config.close), function(tag){
63 | return tag.replace(/(.)/g, '\\$1')
64 | });
65 | return str
66 | })
67 |
68 | //匹配JS规则内容
69 | .replace(/(?="|')/g, '\\').replace(tool.query(), function(str){
70 | str = str.replace(jss, '').replace(jsse, '');
71 | return '";' + str.replace(/\\/g, '') + ';view+="';
72 | })
73 |
74 | //匹配普通字段
75 | .replace(tool.query(1), function(str){
76 | var start = '"+(';
77 | if(str.replace(/\s/g, '') === config.open+config.close){
78 | return '';
79 | }
80 | str = str.replace(exp(config.open+'|'+config.close), '');
81 | if(/^=/.test(str)){
82 | str = str.replace(/^=/, '');
83 | start = '"+_escape_(';
84 | }
85 | return start + str.replace(/\\/g, '') + ')+"';
86 | });
87 |
88 | tpl = '"use strict";var view = "' + tpl + '";return view;';
89 |
90 | try{
91 | that.cache = tpl = new Function('d, _escape_', tpl);
92 | return tpl(data, tool.escape);
93 | } catch(e){
94 | delete that.cache;
95 | return tool.error(e, tplog);
96 | }
97 | };
98 |
99 | Tpl.pt.render = function(data, callback){
100 | var that = this, tpl;
101 | if(!data) return tool.error('no data');
102 | tpl = that.cache ? that.cache(data, tool.escape) : that.parse(that.tpl, data);
103 | if(!callback) return tpl;
104 | callback(tpl);
105 | };
106 |
107 | var laytpl = function(tpl){
108 | if(typeof tpl !== 'string') return tool.error('Template not found');
109 | return new Tpl(tpl);
110 | };
111 |
112 | laytpl.config = function(options){
113 | options = options || {};
114 | for(var i in options){
115 | config[i] = options[i];
116 | }
117 | };
118 |
119 | laytpl.v = '1.2.0';
120 |
121 | exports('laytpl', laytpl);
122 |
123 | });
--------------------------------------------------------------------------------
/dist/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([''+("updown"===n.anim?"":"")+" ",''+("updown"===n.anim?"":"")+" "].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):a
2 |
3 |
4 |
5 |
6 |
7 | Classic modular front-end UI framework
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | ---
20 |
21 | layui 是一款采用自身模块规范编写的前端 UI 框架,遵循原生 HTML/CSS/JS 的书写与组织形式,门槛极低,拿来即用。其外在极简,却又不失饱满的内在,体积轻盈,组件丰盈,从核心代码到 API 的每一处细节都经过精心雕琢,非常适合界面的快速开发。layui 首个版本发布于 2016 年金秋,她区别于那些基于 MVVM 底层的 UI 框架,却并非逆道而行,而是信奉返璞归真之道。准确地说,她更多是为服务端程序员量身定做,你无需涉足各种前端工具的复杂配置,只需面对浏览器本身,让一切你所需要的元素与交互,从这里信手拈来。
22 |
23 | ## 返璞归真
24 |
25 | layui 定义为“经典模块化”,并非是自吹她自身有多优秀,而是有意避开当下 JS 社区的主流方案,试图以最简单的方式去诠释高效!她的所谓经典,是在于对返璞归真的执念 ,她以当前浏览器普通认可的方式去组织模块!我们认为,这恰是符合当下国内绝大多数程序员从旧时代过渡到未来新标准的最佳指引。所以 layui 本身也并不是完全遵循于AMD时代,准确地说,她试图建立自己的模式,所以你会看到:
26 |
27 | ```js
28 | //layui模块的定义
29 | layui.define([mods], function(exports){
30 |
31 | //……
32 |
33 | exports('mod', api);
34 | });
35 |
36 | //layui模块的使用
37 | layui.use(['mod1', 'mod2'], function(args){
38 | var mod = layui.mod1;
39 |
40 | //……
41 |
42 | });
43 | ```
44 | 没错,她具备AMD的影子,又并非受限于 commonjs 的那些条条框框,layui 认为这种轻量的组织方式,比 WebPack 更符合绝大多数场景。所以她坚持采用经典模块化,也正是能让人避开工具的复杂配置,回归简单,安静高效地撸一会原生态的HTML、CSS、JavaScript。
45 |
46 | 但是 layui 又并非是 Requirejs 那样的模块加载器,而是一款 UI 解决方案,她与 Bootstrap 最大的不同恰恰在于她糅合了自身对经典模块化的理解。
47 |
48 |
49 | ## 快速上手
50 |
51 | 获得 layui 后,将其完整地部署到你的项目目录(或静态资源服务器),你只需要引入下述两个文件:
52 |
53 | ```
54 | ./layui/css/layui.css
55 | ./layui/layui.js //提示:如果是采用非模块化方式(最下面有讲解),此处可换成:./layui/layui.all.js
56 | ```
57 |
58 | 不用去管其它任何文件。因为他们(比如各模块)都是在最终使用的时候才会自动加载。这是一个基本的入门页面:
59 |
60 | ```html
61 |
62 |
63 |
64 |
65 |
66 | 开始使用layui
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
83 |
84 |
85 | ```
86 |
87 | 如果你想采用非模块化方式(即所有模块一次性加载,尽管我们并不推荐你这么做),你也可以按照下面的方式使用:
88 |
89 | ```html
90 |
91 |
92 |
93 |
94 |
95 | 非模块化方式使用layui
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
112 |
113 |
114 | ```
115 | ## [阅读文档](http://www.layui.com/)
116 | 从现在开始,尽情地拥抱 layui 吧!但愿她能成为你长远的开发伴侣,化作你方寸屏幕前的亿万字节!
117 |
118 | ## 相关
119 | [官网](http://www.layui.com/)、[更新日志](http://www.layui.com/doc/base/changelog.html)、[社区交流](http://fly.layui.com)
--------------------------------------------------------------------------------
/examples/laypage.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 分页 - layui
7 |
8 |
9 |
10 |
13 |
14 |
15 |
16 | 总页数低于页码总数:
17 | 总页数大于页码总数:
18 | 自定义主题:
19 | 自定义首页、尾页、上一页、下一页文本:
20 | 不显示首页尾页:
21 | 开启HASH:
22 | 只显示上一页、下一页:
23 | 显示完整功能:
24 | 自定义排版:
25 |
26 |
27 | 将一段已知数组分页展示
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
188 |
189 |
190 |
--------------------------------------------------------------------------------
/examples/button.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 按钮 - layui
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
18 |
19 |
20 |
21 |
22 | 按钮色系:
23 |
24 | 原始按钮
25 | 默认按钮
26 | 百搭按钮
27 | 暖色按钮
28 | 警告按钮
29 | 禁用按钮
30 |
31 |
32 |
33 | 按钮图标:
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | 按钮尺寸:
46 |
47 |
48 | 大型按钮
49 | 默认按钮
50 | 小型按钮
51 | 迷你按钮
52 | 大型按钮
53 | 默认按钮
54 | 小型按钮
55 | 迷你按钮
56 |
57 |
58 |
59 | 按钮圆角:
60 |
61 | 原始按钮
62 | 默认按钮
63 | 百搭按钮
64 | 暖色按钮
65 | 警告按钮
66 | 禁用按钮
67 |
68 |
69 |
70 | 按钮图文:
71 |
72 | 大型加圆角
73 | 删除
74 | 禁分享
75 |
76 |
77 |
78 | 按钮组:
79 |
80 |
81 | 增加
82 | 编辑
83 | 删除
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
108 |
109 |
110 |
--------------------------------------------------------------------------------
/dist/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=[''];return layui.each(a.limits,function(t,n){e.push('"+n+" 条/页 ")}),e.join("")+" "}(),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)});
--------------------------------------------------------------------------------
/karma.conf.base.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file karma自动化测试配置
3 | * @author fe.xiaowu@gmail.com
4 | */
5 |
6 | var url = require('url');
7 |
8 | /**
9 | * mock一个server供测试使用
10 | *
11 | * @param {Object} req request
12 | * @param {Object} res response
13 | * @param {Function} next 下一路由
14 | *
15 | * @example
16 | * 请求 /api/mock 参数如:
17 | * timeout - 超时时间, 默认 0
18 | * statusCode - 状态码, 默认 200
19 | * response - 响应内容, 默认 {}
20 | * dataType - 响应格式, 默认 json
21 | */
22 | var httpServer = function (req, res, next) {
23 | if (req.url.indexOf('/api/mock') === -1) {
24 | return next();
25 | }
26 |
27 | var data = url.parse(req.url, true).query;
28 |
29 | setTimeout(function () {
30 | res.statusCode = data.statusCode || 200;
31 | res.setHeader('content-type', data.contentType || 'json');
32 | res.end(data.response || '{}');
33 | }, data.timeout || 0);
34 | };
35 |
36 | /**
37 | * 源文件
38 | *
39 | * @type {Array}
40 | */
41 | var sourceFileMap = [
42 | 'src/layui.js',
43 | 'src/lay/modules/jquery.js',
44 | 'src/lay/modules/carousel.js',
45 | 'src/lay/modules/code.js',
46 | 'src/lay/modules/element.js',
47 | 'src/lay/modules/flow.js',
48 | 'src/lay/modules/form.js',
49 | 'src/lay/modules/laydate.js',
50 | 'src/lay/modules/layedit.js',
51 | 'src/lay/modules/layer.js',
52 | 'src/lay/modules/laypage.js',
53 | 'src/lay/modules/laytpl.js',
54 | 'src/lay/modules/table.js',
55 | 'src/lay/modules/tree.js',
56 | 'src/lay/modules/upload.js',
57 | 'src/lay/modules/util.js',
58 | 'src/lay/modules/mobile/zepto.js',
59 | 'src/lay/modules/mobile/layer-mobile.js',
60 | 'src/lay/modules/mobile/upload-mobile.js'
61 | ];
62 |
63 | /**
64 | * 测试覆盖率文件, 要忽略 jquery.js、zepto.js
65 | *
66 | * @type {Object}
67 | */
68 | var coverageFileMap = {};
69 | sourceFileMap.filter(function (uri) {
70 | return !/(jquery|zepto)\.js$/.test(uri);
71 | }).forEach(function (uri) {
72 | coverageFileMap[uri] = ['coverage'];
73 | });
74 |
75 | module.exports = function (config) {
76 | return {
77 | // base path that will be used to resolve all patterns (eg. files, exclude)
78 | basePath: '',
79 |
80 | // frameworks to use
81 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
82 | // Important: 下列数组中文件将『逆序载入』
83 | frameworks: ['mocha', 'chai', 'chai-sinon'],
84 |
85 |
86 | // list of files / patterns to load in the browser
87 | files: sourceFileMap.concat('test/**/*.js').concat({
88 | pattern: 'src/css/**/*',
89 | included: false
90 | }, {
91 | pattern: 'src/font/**/*',
92 | included: false
93 | }, {
94 | pattern: 'src/images/**/*',
95 | included: false
96 | }),
97 |
98 |
99 | // list of files to exclude
100 | exclude: [],
101 |
102 | client: {
103 | mocha: {
104 | // mocha测试超时6秒
105 | timeout: 1000 * 6
106 | }
107 | },
108 |
109 |
110 | // preprocess matching files before serving them to the browser
111 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
112 | preprocessors: coverageFileMap,
113 |
114 |
115 | // test results reporter to use
116 | // possible values: 'dots', 'progress'
117 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter
118 | reporters: [
119 | 'mocha'
120 | // 'coverage'
121 | ],
122 |
123 | coverageReporter: {
124 | // specify a common output directory
125 | dir: '.',
126 | reporters: [
127 | // { type: 'html', subdir: 'report-html' },
128 | {
129 | type: 'lcov',
130 | subdir: 'coverage'
131 | },
132 | {
133 | type: 'text-summary'
134 | }
135 | ]
136 | },
137 |
138 |
139 | // web server port
140 | port: 9876,
141 |
142 |
143 | // enable / disable colors in the output (reporters and logs)
144 | colors: true,
145 |
146 |
147 | // level of logging
148 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
149 | // Note: 如果要调试Karma,请设置为DEBUG
150 | logLevel: config.LOG_INFO,
151 |
152 | // start these browsers
153 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
154 | browsers: [
155 | 'PhantomJS'
156 | ],
157 |
158 |
159 | // enable / disable watching file and executing tests whenever any file changes
160 | // Note: 代码改动自动运行测试,需要singleRun为false
161 | autoWatch: false,
162 |
163 | // Continuous Integration mode
164 | // if true, Karma captures browsers, runs the tests and exits
165 | // 脚本调用请设为 true
166 | singleRun: true,
167 |
168 | middleware: ['httpServer'],
169 |
170 | plugins: ['karma-*', {
171 | 'middleware:httpServer': [
172 | 'factory', function () {
173 | return httpServer;
174 | }
175 | ]
176 | }]
177 | };
178 | };
179 |
--------------------------------------------------------------------------------
/src/lay/modules/flow.js:
--------------------------------------------------------------------------------
1 | /**
2 |
3 | @Name:layui.flow 流加载
4 | @Author:贤心
5 | @License:MIT
6 |
7 | */
8 |
9 |
10 | layui.define('jquery', function(exports){
11 | "use strict";
12 |
13 | var $ = layui.$, Flow = function(options){}
14 | ,ELEM_MORE = 'layui-flow-more'
15 | ,ELEM_LOAD = ' ';
16 |
17 | //主方法
18 | Flow.prototype.load = function(options){
19 | var that = this, page = 0, lock, isOver, lazyimg, timer;
20 | options = options || {};
21 |
22 | var elem = $(options.elem); if(!elem[0]) return;
23 | var scrollElem = $(options.scrollElem || document); //滚动条所在元素
24 | var mb = options.mb || 50; //与底部的临界距离
25 | var isAuto = 'isAuto' in options ? options.isAuto : true; //是否自动滚动加载
26 | var end = options.end || '没有更多了'; //“末页”显示文案
27 |
28 | //滚动条所在元素是否为document
29 | var notDocment = options.scrollElem && options.scrollElem !== document;
30 |
31 | //加载更多
32 | var ELEM_TEXT = '加载更多 '
33 | ,more = $('');
34 |
35 | if(!elem.find('.layui-flow-more')[0]){
36 | elem.append(more);
37 | }
38 |
39 | //加载下一个元素
40 | var next = function(html, over){
41 | html = $(html);
42 | more.before(html);
43 | over = over == 0 ? true : null;
44 | over ? more.html(end) : more.find('a').html(ELEM_TEXT);
45 | isOver = over;
46 | lock = null;
47 | lazyimg && lazyimg();
48 | };
49 |
50 | //触发请求
51 | var done = function(){
52 | lock = true;
53 | more.find('a').html(ELEM_LOAD);
54 | typeof options.done === 'function' && options.done(++page, next);
55 | };
56 |
57 | done();
58 |
59 | //不自动滚动加载
60 | more.find('a').on('click', function(){
61 | var othis = $(this);
62 | if(isOver) return;
63 | lock || done();
64 | });
65 |
66 | //如果允许图片懒加载
67 | if(options.isLazyimg){
68 | var lazyimg = that.lazyimg({
69 | elem: options.elem + ' img'
70 | ,scrollElem: options.scrollElem
71 | });
72 | }
73 |
74 | if(!isAuto) return that;
75 |
76 | scrollElem.on('scroll', function(){
77 | var othis = $(this), top = othis.scrollTop();
78 |
79 | if(timer) clearTimeout(timer);
80 | if(isOver || !elem.width()) return; //如果已经结束,或者元素处于隐藏状态,则不执行滚动加载
81 |
82 | timer = setTimeout(function(){
83 | //计算滚动所在容器的可视高度
84 | var height = notDocment ? othis.height() : $(window).height();
85 |
86 | //计算滚动所在容器的实际高度
87 | var scrollHeight = notDocment
88 | ? othis.prop('scrollHeight')
89 | : document.documentElement.scrollHeight;
90 |
91 | //临界点
92 | if(scrollHeight - top - height <= mb){
93 | lock || done();
94 | }
95 | }, 100);
96 | });
97 |
98 | return that;
99 | };
100 |
101 | //图片懒加载
102 | Flow.prototype.lazyimg = function(options){
103 | var that = this, index = 0, haveScroll;
104 | options = options || {};
105 |
106 | var scrollElem = $(options.scrollElem || document); //滚动条所在元素
107 | var elem = options.elem || 'img';
108 |
109 | //滚动条所在元素是否为document
110 | var notDocment = options.scrollElem && options.scrollElem !== document;
111 |
112 | //显示图片
113 | var show = function(item, height){
114 | var start = scrollElem.scrollTop(), end = start + height;
115 | var elemTop = notDocment ? function(){
116 | return item.offset().top - scrollElem.offset().top + start;
117 | }() : item.offset().top;
118 |
119 | /* 始终只加载在当前屏范围内的图片 */
120 | if(elemTop >= start && elemTop <= end){
121 | if(!item.attr('src')){
122 | var src = item.attr('lay-src');
123 | layui.img(src, function(){
124 | var next = that.lazyimg.elem.eq(index);
125 | item.attr('src', src).removeAttr('lay-src');
126 |
127 | /* 当前图片加载就绪后,检测下一个图片是否在当前屏 */
128 | next[0] && render(next);
129 | index++;
130 | });
131 | }
132 | }
133 | }, render = function(othis, scroll){
134 |
135 | //计算滚动所在容器的可视高度
136 | var height = notDocment ? (scroll||scrollElem).height() : $(window).height();
137 | var start = scrollElem.scrollTop(), end = start + height;
138 |
139 | that.lazyimg.elem = $(elem);
140 |
141 | if(othis){
142 | show(othis, height);
143 | } else {
144 | //计算未加载过的图片
145 | for(var i = 0; i < that.lazyimg.elem.length; i++){
146 | var item = that.lazyimg.elem.eq(i), elemTop = notDocment ? function(){
147 | return item.offset().top - scrollElem.offset().top + start;
148 | }() : item.offset().top;
149 |
150 | show(item, height);
151 | index = i;
152 |
153 | //如果图片的top坐标,超出了当前屏,则终止后续图片的遍历
154 | if(elemTop > end) break;
155 | }
156 | }
157 | };
158 |
159 | render();
160 |
161 | if(!haveScroll){
162 | var timer;
163 | scrollElem.on('scroll', function(){
164 | var othis = $(this);
165 | if(timer) clearTimeout(timer)
166 | timer = setTimeout(function(){
167 | render(null, othis);
168 | }, 50);
169 | });
170 | haveScroll = true;
171 | }
172 | return render;
173 | };
174 |
175 | //暴露接口
176 | exports('flow', new Flow());
177 | });
178 |
--------------------------------------------------------------------------------
/test/lay/modules/code.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file code - 测试
3 | * @author xuexb
4 | */
5 |
6 | /* global layui */
7 | /* eslint-disable max-nested-callbacks, fecs-indent */
8 |
9 | var laycode = layui.code;
10 | var $ = layui.$;
11 |
12 | /**
13 | * 创建dom元素, 并返回 jquery 对象
14 | *
15 | * @inner
16 | *
17 | * @param {string} html 标签
18 | *
19 | * @return {jQuery}
20 | */
21 | var createNode = function (html) {
22 | return $(html).addClass('test-node').appendTo('body');
23 | };
24 |
25 | describe('code', function () {
26 | // 输出测试节点
27 | beforeEach(function () {
28 | createNode('
');
29 | });
30 |
31 | // 删除节点
32 | afterEach(function () {
33 | $('.test-node').remove();
34 | });
35 |
36 | it('css loaded', function () {
37 | expect($('#layuicss-skincodecss').length).to.equal(1, 'css link 节点必须存在');
38 | });
39 |
40 | it('default params', function () {
41 | expect(function () {
42 | laycode();
43 | }).to.not.throw();
44 |
45 | createNode('123
');
46 | laycode();
47 |
48 | expect($('.layui-code').hasClass('layui-code-view')).to.equal(true, '元素的样式名必须包含 layui-code-view');
49 | expect($('.layui-code').find('.layui-code-div').length).to.equal(1, '默认没有 encode');
50 | expect($('.layui-code').find('.layui-code-h3 a').length).to.equal(1, '默认有版权元素');
51 | });
52 |
53 | it('options.elem', function () {
54 | createNode('123
');
55 |
56 | laycode();
57 | expect($('.layui-test').hasClass('layui-code-view')).to.be.false;
58 |
59 | laycode({
60 | elem: '.layui-test'
61 | });
62 | expect($('.layui-test').hasClass('layui-code-view')).to.be.true;
63 | });
64 |
65 | it('options.title', function () {
66 | createNode('123
');
67 |
68 | laycode({
69 | title: 'layui',
70 |
71 | // 主要是版权和标题在一个元素内
72 | about: false
73 | });
74 |
75 | expect($('.layui-code-h3').text()).to.equal('layui', '判断标题元素');
76 | });
77 |
78 | it('options.height', function () {
79 | createNode('123
');
80 |
81 | laycode({
82 | height: 100
83 | });
84 |
85 | expect($('.layui-code-ol').css('maxHeight')).to.equal('100px', '判断ol元素的最大高');
86 | });
87 |
88 | it('options.encode', function () {
89 | createNode('123\'"
');
90 |
91 | laycode({
92 | encode: true
93 | });
94 |
95 | expect($('.layui-code').find('.layui-code-div').length).to.equal(0, 'encode 后元素被转义');
96 | });
97 |
98 | it('options.skin', function () {
99 | createNode('123
');
100 |
101 | laycode({
102 | skin: 'notepad'
103 | });
104 |
105 | expect($('.layui-code-notepad').length).to.equal(1, '自定义风格存在');
106 | });
107 |
108 | it('options.about', function () {
109 | createNode('123
');
110 |
111 | laycode({
112 | about: false
113 | });
114 |
115 | expect($('.layui-code').find('.layui-code-h3 a').length).to.equal(0, '不输出版权元素');
116 | });
117 |
118 | it('attr lay-title', function () {
119 | createNode('123
');
120 |
121 | laycode({
122 | // 主要是版权和标题在一个元素内
123 | about: false
124 | });
125 |
126 | expect($('.layui-code-h3').text()).to.equal('layui', '判断标题元素');
127 | });
128 |
129 | it('attr lay-height', function () {
130 | createNode('123
');
131 |
132 | laycode();
133 |
134 | expect($('.layui-code-ol').css('maxHeight')).to.equal('100px', '判断ol元素的最大高');
135 | });
136 |
137 | it('attr lay-encode', function () {
138 | createNode('123
');
139 |
140 | laycode();
141 |
142 | expect($('.layui-code').find('.layui-code-div').length).to.equal(0, 'encode 后元素被转义');
143 | });
144 |
145 | it('attr lay-skin', function () {
146 | createNode('123
');
147 |
148 | laycode();
149 |
150 | expect($('.layui-code-notepad').length).to.equal(1, '自定义风格存在');
151 | });
152 |
153 | it('multiple nested', function () {
154 | createNode([
155 | '',
156 | '123
',
157 | '123
',
158 | ' '
159 | ].join(''));
160 |
161 | laycode();
162 |
163 | expect($('.layui-code-view').length).to.equal(2, '必须输出2个代码块');
164 | expect($('.layui-code-h3').length).to.equal(2, '必须输出2个标题元素');
165 | });
166 |
167 | it('multiple init', function () {
168 | createNode('123
');
169 |
170 | laycode();
171 | expect($('.layui-code-view').length).to.equal(1);
172 | expect($('.layui-code-h3').length).to.equal(1);
173 |
174 | laycode();
175 | expect($('.layui-code-view').length).to.equal(1, '同标签多次调用时 view 层只有一个');
176 | expect($('.layui-code-h3').length).to.equal(2, '多次调用输出多个标题元素');
177 | });
178 |
179 | it('multiple line', function () {
180 | var html = [];
181 |
182 | for (var i = 0; i < 300; i++) {
183 | html.push('layui
');
184 | }
185 |
186 | createNode('' + html.join('\n') + ' ');
187 |
188 | laycode();
189 |
190 | expect($('.layui-code-div').length).to.equal(300);
191 | });
192 | });
193 | /* eslint-enable max-nested-callbacks, fecs-indent */
194 |
--------------------------------------------------------------------------------
/dist/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=['"].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)});
--------------------------------------------------------------------------------
/src/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 | });
--------------------------------------------------------------------------------
/test/lay/modules/laytpl.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file laytpl - 测试
3 | * @author xuexb
4 | */
5 |
6 | /* global layui */
7 | /* eslint-disable max-nested-callbacks, fecs-indent */
8 |
9 | var laytpl = layui.laytpl;
10 |
11 | describe('laytpl', function () {
12 | it('param is error', function () {
13 | [
14 | [], {},
15 | null,
16 | 1,
17 | true
18 | ].forEach(function (key) {
19 | expect(laytpl(key)).to.have.string('Laytpl Error');
20 | });
21 | });
22 |
23 | it('async render callback', function (done) {
24 | expect(laytpl('').render()).to.have.string('Laytpl Error');
25 |
26 | laytpl('{{ d.name }}是一位公猿').render({
27 | name: '贤心'
28 | }, function (result) {
29 | expect(result).to.equal('贤心是一位公猿');
30 | done();
31 | });
32 | });
33 |
34 | it('sync result', function () {
35 | var result = laytpl('{{ d.name }}是一位公猿').render({
36 | name: '贤心'
37 | });
38 | expect(result).to.equal('贤心是一位公猿');
39 | });
40 |
41 | it('cached', function () {
42 | var compile = laytpl('{{ d.name }}');
43 |
44 | expect(compile.render({
45 | name: 1
46 | })).to.equal('1');
47 |
48 | expect(compile.render({
49 | name: 2
50 | })).to.equal('2');
51 | });
52 |
53 | it('unescape result', function () {
54 | var result = laytpl('{{ d.name }}
').render({
55 | name: 'laytpl '
56 | });
57 | expect(result).to.equal('laytpl
');
58 | });
59 |
60 | it('escape result', function () {
61 | var result = laytpl('{{= d.name }}
').render({
62 | name: 'laytpl '
63 | });
64 | expect(result).to.equal('<em>laytpl</em>
');
65 | });
66 |
67 | describe('typeof result', function () {
68 | it('string', function () {
69 | expect(laytpl('{{ d.name }}').render({
70 | name: 1
71 | })).to.be.a('string');
72 |
73 | expect(laytpl([
74 | '{{# ',
75 | ' if (true) {',
76 | ' return "1";',
77 | ' }',
78 | '}}'
79 | ].join('')).render({})).to.be.a('string');
80 | });
81 |
82 | // 表达式返回boolean
83 | it('boolean', function () {
84 | expect(laytpl([
85 | '{{# ',
86 | ' if (true) {',
87 | ' return true;',
88 | ' }',
89 | '}}'
90 | ].join('')).render({})).to.be.a('boolean');
91 | });
92 |
93 | it('number', function () {
94 | expect(laytpl([
95 | '{{# ',
96 | ' if (true) {',
97 | ' return 1;',
98 | ' }',
99 | '}}'
100 | ].join('')).render({})).to.be.a('number');
101 | });
102 | });
103 |
104 | describe('method config', function () {
105 | // reset
106 | afterEach(function () {
107 | laytpl.config({
108 | open: '{{',
109 | close: '}}'
110 | });
111 | });
112 |
113 | it('typeof', function () {
114 | expect(laytpl.config).to.be.a('function');
115 | });
116 |
117 | it('param is empty', function () {
118 | expect(laytpl.config()).to.be.undefined;
119 | });
120 |
121 | it('set open', function () {
122 | laytpl.config({
123 | open: '<%'
124 | });
125 |
126 | var result = laytpl([
127 | '<%# var name = "laytpl"; }}',
128 | '你好, <% name }}, <% d.date }}'
129 | ].join('')).render({
130 | date: '2017'
131 | });
132 | expect(result).to.equal('你好, laytpl, 2017');
133 | });
134 |
135 | it('set open and close', function () {
136 | laytpl.config({
137 | open: '<%',
138 | close: '%>'
139 | });
140 |
141 | var result = laytpl([
142 | '<%# var name = "laytpl"; %>',
143 | '你好, <% name %>, <% d.date %>'
144 | ].join('')).render({
145 | date: '2017'
146 | });
147 | expect(result).to.equal('你好, laytpl, 2017');
148 | });
149 | });
150 |
151 | describe('js expression', function () {
152 | it('var', function () {
153 | var result = laytpl('{{# var type = 1; }}{{ type }}{{ d.name }}').render({
154 | name: 2
155 | });
156 | expect(result).to.equal('12');
157 | });
158 |
159 | it('function', function () {
160 | var result = laytpl('{{# var fn = function () {return "ok"}; }}{{ fn() }}').render({});
161 | expect(result).to.equal('ok');
162 | });
163 |
164 | it('for', function () {
165 | var result = laytpl([
166 | '{{# ',
167 | ' var fn = function () {',
168 | ' var num = 0;',
169 | ' for (var i = 0; i < 10;i++) {',
170 | ' num += 1;',
171 | ' }',
172 | ' return num',
173 | ' };',
174 | '}}',
175 | '{{# ',
176 | ' var name = "laytpl";',
177 | '}}',
178 | '你好, {{ name }}, {{ d.name }}, {{ fn() }}'
179 | ].join('')).render({
180 | name: 'ok'
181 | });
182 | expect(result).to.equal('你好, laytpl, ok, 10');
183 | });
184 |
185 | it('if else', function () {
186 | var result;
187 | result = laytpl([
188 | '{{# ',
189 | ' if (true) {',
190 | ' return true;',
191 | ' }',
192 | ' else {',
193 | ' return false',
194 | ' }',
195 | '}}'
196 | ].join('')).render({});
197 | expect(result).to.be.true;
198 |
199 | result = laytpl([
200 | '{{# ',
201 | ' if (!true) {',
202 | ' return true;',
203 | ' }',
204 | ' else {',
205 | ' return false',
206 | ' }',
207 | '}}'
208 | ].join('')).render({});
209 | expect(result).to.be.false;
210 | });
211 | });
212 |
213 | describe('parse error', function () {
214 | it('error var', function () {
215 | var result = laytpl('{{ data.xxoo }}').render({});
216 |
217 | expect(result).to.have.string('data');
218 | expect(result).to.have.string('ReferenceError');
219 | expect(result).to.have.string('Laytpl Error');
220 | });
221 |
222 | it('error expression', function () {
223 | var result = laytpl('{{# var xxoo = ; }}').render({});
224 |
225 | expect(result).to.have.string('Laytpl Error');
226 | expect(result).to.have.string('SyntaxError');
227 | });
228 | });
229 | });
230 | /* eslint-enable max-nested-callbacks, fecs-indent */
231 |
--------------------------------------------------------------------------------
/src/lay/modules/rate.js:
--------------------------------------------------------------------------------
1 | /**
2 |
3 | @Title: layui.rate 评分评星
4 | @Author: star1029
5 | @License:MIT
6 |
7 | */
8 |
9 | layui.define('jquery',function(exports){
10 | "use strict";
11 | var $ = layui.jquery
12 |
13 | //外部接口
14 | ,rate = {
15 | config: {}
16 | ,index: layui.rate ? (layui.rate.index + 10000) : 0
17 |
18 | //设置全局项
19 | ,set: function(options){
20 | var that = this;
21 | that.config = $.extend({}, that.config, options);
22 | return that;
23 | }
24 |
25 | //事件监听
26 | ,on: function(events, callback){
27 | return layui.onevent.call(this, MOD_NAME, events, callback);
28 | }
29 | }
30 |
31 | //操作当前实例
32 | ,thisRate = function(){
33 | var that = this
34 | ,options = that.config;
35 |
36 | return {
37 | setvalue: function(value){
38 | that.setvalue.call(that, value);
39 | }
40 | ,config: options
41 | }
42 | }
43 |
44 | //字符常量
45 | ,MOD_NAME = 'rate',ELEM_VIEW = 'layui-rate', ICON_RATE = 'layui-icon-rate', ICON_RATE_SOLID = 'layui-icon-rate-solid', ICON_RATE_HALF = 'layui-icon-rate-half'
46 |
47 | ,ICON_SOLID_HALF = 'layui-icon-rate-solid layui-icon-rate-half', ICON_SOLID_RATE = 'layui-icon-rate-solid layui-icon-rate', ICON_HALF_RATE = 'layui-icon-rate layui-icon-rate-half'
48 |
49 | //构造器
50 | ,Class = function(options){
51 | var that = this;
52 | that.index = ++rate.index;
53 | that.config = $.extend({}, that.config, rate.config, options);
54 | that.render();
55 | };
56 |
57 | //默认配置
58 | Class.prototype.config = {
59 | length: 5 //初始长度
60 | ,text: false //是否显示评分等级
61 | ,readonly: false //是否只读
62 | ,half: false //是否可以半星
63 | ,value: 0 //星星选中个数
64 | ,theme: ''
65 | };
66 |
67 | //评分渲染
68 | Class.prototype.render = function(){
69 | var that = this
70 | ,options = that.config
71 | ,style = options.theme ? ('style="color: '+ options.theme + ';"') : '';
72 |
73 | options.elem = $(options.elem);
74 |
75 | //如果没有选择半星的属性,却给了小数的数值,统一向上或向下取整
76 | if(parseInt(options.value) !== options.value){
77 | if(!options.half){
78 | options.value = (Math.ceil(options.value) - options.value) < 0.5 ? Math.ceil(options.value): Math.floor(options.value)
79 | }
80 | }
81 |
82 | //组件模板
83 | var temp = '';
84 | for(var i = 1;i <= options.length;i++){
85 | var item = ' ';
88 |
89 | if(options.half){
90 | if(parseInt(options.value) !== options.value){
91 | if(i == Math.ceil(options.value)){
92 | temp = temp + ' ';
93 | }else{
94 | temp = temp + item
95 | }
96 | }else{
97 | temp = temp + item
98 | }
99 | }else{
100 | temp = temp +item;
101 | }
102 | }
103 | temp += ' ' + (options.text ? (''+ options.value + '星') : '') + ' ';
104 |
105 | //开始插入替代元素
106 | var othis = options.elem
107 | ,hasRender = othis.next('.' + ELEM_VIEW);
108 |
109 | //生成替代元素
110 | hasRender[0] && hasRender.remove(); //如果已经渲染,则Rerender
111 |
112 | that.elemTemp = $(temp);
113 |
114 | options.span = that.elemTemp.next('span');
115 |
116 | options.setText && options.setText(options.value);
117 |
118 | othis.html(that.elemTemp);
119 |
120 | othis.addClass("layui-inline");
121 |
122 | //如果不是只读,那么进行触控事件
123 | if(!options.readonly) that.action();
124 |
125 | };
126 |
127 | //评分重置
128 | Class.prototype.setvalue = function(value){
129 | var that = this
130 | ,options = that.config ;
131 |
132 | options.value = value ;
133 | that.render();
134 | };
135 |
136 | //li触控事件
137 | Class.prototype.action = function(){
138 | var that = this
139 | ,options = that.config
140 | ,_ul = that.elemTemp
141 | ,wide = _ul.find("i").width();
142 |
143 | _ul.children("li").each(function(index){
144 | var ind = index + 1
145 | ,othis = $(this);
146 |
147 | //点击
148 | othis.on('click', function(e){
149 | //将当前点击li的索引值赋给value
150 | options.value = ind;
151 | if(options.half){
152 | //获取鼠标在li上的位置
153 | var x = e.pageX - $(this).offset().left;
154 | if(x <= wide / 2){
155 | options.value = options.value - 0.5;
156 | }
157 | }
158 |
159 | if(options.text) _ul.next("span").text(options.value + "星");
160 |
161 | options.choose && options.choose(options.value);
162 | options.setText && options.setText(options.value);
163 | });
164 |
165 | //移入
166 | othis.on('mousemove', function(e){
167 | _ul.find("i").each(function(){
168 | $(this).addClass(ICON_RATE).removeClass(ICON_SOLID_HALF)
169 | });
170 | _ul.find("i:lt(" + ind + ")").each(function(){
171 | $(this).addClass(ICON_RATE_SOLID).removeClass(ICON_HALF_RATE)
172 | });
173 | // 如果设置可选半星,那么判断鼠标相对li的位置
174 | if(options.half){
175 | var x = e.pageX - $(this).offset().left;
176 | if(x <= wide / 2){
177 | othis.children("i").addClass(ICON_RATE_HALF).removeClass(ICON_RATE_SOLID)
178 | }
179 | }
180 | })
181 |
182 | //移出
183 | othis.on('mouseleave', function(){
184 | _ul.find("i").each(function(){
185 | $(this).addClass(ICON_RATE).removeClass(ICON_SOLID_HALF)
186 | });
187 | _ul.find("i:lt(" + Math.floor(options.value) + ")").each(function(){
188 | $(this).addClass(ICON_RATE_SOLID).removeClass(ICON_HALF_RATE)
189 | });
190 | //如果设置可选半星,根据分数判断是否有半星
191 | if(options.half){
192 | if(parseInt(options.value) !== options.value){
193 | _ul.children("li:eq(" + Math.floor(options.value) + ")").children("i").addClass(ICON_RATE_HALF).removeClass(ICON_SOLID_RATE)
194 | }
195 | }
196 | })
197 |
198 | })
199 | };
200 |
201 | //事件处理
202 | Class.prototype.events = function(){
203 | var that = this
204 | ,options = that.config;
205 | };
206 |
207 | //核心入口
208 | rate.render = function(options){
209 | var inst = new Class(options);
210 | return thisRate.call(inst);
211 | };
212 |
213 | exports(MOD_NAME, rate);
214 | })
--------------------------------------------------------------------------------
/gulpfile.js:
--------------------------------------------------------------------------------
1 | /**
2 | layui构建
3 | */
4 |
5 | var pkg = require('./package.json');
6 | var inds = pkg.independents;
7 |
8 | var gulp = require('gulp');
9 | var uglify = require('gulp-uglify');
10 | var minify = require('gulp-minify-css');
11 | var concat = require('gulp-concat');
12 | var rename = require('gulp-rename');
13 | var header = require('gulp-header');
14 | var del = require('del');
15 | var gulpif = require('gulp-if');
16 | var minimist = require('minimist');
17 | var zip = require('gulp-zip');
18 |
19 | //获取参数
20 | var argv = require('minimist')(process.argv.slice(2), {
21 | default: {
22 | ver: 'all'
23 | }
24 | })
25 |
26 | //注释
27 | ,note = [
28 | '/** <%= pkg.realname %>-v<%= pkg.version %> <%= pkg.license %> License By <%= pkg.homepage %> */\n <%= js %>'
29 | ,{pkg: pkg, js: ';'}
30 | ]
31 |
32 | //模块
33 | ,mods = 'laytpl,laypage,laydate,jquery,layer,element,upload,slider,colorpicker,form,tree,transfer,table,carousel,rate,util,flow,layedit,code'
34 |
35 | //发行版本目录
36 | ,releaseDir = './release/zip/layui-v' + pkg.version
37 | ,release = releaseDir + '/layui'
38 |
39 | //目标木
40 | ,destDir = function(ver){
41 | return ver ? release : function(){
42 | return argv.rc ? 'rc' : 'dist'
43 | }();
44 | }
45 |
46 | //任务
47 | ,task = {
48 | //压缩js模块
49 | minjs: function(ver) {
50 | ver = ver === 'open';
51 |
52 | //可指定模块压缩,eg:gulp minjs --mod layer,laytpl
53 | var mod = argv.mod ? function(){
54 | return '(' + argv.mod.replace(/,/g, '|') + ')';
55 | }() : ''
56 | ,src = [
57 | './src/**/*'+ mod +'.js'
58 | ,'!./src/**/mobile/*.js'
59 | ,'!./src/lay/**/mobile.js'
60 | ,'!./src/lay/all.js'
61 | ,'!./src/lay/all-mobile.js'
62 | ]
63 | ,dir = destDir(ver);
64 |
65 | //过滤 layim
66 | if(ver || argv.open){
67 | src.push('!./src/lay/**/layim.js');
68 | }
69 |
70 | return gulp.src(src).pipe(uglify())
71 | .pipe(header.apply(null, note))
72 | .pipe(gulp.dest('./'+ dir));
73 | }
74 |
75 | //打包PC合并版JS,即包含layui.js和所有模块的合并
76 | ,alljs: function(ver){
77 | ver = ver === 'open';
78 |
79 | var src = [
80 | './src/**/{layui,all,'+ mods +'}.js'
81 | ,'!./src/**/mobile/*.js'
82 | ]
83 | ,dir = destDir(ver);
84 |
85 | return gulp.src(src).pipe(uglify())
86 | .pipe(concat('layui.all.js', {newLine: ''}))
87 | .pipe(header.apply(null, note))
88 | .pipe(gulp.dest('./'+ dir));
89 | }
90 |
91 | //打包mobile模块集合
92 | ,mobile: function(ver){
93 | ver = ver === 'open';
94 |
95 | var mods = 'layer-mobile,zepto', src = [
96 | './src/lay/all-mobile.js'
97 | ,'./src/lay/modules/laytpl.js'
98 | ,'./src/**/mobile/{'+ mods +'}.js'
99 | ]
100 | ,dir = destDir(ver);
101 |
102 | if(ver || argv.open){
103 | src.push('./src/**/mobile/layim-mobile-open.js');
104 | }
105 |
106 | src.push((ver ? '!' : '') + './src/**/mobile/layim-mobile.js');
107 | src.push('./src/lay/modules/mobile.js');
108 |
109 | return gulp.src(src).pipe(uglify())
110 | .pipe(concat('mobile.js', {newLine: ''}))
111 | .pipe(header.apply(null, note))
112 | .pipe(gulp.dest('./'+ dir + '/lay/modules/'));
113 | }
114 |
115 | //压缩css文件
116 | ,mincss: function(ver){
117 | ver = ver === 'open';
118 |
119 | var src = [
120 | './src/css/**/*.css'
121 | ,'!./src/css/**/font.css'
122 | ]
123 | ,dir = destDir(ver)
124 | ,noteNew = JSON.parse(JSON.stringify(note));
125 |
126 | if(ver || argv.open){
127 | src.push('!./src/css/**/layim.css');
128 | }
129 |
130 | noteNew[1].js = '';
131 |
132 | return gulp.src(src).pipe(minify({
133 | compatibility: 'ie7'
134 | })).pipe(header.apply(null, noteNew))
135 | .pipe(gulp.dest('./'+ dir +'/css'));
136 | }
137 |
138 | //复制iconfont文件
139 | ,font: function(ver){
140 | ver = ver === 'open';
141 |
142 | var dir = destDir(ver);
143 |
144 | return gulp.src('./src/font/*')
145 | .pipe(rename({}))
146 | .pipe(gulp.dest('./'+ dir +'/font'));
147 | }
148 |
149 | //复制组件可能所需的非css和js资源
150 | ,mv: function(ver){
151 | ver = ver === 'open';
152 |
153 | var src = ['./src/**/*.{png,jpg,gif,html,mp3,json}']
154 | ,dir = destDir(ver);
155 |
156 | if(ver || argv.open){
157 | src.push('!./src/**/layim/**/*.*');
158 | }
159 |
160 | gulp.src(src).pipe(rename({}))
161 | .pipe(gulp.dest('./'+ dir));
162 | }
163 |
164 | //复制发行的引导文件
165 | ,release: function(){
166 | gulp.src('./release/doc/**/*')
167 | .pipe(gulp.dest(releaseDir));
168 | }
169 | };
170 |
171 | //清理
172 | gulp.task('clear', function(cb) {
173 | return del(['./'+ (argv.rc ? 'rc' : 'dist') +'/*'], cb);
174 | });
175 | gulp.task('clearRelease', function(cb) {
176 | return del([releaseDir], cb);
177 | });
178 |
179 | gulp.task('minjs', task.minjs);
180 | gulp.task('alljs', task.alljs);
181 | gulp.task('mobile', task.mobile);
182 | gulp.task('mincss', task.mincss);
183 | gulp.task('font', task.font);
184 | gulp.task('mv', task.mv);
185 | gulp.task('release', task.release);
186 |
187 | //发行版 gulp
188 | gulp.task('default', ['clearRelease'], function(){
189 | for(var key in task){
190 | task[key]('open');
191 | }
192 | });
193 |
194 | //完整任务 gulp all
195 | gulp.task('all', ['clear'], function(){ //过滤 layim:gulp all --open、rc 版:gulp all --rc
196 | for(var key in task){
197 | task[key]();
198 | }
199 | });
200 |
201 | //打包 layer 独立版
202 | gulp.task('layer', function(){
203 | var dir = './release/layer';
204 |
205 | gulp.src('./src/css/modules/layer/default/*')
206 | .pipe(gulp.dest(dir + '/src/theme/default'));
207 |
208 | return gulp.src('./src/lay/modules/layer.js')
209 | .pipe(gulp.dest(dir + '/src'));
210 | });
211 |
212 | //打包 layDate 独立版
213 | gulp.task('laydate', function(){
214 | var dir = './release/laydate';
215 |
216 | gulp.src('./src/css/modules/laydate/default/{font,laydate}.css')
217 | .pipe(concat('laydate.css', {newLine: '\n\n'}))
218 | .pipe(gulp.dest(dir + '/src/theme/default'));
219 |
220 | return gulp.src('./src/lay/modules/laydate.js')
221 | .pipe(gulp.dest(dir + '/src'));
222 | });
223 |
224 | //打包 LayIM 版本
225 | gulp.task('layim', function(){
226 | var dir = './release/zip/layim-v'+ inds.layim;
227 | gulp.src('./release/doc-layim/**/*')
228 | .pipe(gulp.dest(dir))
229 |
230 | gulp.src('./src/**/*')
231 | .pipe(gulp.dest(dir + '/src'))
232 |
233 | return gulp.src('./dist/**/*')
234 | .pipe(gulp.dest(dir + '/dist'));
235 | });
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
--------------------------------------------------------------------------------
/dist/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)});
--------------------------------------------------------------------------------
/dist/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)});
--------------------------------------------------------------------------------
/dist/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)});
--------------------------------------------------------------------------------
/dist/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:r
3 |
4 |
5 |
6 | 树组件 - layui
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
20 |
21 |
22 |
23 |
24 | 获取选中数据
25 | 设置节点勾选
26 | 重载实例
27 |
28 |
29 |