New file |
| | |
| | | ###################################################################### |
| | | # Build Tools |
| | | |
| | | .gradle |
| | | /build/ |
| | | !gradle/wrapper/gradle-wrapper.jar |
| | | |
| | | target/ |
| | | !.mvn/wrapper/maven-wrapper.jar |
| | | |
| | | ###################################################################### |
| | | # IDE |
| | | |
| | | ### STS ### |
| | | .apt_generated |
| | | .classpath |
| | | .factorypath |
| | | .project |
| | | .settings |
| | | .springBeans |
| | | |
| | | ### IntelliJ IDEA ### |
| | | .idea |
| | | *.iws |
| | | *.iml |
| | | *.ipr |
| | | |
| | | ### JRebel ### |
| | | rebel.xml |
| | | ### NetBeans ### |
| | | nbproject/private/ |
| | | build/* |
| | | nbbuild/ |
| | | dist/ |
| | | nbdist/ |
| | | .nb-gradle/ |
| | | |
| | | ###################################################################### |
| | | # Others |
| | | *.log |
| | | *.xml.versionsBackup |
| | | *.swp |
| | | |
| | | !*/build/*.java |
| | | !*/build/*.html |
| | | !*/build/*.xml |
New file |
| | |
| | | The MIT License (MIT) |
| | | |
| | | Copyright (c) 2018 RuoYi |
| | | |
| | | Permission is hereby granted, free of charge, to any person obtaining a copy of |
| | | this software and associated documentation files (the "Software"), to deal in |
| | | the Software without restriction, including without limitation the rights to |
| | | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
| | | the Software, and to permit persons to whom the Software is furnished to do so, |
| | | subject to the following conditions: |
| | | |
| | | The above copyright notice and this permission notice shall be included in all |
| | | copies or substantial portions of the Software. |
| | | |
| | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| | | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
| | | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
| | | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
| | | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| | | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| | |
| | | ## sangeshenbian |
| | | <p align="center"> |
| | | <img alt="logo" src="https://oscimg.oschina.net/oscnet/up-dd77653d7c9f197dd9d93684f3c8dcfbab6.png"> |
| | | </p> |
| | | <h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v4.8.0</h1> |
| | | <h4 align="center">基于SpringBoot开发的轻量级Java快速开发框架</h4> |
| | | <p align="center"> |
| | | <a href="https://gitee.com/y_project/RuoYi/stargazers"><img src="https://gitee.com/y_project/RuoYi/badge/star.svg?theme=gvp"></a> |
| | | <a href="https://gitee.com/y_project/RuoYi"><img src="https://img.shields.io/badge/RuoYi-v4.8.0-brightgreen.svg"></a> |
| | | <a href="https://gitee.com/y_project/RuoYi/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a> |
| | | </p> |
| | | |
| | | 三个身边 |
| | | ## 平台简介 |
| | | |
| | | 一直想做一款后台管理系统,看了很多优秀的开源项目但是发现没有合适的。于是利用空闲休息时间开始自己写了一套后台系统。如此有了若依。她可以用于所有的Web应用程序,如网站管理后台,网站会员中心,CMS,CRM,OA。所有前端后台代码封装过后十分精简易上手,出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。 |
| | | |
| | | 性别男,若依是给女儿取的名字(寓意:你若不离不弃,我必生死相依) |
| | | |
| | | 若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。 |
| | | |
| | | * 前端基于 [Hplus(H+)](https://gitee.com/hplus_admin/hplus) 后台主题 UI 框架。 |
| | | * 前后端分离版本,请移步[RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud) |
| | | * 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip) |
| | | |
| | | ## 内置功能 |
| | | |
| | | 1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。 |
| | | 2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。 |
| | | 3. 岗位管理:配置系统用户所属担任职务。 |
| | | 4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。 |
| | | 5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。 |
| | | 6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。 |
| | | 7. 参数管理:对系统动态配置常用参数。 |
| | | 8. 通知公告:系统通知公告信息发布维护。 |
| | | 9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。 |
| | | 10. 登录日志:系统登录日志记录查询包含登录异常。 |
| | | 11. 在线用户:当前系统中活跃用户状态监控。 |
| | | 12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。 |
| | | 13. 代码生成:前后端代码的生成(java、html、xml、sql)支持CRUD下载 。 |
| | | 14. 系统接口:根据业务代码自动生成相关的api接口文档。 |
| | | 15. 服务监控:监视当前系统CPU、内存、磁盘、堆栈等相关信息。 |
| | | 16. 缓存监控:对系统的缓存查询,删除、清空等操作。 |
| | | 17. 在线构建器:拖动表单元素生成相应的HTML代码。 |
| | | 18. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。 |
| | | |
| | | ## 在线体验 |
| | | |
| | | - admin/admin123 |
| | | - 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。 |
| | | |
| | | 演示地址:http://ruoyi.vip |
| | | 文档地址:http://doc.ruoyi.vip |
| | | |
| | | ## 演示图 |
| | | |
| | | <table> |
| | | <tr> |
| | | <td><img src="https://oscimg.oschina.net/oscnet/up-42e518aa72a24d228427a1261cb3679f395.png"/></td> |
| | | <td><img src="https://oscimg.oschina.net/oscnet/up-7f20dd0edba25e5187c5c4dd3ec7d3d9797.png"/></td> |
| | | </tr> |
| | | <tr> |
| | | <td><img src="https://oscimg.oschina.net/oscnet/up-2dae3d87f6a8ca05057db059cd9a411d51d.png"/></td> |
| | | <td><img src="https://oscimg.oschina.net/oscnet/up-ea4d98423471e55fba784694e45d12bd4bb.png"/></td> |
| | | </tr> |
| | | <tr> |
| | | <td><img src="https://oscimg.oschina.net/oscnet/up-7f6c6e9f5873efca09bd2870ee8468b8fce.png"/></td> |
| | | <td><img src="https://oscimg.oschina.net/oscnet/up-c708b65f2c382a03f69fe1efa8d341e6cff.png"/></td> |
| | | </tr> |
| | | <tr> |
| | | <td><img src="https://oscimg.oschina.net/oscnet/up-9ab586c47dd5c7b92bca0d727962c90e3b8.png"/></td> |
| | | <td><img src="https://oscimg.oschina.net/oscnet/up-ef954122a2080e02013112db21754b955c6.png"/></td> |
| | | </tr> |
| | | <tr> |
| | | <td><img src="https://oscimg.oschina.net/oscnet/up-088edb4d531e122415a1e2342bccb1a9691.png"/></td> |
| | | <td><img src="https://oscimg.oschina.net/oscnet/up-f886fe19bd820c0efae82f680223cac196c.png"/></td> |
| | | </tr> |
| | | <tr> |
| | | <td><img src="https://oscimg.oschina.net/oscnet/up-c7a2eb71fa65d6e660294b4bccca613d638.png"/></td> |
| | | <td><img src="https://oscimg.oschina.net/oscnet/up-e60137fb0787defe613bd83331dc4755a70.png"/></td> |
| | | </tr> |
| | | <tr> |
| | | <td><img src="https://oscimg.oschina.net/oscnet/up-7c51c1b5758f0a0f92ed3c60469b7526f9f.png"/></td> |
| | | <td><img src="https://oscimg.oschina.net/oscnet/up-15181aed45bb2461aa97b594cbf2f86ea5f.png"/></td> |
| | | </tr> |
| | | <tr> |
| | | <td><img src="https://oscimg.oschina.net/oscnet/up-83326ad52ea63f67233d126226738054d98.png"/></td> |
| | | <td><img src="https://oscimg.oschina.net/oscnet/up-3bd6d31e913b70df00107db51d64ef81df7.png"/></td> |
| | | </tr> |
| | | <tr> |
| | | <td><img src="https://oscimg.oschina.net/oscnet/up-70a2225836bc82042a6785edf6299e2586a.png"/></td> |
| | | <td><img src="https://oscimg.oschina.net/oscnet/up-0184d6ab01fdc6667a14327fcaf8b46345d.png"/></td> |
| | | </tr> |
| | | <tr> |
| | | <td><img src="https://oscimg.oschina.net/oscnet/up-64d8086dc2c02c8f71170290482f7640098.png"/></td> |
| | | <td><img src="https://oscimg.oschina.net/oscnet/up-5e4daac0bb59612c5038448acbcef235e3a.png"/></td> |
| | | </tr> |
| | | </table> |
| | | |
| | | |
| | | ## 若依交流群 |
| | | |
| | | QQ群: [](https://jq.qq.com/?_wv=1027&k=5HBAaYN) [](https://jq.qq.com/?_wv=1027&k=5cHeRVW) [](https://jq.qq.com/?_wv=1027&k=53R0L5Z) [](https://jq.qq.com/?_wv=1027&k=5g75dCU) [](https://jq.qq.com/?_wv=1027&k=58cPoHA) [](https://jq.qq.com/?_wv=1027&k=5Ofd4Pb) [](https://jq.qq.com/?_wv=1027&k=5yugASz) [](https://jq.qq.com/?_wv=1027&k=5Rf3d2P) [](https://jq.qq.com/?_wv=1027&k=5ZIjaeP) [](https://jq.qq.com/?_wv=1027&k=5CJw1jY) [](https://jq.qq.com/?_wv=1027&k=5omzbKc) [](https://jq.qq.com/?_wv=1027&k=qPIKBb7s) [](https://jq.qq.com/?_wv=1027&k=4NsjKbtU) [](https://jq.qq.com/?_wv=1027&k=VD2pkz2G) [](https://jq.qq.com/?_wv=1027&k=HlshFwkJ) [](https://jq.qq.com/?_wv=1027&k=0ARRrO9V) [](https://jq.qq.com/?_wv=1027&k=up9k3ZXJ) [](https://jq.qq.com/?_wv=1027&k=540WfdEr) [](https://jq.qq.com/?_wv=1027&k=ss91fC4t) [](https://jq.qq.com/?_wv=1027&k=Cqd66IKe) [](https://jq.qq.com/?_wv=1027&k=7FplYUnR) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=lqMHu_5Fskm7H2S1vNAQTtzAUokVydwc&authKey=ptw0Fpch5pbNocML3CIJKKqZBaq2DI7cusKuzIgfMNiY3t9Pvd9hP%2BA8WYx3yaY1&noverify=0&group_code=174942938) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=blYlRDmwZXSXI5pVrPPU7ZJ1stFJ6Q2Q&authKey=ForGBWffHVlPt9NE3d7g4DoOIouBh%2BqvAj2lp1CLReHfZAUaK7SRrdwsChKpRJDJ&noverify=0&group_code=287843737) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=KTVAIhggR3rR3uZWK9A8kR4yYNREQ4jo&authKey=An4DUV9e7uK8I8VgBbp949z0ypQoDrOoqvVg%2FWOr2vuNNDMZUAMPvqHor6TFMIgz&noverify=0&group_code=232896766) |
New file |
| | |
| | | @echo off |
| | | echo. |
| | | echo [ÐÅÏ¢] ÇåÀí¹¤³ÌtargetÉú³É·¾¶¡£ |
| | | echo. |
| | | |
| | | %~d0 |
| | | cd %~dp0 |
| | | |
| | | cd .. |
| | | call mvn clean |
| | | |
| | | pause |
New file |
| | |
| | | @echo off |
| | | echo. |
| | | echo [ÐÅÏ¢] ´ò°üWeb¹¤³Ì£¬Éú³Éwar/jar°üÎļþ¡£ |
| | | echo. |
| | | |
| | | %~d0 |
| | | cd %~dp0 |
| | | |
| | | cd .. |
| | | call mvn clean package -Dmaven.test.skip=true |
| | | |
| | | pause |
New file |
| | |
| | | @echo off |
| | | echo. |
| | | echo [ÐÅÏ¢] ʹÓÃJarÃüÁîÔËÐÐWeb¹¤³Ì¡£ |
| | | echo. |
| | | |
| | | cd %~dp0 |
| | | cd ../ruoyi-admin/target |
| | | |
| | | set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m |
| | | |
| | | java -jar %JAVA_OPTS% ruoyi-admin.jar |
| | | |
| | | cd bin |
| | | pause |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi</artifactId> |
| | | <version>4.8.0</version> |
| | | |
| | | <name>ruoyi</name> |
| | | <url>http://www.ruoyi.vip</url> |
| | | <description>若依管理系统</description> |
| | | |
| | | <properties> |
| | | <ruoyi.version>4.8.0</ruoyi.version> |
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| | | <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> |
| | | <java.version>1.8</java.version> |
| | | <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version> |
| | | <spring-boot.version>2.5.15</spring-boot.version> |
| | | <shiro.version>1.13.0</shiro.version> |
| | | <thymeleaf.extras.shiro.version>2.1.0</thymeleaf.extras.shiro.version> |
| | | <druid.version>1.2.23</druid.version> |
| | | <bitwalker.version>1.21</bitwalker.version> |
| | | <kaptcha.version>2.3.3</kaptcha.version> |
| | | <swagger.version>3.0.0</swagger.version> |
| | | <pagehelper.boot.version>1.4.7</pagehelper.boot.version> |
| | | <fastjson.version>1.2.83</fastjson.version> |
| | | <oshi.version>6.6.5</oshi.version> |
| | | <commons.io.version>2.16.1</commons.io.version> |
| | | <poi.version>4.1.2</poi.version> |
| | | <velocity.version>2.3</velocity.version> |
| | | <!-- override dependency version --> |
| | | <tomcat.version>9.0.96</tomcat.version> |
| | | <logback.version>1.2.13</logback.version> |
| | | <spring-framework.version>5.3.39</spring-framework.version> |
| | | </properties> |
| | | |
| | | <!-- 依赖声明 --> |
| | | <dependencyManagement> |
| | | <dependencies> |
| | | |
| | | <!-- 覆盖SpringFramework的依赖配置--> |
| | | <dependency> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-framework-bom</artifactId> |
| | | <version>${spring-framework.version}</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | </dependency> |
| | | |
| | | <!-- SpringBoot的依赖配置--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-dependencies</artifactId> |
| | | <version>${spring-boot.version}</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | </dependency> |
| | | |
| | | <!-- 覆盖logback的依赖配置--> |
| | | <dependency> |
| | | <groupId>ch.qos.logback</groupId> |
| | | <artifactId>logback-core</artifactId> |
| | | <version>${logback.version}</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>ch.qos.logback</groupId> |
| | | <artifactId>logback-classic</artifactId> |
| | | <version>${logback.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 覆盖tomcat的依赖配置--> |
| | | <dependency> |
| | | <groupId>org.apache.tomcat.embed</groupId> |
| | | <artifactId>tomcat-embed-core</artifactId> |
| | | <version>${tomcat.version}</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.tomcat.embed</groupId> |
| | | <artifactId>tomcat-embed-el</artifactId> |
| | | <version>${tomcat.version}</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.tomcat.embed</groupId> |
| | | <artifactId>tomcat-embed-websocket</artifactId> |
| | | <version>${tomcat.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 阿里数据库连接池 --> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>druid-spring-boot-starter</artifactId> |
| | | <version>${druid.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 验证码 --> |
| | | <dependency> |
| | | <groupId>pro.fessional</groupId> |
| | | <artifactId>kaptcha</artifactId> |
| | | <version>${kaptcha.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- Shiro核心框架 --> |
| | | <dependency> |
| | | <groupId>org.apache.shiro</groupId> |
| | | <artifactId>shiro-core</artifactId> |
| | | <version>${shiro.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- Shiro使用Spring框架 --> |
| | | <dependency> |
| | | <groupId>org.apache.shiro</groupId> |
| | | <artifactId>shiro-spring</artifactId> |
| | | <version>${shiro.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- Shiro使用EhCache缓存框架 --> |
| | | <dependency> |
| | | <groupId>org.apache.shiro</groupId> |
| | | <artifactId>shiro-ehcache</artifactId> |
| | | <version>${shiro.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- thymeleaf模板引擎和shiro框架的整合 --> |
| | | <dependency> |
| | | <groupId>com.github.theborakompanioni</groupId> |
| | | <artifactId>thymeleaf-extras-shiro</artifactId> |
| | | <version>${thymeleaf.extras.shiro.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 解析客户端操作系统、浏览器等 --> |
| | | <dependency> |
| | | <groupId>eu.bitwalker</groupId> |
| | | <artifactId>UserAgentUtils</artifactId> |
| | | <version>${bitwalker.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- pagehelper 分页插件 --> |
| | | <dependency> |
| | | <groupId>com.github.pagehelper</groupId> |
| | | <artifactId>pagehelper-spring-boot-starter</artifactId> |
| | | <version>${pagehelper.boot.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 获取系统信息 --> |
| | | <dependency> |
| | | <groupId>com.github.oshi</groupId> |
| | | <artifactId>oshi-core</artifactId> |
| | | <version>${oshi.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- Swagger3依赖 --> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-boot-starter</artifactId> |
| | | <version>${swagger.version}</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>io.swagger</groupId> |
| | | <artifactId>swagger-models</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <!-- io常用工具类 --> |
| | | <dependency> |
| | | <groupId>commons-io</groupId> |
| | | <artifactId>commons-io</artifactId> |
| | | <version>${commons.io.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- excel工具 --> |
| | | <dependency> |
| | | <groupId>org.apache.poi</groupId> |
| | | <artifactId>poi-ooxml</artifactId> |
| | | <version>${poi.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- velocity代码生成使用模板 --> |
| | | <dependency> |
| | | <groupId>org.apache.velocity</groupId> |
| | | <artifactId>velocity-engine-core</artifactId> |
| | | <version>${velocity.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 阿里JSON解析器 --> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>fastjson</artifactId> |
| | | <version>${fastjson.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 定时任务--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-quartz</artifactId> |
| | | <version>${ruoyi.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 代码生成--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-generator</artifactId> |
| | | <version>${ruoyi.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 核心模块--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-framework</artifactId> |
| | | <version>${ruoyi.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 系统模块--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-system</artifactId> |
| | | <version>${ruoyi.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 通用工具--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-common</artifactId> |
| | | <version>${ruoyi.version}</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | </dependencyManagement> |
| | | |
| | | <modules> |
| | | <module>ruoyi-admin</module> |
| | | <module>ruoyi-framework</module> |
| | | <module>ruoyi-system</module> |
| | | <module>ruoyi-quartz</module> |
| | | <module>ruoyi-generator</module> |
| | | <module>ruoyi-common</module> |
| | | </modules> |
| | | <packaging>pom</packaging> |
| | | |
| | | |
| | | <dependencies> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <version>3.1</version> |
| | | <configuration> |
| | | <source>${java.version}</source> |
| | | <target>${java.version}</target> |
| | | <encoding>${project.build.sourceEncoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | <repositories> |
| | | <repository> |
| | | <id>public</id> |
| | | <name>aliyun nexus</name> |
| | | <url>https://maven.aliyun.com/repository/public</url> |
| | | <releases> |
| | | <enabled>true</enabled> |
| | | </releases> |
| | | </repository> |
| | | </repositories> |
| | | |
| | | <pluginRepositories> |
| | | <pluginRepository> |
| | | <id>public</id> |
| | | <name>aliyun nexus</name> |
| | | <url>https://maven.aliyun.com/repository/public</url> |
| | | <releases> |
| | | <enabled>true</enabled> |
| | | </releases> |
| | | <snapshots> |
| | | <enabled>false</enabled> |
| | | </snapshots> |
| | | </pluginRepository> |
| | | </pluginRepositories> |
| | | |
| | | </project> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>ruoyi</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>4.8.0</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <packaging>jar</packaging> |
| | | <artifactId>ruoyi-admin</artifactId> |
| | | |
| | | <description> |
| | | web服务入口 |
| | | </description> |
| | | |
| | | <dependencies> |
| | | |
| | | <!-- SpringBoot集成thymeleaf模板 --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-thymeleaf</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- spring-boot-devtools --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-devtools</artifactId> |
| | | <optional>true</optional> <!-- 表示依赖不会传递 --> |
| | | </dependency> |
| | | |
| | | <!-- swagger3--> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-boot-starter</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 --> |
| | | <dependency> |
| | | <groupId>io.swagger</groupId> |
| | | <artifactId>swagger-models</artifactId> |
| | | <version>1.6.2</version> |
| | | </dependency> |
| | | |
| | | <!-- Mysql驱动包 --> |
| | | <dependency> |
| | | <groupId>mysql</groupId> |
| | | <artifactId>mysql-connector-java</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- 核心模块--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-framework</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- 定时任务--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-quartz</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- 代码生成--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-generator</artifactId> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <version>2.5.15</version> |
| | | <configuration> |
| | | <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 --> |
| | | </configuration> |
| | | <executions> |
| | | <execution> |
| | | <goals> |
| | | <goal>repackage</goal> |
| | | </goals> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-war-plugin</artifactId> |
| | | <version>3.0.0</version> |
| | | <configuration> |
| | | <failOnMissingWebXml>false</failOnMissingWebXml> |
| | | <warName>${project.artifactId}</warName> |
| | | </configuration> |
| | | </plugin> |
| | | <!-- YUI Compressor (CSS/JS压缩) |
| | | <plugin> |
| | | <groupId>net.alchim31.maven</groupId> |
| | | <artifactId>yuicompressor-maven-plugin</artifactId> |
| | | <version>1.5.1</version> |
| | | <executions> |
| | | <execution> |
| | | <phase>prepare-package</phase> |
| | | <goals> |
| | | <goal>compress</goal> |
| | | </goals> |
| | | </execution> |
| | | </executions> |
| | | <configuration> |
| | | <encoding>UTF-8</encoding> |
| | | <jswarn>false</jswarn> |
| | | <nosuffix>true</nosuffix> |
| | | <linebreakpos>50000</linebreakpos> |
| | | <sourceDirectory>src/main/resources/static</sourceDirectory> |
| | | <force>true</force> |
| | | <includes> |
| | | <include>**/*.js</include> |
| | | <include>**/*.css</include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude>**/*.min.js</exclude> |
| | | <exclude>**/*.min.css</exclude> |
| | | <exclude>**/fileinput.js</exclude> |
| | | <exclude>**/validate/**</exclude> |
| | | <exclude>**/bootstrap-table/**</exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </plugin> --> |
| | | </plugins> |
| | | <finalName>${project.artifactId}</finalName> |
| | | </build> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.ruoyi; |
| | | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
| | | |
| | | /** |
| | | * 启动程序 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) |
| | | public class RuoYiApplication |
| | | { |
| | | public static void main(String[] args) |
| | | { |
| | | // System.setProperty("spring.devtools.restart.enabled", "false"); |
| | | SpringApplication.run(RuoYiApplication.class, args); |
| | | System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" + |
| | | " .-------. ____ __ \n" + |
| | | " | _ _ \\ \\ \\ / / \n" + |
| | | " | ( ' ) | \\ _. / ' \n" + |
| | | " |(_ o _) / _( )_ .' \n" + |
| | | " | (_,_).' __ ___(_ o _)' \n" + |
| | | " | |\\ \\ | || |(_,_)' \n" + |
| | | " | | \\ `' /| `-' / \n" + |
| | | " | | \\ / \\ / \n" + |
| | | " ''-' `'-' `-..-' "); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi; |
| | | |
| | | import org.springframework.boot.builder.SpringApplicationBuilder; |
| | | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
| | | |
| | | /** |
| | | * web容器中进行部署 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class RuoYiServletInitializer extends SpringBootServletInitializer |
| | | { |
| | | @Override |
| | | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) |
| | | { |
| | | return application.sources(RuoYiApplication.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.common; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.config.ServerConfig; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.file.FileUploadUtils; |
| | | import com.ruoyi.common.utils.file.FileUtils; |
| | | |
| | | /** |
| | | * 通用请求处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/common") |
| | | public class CommonController |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(CommonController.class); |
| | | |
| | | @Autowired |
| | | private ServerConfig serverConfig; |
| | | |
| | | private static final String FILE_DELIMETER = ","; |
| | | |
| | | /** |
| | | * 通用下载请求 |
| | | * |
| | | * @param fileName 文件名称 |
| | | * @param delete 是否删除 |
| | | */ |
| | | @GetMapping("/download") |
| | | public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) |
| | | { |
| | | try |
| | | { |
| | | if (!FileUtils.checkAllowDownload(fileName)) |
| | | { |
| | | throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); |
| | | } |
| | | String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); |
| | | String filePath = RuoYiConfig.getDownloadPath() + fileName; |
| | | |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| | | FileUtils.setAttachmentResponseHeader(response, realFileName); |
| | | FileUtils.writeBytes(filePath, response.getOutputStream()); |
| | | if (delete) |
| | | { |
| | | FileUtils.deleteFile(filePath); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("下载文件失败", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 通用上传请求(单个) |
| | | */ |
| | | @PostMapping("/upload") |
| | | @ResponseBody |
| | | public AjaxResult uploadFile(MultipartFile file) throws Exception |
| | | { |
| | | try |
| | | { |
| | | // 上传文件路径 |
| | | String filePath = RuoYiConfig.getUploadPath(); |
| | | // 上传并返回新文件名称 |
| | | String fileName = FileUploadUtils.upload(filePath, file); |
| | | String url = serverConfig.getUrl() + fileName; |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("url", url); |
| | | ajax.put("fileName", fileName); |
| | | ajax.put("newFileName", FileUtils.getName(fileName)); |
| | | ajax.put("originalFilename", file.getOriginalFilename()); |
| | | return ajax; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 通用上传请求(多个) |
| | | */ |
| | | @PostMapping("/uploads") |
| | | @ResponseBody |
| | | public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception |
| | | { |
| | | try |
| | | { |
| | | // 上传文件路径 |
| | | String filePath = RuoYiConfig.getUploadPath(); |
| | | List<String> urls = new ArrayList<String>(); |
| | | List<String> fileNames = new ArrayList<String>(); |
| | | List<String> newFileNames = new ArrayList<String>(); |
| | | List<String> originalFilenames = new ArrayList<String>(); |
| | | for (MultipartFile file : files) |
| | | { |
| | | // 上传并返回新文件名称 |
| | | String fileName = FileUploadUtils.upload(filePath, file); |
| | | String url = serverConfig.getUrl() + fileName; |
| | | urls.add(url); |
| | | fileNames.add(fileName); |
| | | newFileNames.add(FileUtils.getName(fileName)); |
| | | originalFilenames.add(file.getOriginalFilename()); |
| | | } |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER)); |
| | | ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER)); |
| | | ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER)); |
| | | ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER)); |
| | | return ajax; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 本地资源通用下载 |
| | | */ |
| | | @GetMapping("/download/resource") |
| | | public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response) throws Exception |
| | | { |
| | | try |
| | | { |
| | | if (!FileUtils.checkAllowDownload(resource)) |
| | | { |
| | | throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource)); |
| | | } |
| | | // 本地资源路径 |
| | | String localPath = RuoYiConfig.getProfile(); |
| | | // 数据库资源地址 |
| | | String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX); |
| | | // 下载名称 |
| | | String downloadName = StringUtils.substringAfterLast(downloadPath, "/"); |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| | | FileUtils.setAttachmentResponseHeader(response, downloadName); |
| | | FileUtils.writeBytes(downloadPath, response.getOutputStream()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("下载文件失败", e); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.demo.controller; |
| | | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | /** |
| | | * 模态窗口 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/demo/modal") |
| | | public class DemoDialogController |
| | | { |
| | | private String prefix = "demo/modal"; |
| | | |
| | | /** |
| | | * 模态窗口 |
| | | */ |
| | | @GetMapping("/dialog") |
| | | public String dialog() |
| | | { |
| | | return prefix + "/dialog"; |
| | | } |
| | | |
| | | /** |
| | | * 弹层组件 |
| | | */ |
| | | @GetMapping("/layer") |
| | | public String layer() |
| | | { |
| | | return prefix + "/layer"; |
| | | } |
| | | |
| | | /** |
| | | * 表单 |
| | | */ |
| | | @GetMapping("/form") |
| | | public String form() |
| | | { |
| | | return prefix + "/form"; |
| | | } |
| | | |
| | | /** |
| | | * 表格 |
| | | */ |
| | | @GetMapping("/table") |
| | | public String table() |
| | | { |
| | | return prefix + "/table"; |
| | | } |
| | | |
| | | /** |
| | | * 表格check |
| | | */ |
| | | @GetMapping("/check") |
| | | public String check() |
| | | { |
| | | return prefix + "/table/check"; |
| | | } |
| | | |
| | | /** |
| | | * 表格radio |
| | | */ |
| | | @GetMapping("/radio") |
| | | public String radio() |
| | | { |
| | | return prefix + "/table/radio"; |
| | | } |
| | | |
| | | /** |
| | | * 表格回传父窗体 |
| | | */ |
| | | @GetMapping("/parent") |
| | | public String parent() |
| | | { |
| | | return prefix + "/table/parent"; |
| | | } |
| | | |
| | | /** |
| | | * 多层窗口frame1 |
| | | */ |
| | | @GetMapping("/frame1") |
| | | public String frame1() |
| | | { |
| | | return prefix + "/table/frame1"; |
| | | } |
| | | |
| | | /** |
| | | * 多层窗口frame2 |
| | | */ |
| | | @GetMapping("/frame2") |
| | | public String frame2() |
| | | { |
| | | return prefix + "/table/frame2"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.demo.controller; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.CxSelect; |
| | | import com.ruoyi.common.json.JSONObject; |
| | | import com.ruoyi.common.json.JSONObject.JSONArray; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * 表单相关 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/demo/form") |
| | | public class DemoFormController |
| | | { |
| | | private String prefix = "demo/form"; |
| | | |
| | | private final static List<UserFormModel> users = new ArrayList<UserFormModel>(); |
| | | { |
| | | users.add(new UserFormModel(1, "1000001", "测试1", "15888888888")); |
| | | users.add(new UserFormModel(2, "1000002", "测试2", "15666666666")); |
| | | users.add(new UserFormModel(3, "1000003", "测试3", "15666666666")); |
| | | users.add(new UserFormModel(4, "1000004", "测试4", "15666666666")); |
| | | users.add(new UserFormModel(5, "1000005", "测试5", "15666666666")); |
| | | } |
| | | |
| | | /** |
| | | * 按钮页 |
| | | */ |
| | | @GetMapping("/button") |
| | | public String button() |
| | | { |
| | | return prefix + "/button"; |
| | | } |
| | | |
| | | /** |
| | | * 下拉框 |
| | | */ |
| | | @GetMapping("/select") |
| | | public String select() |
| | | { |
| | | return prefix + "/select"; |
| | | } |
| | | |
| | | /** |
| | | * 时间轴 |
| | | */ |
| | | @GetMapping("/timeline") |
| | | public String timeline() |
| | | { |
| | | return prefix + "/timeline"; |
| | | } |
| | | |
| | | /** |
| | | * 进度条 |
| | | */ |
| | | @GetMapping("/progress_bars") |
| | | public String progress_bars() |
| | | { |
| | | return prefix + "/progress_bars"; |
| | | } |
| | | |
| | | /** |
| | | * 表单校验 |
| | | */ |
| | | @GetMapping("/validate") |
| | | public String validate() |
| | | { |
| | | return prefix + "/validate"; |
| | | } |
| | | |
| | | /** |
| | | * 功能扩展(包含文件上传) |
| | | */ |
| | | @GetMapping("/jasny") |
| | | public String jasny() |
| | | { |
| | | return prefix + "/jasny"; |
| | | } |
| | | |
| | | /** |
| | | * 拖动排序 |
| | | */ |
| | | @GetMapping("/sortable") |
| | | public String sortable() |
| | | { |
| | | return prefix + "/sortable"; |
| | | } |
| | | |
| | | /** |
| | | * 单据打印 |
| | | */ |
| | | @GetMapping("/invoice") |
| | | public String invoice() |
| | | { |
| | | return prefix + "/invoice"; |
| | | } |
| | | |
| | | /** |
| | | * 标签 & 提示 |
| | | */ |
| | | @GetMapping("/labels_tips") |
| | | public String labels_tips() |
| | | { |
| | | return prefix + "/labels_tips"; |
| | | } |
| | | |
| | | /** |
| | | * 选项卡 & 面板 |
| | | */ |
| | | @GetMapping("/tabs_panels") |
| | | public String tabs_panels() |
| | | { |
| | | return prefix + "/tabs_panels"; |
| | | } |
| | | |
| | | /** |
| | | * 栅格 |
| | | */ |
| | | @GetMapping("/grid") |
| | | public String grid() |
| | | { |
| | | return prefix + "/grid"; |
| | | } |
| | | |
| | | /** |
| | | * 表单向导 |
| | | */ |
| | | @GetMapping("/wizard") |
| | | public String wizard() |
| | | { |
| | | return prefix + "/wizard"; |
| | | } |
| | | |
| | | /** |
| | | * 文件上传 |
| | | */ |
| | | @GetMapping("/upload") |
| | | public String upload() |
| | | { |
| | | return prefix + "/upload"; |
| | | } |
| | | |
| | | /** |
| | | * 日期和时间页 |
| | | */ |
| | | @GetMapping("/datetime") |
| | | public String datetime() |
| | | { |
| | | return prefix + "/datetime"; |
| | | } |
| | | |
| | | /** |
| | | * 左右互选组件 |
| | | */ |
| | | @GetMapping("/duallistbox") |
| | | public String duallistbox() |
| | | { |
| | | return prefix + "/duallistbox"; |
| | | } |
| | | |
| | | /** |
| | | * 基本表单 |
| | | */ |
| | | @GetMapping("/basic") |
| | | public String basic() |
| | | { |
| | | return prefix + "/basic"; |
| | | } |
| | | |
| | | /** |
| | | * 卡片列表 |
| | | */ |
| | | @GetMapping("/cards") |
| | | public String cards() |
| | | { |
| | | return prefix + "/cards"; |
| | | } |
| | | |
| | | /** |
| | | * summernote 富文本编辑器 |
| | | */ |
| | | @GetMapping("/summernote") |
| | | public String summernote() |
| | | { |
| | | return prefix + "/summernote"; |
| | | } |
| | | |
| | | /** |
| | | * 搜索自动补全 |
| | | */ |
| | | @GetMapping("/autocomplete") |
| | | public String autocomplete() |
| | | { |
| | | return prefix + "/autocomplete"; |
| | | } |
| | | |
| | | /** |
| | | * 多级联动下拉 |
| | | */ |
| | | @GetMapping("/cxselect") |
| | | public String cxselect(ModelMap mmap) |
| | | { |
| | | CxSelect cxSelectTB = new CxSelect(); |
| | | cxSelectTB.setN("淘宝"); |
| | | cxSelectTB.setV("taobao"); |
| | | CxSelect cxSelectTm = new CxSelect(); |
| | | cxSelectTm.setN("天猫"); |
| | | cxSelectTm.setV("tm"); |
| | | CxSelect cxSelectJhs = new CxSelect(); |
| | | cxSelectJhs.setN("聚划算"); |
| | | cxSelectJhs.setV("jhs"); |
| | | List<CxSelect> tmList = new ArrayList<CxSelect>(); |
| | | tmList.add(cxSelectTm); |
| | | tmList.add(cxSelectJhs); |
| | | cxSelectTB.setS(tmList); |
| | | |
| | | CxSelect cxSelectJD = new CxSelect(); |
| | | cxSelectJD.setN("京东"); |
| | | cxSelectJD.setV("jd"); |
| | | CxSelect cxSelectCs = new CxSelect(); |
| | | cxSelectCs.setN("京东超市"); |
| | | cxSelectCs.setV("jdcs"); |
| | | CxSelect cxSelectSx = new CxSelect(); |
| | | cxSelectSx.setN("京东生鲜"); |
| | | cxSelectSx.setV("jdsx"); |
| | | List<CxSelect> jdList = new ArrayList<CxSelect>(); |
| | | jdList.add(cxSelectCs); |
| | | jdList.add(cxSelectSx); |
| | | cxSelectJD.setS(jdList); |
| | | |
| | | List<CxSelect> cxList = new ArrayList<CxSelect>(); |
| | | cxList.add(cxSelectTB); |
| | | cxList.add(cxSelectJD); |
| | | |
| | | mmap.put("data", JSON.toJSON(cxList)); |
| | | return prefix + "/cxselect"; |
| | | } |
| | | |
| | | /** |
| | | * 局部刷新 |
| | | */ |
| | | @GetMapping("/localrefresh") |
| | | public String localRefresh(ModelMap mmap) |
| | | { |
| | | JSONArray list = new JSONArray(); |
| | | JSONObject item = new JSONObject(); |
| | | item.put("name", "这条任务数据是由ModelMap传递到页面的,点击添加按钮后会将这条数据替换为新数据"); |
| | | item.put("type", "默认"); |
| | | item.put("date", "2020.06.10"); |
| | | list.add(item); |
| | | mmap.put("tasks", list); |
| | | mmap.put("min", 2); |
| | | mmap.put("max", 10); |
| | | return prefix + "/localrefresh"; |
| | | } |
| | | |
| | | /** |
| | | * 局部刷新-添加任务 |
| | | * |
| | | * @param fragment 页面中的模板名称 |
| | | * @param taskName 任务名称 |
| | | */ |
| | | @PostMapping("/localrefresh/task") |
| | | public String localRefreshTask(String fragment, String taskName, ModelMap mmap) |
| | | { |
| | | JSONArray list = new JSONArray(); |
| | | JSONObject item = new JSONObject(); |
| | | item.put("name", StringUtils.defaultIfBlank(taskName, "通过电话销售过程中了解各盛市的设备仪器使用、采购情况及相关重要追踪人")); |
| | | item.put("type", "新增"); |
| | | item.put("date", "2018.06.10"); |
| | | list.add(item); |
| | | item = new JSONObject(); |
| | | item.put("name", "提高自己电话营销技巧,灵活专业地与客户进行电话交流"); |
| | | item.put("type", "新增"); |
| | | item.put("date", "2018.06.12"); |
| | | list.add(item); |
| | | mmap.put("tasks", list); |
| | | return prefix + "/localrefresh::" + fragment; |
| | | } |
| | | |
| | | /** |
| | | * 模拟数据 |
| | | */ |
| | | @GetMapping("/cityData") |
| | | @ResponseBody |
| | | public String cityData() |
| | | { |
| | | String data = "[{\"n\":\"湖南省\",\"s\":[{\"n\":\"长沙市\",\"s\":[{\"n\":\"芙蓉区\"},{\"n\":\"天心区\"},{\"n\":\"岳麓区\"},{\"n\":\"开福区\"},{\"n\":\"雨花区\"},{\"n\":\"望城区\"},{\"n\":\"长沙县\"},{\"n\":\"宁乡县\"},{\"n\":\"浏阳市\"}]},{\"n\":\"株洲市\",\"s\":[{\"n\":\"荷塘区\"},{\"n\":\"芦淞区\"},{\"n\":\"石峰区\"},{\"n\":\"天元区\"},{\"n\":\"株洲县\"},{\"n\":\"攸县\"},{\"n\":\"茶陵县\"},{\"n\":\"炎陵县\"},{\"n\":\"醴陵市\"}]},{\"n\":\"湘潭市\",\"s\":[{\"n\":\"雨湖区\"},{\"n\":\"岳塘区\"},{\"n\":\"湘潭县\"},{\"n\":\"湘乡市\"},{\"n\":\"韶山市\"}]},{\"n\":\"衡阳市\",\"s\":[{\"n\":\"珠晖区\"},{\"n\":\"雁峰区\"},{\"n\":\"石鼓区\"},{\"n\":\"蒸湘区\"},{\"n\":\"南岳区\"},{\"n\":\"衡阳县\"},{\"n\":\"衡南县\"},{\"n\":\"衡山县\"},{\"n\":\"衡东县\"},{\"n\":\"祁东县\"},{\"n\":\"耒阳市\"},{\"n\":\"常宁市\"}]},{\"n\":\"邵阳市\",\"s\":[{\"n\":\"双清区\"},{\"n\":\"大祥区\"},{\"n\":\"北塔区\"},{\"n\":\"邵东县\"},{\"n\":\"新邵县\"},{\"n\":\"邵阳县\"},{\"n\":\"隆回县\"},{\"n\":\"洞口县\"},{\"n\":\"绥宁县\"},{\"n\":\"新宁县\"},{\"n\":\"城步苗族自治县\"},{\"n\":\"武冈市\"}]},{\"n\":\"岳阳市\",\"s\":[{\"n\":\"岳阳楼区\"},{\"n\":\"云溪区\"},{\"n\":\"君山区\"},{\"n\":\"岳阳县\"},{\"n\":\"华容县\"},{\"n\":\"湘阴县\"},{\"n\":\"平江县\"},{\"n\":\"汨罗市\"},{\"n\":\"临湘市\"}]},{\"n\":\"常德市\",\"s\":[{\"n\":\"武陵区\"},{\"n\":\"鼎城区\"},{\"n\":\"安乡县\"},{\"n\":\"汉寿县\"},{\"n\":\"澧县\"},{\"n\":\"临澧县\"},{\"n\":\"桃源县\"},{\"n\":\"石门县\"},{\"n\":\"津市市\"}]},{\"n\":\"张家界市\",\"s\":[{\"n\":\"永定区\"},{\"n\":\"武陵源区\"},{\"n\":\"慈利县\"},{\"n\":\"桑植县\"}]},{\"n\":\"益阳市\",\"s\":[{\"n\":\"资阳区\"},{\"n\":\"赫山区\"},{\"n\":\"南县\"},{\"n\":\"桃江县\"},{\"n\":\"安化县\"},{\"n\":\"沅江市\"}]},{\"n\":\"郴州市\",\"s\":[{\"n\":\"北湖区\"},{\"n\":\"苏仙区\"},{\"n\":\"桂阳县\"},{\"n\":\"宜章县\"},{\"n\":\"永兴县\"},{\"n\":\"嘉禾县\"},{\"n\":\"临武县\"},{\"n\":\"汝城县\"},{\"n\":\"桂东县\"},{\"n\":\"安仁县\"},{\"n\":\"资兴市\"}]},{\"n\":\"永州市\",\"s\":[{\"n\":\"零陵区\"},{\"n\":\"冷水滩区\"},{\"n\":\"祁阳县\"},{\"n\":\"东安县\"},{\"n\":\"双牌县\"},{\"n\":\"道县\"},{\"n\":\"江永县\"},{\"n\":\"宁远县\"},{\"n\":\"蓝山县\"},{\"n\":\"新田县\"},{\"n\":\"江华瑶族自治县\"}]},{\"n\":\"怀化市\",\"s\":[{\"n\":\"鹤城区\"},{\"n\":\"中方县\"},{\"n\":\"沅陵县\"},{\"n\":\"辰溪县\"},{\"n\":\"溆浦县\"},{\"n\":\"会同县\"},{\"n\":\"麻阳苗族自治县\"},{\"n\":\"新晃侗族自治县\"},{\"n\":\"芷江侗族自治县\"},{\"n\":\"靖州苗族侗族自治县\"},{\"n\":\"通道侗族自治县\"},{\"n\":\"洪江市\"}]},{\"n\":\"娄底市\",\"s\":[{\"n\":\"娄星区\"},{\"n\":\"双峰县\"},{\"n\":\"新化县\"},{\"n\":\"冷水江市\"},{\"n\":\"涟源市\"}]},{\"n\":\"湘西土家族苗族自治州\",\"s\":[{\"n\":\"吉首市\"},{\"n\":\"泸溪县\"},{\"n\":\"凤凰县\"},{\"n\":\"花垣县\"},{\"n\":\"保靖县\"},{\"n\":\"古丈县\"},{\"n\":\"永顺县\"},{\"n\":\"龙山县\"}]}]},{\"n\":\"广东省\",\"s\":[{\"n\":\"广州市\",\"s\":[{\"n\":\"荔湾区\"},{\"n\":\"越秀区\"},{\"n\":\"海珠区\"},{\"n\":\"天河区\"},{\"n\":\"白云区\"},{\"n\":\"黄埔区\"},{\"n\":\"番禺区\"},{\"n\":\"花都区\"},{\"n\":\"南沙区\"},{\"n\":\"萝岗区\"},{\"n\":\"增城市\"},{\"n\":\"从化市\"}]},{\"n\":\"韶关市\",\"s\":[{\"n\":\"武江区\"},{\"n\":\"浈江区\"},{\"n\":\"曲江区\"},{\"n\":\"始兴县\"},{\"n\":\"仁化县\"},{\"n\":\"翁源县\"},{\"n\":\"乳源瑶族自治县\"},{\"n\":\"新丰县\"},{\"n\":\"乐昌市\"},{\"n\":\"南雄市\"}]},{\"n\":\"深圳市\",\"s\":[{\"n\":\"罗湖区\"},{\"n\":\"福田区\"},{\"n\":\"南山区\"},{\"n\":\"宝安区\"},{\"n\":\"龙岗区\"},{\"n\":\"盐田区\"}]},{\"n\":\"珠海市\",\"s\":[{\"n\":\"香洲区\"},{\"n\":\"斗门区\"},{\"n\":\"金湾区\"}]},{\"n\":\"汕头市\",\"s\":[{\"n\":\"龙湖区\"},{\"n\":\"金平区\"},{\"n\":\"濠江区\"},{\"n\":\"潮阳区\"},{\"n\":\"潮南区\"},{\"n\":\"澄海区\"},{\"n\":\"南澳县\"}]},{\"n\":\"佛山市\",\"s\":[{\"n\":\"禅城区\"},{\"n\":\"南海区\"},{\"n\":\"顺德区\"},{\"n\":\"三水区\"},{\"n\":\"高明区\"}]},{\"n\":\"江门市\",\"s\":[{\"n\":\"蓬江区\"},{\"n\":\"江海区\"},{\"n\":\"新会区\"},{\"n\":\"台山市\"},{\"n\":\"开平市\"},{\"n\":\"鹤山市\"},{\"n\":\"恩平市\"}]},{\"n\":\"湛江市\",\"s\":[{\"n\":\"赤坎区\"},{\"n\":\"霞山区\"},{\"n\":\"坡头区\"},{\"n\":\"麻章区\"},{\"n\":\"遂溪县\"},{\"n\":\"徐闻县\"},{\"n\":\"廉江市\"},{\"n\":\"雷州市\"},{\"n\":\"吴川市\"}]},{\"n\":\"茂名市\",\"s\":[{\"n\":\"茂南区\"},{\"n\":\"茂港区\"},{\"n\":\"电白县\"},{\"n\":\"高州市\"},{\"n\":\"化州市\"},{\"n\":\"信宜市\"}]},{\"n\":\"肇庆市\",\"s\":[{\"n\":\"端州区\"},{\"n\":\"鼎湖区\"},{\"n\":\"广宁县\"},{\"n\":\"怀集县\"},{\"n\":\"封开县\"},{\"n\":\"德庆县\"},{\"n\":\"高要市\"},{\"n\":\"四会市\"}]},{\"n\":\"惠州市\",\"s\":[{\"n\":\"惠城区\"},{\"n\":\"惠阳区\"},{\"n\":\"博罗县\"},{\"n\":\"惠东县\"},{\"n\":\"龙门县\"}]},{\"n\":\"梅州市\",\"s\":[{\"n\":\"梅江区\"},{\"n\":\"梅县\"},{\"n\":\"大埔县\"},{\"n\":\"丰顺县\"},{\"n\":\"五华县\"},{\"n\":\"平远县\"},{\"n\":\"蕉岭县\"},{\"n\":\"兴宁市\"}]},{\"n\":\"汕尾市\",\"s\":[{\"n\":\"城区\"},{\"n\":\"海丰县\"},{\"n\":\"陆河县\"},{\"n\":\"陆丰市\"}]},{\"n\":\"河源市\",\"s\":[{\"n\":\"源城区\"},{\"n\":\"紫金县\"},{\"n\":\"龙川县\"},{\"n\":\"连平县\"},{\"n\":\"和平县\"},{\"n\":\"东源县\"}]},{\"n\":\"阳江市\",\"s\":[{\"n\":\"江城区\"},{\"n\":\"阳西县\"},{\"n\":\"阳东县\"},{\"n\":\"阳春市\"}]},{\"n\":\"清远市\",\"s\":[{\"n\":\"清城区\"},{\"n\":\"清新区\"},{\"n\":\"佛冈县\"},{\"n\":\"阳山县\"},{\"n\":\"连山壮族瑶族自治县\"},{\"n\":\"连南瑶族自治县\"},{\"n\":\"英德市\"},{\"n\":\"连州市\"}]},{\"n\":\"东莞市\"},{\"n\":\"中山市\"},{\"n\":\"潮州市\",\"s\":[{\"n\":\"湘桥区\"},{\"n\":\"潮安区\"},{\"n\":\"饶平县\"}]},{\"n\":\"揭阳市\",\"s\":[{\"n\":\"榕城区\"},{\"n\":\"揭东区\"},{\"n\":\"揭西县\"},{\"n\":\"惠来县\"},{\"n\":\"普宁市\"}]},{\"n\":\"云浮市\",\"s\":[{\"n\":\"云城区\"},{\"n\":\"新兴县\"},{\"n\":\"郁南县\"},{\"n\":\"云安县\"},{\"n\":\"罗定市\"}]}]}]"; |
| | | return data; |
| | | } |
| | | |
| | | /** |
| | | * 获取用户数据 |
| | | */ |
| | | @GetMapping("/userModel") |
| | | @ResponseBody |
| | | public AjaxResult userModel() |
| | | { |
| | | AjaxResult ajax = new AjaxResult(); |
| | | |
| | | ajax.put("code", 200); |
| | | ajax.put("value", users); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * 获取数据集合 |
| | | */ |
| | | @GetMapping("/collection") |
| | | @ResponseBody |
| | | public AjaxResult collection() |
| | | { |
| | | String[] array = { "ruoyi 1", "ruoyi 2", "ruoyi 3", "ruoyi 4", "ruoyi 5" }; |
| | | AjaxResult ajax = new AjaxResult(); |
| | | ajax.put("value", array); |
| | | return ajax; |
| | | } |
| | | } |
| | | |
| | | class UserFormModel |
| | | { |
| | | /** 用户ID */ |
| | | private int userId; |
| | | |
| | | /** 用户编号 */ |
| | | private String userCode; |
| | | |
| | | /** 用户姓名 */ |
| | | private String userName; |
| | | |
| | | /** 用户手机 */ |
| | | private String userPhone; |
| | | |
| | | public UserFormModel() |
| | | { |
| | | |
| | | } |
| | | |
| | | public UserFormModel(int userId, String userCode, String userName, String userPhone) |
| | | { |
| | | this.userId = userId; |
| | | this.userCode = userCode; |
| | | this.userName = userName; |
| | | this.userPhone = userPhone; |
| | | } |
| | | |
| | | public int getUserId() |
| | | { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(int userId) |
| | | { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getUserCode() |
| | | { |
| | | return userCode; |
| | | } |
| | | |
| | | public void setUserCode(String userCode) |
| | | { |
| | | this.userCode = userCode; |
| | | } |
| | | |
| | | public String getUserName() |
| | | { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) |
| | | { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | public String getUserPhone() |
| | | { |
| | | return userPhone; |
| | | } |
| | | |
| | | public void setUserPhone(String userPhone) |
| | | { |
| | | this.userPhone = userPhone; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.demo.controller; |
| | | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | /** |
| | | * 图标相关 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/demo/icon") |
| | | public class DemoIconController |
| | | { |
| | | private String prefix = "demo/icon"; |
| | | |
| | | /** |
| | | * FontAwesome图标 |
| | | */ |
| | | @GetMapping("/fontawesome") |
| | | public String fontAwesome() |
| | | { |
| | | return prefix + "/fontawesome"; |
| | | } |
| | | |
| | | /** |
| | | * Glyphicons图标 |
| | | */ |
| | | @GetMapping("/glyphicons") |
| | | public String glyphicons() |
| | | { |
| | | return prefix + "/glyphicons"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.demo.controller; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.PageDomain; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.core.page.TableSupport; |
| | | import com.ruoyi.common.core.text.Convert; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.web.controller.demo.domain.CustomerModel; |
| | | import com.ruoyi.web.controller.demo.domain.UserOperateModel; |
| | | |
| | | /** |
| | | * 操作控制 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/demo/operate") |
| | | public class DemoOperateController extends BaseController |
| | | { |
| | | private String prefix = "demo/operate"; |
| | | |
| | | private final static Map<Integer, UserOperateModel> users = new LinkedHashMap<Integer, UserOperateModel>(); |
| | | { |
| | | users.put(1, new UserOperateModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0")); |
| | | users.put(2, new UserOperateModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1")); |
| | | users.put(3, new UserOperateModel(3, "1000003", "测试3", "0", "15666666666", "ry@qq.com", 110.0, "1")); |
| | | users.put(4, new UserOperateModel(4, "1000004", "测试4", "1", "15666666666", "ry@qq.com", 220.0, "1")); |
| | | users.put(5, new UserOperateModel(5, "1000005", "测试5", "0", "15666666666", "ry@qq.com", 140.0, "1")); |
| | | users.put(6, new UserOperateModel(6, "1000006", "测试6", "1", "15666666666", "ry@qq.com", 330.0, "1")); |
| | | users.put(7, new UserOperateModel(7, "1000007", "测试7", "0", "15666666666", "ry@qq.com", 160.0, "1")); |
| | | users.put(8, new UserOperateModel(8, "1000008", "测试8", "1", "15666666666", "ry@qq.com", 170.0, "1")); |
| | | users.put(9, new UserOperateModel(9, "1000009", "测试9", "0", "15666666666", "ry@qq.com", 180.0, "1")); |
| | | users.put(10, new UserOperateModel(10, "1000010", "测试10", "0", "15666666666", "ry@qq.com", 210.0, "1")); |
| | | users.put(11, new UserOperateModel(11, "1000011", "测试11", "1", "15666666666", "ry@qq.com", 110.0, "1")); |
| | | users.put(12, new UserOperateModel(12, "1000012", "测试12", "0", "15666666666", "ry@qq.com", 120.0, "1")); |
| | | users.put(13, new UserOperateModel(13, "1000013", "测试13", "1", "15666666666", "ry@qq.com", 380.0, "1")); |
| | | users.put(14, new UserOperateModel(14, "1000014", "测试14", "0", "15666666666", "ry@qq.com", 280.0, "1")); |
| | | users.put(15, new UserOperateModel(15, "1000015", "测试15", "0", "15666666666", "ry@qq.com", 570.0, "1")); |
| | | users.put(16, new UserOperateModel(16, "1000016", "测试16", "1", "15666666666", "ry@qq.com", 260.0, "1")); |
| | | users.put(17, new UserOperateModel(17, "1000017", "测试17", "1", "15666666666", "ry@qq.com", 210.0, "1")); |
| | | users.put(18, new UserOperateModel(18, "1000018", "测试18", "1", "15666666666", "ry@qq.com", 340.0, "1")); |
| | | users.put(19, new UserOperateModel(19, "1000019", "测试19", "1", "15666666666", "ry@qq.com", 160.0, "1")); |
| | | users.put(20, new UserOperateModel(20, "1000020", "测试20", "1", "15666666666", "ry@qq.com", 220.0, "1")); |
| | | users.put(21, new UserOperateModel(21, "1000021", "测试21", "1", "15666666666", "ry@qq.com", 120.0, "1")); |
| | | users.put(22, new UserOperateModel(22, "1000022", "测试22", "1", "15666666666", "ry@qq.com", 130.0, "1")); |
| | | users.put(23, new UserOperateModel(23, "1000023", "测试23", "1", "15666666666", "ry@qq.com", 490.0, "1")); |
| | | users.put(24, new UserOperateModel(24, "1000024", "测试24", "1", "15666666666", "ry@qq.com", 570.0, "1")); |
| | | users.put(25, new UserOperateModel(25, "1000025", "测试25", "1", "15666666666", "ry@qq.com", 250.0, "1")); |
| | | users.put(26, new UserOperateModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1")); |
| | | } |
| | | |
| | | /** |
| | | * 表格 |
| | | */ |
| | | @GetMapping("/table") |
| | | public String table() |
| | | { |
| | | return prefix + "/table"; |
| | | } |
| | | |
| | | /** |
| | | * 其他 |
| | | */ |
| | | @GetMapping("/other") |
| | | public String other() |
| | | { |
| | | return prefix + "/other"; |
| | | } |
| | | |
| | | /** |
| | | * 查询数据 |
| | | */ |
| | | @PostMapping("/list") |
| | | @ResponseBody |
| | | public TableDataInfo list(UserOperateModel userModel) |
| | | { |
| | | TableDataInfo rspData = new TableDataInfo(); |
| | | List<UserOperateModel> userList = new ArrayList<UserOperateModel>(users.values()); |
| | | // 查询条件过滤 |
| | | if (StringUtils.isNotEmpty(userModel.getSearchValue())) |
| | | { |
| | | userList.clear(); |
| | | for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet()) |
| | | { |
| | | if (entry.getValue().getUserName().equals(userModel.getSearchValue())) |
| | | { |
| | | userList.add(entry.getValue()); |
| | | } |
| | | } |
| | | } |
| | | else if (StringUtils.isNotEmpty(userModel.getUserName())) |
| | | { |
| | | userList.clear(); |
| | | for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet()) |
| | | { |
| | | if (entry.getValue().getUserName().equals(userModel.getUserName())) |
| | | { |
| | | userList.add(entry.getValue()); |
| | | } |
| | | } |
| | | } |
| | | PageDomain pageDomain = TableSupport.buildPageRequest(); |
| | | if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize()) |
| | | { |
| | | rspData.setRows(userList); |
| | | rspData.setTotal(userList.size()); |
| | | return rspData; |
| | | } |
| | | Integer pageNum = (pageDomain.getPageNum() - 1) * 10; |
| | | Integer pageSize = pageDomain.getPageNum() * 10; |
| | | if (pageSize > userList.size()) |
| | | { |
| | | pageSize = userList.size(); |
| | | } |
| | | rspData.setRows(userList.subList(pageNum, pageSize)); |
| | | rspData.setTotal(userList.size()); |
| | | return rspData; |
| | | } |
| | | |
| | | /** |
| | | * 新增用户 |
| | | */ |
| | | @GetMapping("/add") |
| | | public String add(ModelMap mmap) |
| | | { |
| | | return prefix + "/add"; |
| | | } |
| | | |
| | | /** |
| | | * 新增保存用户 |
| | | */ |
| | | @PostMapping("/add") |
| | | @ResponseBody |
| | | public AjaxResult addSave(UserOperateModel user) |
| | | { |
| | | Integer userId = users.size() + 1; |
| | | user.setUserId(userId); |
| | | return AjaxResult.success(users.put(userId, user)); |
| | | } |
| | | |
| | | /** |
| | | * 新增保存主子表信息 |
| | | */ |
| | | @PostMapping("/customer/add") |
| | | @ResponseBody |
| | | public AjaxResult addSave(CustomerModel customerModel) |
| | | { |
| | | System.out.println(customerModel.toString()); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 修改用户 |
| | | */ |
| | | @GetMapping("/edit/{userId}") |
| | | public String edit(@PathVariable("userId") Integer userId, ModelMap mmap) |
| | | { |
| | | mmap.put("user", users.get(userId)); |
| | | return prefix + "/edit"; |
| | | } |
| | | |
| | | /** |
| | | * 修改保存用户 |
| | | */ |
| | | @PostMapping("/edit") |
| | | @ResponseBody |
| | | public AjaxResult editSave(UserOperateModel user) |
| | | { |
| | | return AjaxResult.success(users.put(user.getUserId(), user)); |
| | | } |
| | | |
| | | /** |
| | | * 导出 |
| | | */ |
| | | @PostMapping("/export") |
| | | @ResponseBody |
| | | public AjaxResult export(UserOperateModel user) |
| | | { |
| | | List<UserOperateModel> list = new ArrayList<UserOperateModel>(users.values()); |
| | | ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class); |
| | | return util.exportExcel(list, "用户数据"); |
| | | } |
| | | |
| | | /** |
| | | * 下载模板 |
| | | */ |
| | | @GetMapping("/importTemplate") |
| | | @ResponseBody |
| | | public AjaxResult importTemplate() |
| | | { |
| | | ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class); |
| | | return util.importTemplateExcel("用户数据"); |
| | | } |
| | | |
| | | /** |
| | | * 导入数据 |
| | | */ |
| | | @PostMapping("/importData") |
| | | @ResponseBody |
| | | public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception |
| | | { |
| | | ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class); |
| | | List<UserOperateModel> userList = util.importExcel(file.getInputStream()); |
| | | String message = importUser(userList, updateSupport); |
| | | return AjaxResult.success(message); |
| | | } |
| | | |
| | | /** |
| | | * 删除用户 |
| | | */ |
| | | @PostMapping("/remove") |
| | | @ResponseBody |
| | | public AjaxResult remove(String ids) |
| | | { |
| | | Integer[] userIds = Convert.toIntArray(ids); |
| | | for (Integer userId : userIds) |
| | | { |
| | | users.remove(userId); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 查看详细 |
| | | */ |
| | | @GetMapping("/detail/{userId}") |
| | | public String detail(@PathVariable("userId") Integer userId, ModelMap mmap) |
| | | { |
| | | mmap.put("user", users.get(userId)); |
| | | return prefix + "/detail"; |
| | | } |
| | | |
| | | @PostMapping("/clean") |
| | | @ResponseBody |
| | | public AjaxResult clean() |
| | | { |
| | | users.clear(); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * 导入用户数据 |
| | | * |
| | | * @param userList 用户数据列表 |
| | | * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 |
| | | * @return 结果 |
| | | */ |
| | | public String importUser(List<UserOperateModel> userList, Boolean isUpdateSupport) |
| | | { |
| | | if (StringUtils.isNull(userList) || userList.size() == 0) |
| | | { |
| | | throw new ServiceException("导入用户数据不能为空!"); |
| | | } |
| | | int successNum = 0; |
| | | int failureNum = 0; |
| | | StringBuilder successMsg = new StringBuilder(); |
| | | StringBuilder failureMsg = new StringBuilder(); |
| | | for (UserOperateModel user : userList) |
| | | { |
| | | try |
| | | { |
| | | // 验证是否存在这个用户 |
| | | boolean userFlag = false; |
| | | for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet()) |
| | | { |
| | | if (entry.getValue().getUserName().equals(user.getUserName())) |
| | | { |
| | | userFlag = true; |
| | | break; |
| | | } |
| | | } |
| | | if (!userFlag) |
| | | { |
| | | Integer userId = users.size() + 1; |
| | | user.setUserId(userId); |
| | | users.put(userId, user); |
| | | successNum++; |
| | | successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 导入成功"); |
| | | } |
| | | else if (isUpdateSupport) |
| | | { |
| | | users.put(user.getUserId(), user); |
| | | successNum++; |
| | | successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 更新成功"); |
| | | } |
| | | else |
| | | { |
| | | failureNum++; |
| | | failureMsg.append("<br/>" + failureNum + "、用户 " + user.getUserName() + " 已存在"); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | failureNum++; |
| | | String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:"; |
| | | failureMsg.append(msg + e.getMessage()); |
| | | } |
| | | } |
| | | if (failureNum > 0) |
| | | { |
| | | failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); |
| | | throw new ServiceException(failureMsg.toString()); |
| | | } |
| | | else |
| | | { |
| | | successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); |
| | | } |
| | | return successMsg.toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.demo.controller; |
| | | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | /** |
| | | * 报表 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/demo/report") |
| | | public class DemoReportController |
| | | { |
| | | private String prefix = "demo/report"; |
| | | |
| | | /** |
| | | * 百度ECharts |
| | | */ |
| | | @GetMapping("/echarts") |
| | | public String echarts() |
| | | { |
| | | return prefix + "/echarts"; |
| | | } |
| | | |
| | | /** |
| | | * 图表插件 |
| | | */ |
| | | @GetMapping("/peity") |
| | | public String peity() |
| | | { |
| | | return prefix + "/peity"; |
| | | } |
| | | |
| | | /** |
| | | * 线状图插件 |
| | | */ |
| | | @GetMapping("/sparkline") |
| | | public String sparkline() |
| | | { |
| | | return prefix + "/sparkline"; |
| | | } |
| | | |
| | | /** |
| | | * 图表组合 |
| | | */ |
| | | @GetMapping("/metrics") |
| | | public String metrics() |
| | | { |
| | | return prefix + "/metrics"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.demo.controller; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import com.ruoyi.common.annotation.Excel.ColumnType; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import com.ruoyi.common.core.page.PageDomain; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.core.page.TableSupport; |
| | | import com.ruoyi.common.core.text.Convert; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | |
| | | /** |
| | | * 表格相关 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/demo/table") |
| | | public class DemoTableController extends BaseController |
| | | { |
| | | private String prefix = "demo/table"; |
| | | |
| | | private final static List<UserTableModel> users = new ArrayList<UserTableModel>(); |
| | | { |
| | | users.add(new UserTableModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0")); |
| | | users.add(new UserTableModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1")); |
| | | users.add(new UserTableModel(3, "1000003", "测试3", "0", "15666666666", "ry@qq.com", 110.0, "1")); |
| | | users.add(new UserTableModel(4, "1000004", "测试4", "1", "15666666666", "ry@qq.com", 220.0, "1")); |
| | | users.add(new UserTableModel(5, "1000005", "测试5", "0", "15666666666", "ry@qq.com", 140.0, "1")); |
| | | users.add(new UserTableModel(6, "1000006", "测试6", "1", "15666666666", "ry@qq.com", 330.0, "1")); |
| | | users.add(new UserTableModel(7, "1000007", "测试7", "0", "15666666666", "ry@qq.com", 160.0, "1")); |
| | | users.add(new UserTableModel(8, "1000008", "测试8", "1", "15666666666", "ry@qq.com", 170.0, "1")); |
| | | users.add(new UserTableModel(9, "1000009", "测试9", "0", "15666666666", "ry@qq.com", 180.0, "1")); |
| | | users.add(new UserTableModel(10, "1000010", "测试10", "0", "15666666666", "ry@qq.com", 210.0, "1")); |
| | | users.add(new UserTableModel(11, "1000011", "测试11", "1", "15666666666", "ry@qq.com", 110.0, "1")); |
| | | users.add(new UserTableModel(12, "1000012", "测试12", "0", "15666666666", "ry@qq.com", 120.0, "1")); |
| | | users.add(new UserTableModel(13, "1000013", "测试13", "1", "15666666666", "ry@qq.com", 380.0, "1")); |
| | | users.add(new UserTableModel(14, "1000014", "测试14", "0", "15666666666", "ry@qq.com", 280.0, "1")); |
| | | users.add(new UserTableModel(15, "1000015", "测试15", "0", "15666666666", "ry@qq.com", 570.0, "1")); |
| | | users.add(new UserTableModel(16, "1000016", "测试16", "1", "15666666666", "ry@qq.com", 260.0, "1")); |
| | | users.add(new UserTableModel(17, "1000017", "测试17", "1", "15666666666", "ry@qq.com", 210.0, "1")); |
| | | users.add(new UserTableModel(18, "1000018", "测试18", "1", "15666666666", "ry@qq.com", 340.0, "1")); |
| | | users.add(new UserTableModel(19, "1000019", "测试19", "1", "15666666666", "ry@qq.com", 160.0, "1")); |
| | | users.add(new UserTableModel(20, "1000020", "测试20", "1", "15666666666", "ry@qq.com", 220.0, "1")); |
| | | users.add(new UserTableModel(21, "1000021", "测试21", "1", "15666666666", "ry@qq.com", 120.0, "1")); |
| | | users.add(new UserTableModel(22, "1000022", "测试22", "1", "15666666666", "ry@qq.com", 130.0, "1")); |
| | | users.add(new UserTableModel(23, "1000023", "测试23", "1", "15666666666", "ry@qq.com", 490.0, "1")); |
| | | users.add(new UserTableModel(24, "1000024", "测试24", "1", "15666666666", "ry@qq.com", 570.0, "1")); |
| | | users.add(new UserTableModel(25, "1000025", "测试25", "1", "15666666666", "ry@qq.com", 250.0, "1")); |
| | | users.add(new UserTableModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1")); |
| | | } |
| | | |
| | | private final static List<AreaModel> areas = new ArrayList<AreaModel>(); |
| | | { |
| | | areas.add(new AreaModel(1, 0, "广东省", "440000", "GDS", "GuangDongSheng", 1)); |
| | | areas.add(new AreaModel(2, 0, "湖南省", "430000", "HNS", "HuNanSheng", 1)); |
| | | areas.add(new AreaModel(3, 0, "河南省", "410000", "HNS", "HeNanSheng", 0)); |
| | | areas.add(new AreaModel(4, 0, "湖北省", "420000", "HBS", "HuBeiSheng", 0)); |
| | | areas.add(new AreaModel(5, 0, "辽宁省", "210000", "LNS", "LiaoNingSheng", 0)); |
| | | areas.add(new AreaModel(6, 0, "山东省", "370000", "SDS", "ShanDongSheng", 0)); |
| | | areas.add(new AreaModel(7, 0, "陕西省", "610000", "SXS", "ShanXiSheng", 0)); |
| | | areas.add(new AreaModel(8, 0, "贵州省", "520000", "GZS", "GuiZhouSheng", 0)); |
| | | areas.add(new AreaModel(9, 0, "上海市", "310000", "SHS", "ShangHaiShi", 0)); |
| | | areas.add(new AreaModel(10, 0, "重庆市", "500000", "CQS", "ChongQingShi", 0)); |
| | | areas.add(new AreaModel(11, 0, "若依省", "666666", "YYS", "RuoYiSheng", 0)); |
| | | areas.add(new AreaModel(12, 0, "安徽省", "340000", "AHS", "AnHuiSheng", 0)); |
| | | areas.add(new AreaModel(13, 0, "福建省", "350000", "FJS", "FuJianSheng", 0)); |
| | | areas.add(new AreaModel(14, 0, "海南省", "460000", "HNS", "HaiNanSheng", 0)); |
| | | areas.add(new AreaModel(15, 0, "江苏省", "320000", "JSS", "JiangSuSheng", 0)); |
| | | areas.add(new AreaModel(16, 0, "青海省", "630000", "QHS", "QingHaiSheng", 0)); |
| | | areas.add(new AreaModel(17, 0, "广西壮族自治区", "450000", "GXZZZZQ", "GuangXiZhuangZuZiZhiQu", 0)); |
| | | areas.add(new AreaModel(18, 0, "宁夏回族自治区", "640000", "NXHZZZQ", "NingXiaHuiZuZiZhiQu", 0)); |
| | | areas.add(new AreaModel(19, 0, "内蒙古自治区", "150000", "NMGZZQ", "NeiMengGuZiZhiQu", 0)); |
| | | areas.add(new AreaModel(20, 0, "新疆维吾尔自治区", "650000", "XJWWEZZQ", "XinJiangWeiWuErZiZhiQu", 0)); |
| | | areas.add(new AreaModel(21, 0, "江西省", "360000", "JXS", "JiangXiSheng", 0)); |
| | | areas.add(new AreaModel(22, 0, "浙江省", "330000", "ZJS", "ZheJiangSheng", 0)); |
| | | areas.add(new AreaModel(23, 0, "河北省", "130000", "HBS", "HeBeiSheng", 0)); |
| | | areas.add(new AreaModel(24, 0, "天津市", "120000", "TJS", "TianJinShi", 0)); |
| | | areas.add(new AreaModel(25, 0, "山西省", "140000", "SXS", "ShanXiSheng", 0)); |
| | | areas.add(new AreaModel(26, 0, "台湾省", "710000", "TWS", "TaiWanSheng", 0)); |
| | | areas.add(new AreaModel(27, 0, "甘肃省", "620000", "GSS", "GanSuSheng", 0)); |
| | | areas.add(new AreaModel(28, 0, "四川省", "510000", "SCS", "SiChuanSheng", 0)); |
| | | areas.add(new AreaModel(29, 0, "云南省", "530000", "YNS", "YunNanSheng", 0)); |
| | | areas.add(new AreaModel(30, 0, "北京市", "110000", "BJS", "BeiJingShi", 0)); |
| | | areas.add(new AreaModel(31, 0, "香港特别行政区", "810000", "XGTBXZQ", "XiangGangTeBieXingZhengQu", 0)); |
| | | areas.add(new AreaModel(32, 0, "澳门特别行政区", "820000", "AMTBXZQ", "AoMenTeBieXingZhengQu", 0)); |
| | | |
| | | areas.add(new AreaModel(100, 1, "深圳市", "440300", "SZS", "ShenZhenShi", 1)); |
| | | areas.add(new AreaModel(101, 1, "广州市", "440100", "GZS", "GuangZhouShi", 0)); |
| | | areas.add(new AreaModel(102, 1, "东莞市", "441900", "DGS", "DongGuanShi", 0)); |
| | | areas.add(new AreaModel(103, 2, "长沙市", "410005", "CSS", "ChangShaShi", 1)); |
| | | areas.add(new AreaModel(104, 2, "岳阳市", "414000", "YYS", "YueYangShi", 0)); |
| | | |
| | | areas.add(new AreaModel(1000, 100, "龙岗区", "518172", "LGQ", "LongGangQu", 0)); |
| | | areas.add(new AreaModel(1001, 100, "南山区", "518051", "NSQ", "NanShanQu", 0)); |
| | | areas.add(new AreaModel(1002, 100, "宝安区", "518101", "BAQ", "BaoAnQu", 0)); |
| | | areas.add(new AreaModel(1003, 100, "福田区", "518081", "FTQ", "FuTianQu", 0)); |
| | | areas.add(new AreaModel(1004, 103, "天心区", "410004", "TXQ", "TianXinQu", 0)); |
| | | areas.add(new AreaModel(1005, 103, "开福区", "410008", "KFQ", "KaiFuQu", 0)); |
| | | areas.add(new AreaModel(1006, 103, "芙蓉区", "410011", "FRQ", "FuRongQu", 0)); |
| | | areas.add(new AreaModel(1007, 103, "雨花区", "410011", "YHQ", "YuHuaQu", 0)); |
| | | } |
| | | |
| | | private final static List<UserTableColumn> columns = new ArrayList<UserTableColumn>(); |
| | | { |
| | | columns.add(new UserTableColumn("用户ID", "userId")); |
| | | columns.add(new UserTableColumn("用户编号", "userCode")); |
| | | columns.add(new UserTableColumn("用户姓名", "userName")); |
| | | columns.add(new UserTableColumn("用户手机", "userPhone")); |
| | | columns.add(new UserTableColumn("用户邮箱", "userEmail")); |
| | | columns.add(new UserTableColumn("用户状态", "status")); |
| | | } |
| | | |
| | | private final static List<DocumentModel> documents = new ArrayList<DocumentModel>(); |
| | | { |
| | | documents.add(new DocumentModel(1, "247-XW·2024-D10-0001", "新闻热线[2024]000001", "索尼射击游戏《Concord》停止运营,玩家将获全额退款", "索尼宣布多人射击游戏《Concord》将于9月6日停止运营,玩家将获得全额退款。游戏总监Ryan Ellis在给玩家的信中表示,这款游戏首次发布“并没有像我们预期的那样顺利”。《Concord》的开发历时8年,投资超过1.5亿美元。游戏在Steam平台的售价为40美元,采用买断制销售模式。据SteamDB统计,游戏上市后的最高同时在线人数为697人。")); |
| | | documents.add(new DocumentModel(2, "247-XW·2024-D30-0002", "新闻热线[2024]000002", "网红账号被封,央媒:如此炫富毒瘤早就该拔了", "在社交平台上分享自己的生活日常,本来无可厚非。但无底线地展示物欲、宣扬拜金,取笑甚至嘲讽工薪者的烟火生活,就会遮蔽普通人的平凡质朴和坚韧奋斗,在无形中消解芸芸众生脚踏实地、自立自强的社会正气。对这种助长金钱至上、刺激公众焦虑,既污染网络生态,又撕裂社会和谐的炫富“毒瘤”,必须坚决拔除之。在国家有关部门的部署下,近日,多个网络平台开展“不良价值导向内容专项治理”行动,对“奢靡浪费”“炫富拜金”等问题从严打击,倡导理性、文明的消费观和价值观。")); |
| | | documents.add(new DocumentModel(3, "CT01-XW·2024-Y-0003", "新闻热线[2024]000003", "重庆一夫妻被骗至缅甸,家属:两人已被解救,预计很快能回国", "5月25日,重庆一对夫妻在前往泰国后失联,疑被诈骗集团骗至缅甸的消息引发广泛关注。警方已对此事立案调查,而这对夫妻的亲属则每天生活在焦急和不安之中。亲属:家都瘫痪了,事情一经曝光,迅速登上了热搜,成为公众热议的话题。据了解,这对夫妻原计划是去泰国谈生意,但不幸的是,他们的泰国之行变成了一场噩梦。亲属李先生透露,4月14日,他们夫妻二人抵达泰国,不久后便疑似被人以10万元的价格卖到缅甸,目前被困在缅甸妙瓦底的一个电信诈骗园区。")); |
| | | documents.add(new DocumentModel(4, "CT01-XW·2024-Y-0004", "新闻热线[2024]000004", "江滨社区联合派出所、金霞消防站开展电动自行车安全隐患夜查活动", "近日,长沙市开福区江滨社区联合派出所、金霞消防站深入居民小区、单位场所,以电动车自行车火灾防范为重点,开展消防安全夜查行动。此次夜查紧紧围绕老旧居民区、“三合一”场所、沿街门店、夜间经营使用场所等场所开展监督检查,重点检查电动自行车违规停放充电、堵塞疏散通道和安全出口,架空层违规作为电动自行车停放充电场所,电动自行车违规“进楼入户”“飞线充电”,电动自行车擅自改装等五大类问题。")); |
| | | documents.add(new DocumentModel(5, "CT01-XW·2024-Y-0005", "新闻热线[2024]000005", "《黑神话》让海外玩家迷上“悟空”", "备受全球玩家瞩目的首款国产3A游戏《黑神话:悟空》日前正式发布。精美绝伦的东方美学世界、精彩纷呈的中国神话故事、酣畅淋漓的游戏体验,这款游戏为全球玩家带来一场视觉与文化的双重盛宴。从“悟空”成功出海的背后,海外人士看到了中国游戏产业的巨大进步,感受到了中国文化的多元精彩,并对下一个“悟空”的诞生及更多中国文化产品走向世界充满期待。")); |
| | | documents.add(new DocumentModel(6, "CT01-XW·2024-Y-0006", "新闻热线[2024]000006", "市场状况充满挑战!极星宣布裁员全球约15%的员工", "据路透社报道,极星周五以“充满挑战的市场状况”为由,宣布计划在全球范围内裁减约450个职位。此次裁员之际,许多人都对电动汽车需求降温表示担忧,而且极星预计汽车业务最早将在2025年开始实现收支平衡。极星发言人表示:“作为该商业计划的一部分,我们需要调整我们的业务和运营规模。” “这涉及减少外部支出,遗憾的是,还包括我们的员工数量。”该公司还表示,希望减少对沃尔沃及其母公司吉利外部融资的依赖,最近还表示希望削减成本并提高电动汽车的利润率。")); |
| | | documents.add(new DocumentModel(7, "CT01-XW·2024-Y-0007", "新闻热线[2024]000007", "浙江隐秘富豪涉百亿非法集资案,部分资金流入新造车公司", "5月10日、11日,上海北广投资管理有限公司(下称“北广投”)非法集资案在上海黄浦区人民法院一审公开开庭审理,北广投实控人周敏、法定代表人朱江等30余名中高管被控非法吸收公众存款罪。根据财新报道,这一案件中,非法集资的资金有部分流入了两家新能源车企——爱驰汽车、万象汽车。同时,有多位投资人引述与经侦部门沟通时的说法称,该案事发时未兑付金额有130余亿元,其中去往广微控股45亿元、万象汽车63亿元、爱驰汽车15亿元。")); |
| | | documents.add(new DocumentModel(8, "CT01-XW·2024-Y-0008", "新闻热线[2024]000008", "特斯拉宣布Model Y升级:搭载HW4.0硬件,售价仍25.89万元起", "2月1日,特斯拉官方宣布ModelY升级。外观上,新增ModelY专属色“快银车漆”,并采用烈焰红代替中国红、星空灰代替冷光银;性能上,ModelY全系配备全新一代自动辅助驾驶硬件(HW4.0),通过搭载超远距离双目摄像头,ModelY的最远探测距离达424米。由此,特斯拉全系车型均配备了自动辅助驾驶硬件HW4.0。在售价方面,特斯拉中国官网显示,ModelY车型依然保持原价。ModelY后轮驱动版25.89万元起、ModelY长续航版29.99万元起、ModelY高性能版售价36.39万元起。")); |
| | | documents.add(new DocumentModel(9, "CT01-XW·2024-D10-0009", "新闻热线[2024]000009", "华为手机归来,谁最受伤?", "低迷周期下的智能手机市场在2023年下半年迎来了华为的回归,这也给本就竞争激烈的市场环境带来了更大变数。1月29日,有消息称,华为已注册“星耀手机”品牌商标,定位中端手机市场,但上述消息并未获得华为方面确认。“目前星耀的相关信息我们看到了,但是没有获得产品信息以及启动线下铺货的通知。对于和其他品牌的二选一问题,听其他省份的经销商说过,但目前(华为渠道)这边也没有更多动作。”一位广东区域的华为核心经销商对记者说。但华为手机的反扑已经开始。在多家调研机构公布的2023年四季度智能手机出货数据中,华为手机的量正在明显上升,当季增幅在35%到47%之间。不过,从全年数据来看,并未登上前五榜单。")); |
| | | documents.add(new DocumentModel(10, "CT01-XW·2024-D10-0010", "新闻热线[2024]000010", "疯狂裁员的硅谷大厂:除了AI,其它都是将就", "放眼望去,近期科技企业财报形势一片大好,裁员浪潮却仍在不断蔓延。国内职场动态看脉脉,那硅谷裁员情况就得看layoff.fyi了。数据显示,2024年,103家科技企业进行了裁员,28963位员工失去了饭碗。其中,电子支付公司PayPal大笔一挥,裁掉2500人,微软则在开年就裁掉1900人。回望2023年,谷歌、Meta、亚马逊、微软均为裁员重灾区,裁员人数在一万左右。具体而言,谷歌近日披露的财报指出,2023年谷歌解雇了12000多名员工,光是在遣散费和其他费用上就花费了21亿美元。而且裁员费用还在不断增加,2024年刚过去一个月,谷歌就已经花费了7亿美元用来裁员。")); |
| | | documents.add(new DocumentModel(11, "CT01-XW·2024-D30-0011", "新闻热线[2024]000011", "国产手机品牌重新崛起背后:市场正在逐步恢复活力,竞争也愈发激烈", "2024年伊始,随着全球经济的逐渐复苏,手机消费市场也展现出勃勃生机。中国信通院最新数据显示,2023年中国市场手机出货量实现了6.5%的同比增长,其中5G手机增长势头更为强劲,占比高达82.8%。1月25日,国际数据公司(IDC)发布了最新手机季度跟踪报告,揭示了中国智能手机市场在2023年第四季度的出货量情况。报告显示,该季度中国智能手机市场出货量达到了约7363万台,同比增长1.2%。这是在连续十个季度同比下降后,中国智能手机市场首次实现反弹。这一积极信号表明,市场正在逐步恢复活力,各大品牌之间的竞争也愈发激烈。")); |
| | | documents.add(new DocumentModel(12, "CT01-XW·2024-D30-0012", "新闻热线[2024]000012", "SpaceX将于1月31日向国际空间站发射天鹅号货运飞船", "1月29日消息,美国太空探索技术公司SpaceX计划于当地时间1月30日,利用“猎鹰9号”火箭从佛罗里达州肯尼迪航天中心发射诺斯罗普·格鲁曼公司的“天鹅号”货运飞船至国际空间站。此次任务是执行NG-20商业补给,将运送约8200多磅的物资、设备及科学实验器材。")); |
| | | } |
| | | |
| | | /** |
| | | * 搜索相关 |
| | | */ |
| | | @GetMapping("/search") |
| | | public String search() |
| | | { |
| | | return prefix + "/search"; |
| | | } |
| | | |
| | | /** |
| | | * 数据汇总 |
| | | */ |
| | | @GetMapping("/footer") |
| | | public String footer() |
| | | { |
| | | return prefix + "/footer"; |
| | | } |
| | | |
| | | /** |
| | | * 组合表头 |
| | | */ |
| | | @GetMapping("/groupHeader") |
| | | public String groupHeader() |
| | | { |
| | | return prefix + "/groupHeader"; |
| | | } |
| | | |
| | | /** |
| | | * 表格导出 |
| | | */ |
| | | @GetMapping("/export") |
| | | public String export() |
| | | { |
| | | return prefix + "/export"; |
| | | } |
| | | |
| | | /** |
| | | * 表格导出选择列 |
| | | */ |
| | | @GetMapping("/exportSelected") |
| | | public String exportSelected() |
| | | { |
| | | return prefix + "/exportSelected"; |
| | | } |
| | | |
| | | /** |
| | | * 导出数据 |
| | | */ |
| | | @PostMapping("/exportData") |
| | | @ResponseBody |
| | | public AjaxResult exportSelected(UserTableModel userModel, String userIds) |
| | | { |
| | | List<UserTableModel> userList = new ArrayList<UserTableModel>(Arrays.asList(new UserTableModel[users.size()])); |
| | | Collections.copy(userList, users); |
| | | |
| | | // 条件过滤 |
| | | if (StringUtils.isNotEmpty(userIds)) |
| | | { |
| | | userList.clear(); |
| | | for (Long userId : Convert.toLongArray(userIds)) |
| | | { |
| | | for (UserTableModel user : users) |
| | | { |
| | | if (user.getUserId() == userId) |
| | | { |
| | | userList.add(user); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ExcelUtil<UserTableModel> util = new ExcelUtil<UserTableModel>(UserTableModel.class); |
| | | return util.exportExcel(userList, "用户数据"); |
| | | } |
| | | |
| | | /** |
| | | * 翻页记住选择 |
| | | */ |
| | | @GetMapping("/remember") |
| | | public String remember() |
| | | { |
| | | return prefix + "/remember"; |
| | | } |
| | | |
| | | /** |
| | | * 表格保存状态 |
| | | */ |
| | | @GetMapping("/cookie") |
| | | public String cookie() |
| | | { |
| | | return prefix + "/cookie"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转至指定页 |
| | | */ |
| | | @GetMapping("/pageGo") |
| | | public String pageGo() |
| | | { |
| | | return prefix + "/pageGo"; |
| | | } |
| | | |
| | | /** |
| | | * 自定义查询参数 |
| | | */ |
| | | @GetMapping("/params") |
| | | public String params() |
| | | { |
| | | return prefix + "/params"; |
| | | } |
| | | |
| | | /** |
| | | * 多表格 |
| | | */ |
| | | @GetMapping("/multi") |
| | | public String multi() |
| | | { |
| | | return prefix + "/multi"; |
| | | } |
| | | |
| | | /** |
| | | * 点击按钮加载表格 |
| | | */ |
| | | @GetMapping("/button") |
| | | public String button() |
| | | { |
| | | return prefix + "/button"; |
| | | } |
| | | |
| | | /** |
| | | * 直接加载表格数据 |
| | | */ |
| | | @GetMapping("/data") |
| | | public String data(ModelMap mmap) |
| | | { |
| | | mmap.put("users", users); |
| | | return prefix + "/data"; |
| | | } |
| | | |
| | | /** |
| | | * 表格冻结列 |
| | | */ |
| | | @GetMapping("/fixedColumns") |
| | | public String fixedColumns() |
| | | { |
| | | return prefix + "/fixedColumns"; |
| | | } |
| | | |
| | | /** |
| | | * 自定义触发事件 |
| | | */ |
| | | @GetMapping("/event") |
| | | public String event() |
| | | { |
| | | return prefix + "/event"; |
| | | } |
| | | |
| | | /** |
| | | * 表格细节视图 |
| | | */ |
| | | @GetMapping("/detail") |
| | | public String detail() |
| | | { |
| | | return prefix + "/detail"; |
| | | } |
| | | |
| | | /** |
| | | * 表格父子视图 |
| | | */ |
| | | @GetMapping("/child") |
| | | public String child() |
| | | { |
| | | return prefix + "/child"; |
| | | } |
| | | |
| | | /** |
| | | * 表格图片预览 |
| | | */ |
| | | @GetMapping("/image") |
| | | public String image() |
| | | { |
| | | return prefix + "/image"; |
| | | } |
| | | |
| | | /** |
| | | * 动态增删改查 |
| | | */ |
| | | @GetMapping("/curd") |
| | | public String curd() |
| | | { |
| | | return prefix + "/curd"; |
| | | } |
| | | |
| | | /** |
| | | * 表格行拖拽操作 |
| | | */ |
| | | @GetMapping("/reorderRows") |
| | | public String reorderRows() |
| | | { |
| | | return prefix + "/reorderRows"; |
| | | } |
| | | |
| | | /** |
| | | * 表格列拖拽操作 |
| | | */ |
| | | @GetMapping("/reorderColumns") |
| | | public String reorderColumns() |
| | | { |
| | | return prefix + "/reorderColumns"; |
| | | } |
| | | |
| | | /** |
| | | * 表格列宽拖动 |
| | | */ |
| | | @GetMapping("/resizable") |
| | | public String resizable() |
| | | { |
| | | return prefix + "/resizable"; |
| | | } |
| | | |
| | | /** |
| | | * 表格行内编辑操作 |
| | | */ |
| | | @GetMapping("/editable") |
| | | public String editable() |
| | | { |
| | | return prefix + "/editable"; |
| | | } |
| | | |
| | | /** |
| | | * 主子表提交 |
| | | */ |
| | | @GetMapping("/subdata") |
| | | public String subdata() |
| | | { |
| | | return prefix + "/subdata"; |
| | | } |
| | | |
| | | /** |
| | | * 表格自动刷新 |
| | | */ |
| | | @GetMapping("/refresh") |
| | | public String refresh() |
| | | { |
| | | return prefix + "/refresh"; |
| | | } |
| | | |
| | | /** |
| | | * 表格打印配置 |
| | | */ |
| | | @GetMapping("/print") |
| | | public String print() |
| | | { |
| | | return prefix + "/print"; |
| | | } |
| | | |
| | | /** |
| | | * 表格标题格式化 |
| | | */ |
| | | @GetMapping("/headerStyle") |
| | | public String headerStyle() |
| | | { |
| | | return prefix + "/headerStyle"; |
| | | } |
| | | |
| | | /** |
| | | * 表格动态列 |
| | | */ |
| | | @GetMapping("/dynamicColumns") |
| | | public String dynamicColumns() |
| | | { |
| | | return prefix + "/dynamicColumns"; |
| | | } |
| | | |
| | | /** |
| | | * 表格虚拟滚动 |
| | | */ |
| | | @GetMapping("/virtualScroll") |
| | | public String virtualScroll() |
| | | { |
| | | return prefix + "/virtualScroll"; |
| | | } |
| | | |
| | | /** |
| | | * 自定义视图分页 |
| | | */ |
| | | @GetMapping("/customView") |
| | | public String customView() |
| | | { |
| | | return prefix + "/customView"; |
| | | } |
| | | |
| | | /** |
| | | * 全文索引 |
| | | */ |
| | | @GetMapping("/textSearch") |
| | | public String textSearch() |
| | | { |
| | | return prefix + "/textSearch"; |
| | | } |
| | | |
| | | /** |
| | | * 异步加载表格树 |
| | | */ |
| | | @GetMapping("/asynTree") |
| | | public String asynTree() |
| | | { |
| | | return prefix + "/asynTree"; |
| | | } |
| | | |
| | | /** |
| | | * 表格其他操作 |
| | | */ |
| | | @GetMapping("/other") |
| | | public String other() |
| | | { |
| | | return prefix + "/other"; |
| | | } |
| | | |
| | | /** |
| | | * 动态获取列 |
| | | */ |
| | | @PostMapping("/ajaxColumns") |
| | | @ResponseBody |
| | | public AjaxResult ajaxColumns(UserTableColumn userColumn) |
| | | { |
| | | List<UserTableColumn> columnList = new ArrayList<UserTableColumn>(Arrays.asList(new UserTableColumn[columns.size()])); |
| | | Collections.copy(columnList, columns); |
| | | if (userColumn != null && "userBalance".equals(userColumn.getField())) |
| | | { |
| | | columnList.add(new UserTableColumn("用户余额", "userBalance")); |
| | | } |
| | | return AjaxResult.success(columnList); |
| | | } |
| | | |
| | | /** |
| | | * 查询数据 |
| | | */ |
| | | @PostMapping("/list") |
| | | @ResponseBody |
| | | public TableDataInfo list(UserTableModel userModel) |
| | | { |
| | | TableDataInfo rspData = new TableDataInfo(); |
| | | List<UserTableModel> userList = new ArrayList<UserTableModel>(Arrays.asList(new UserTableModel[users.size()])); |
| | | Collections.copy(userList, users); |
| | | // 查询条件过滤 |
| | | if (StringUtils.isNotEmpty(userModel.getUserName())) |
| | | { |
| | | userList.clear(); |
| | | for (UserTableModel user : users) |
| | | { |
| | | if (user.getUserName().equals(userModel.getUserName())) |
| | | { |
| | | userList.add(user); |
| | | } |
| | | } |
| | | } |
| | | PageDomain pageDomain = TableSupport.buildPageRequest(); |
| | | if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize()) |
| | | { |
| | | rspData.setRows(userList); |
| | | rspData.setTotal(userList.size()); |
| | | return rspData; |
| | | } |
| | | Integer pageNum = (pageDomain.getPageNum() - 1) * 10; |
| | | Integer pageSize = pageDomain.getPageNum() * 10; |
| | | if (pageSize > userList.size()) |
| | | { |
| | | pageSize = userList.size(); |
| | | } |
| | | rspData.setRows(userList.subList(pageNum, pageSize)); |
| | | rspData.setTotal(userList.size()); |
| | | return rspData; |
| | | } |
| | | |
| | | /** |
| | | * 查询全文索引数据 |
| | | */ |
| | | @PostMapping("/text/list") |
| | | @ResponseBody |
| | | public TableDataInfo textList(BaseEntity baseEntity) |
| | | { |
| | | TableDataInfo rspData = new TableDataInfo(); |
| | | List<DocumentModel> documentList = new ArrayList<DocumentModel>(Arrays.asList(new DocumentModel[documents.size()])); |
| | | Collections.copy(documentList, documents); |
| | | // 查询条件过滤 |
| | | if (StringUtils.isNotEmpty(baseEntity.getSearchValue())) |
| | | { |
| | | documentList.clear(); |
| | | for (DocumentModel document : documents) |
| | | { |
| | | boolean indexFlag = false; |
| | | if (document.getTitle().contains(baseEntity.getSearchValue())) |
| | | { |
| | | indexFlag = true; |
| | | document.setTitle(document.getTitle().replace(baseEntity.getSearchValue(), "<font color=\"red\">" + baseEntity.getSearchValue() + "</font>")); |
| | | } |
| | | if (document.getContent().contains(baseEntity.getSearchValue())) |
| | | { |
| | | indexFlag = true; |
| | | document.setContent(document.getContent().replace(baseEntity.getSearchValue(), "<font color=\"red\">" + baseEntity.getSearchValue() + "</font>")); |
| | | } |
| | | if (indexFlag) |
| | | { |
| | | documentList.add(document); |
| | | } |
| | | } |
| | | } |
| | | PageDomain pageDomain = TableSupport.buildPageRequest(); |
| | | if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize()) |
| | | { |
| | | rspData.setRows(documentList); |
| | | rspData.setTotal(documentList.size()); |
| | | return rspData; |
| | | } |
| | | Integer pageNum = (pageDomain.getPageNum() - 1) * 10; |
| | | Integer pageSize = pageDomain.getPageNum() * 10; |
| | | if (pageSize > documentList.size()) |
| | | { |
| | | pageSize = documentList.size(); |
| | | } |
| | | rspData.setRows(documentList.subList(pageNum, pageSize)); |
| | | rspData.setTotal(documentList.size()); |
| | | return rspData; |
| | | } |
| | | |
| | | /** |
| | | * 查询树表数据 |
| | | */ |
| | | @PostMapping("/tree/list") |
| | | @ResponseBody |
| | | public TableDataInfo treeList(AreaModel areaModel) |
| | | { |
| | | TableDataInfo rspData = new TableDataInfo(); |
| | | List<AreaModel> areaList = new ArrayList<AreaModel>(Arrays.asList(new AreaModel[areas.size()])); |
| | | // 默认查询条件 parentId 0 |
| | | Collections.copy(areaList, areas); |
| | | areaList.clear(); |
| | | if (StringUtils.isNotEmpty(areaModel.getAreaName())) |
| | | { |
| | | for (AreaModel area : areas) |
| | | { |
| | | if (area.getParentId() == 0 && area.getAreaName().equals(areaModel.getAreaName())) |
| | | { |
| | | areaList.add(area); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (AreaModel area : areas) |
| | | { |
| | | if (area.getParentId() == 0) |
| | | { |
| | | areaList.add(area); |
| | | } |
| | | } |
| | | } |
| | | PageDomain pageDomain = TableSupport.buildPageRequest(); |
| | | Integer pageNum = (pageDomain.getPageNum() - 1) * pageDomain.getPageSize(); |
| | | Integer pageSize = pageDomain.getPageNum() * pageDomain.getPageSize(); |
| | | if (pageSize > areaList.size()) |
| | | { |
| | | pageSize = areaList.size(); |
| | | } |
| | | rspData.setRows(areaList.subList(pageNum, pageSize)); |
| | | rspData.setTotal(areaList.size()); |
| | | return rspData; |
| | | } |
| | | |
| | | /** |
| | | * 查询树表子节点数据 |
| | | */ |
| | | @PostMapping("/tree/listChild") |
| | | @ResponseBody |
| | | public List<AreaModel> listChild(AreaModel areaModel) |
| | | { |
| | | List<AreaModel> areaList = new ArrayList<AreaModel>(Arrays.asList(new AreaModel[areas.size()])); |
| | | // 查询条件 parentId |
| | | Collections.copy(areaList, areas); |
| | | areaList.clear(); |
| | | if (StringUtils.isNotEmpty(areaModel.getAreaName())) |
| | | { |
| | | for (AreaModel area : areas) |
| | | { |
| | | if (area.getParentId().intValue() == areaModel.getParentId().intValue() && area.getAreaName().equals(areaModel.getAreaName())) |
| | | { |
| | | areaList.add(area); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (AreaModel area : areas) |
| | | { |
| | | if (area.getParentId().intValue() == areaModel.getParentId().intValue()) |
| | | { |
| | | areaList.add(area); |
| | | } |
| | | } |
| | | } |
| | | return areaList; |
| | | } |
| | | } |
| | | |
| | | class UserTableColumn |
| | | { |
| | | /** 表头 */ |
| | | private String title; |
| | | /** 字段 */ |
| | | private String field; |
| | | |
| | | public UserTableColumn() |
| | | { |
| | | |
| | | } |
| | | |
| | | public UserTableColumn(String title, String field) |
| | | { |
| | | this.title = title; |
| | | this.field = field; |
| | | } |
| | | |
| | | public String getTitle() |
| | | { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) |
| | | { |
| | | this.title = title; |
| | | } |
| | | |
| | | public String getField() |
| | | { |
| | | return field; |
| | | } |
| | | |
| | | public void setField(String field) |
| | | { |
| | | this.field = field; |
| | | } |
| | | } |
| | | |
| | | class UserTableModel |
| | | { |
| | | /** 用户ID */ |
| | | private int userId; |
| | | |
| | | /** 用户编号 */ |
| | | @Excel(name = "用户编号", cellType = ColumnType.NUMERIC) |
| | | private String userCode; |
| | | |
| | | /** 用户姓名 */ |
| | | @Excel(name = "用户姓名") |
| | | private String userName; |
| | | |
| | | /** 用户性别 */ |
| | | private String userSex; |
| | | |
| | | /** 用户手机 */ |
| | | @Excel(name = "用户手机") |
| | | private String userPhone; |
| | | |
| | | /** 用户邮箱 */ |
| | | @Excel(name = "用户邮箱") |
| | | private String userEmail; |
| | | |
| | | /** 用户余额 */ |
| | | @Excel(name = "用户余额", cellType = ColumnType.NUMERIC) |
| | | private double userBalance; |
| | | |
| | | /** 用户状态(0正常 1停用) */ |
| | | private String status; |
| | | |
| | | /** 创建时间 */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | public UserTableModel() |
| | | { |
| | | |
| | | } |
| | | |
| | | public UserTableModel(int userId, String userCode, String userName, String userSex, String userPhone, |
| | | String userEmail, double userBalance, String status) |
| | | { |
| | | this.userId = userId; |
| | | this.userCode = userCode; |
| | | this.userName = userName; |
| | | this.userSex = userSex; |
| | | this.userPhone = userPhone; |
| | | this.userEmail = userEmail; |
| | | this.userBalance = userBalance; |
| | | this.status = status; |
| | | this.createTime = DateUtils.getNowDate(); |
| | | } |
| | | |
| | | public int getUserId() |
| | | { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(int userId) |
| | | { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getUserCode() |
| | | { |
| | | return userCode; |
| | | } |
| | | |
| | | public void setUserCode(String userCode) |
| | | { |
| | | this.userCode = userCode; |
| | | } |
| | | |
| | | public String getUserName() |
| | | { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) |
| | | { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | public String getUserSex() |
| | | { |
| | | return userSex; |
| | | } |
| | | |
| | | public void setUserSex(String userSex) |
| | | { |
| | | this.userSex = userSex; |
| | | } |
| | | |
| | | public String getUserPhone() |
| | | { |
| | | return userPhone; |
| | | } |
| | | |
| | | public void setUserPhone(String userPhone) |
| | | { |
| | | this.userPhone = userPhone; |
| | | } |
| | | |
| | | public String getUserEmail() |
| | | { |
| | | return userEmail; |
| | | } |
| | | |
| | | public void setUserEmail(String userEmail) |
| | | { |
| | | this.userEmail = userEmail; |
| | | } |
| | | |
| | | public double getUserBalance() |
| | | { |
| | | return userBalance; |
| | | } |
| | | |
| | | public void setUserBalance(double userBalance) |
| | | { |
| | | this.userBalance = userBalance; |
| | | } |
| | | |
| | | public String getStatus() |
| | | { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) |
| | | { |
| | | this.status = status; |
| | | } |
| | | |
| | | public Date getCreateTime() |
| | | { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) |
| | | { |
| | | this.createTime = createTime; |
| | | } |
| | | } |
| | | class AreaModel |
| | | { |
| | | /** 编号 */ |
| | | private Long id; |
| | | |
| | | /** 父编号 */ |
| | | private Long parentId; |
| | | |
| | | /** 区域名称 */ |
| | | private String areaName; |
| | | |
| | | /** 区域代码 */ |
| | | private String areaCode; |
| | | |
| | | /** 名称首字母 */ |
| | | private String simplePy; |
| | | |
| | | /** 名称全拼 */ |
| | | private String pinYin; |
| | | |
| | | /** 是否有子节点(0无 1有) */ |
| | | private Integer isTreeLeaf = 1; |
| | | |
| | | public AreaModel() |
| | | { |
| | | |
| | | } |
| | | |
| | | public AreaModel(int id, int parentId, String areaName, String areaCode, String simplePy, String pinYin, Integer isTreeLeaf) |
| | | { |
| | | this.id = Long.valueOf(id); |
| | | this.parentId = Long.valueOf(parentId); |
| | | this.areaName = areaName; |
| | | this.areaCode = areaCode; |
| | | this.simplePy = simplePy; |
| | | this.pinYin = pinYin; |
| | | this.isTreeLeaf = isTreeLeaf; |
| | | } |
| | | |
| | | public Long getId() |
| | | { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) |
| | | { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getParentId() |
| | | { |
| | | return parentId; |
| | | } |
| | | |
| | | public void setParentId(Long parentId) |
| | | { |
| | | this.parentId = parentId; |
| | | } |
| | | |
| | | public String getAreaName() |
| | | { |
| | | return areaName; |
| | | } |
| | | |
| | | public void setAreaName(String areaName) |
| | | { |
| | | this.areaName = areaName; |
| | | } |
| | | |
| | | public String getAreaCode() |
| | | { |
| | | return areaCode; |
| | | } |
| | | |
| | | public void setAreaCode(String areaCode) |
| | | { |
| | | this.areaCode = areaCode; |
| | | } |
| | | |
| | | public String getSimplePy() |
| | | { |
| | | return simplePy; |
| | | } |
| | | |
| | | public void setSimplePy(String simplePy) |
| | | { |
| | | this.simplePy = simplePy; |
| | | } |
| | | |
| | | public String getPinYin() |
| | | { |
| | | return pinYin; |
| | | } |
| | | |
| | | public void setPinYin(String pinYin) |
| | | { |
| | | this.pinYin = pinYin; |
| | | } |
| | | |
| | | public Integer getIsTreeLeaf() |
| | | { |
| | | return isTreeLeaf; |
| | | } |
| | | |
| | | public void setIsTreeLeaf(Integer isTreeLeaf) |
| | | { |
| | | this.isTreeLeaf = isTreeLeaf; |
| | | } |
| | | } |
| | | |
| | | class DocumentModel |
| | | { |
| | | /** 编号 */ |
| | | private int tableId; |
| | | |
| | | /** 档号 */ |
| | | private String archiveNo; |
| | | |
| | | /** 文件编号 */ |
| | | private String docNo; |
| | | |
| | | /** 标题 */ |
| | | private String title; |
| | | |
| | | /** 内容 */ |
| | | private String content; |
| | | |
| | | public DocumentModel() |
| | | { |
| | | |
| | | } |
| | | |
| | | public DocumentModel(int tableId, String archiveNo, String docNo, String title, String content) |
| | | { |
| | | this.tableId = tableId; |
| | | this.archiveNo = archiveNo; |
| | | this.docNo = docNo; |
| | | this.title = title; |
| | | this.content = content; |
| | | } |
| | | |
| | | public int getTableId() |
| | | { |
| | | return tableId; |
| | | } |
| | | |
| | | public String getArchiveNo() |
| | | { |
| | | return archiveNo; |
| | | } |
| | | |
| | | public String getDocNo() |
| | | { |
| | | return docNo; |
| | | } |
| | | |
| | | public String getTitle() |
| | | { |
| | | return title; |
| | | } |
| | | |
| | | public String getContent() |
| | | { |
| | | return content; |
| | | } |
| | | |
| | | public void setTableId(int tableId) |
| | | { |
| | | this.tableId = tableId; |
| | | } |
| | | |
| | | public void setArchiveNo(String archiveNo) |
| | | { |
| | | this.archiveNo = archiveNo; |
| | | } |
| | | |
| | | public void setDocNo(String docNo) |
| | | { |
| | | this.docNo = docNo; |
| | | } |
| | | |
| | | public void setTitle(String title) |
| | | { |
| | | this.title = title; |
| | | } |
| | | |
| | | public void setContent(String content) |
| | | { |
| | | this.content = content; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.demo.domain; |
| | | |
| | | import java.util.List; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | |
| | | /** |
| | | * 客户测试信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class CustomerModel |
| | | { |
| | | /** |
| | | * 客户姓名 |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 客户手机 |
| | | */ |
| | | private String phonenumber; |
| | | |
| | | /** |
| | | * 客户性别 |
| | | */ |
| | | private String sex; |
| | | |
| | | /** |
| | | * 客户生日 |
| | | */ |
| | | private String birthday; |
| | | |
| | | /** |
| | | * 客户描述 |
| | | */ |
| | | private String remark; |
| | | |
| | | /** |
| | | * 商品信息 |
| | | */ |
| | | private List<GoodsModel> goods; |
| | | |
| | | public String getName() |
| | | { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) |
| | | { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getPhonenumber() |
| | | { |
| | | return phonenumber; |
| | | } |
| | | |
| | | public void setPhonenumber(String phonenumber) |
| | | { |
| | | this.phonenumber = phonenumber; |
| | | } |
| | | |
| | | |
| | | public String getSex() |
| | | { |
| | | return sex; |
| | | } |
| | | |
| | | public void setSex(String sex) |
| | | { |
| | | this.sex = sex; |
| | | } |
| | | |
| | | public String getBirthday() |
| | | { |
| | | return birthday; |
| | | } |
| | | |
| | | public void setBirthday(String birthday) |
| | | { |
| | | this.birthday = birthday; |
| | | } |
| | | |
| | | public String getRemark() |
| | | { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) |
| | | { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public List<GoodsModel> getGoods() |
| | | { |
| | | return goods; |
| | | } |
| | | |
| | | public void setGoods(List<GoodsModel> goods) |
| | | { |
| | | this.goods = goods; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("name", getName()) |
| | | .append("phonenumber", getPhonenumber()) |
| | | .append("sex", getSex()) |
| | | .append("birthday", getBirthday()) |
| | | .append("goods", getGoods()) |
| | | .append("remark", getRemark()) |
| | | .toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.demo.domain; |
| | | |
| | | import java.util.Date; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | |
| | | /** |
| | | * 商品测试信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class GoodsModel |
| | | { |
| | | /** |
| | | * 商品名称 |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 商品重量 |
| | | */ |
| | | private Integer weight; |
| | | |
| | | /** |
| | | * 商品价格 |
| | | */ |
| | | private Double price; |
| | | |
| | | /** |
| | | * 商品日期 |
| | | */ |
| | | private Date date; |
| | | |
| | | /** |
| | | * 商品种类 |
| | | */ |
| | | private String type; |
| | | |
| | | public String getName() |
| | | { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) |
| | | { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Integer getWeight() |
| | | { |
| | | return weight; |
| | | } |
| | | |
| | | public void setWeight(Integer weight) |
| | | { |
| | | this.weight = weight; |
| | | } |
| | | |
| | | public Double getPrice() |
| | | { |
| | | return price; |
| | | } |
| | | |
| | | public void setPrice(Double price) |
| | | { |
| | | this.price = price; |
| | | } |
| | | |
| | | public Date getDate() |
| | | { |
| | | return date; |
| | | } |
| | | |
| | | public void setDate(Date date) |
| | | { |
| | | this.date = date; |
| | | } |
| | | |
| | | public String getType() |
| | | { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) |
| | | { |
| | | this.type = type; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("name", getName()) |
| | | .append("weight", getWeight()) |
| | | .append("price", getPrice()) |
| | | .append("date", getDate()) |
| | | .append("type", getType()) |
| | | .toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.demo.domain; |
| | | |
| | | import java.util.Date; |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import com.ruoyi.common.annotation.Excel.Type; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | |
| | | public class UserOperateModel extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private int userId; |
| | | |
| | | @Excel(name = "用户编号") |
| | | private String userCode; |
| | | |
| | | @Excel(name = "用户姓名") |
| | | private String userName; |
| | | |
| | | @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") |
| | | private String userSex; |
| | | |
| | | @Excel(name = "用户手机") |
| | | private String userPhone; |
| | | |
| | | @Excel(name = "用户邮箱") |
| | | private String userEmail; |
| | | |
| | | @Excel(name = "用户余额") |
| | | private double userBalance; |
| | | |
| | | @Excel(name = "用户状态", readConverterExp = "0=正常,1=停用") |
| | | private String status; |
| | | |
| | | @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) |
| | | private Date createTime; |
| | | |
| | | public UserOperateModel() |
| | | { |
| | | |
| | | } |
| | | |
| | | public UserOperateModel(int userId, String userCode, String userName, String userSex, String userPhone, |
| | | String userEmail, double userBalance, String status) |
| | | { |
| | | this.userId = userId; |
| | | this.userCode = userCode; |
| | | this.userName = userName; |
| | | this.userSex = userSex; |
| | | this.userPhone = userPhone; |
| | | this.userEmail = userEmail; |
| | | this.userBalance = userBalance; |
| | | this.status = status; |
| | | this.createTime = DateUtils.getNowDate(); |
| | | } |
| | | |
| | | public int getUserId() |
| | | { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(int userId) |
| | | { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getUserCode() |
| | | { |
| | | return userCode; |
| | | } |
| | | |
| | | public void setUserCode(String userCode) |
| | | { |
| | | this.userCode = userCode; |
| | | } |
| | | |
| | | public String getUserName() |
| | | { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) |
| | | { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | public String getUserSex() |
| | | { |
| | | return userSex; |
| | | } |
| | | |
| | | public void setUserSex(String userSex) |
| | | { |
| | | this.userSex = userSex; |
| | | } |
| | | |
| | | public String getUserPhone() |
| | | { |
| | | return userPhone; |
| | | } |
| | | |
| | | public void setUserPhone(String userPhone) |
| | | { |
| | | this.userPhone = userPhone; |
| | | } |
| | | |
| | | public String getUserEmail() |
| | | { |
| | | return userEmail; |
| | | } |
| | | |
| | | public void setUserEmail(String userEmail) |
| | | { |
| | | this.userEmail = userEmail; |
| | | } |
| | | |
| | | public double getUserBalance() |
| | | { |
| | | return userBalance; |
| | | } |
| | | |
| | | public void setUserBalance(double userBalance) |
| | | { |
| | | this.userBalance = userBalance; |
| | | } |
| | | |
| | | public String getStatus() |
| | | { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) |
| | | { |
| | | this.status = status; |
| | | } |
| | | |
| | | @Override |
| | | public Date getCreateTime() |
| | | { |
| | | return createTime; |
| | | } |
| | | |
| | | @Override |
| | | public void setCreateTime(Date createTime) |
| | | { |
| | | this.createTime = createTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.service.CacheService; |
| | | |
| | | /** |
| | | * 缓存监控 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/monitor/cache") |
| | | public class CacheController extends BaseController |
| | | { |
| | | private String prefix = "monitor/cache"; |
| | | |
| | | @Autowired |
| | | private CacheService cacheService; |
| | | |
| | | @RequiresPermissions("monitor:cache:view") |
| | | @GetMapping() |
| | | public String cache(ModelMap mmap) |
| | | { |
| | | mmap.put("cacheNames", cacheService.getCacheNames()); |
| | | return prefix + "/cache"; |
| | | } |
| | | |
| | | @RequiresPermissions("monitor:cache:view") |
| | | @PostMapping("/getNames") |
| | | public String getCacheNames(String fragment, ModelMap mmap) |
| | | { |
| | | mmap.put("cacheNames", cacheService.getCacheNames()); |
| | | return prefix + "/cache::" + fragment; |
| | | } |
| | | |
| | | @RequiresPermissions("monitor:cache:view") |
| | | @PostMapping("/getKeys") |
| | | public String getCacheKeys(String fragment, String cacheName, ModelMap mmap) |
| | | { |
| | | mmap.put("cacheName", cacheName); |
| | | mmap.put("cacheKeys", cacheService.getCacheKeys(cacheName)); |
| | | return prefix + "/cache::" + fragment; |
| | | } |
| | | |
| | | @RequiresPermissions("monitor:cache:view") |
| | | @PostMapping("/getValue") |
| | | public String getCacheValue(String fragment, String cacheName, String cacheKey, ModelMap mmap) |
| | | { |
| | | mmap.put("cacheName", cacheName); |
| | | mmap.put("cacheKey", cacheKey); |
| | | mmap.put("cacheValue", cacheService.getCacheValue(cacheName, cacheKey)); |
| | | return prefix + "/cache::" + fragment; |
| | | } |
| | | |
| | | @RequiresPermissions("monitor:cache:view") |
| | | @PostMapping("/clearCacheName") |
| | | @ResponseBody |
| | | public AjaxResult clearCacheName(String cacheName, ModelMap mmap) |
| | | { |
| | | cacheService.clearCacheName(cacheName); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @RequiresPermissions("monitor:cache:view") |
| | | @PostMapping("/clearCacheKey") |
| | | @ResponseBody |
| | | public AjaxResult clearCacheKey(String cacheName, String cacheKey, ModelMap mmap) |
| | | { |
| | | cacheService.clearCacheKey(cacheName, cacheKey); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @RequiresPermissions("monitor:cache:view") |
| | | @GetMapping("/clearAll") |
| | | @ResponseBody |
| | | public AjaxResult clearAll(ModelMap mmap) |
| | | { |
| | | cacheService.clearAll(); |
| | | return AjaxResult.success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | |
| | | /** |
| | | * druid 监控 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/monitor/data") |
| | | public class DruidController extends BaseController |
| | | { |
| | | private String prefix = "/druid"; |
| | | |
| | | @RequiresPermissions("monitor:data:view") |
| | | @GetMapping() |
| | | public String index() |
| | | { |
| | | return redirect(prefix + "/index.html"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.Server; |
| | | |
| | | /** |
| | | * 服务器监控 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/monitor/server") |
| | | public class ServerController extends BaseController |
| | | { |
| | | private String prefix = "monitor/server"; |
| | | |
| | | @RequiresPermissions("monitor:server:view") |
| | | @GetMapping() |
| | | public String server(ModelMap mmap) throws Exception |
| | | { |
| | | Server server = new Server(); |
| | | server.copyTo(); |
| | | mmap.put("server", server); |
| | | return prefix + "/server"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import java.util.List; |
| | | import com.ruoyi.framework.shiro.service.SysPasswordService; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.domain.SysLogininfor; |
| | | import com.ruoyi.system.service.ISysLogininforService; |
| | | |
| | | /** |
| | | * 系统访问记录 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/monitor/logininfor") |
| | | public class SysLogininforController extends BaseController |
| | | { |
| | | private String prefix = "monitor/logininfor"; |
| | | |
| | | @Autowired |
| | | private ISysLogininforService logininforService; |
| | | |
| | | @Autowired |
| | | private SysPasswordService passwordService; |
| | | |
| | | @RequiresPermissions("monitor:logininfor:view") |
| | | @GetMapping() |
| | | public String logininfor() |
| | | { |
| | | return prefix + "/logininfor"; |
| | | } |
| | | |
| | | @RequiresPermissions("monitor:logininfor:list") |
| | | @PostMapping("/list") |
| | | @ResponseBody |
| | | public TableDataInfo list(SysLogininfor logininfor) |
| | | { |
| | | startPage(); |
| | | List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "登录日志", businessType = BusinessType.EXPORT) |
| | | @RequiresPermissions("monitor:logininfor:export") |
| | | @PostMapping("/export") |
| | | @ResponseBody |
| | | public AjaxResult export(SysLogininfor logininfor) |
| | | { |
| | | List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); |
| | | ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class); |
| | | return util.exportExcel(list, "登录日志"); |
| | | } |
| | | |
| | | @RequiresPermissions("monitor:logininfor:remove") |
| | | @Log(title = "登录日志", businessType = BusinessType.DELETE) |
| | | @PostMapping("/remove") |
| | | @ResponseBody |
| | | public AjaxResult remove(String ids) |
| | | { |
| | | return toAjax(logininforService.deleteLogininforByIds(ids)); |
| | | } |
| | | |
| | | @RequiresPermissions("monitor:logininfor:remove") |
| | | @Log(title = "登录日志", businessType = BusinessType.CLEAN) |
| | | @PostMapping("/clean") |
| | | @ResponseBody |
| | | public AjaxResult clean() |
| | | { |
| | | logininforService.cleanLogininfor(); |
| | | return success(); |
| | | } |
| | | |
| | | @RequiresPermissions("monitor:logininfor:unlock") |
| | | @Log(title = "账户解锁", businessType = BusinessType.OTHER) |
| | | @PostMapping("/unlock") |
| | | @ResponseBody |
| | | public AjaxResult unlock(String loginName) |
| | | { |
| | | passwordService.clearLoginRecordCache(loginName); |
| | | return success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import java.util.List; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.domain.SysOperLog; |
| | | import com.ruoyi.system.service.ISysOperLogService; |
| | | |
| | | /** |
| | | * 操作日志记录 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/monitor/operlog") |
| | | public class SysOperlogController extends BaseController |
| | | { |
| | | private String prefix = "monitor/operlog"; |
| | | |
| | | @Autowired |
| | | private ISysOperLogService operLogService; |
| | | |
| | | @RequiresPermissions("monitor:operlog:view") |
| | | @GetMapping() |
| | | public String operlog() |
| | | { |
| | | return prefix + "/operlog"; |
| | | } |
| | | |
| | | @RequiresPermissions("monitor:operlog:list") |
| | | @PostMapping("/list") |
| | | @ResponseBody |
| | | public TableDataInfo list(SysOperLog operLog) |
| | | { |
| | | startPage(); |
| | | List<SysOperLog> list = operLogService.selectOperLogList(operLog); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "操作日志", businessType = BusinessType.EXPORT) |
| | | @RequiresPermissions("monitor:operlog:export") |
| | | @PostMapping("/export") |
| | | @ResponseBody |
| | | public AjaxResult export(SysOperLog operLog) |
| | | { |
| | | List<SysOperLog> list = operLogService.selectOperLogList(operLog); |
| | | ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class); |
| | | return util.exportExcel(list, "操作日志"); |
| | | } |
| | | |
| | | @Log(title = "操作日志", businessType = BusinessType.DELETE) |
| | | @RequiresPermissions("monitor:operlog:remove") |
| | | @PostMapping("/remove") |
| | | @ResponseBody |
| | | public AjaxResult remove(String ids) |
| | | { |
| | | return toAjax(operLogService.deleteOperLogByIds(ids)); |
| | | } |
| | | |
| | | @RequiresPermissions("monitor:operlog:detail") |
| | | @GetMapping("/detail/{operId}") |
| | | public String detail(@PathVariable("operId") Long operId, ModelMap mmap) |
| | | { |
| | | mmap.put("operLog", operLogService.selectOperLogById(operId)); |
| | | return prefix + "/detail"; |
| | | } |
| | | |
| | | @Log(title = "操作日志", businessType = BusinessType.CLEAN) |
| | | @RequiresPermissions("monitor:operlog:remove") |
| | | @PostMapping("/clean") |
| | | @ResponseBody |
| | | public AjaxResult clean() |
| | | { |
| | | operLogService.cleanOperLog(); |
| | | return success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import java.util.List; |
| | | import org.apache.shiro.authz.annotation.Logical; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.core.text.Convert; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.enums.OnlineStatus; |
| | | import com.ruoyi.common.utils.ShiroUtils; |
| | | import com.ruoyi.framework.shiro.session.OnlineSession; |
| | | import com.ruoyi.framework.shiro.session.OnlineSessionDAO; |
| | | import com.ruoyi.system.domain.SysUserOnline; |
| | | import com.ruoyi.system.service.ISysUserOnlineService; |
| | | |
| | | /** |
| | | * 在线用户监控 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/monitor/online") |
| | | public class SysUserOnlineController extends BaseController |
| | | { |
| | | private String prefix = "monitor/online"; |
| | | |
| | | @Autowired |
| | | private ISysUserOnlineService userOnlineService; |
| | | |
| | | @Autowired |
| | | private OnlineSessionDAO onlineSessionDAO; |
| | | |
| | | @RequiresPermissions("monitor:online:view") |
| | | @GetMapping() |
| | | public String online() |
| | | { |
| | | return prefix + "/online"; |
| | | } |
| | | |
| | | @RequiresPermissions("monitor:online:list") |
| | | @PostMapping("/list") |
| | | @ResponseBody |
| | | public TableDataInfo list(SysUserOnline userOnline) |
| | | { |
| | | startPage(); |
| | | List<SysUserOnline> list = userOnlineService.selectUserOnlineList(userOnline); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @RequiresPermissions(value = { "monitor:online:batchForceLogout", "monitor:online:forceLogout" }, logical = Logical.OR) |
| | | @Log(title = "在线用户", businessType = BusinessType.FORCE) |
| | | @PostMapping("/batchForceLogout") |
| | | @ResponseBody |
| | | public AjaxResult batchForceLogout(String ids) |
| | | { |
| | | for (String sessionId : Convert.toStrArray(ids)) |
| | | { |
| | | SysUserOnline online = userOnlineService.selectOnlineById(sessionId); |
| | | if (online == null) |
| | | { |
| | | return error("用户已下线"); |
| | | } |
| | | OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId()); |
| | | if (onlineSession == null) |
| | | { |
| | | return error("用户已下线"); |
| | | } |
| | | if (sessionId.equals(ShiroUtils.getSessionId())) |
| | | { |
| | | return error("当前登录用户无法强退"); |
| | | } |
| | | onlineSessionDAO.delete(onlineSession); |
| | | online.setStatus(OnlineStatus.off_line); |
| | | userOnlineService.saveOnline(online); |
| | | userOnlineService.removeUserCache(online.getLoginName(), sessionId); |
| | | } |
| | | return success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.IOException; |
| | | import javax.annotation.Resource; |
| | | import javax.imageio.ImageIO; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpSession; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | import com.google.code.kaptcha.Constants; |
| | | import com.google.code.kaptcha.Producer; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | |
| | | /** |
| | | * 图片验证码(支持算术形式) |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/captcha") |
| | | public class SysCaptchaController extends BaseController |
| | | { |
| | | @Resource(name = "captchaProducer") |
| | | private Producer captchaProducer; |
| | | |
| | | @Resource(name = "captchaProducerMath") |
| | | private Producer captchaProducerMath; |
| | | |
| | | /** |
| | | * 验证码生成 |
| | | */ |
| | | @GetMapping(value = "/captchaImage") |
| | | public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response) |
| | | { |
| | | ServletOutputStream out = null; |
| | | try |
| | | { |
| | | HttpSession session = request.getSession(); |
| | | response.setDateHeader("Expires", 0); |
| | | response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate"); |
| | | response.addHeader("Cache-Control", "post-check=0, pre-check=0"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setContentType("image/jpeg"); |
| | | |
| | | String type = request.getParameter("type"); |
| | | String capStr = null; |
| | | String code = null; |
| | | BufferedImage bi = null; |
| | | if ("math".equals(type)) |
| | | { |
| | | String capText = captchaProducerMath.createText(); |
| | | capStr = capText.substring(0, capText.lastIndexOf("@")); |
| | | code = capText.substring(capText.lastIndexOf("@") + 1); |
| | | bi = captchaProducerMath.createImage(capStr); |
| | | } |
| | | else if ("char".equals(type)) |
| | | { |
| | | capStr = code = captchaProducer.createText(); |
| | | bi = captchaProducer.createImage(capStr); |
| | | } |
| | | session.setAttribute(Constants.KAPTCHA_SESSION_KEY, code); |
| | | out = response.getOutputStream(); |
| | | ImageIO.write(bi, "jpg", out); |
| | | out.flush(); |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | e.printStackTrace(); |
| | | } |
| | | finally |
| | | { |
| | | try |
| | | { |
| | | if (out != null) |
| | | { |
| | | out.close(); |
| | | } |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.domain.SysConfig; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | |
| | | /** |
| | | * 参数配置 信息操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/system/config") |
| | | public class SysConfigController extends BaseController |
| | | { |
| | | private String prefix = "system/config"; |
| | | |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | |
| | | @RequiresPermissions("system:config:view") |
| | | @GetMapping() |
| | | public String config() |
| | | { |
| | | return prefix + "/config"; |
| | | } |
| | | |
| | | /** |
| | | * 查询参数配置列表 |
| | | */ |
| | | @RequiresPermissions("system:config:list") |
| | | @PostMapping("/list") |
| | | @ResponseBody |
| | | public TableDataInfo list(SysConfig config) |
| | | { |
| | | startPage(); |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "参数管理", businessType = BusinessType.EXPORT) |
| | | @RequiresPermissions("system:config:export") |
| | | @PostMapping("/export") |
| | | @ResponseBody |
| | | public AjaxResult export(SysConfig config) |
| | | { |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class); |
| | | return util.exportExcel(list, "参数数据"); |
| | | } |
| | | |
| | | /** |
| | | * 新增参数配置 |
| | | */ |
| | | @RequiresPermissions("system:config:add") |
| | | @GetMapping("/add") |
| | | public String add() |
| | | { |
| | | return prefix + "/add"; |
| | | } |
| | | |
| | | /** |
| | | * 新增保存参数配置 |
| | | */ |
| | | @RequiresPermissions("system:config:add") |
| | | @Log(title = "参数管理", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | @ResponseBody |
| | | public AjaxResult addSave(@Validated SysConfig config) |
| | | { |
| | | if (!configService.checkConfigKeyUnique(config)) |
| | | { |
| | | return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | | } |
| | | config.setCreateBy(getLoginName()); |
| | | return toAjax(configService.insertConfig(config)); |
| | | } |
| | | |
| | | /** |
| | | * 修改参数配置 |
| | | */ |
| | | @RequiresPermissions("system:config:edit") |
| | | @GetMapping("/edit/{configId}") |
| | | public String edit(@PathVariable("configId") Long configId, ModelMap mmap) |
| | | { |
| | | mmap.put("config", configService.selectConfigById(configId)); |
| | | return prefix + "/edit"; |
| | | } |
| | | |
| | | /** |
| | | * 修改保存参数配置 |
| | | */ |
| | | @RequiresPermissions("system:config:edit") |
| | | @Log(title = "参数管理", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit") |
| | | @ResponseBody |
| | | public AjaxResult editSave(@Validated SysConfig config) |
| | | { |
| | | if (!configService.checkConfigKeyUnique(config)) |
| | | { |
| | | return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | | } |
| | | config.setUpdateBy(getLoginName()); |
| | | return toAjax(configService.updateConfig(config)); |
| | | } |
| | | |
| | | /** |
| | | * 删除参数配置 |
| | | */ |
| | | @RequiresPermissions("system:config:remove") |
| | | @Log(title = "参数管理", businessType = BusinessType.DELETE) |
| | | @PostMapping("/remove") |
| | | @ResponseBody |
| | | public AjaxResult remove(String ids) |
| | | { |
| | | configService.deleteConfigByIds(ids); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * 刷新参数缓存 |
| | | */ |
| | | @RequiresPermissions("system:config:remove") |
| | | @Log(title = "参数管理", businessType = BusinessType.CLEAN) |
| | | @GetMapping("/refreshCache") |
| | | @ResponseBody |
| | | public AjaxResult refreshCache() |
| | | { |
| | | configService.resetConfigCache(); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * 校验参数键名 |
| | | */ |
| | | @PostMapping("/checkConfigKeyUnique") |
| | | @ResponseBody |
| | | public boolean checkConfigKeyUnique(SysConfig config) |
| | | { |
| | | return configService.checkConfigKeyUnique(config); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.Ztree; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | |
| | | /** |
| | | * 部门信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/system/dept") |
| | | public class SysDeptController extends BaseController |
| | | { |
| | | private String prefix = "system/dept"; |
| | | |
| | | @Autowired |
| | | private ISysDeptService deptService; |
| | | |
| | | @RequiresPermissions("system:dept:view") |
| | | @GetMapping() |
| | | public String dept() |
| | | { |
| | | return prefix + "/dept"; |
| | | } |
| | | |
| | | @RequiresPermissions("system:dept:list") |
| | | @PostMapping("/list") |
| | | @ResponseBody |
| | | public List<SysDept> list(SysDept dept) |
| | | { |
| | | List<SysDept> deptList = deptService.selectDeptList(dept); |
| | | return deptList; |
| | | } |
| | | |
| | | /** |
| | | * 新增部门 |
| | | */ |
| | | @RequiresPermissions("system:dept:add") |
| | | @GetMapping("/add/{parentId}") |
| | | public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) |
| | | { |
| | | if (!getSysUser().isAdmin()) |
| | | { |
| | | parentId = getSysUser().getDeptId(); |
| | | } |
| | | mmap.put("dept", deptService.selectDeptById(parentId)); |
| | | return prefix + "/add"; |
| | | } |
| | | |
| | | /** |
| | | * 新增保存部门 |
| | | */ |
| | | @Log(title = "部门管理", businessType = BusinessType.INSERT) |
| | | @RequiresPermissions("system:dept:add") |
| | | @PostMapping("/add") |
| | | @ResponseBody |
| | | public AjaxResult addSave(@Validated SysDept dept) |
| | | { |
| | | if (!deptService.checkDeptNameUnique(dept)) |
| | | { |
| | | return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); |
| | | } |
| | | dept.setCreateBy(getLoginName()); |
| | | return toAjax(deptService.insertDept(dept)); |
| | | } |
| | | |
| | | /** |
| | | * 修改部门 |
| | | */ |
| | | @RequiresPermissions("system:dept:edit") |
| | | @GetMapping("/edit/{deptId}") |
| | | public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap) |
| | | { |
| | | deptService.checkDeptDataScope(deptId); |
| | | SysDept dept = deptService.selectDeptById(deptId); |
| | | if (StringUtils.isNotNull(dept) && 100L == deptId) |
| | | { |
| | | dept.setParentName("无"); |
| | | } |
| | | mmap.put("dept", dept); |
| | | return prefix + "/edit"; |
| | | } |
| | | |
| | | /** |
| | | * 修改保存部门 |
| | | */ |
| | | @Log(title = "部门管理", businessType = BusinessType.UPDATE) |
| | | @RequiresPermissions("system:dept:edit") |
| | | @PostMapping("/edit") |
| | | @ResponseBody |
| | | public AjaxResult editSave(@Validated SysDept dept) |
| | | { |
| | | Long deptId = dept.getDeptId(); |
| | | deptService.checkDeptDataScope(deptId); |
| | | if (!deptService.checkDeptNameUnique(dept)) |
| | | { |
| | | return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); |
| | | } |
| | | else if (dept.getParentId().equals(deptId)) |
| | | { |
| | | return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); |
| | | } |
| | | else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) |
| | | { |
| | | return AjaxResult.error("该部门包含未停用的子部门!"); |
| | | } |
| | | dept.setUpdateBy(getLoginName()); |
| | | return toAjax(deptService.updateDept(dept)); |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @Log(title = "部门管理", businessType = BusinessType.DELETE) |
| | | @RequiresPermissions("system:dept:remove") |
| | | @GetMapping("/remove/{deptId}") |
| | | @ResponseBody |
| | | public AjaxResult remove(@PathVariable("deptId") Long deptId) |
| | | { |
| | | if (deptService.selectDeptCount(deptId) > 0) |
| | | { |
| | | return AjaxResult.warn("存在下级部门,不允许删除"); |
| | | } |
| | | if (deptService.checkDeptExistUser(deptId)) |
| | | { |
| | | return AjaxResult.warn("部门存在用户,不允许删除"); |
| | | } |
| | | deptService.checkDeptDataScope(deptId); |
| | | return toAjax(deptService.deleteDeptById(deptId)); |
| | | } |
| | | |
| | | /** |
| | | * 校验部门名称 |
| | | */ |
| | | @PostMapping("/checkDeptNameUnique") |
| | | @ResponseBody |
| | | public boolean checkDeptNameUnique(SysDept dept) |
| | | { |
| | | return deptService.checkDeptNameUnique(dept); |
| | | } |
| | | |
| | | /** |
| | | * 选择部门树 |
| | | * |
| | | * @param deptId 部门ID |
| | | * @param excludeId 排除ID |
| | | */ |
| | | @RequiresPermissions("system:dept:list") |
| | | @GetMapping(value = { "/selectDeptTree/{deptId}", "/selectDeptTree/{deptId}/{excludeId}" }) |
| | | public String selectDeptTree(@PathVariable("deptId") Long deptId, @PathVariable(value = "excludeId", required = false) Long excludeId, ModelMap mmap) |
| | | { |
| | | mmap.put("dept", deptService.selectDeptById(deptId)); |
| | | mmap.put("excludeId", excludeId); |
| | | return prefix + "/tree"; |
| | | } |
| | | |
| | | /** |
| | | * 加载部门列表树(排除下级) |
| | | */ |
| | | @RequiresPermissions("system:dept:list") |
| | | @GetMapping("/treeData/{excludeId}") |
| | | @ResponseBody |
| | | public List<Ztree> treeDataExcludeChild(@PathVariable(value = "excludeId", required = false) Long excludeId) |
| | | { |
| | | SysDept dept = new SysDept(); |
| | | dept.setExcludeId(excludeId); |
| | | List<Ztree> ztrees = deptService.selectDeptTreeExcludeChild(dept); |
| | | return ztrees; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDictData; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.service.ISysDictDataService; |
| | | |
| | | /** |
| | | * 数据字典信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/system/dict/data") |
| | | public class SysDictDataController extends BaseController |
| | | { |
| | | private String prefix = "system/dict/data"; |
| | | |
| | | @Autowired |
| | | private ISysDictDataService dictDataService; |
| | | |
| | | @RequiresPermissions("system:dict:view") |
| | | @GetMapping() |
| | | public String dictData() |
| | | { |
| | | return prefix + "/data"; |
| | | } |
| | | |
| | | @PostMapping("/list") |
| | | @RequiresPermissions("system:dict:list") |
| | | @ResponseBody |
| | | public TableDataInfo list(SysDictData dictData) |
| | | { |
| | | startPage(); |
| | | List<SysDictData> list = dictDataService.selectDictDataList(dictData); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "字典数据", businessType = BusinessType.EXPORT) |
| | | @RequiresPermissions("system:dict:export") |
| | | @PostMapping("/export") |
| | | @ResponseBody |
| | | public AjaxResult export(SysDictData dictData) |
| | | { |
| | | List<SysDictData> list = dictDataService.selectDictDataList(dictData); |
| | | ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class); |
| | | return util.exportExcel(list, "字典数据"); |
| | | } |
| | | |
| | | /** |
| | | * 新增字典类型 |
| | | */ |
| | | @RequiresPermissions("system:dict:add") |
| | | @GetMapping("/add/{dictType}") |
| | | public String add(@PathVariable("dictType") String dictType, ModelMap mmap) |
| | | { |
| | | mmap.put("dictType", dictType); |
| | | return prefix + "/add"; |
| | | } |
| | | |
| | | /** |
| | | * 新增保存字典类型 |
| | | */ |
| | | @Log(title = "字典数据", businessType = BusinessType.INSERT) |
| | | @RequiresPermissions("system:dict:add") |
| | | @PostMapping("/add") |
| | | @ResponseBody |
| | | public AjaxResult addSave(@Validated SysDictData dict) |
| | | { |
| | | dict.setCreateBy(getLoginName()); |
| | | return toAjax(dictDataService.insertDictData(dict)); |
| | | } |
| | | |
| | | /** |
| | | * 修改字典类型 |
| | | */ |
| | | @RequiresPermissions("system:dict:edit") |
| | | @GetMapping("/edit/{dictCode}") |
| | | public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap) |
| | | { |
| | | mmap.put("dict", dictDataService.selectDictDataById(dictCode)); |
| | | return prefix + "/edit"; |
| | | } |
| | | |
| | | /** |
| | | * 修改保存字典类型 |
| | | */ |
| | | @Log(title = "字典数据", businessType = BusinessType.UPDATE) |
| | | @RequiresPermissions("system:dict:edit") |
| | | @PostMapping("/edit") |
| | | @ResponseBody |
| | | public AjaxResult editSave(@Validated SysDictData dict) |
| | | { |
| | | dict.setUpdateBy(getLoginName()); |
| | | return toAjax(dictDataService.updateDictData(dict)); |
| | | } |
| | | |
| | | @Log(title = "字典数据", businessType = BusinessType.DELETE) |
| | | @RequiresPermissions("system:dict:remove") |
| | | @PostMapping("/remove") |
| | | @ResponseBody |
| | | public AjaxResult remove(String ids) |
| | | { |
| | | dictDataService.deleteDictDataByIds(ids); |
| | | return success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.Ztree; |
| | | import com.ruoyi.common.core.domain.entity.SysDictType; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.service.ISysDictTypeService; |
| | | |
| | | /** |
| | | * 数据字典信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/system/dict") |
| | | public class SysDictTypeController extends BaseController |
| | | { |
| | | private String prefix = "system/dict/type"; |
| | | |
| | | @Autowired |
| | | private ISysDictTypeService dictTypeService; |
| | | |
| | | @RequiresPermissions("system:dict:view") |
| | | @GetMapping() |
| | | public String dictType() |
| | | { |
| | | return prefix + "/type"; |
| | | } |
| | | |
| | | @PostMapping("/list") |
| | | @RequiresPermissions("system:dict:list") |
| | | @ResponseBody |
| | | public TableDataInfo list(SysDictType dictType) |
| | | { |
| | | startPage(); |
| | | List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "字典类型", businessType = BusinessType.EXPORT) |
| | | @RequiresPermissions("system:dict:export") |
| | | @PostMapping("/export") |
| | | @ResponseBody |
| | | public AjaxResult export(SysDictType dictType) |
| | | { |
| | | |
| | | List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); |
| | | ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class); |
| | | return util.exportExcel(list, "字典类型"); |
| | | } |
| | | |
| | | /** |
| | | * 新增字典类型 |
| | | */ |
| | | @RequiresPermissions("system:dict:add") |
| | | @GetMapping("/add") |
| | | public String add() |
| | | { |
| | | return prefix + "/add"; |
| | | } |
| | | |
| | | /** |
| | | * 新增保存字典类型 |
| | | */ |
| | | @Log(title = "字典类型", businessType = BusinessType.INSERT) |
| | | @RequiresPermissions("system:dict:add") |
| | | @PostMapping("/add") |
| | | @ResponseBody |
| | | public AjaxResult addSave(@Validated SysDictType dict) |
| | | { |
| | | if (!dictTypeService.checkDictTypeUnique(dict)) |
| | | { |
| | | return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); |
| | | } |
| | | dict.setCreateBy(getLoginName()); |
| | | return toAjax(dictTypeService.insertDictType(dict)); |
| | | } |
| | | |
| | | /** |
| | | * 修改字典类型 |
| | | */ |
| | | @RequiresPermissions("system:dict:edit") |
| | | @GetMapping("/edit/{dictId}") |
| | | public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap) |
| | | { |
| | | mmap.put("dict", dictTypeService.selectDictTypeById(dictId)); |
| | | return prefix + "/edit"; |
| | | } |
| | | |
| | | /** |
| | | * 修改保存字典类型 |
| | | */ |
| | | @Log(title = "字典类型", businessType = BusinessType.UPDATE) |
| | | @RequiresPermissions("system:dict:edit") |
| | | @PostMapping("/edit") |
| | | @ResponseBody |
| | | public AjaxResult editSave(@Validated SysDictType dict) |
| | | { |
| | | if (!dictTypeService.checkDictTypeUnique(dict)) |
| | | { |
| | | return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); |
| | | } |
| | | dict.setUpdateBy(getLoginName()); |
| | | return toAjax(dictTypeService.updateDictType(dict)); |
| | | } |
| | | |
| | | @Log(title = "字典类型", businessType = BusinessType.DELETE) |
| | | @RequiresPermissions("system:dict:remove") |
| | | @PostMapping("/remove") |
| | | @ResponseBody |
| | | public AjaxResult remove(String ids) |
| | | { |
| | | dictTypeService.deleteDictTypeByIds(ids); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * 刷新字典缓存 |
| | | */ |
| | | @RequiresPermissions("system:dict:remove") |
| | | @Log(title = "字典类型", businessType = BusinessType.CLEAN) |
| | | @GetMapping("/refreshCache") |
| | | @ResponseBody |
| | | public AjaxResult refreshCache() |
| | | { |
| | | dictTypeService.resetDictCache(); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * 查询字典详细 |
| | | */ |
| | | @RequiresPermissions("system:dict:list") |
| | | @GetMapping("/detail/{dictId}") |
| | | public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap) |
| | | { |
| | | mmap.put("dict", dictTypeService.selectDictTypeById(dictId)); |
| | | mmap.put("dictList", dictTypeService.selectDictTypeAll()); |
| | | return "system/dict/data/data"; |
| | | } |
| | | |
| | | /** |
| | | * 校验字典类型 |
| | | */ |
| | | @PostMapping("/checkDictTypeUnique") |
| | | @ResponseBody |
| | | public boolean checkDictTypeUnique(SysDictType dictType) |
| | | { |
| | | return dictTypeService.checkDictTypeUnique(dictType); |
| | | } |
| | | |
| | | /** |
| | | * 选择字典树 |
| | | */ |
| | | @GetMapping("/selectDictTree/{columnId}/{dictType}") |
| | | public String selectDeptTree(@PathVariable("columnId") Long columnId, @PathVariable("dictType") String dictType, ModelMap mmap) |
| | | { |
| | | mmap.put("columnId", columnId); |
| | | mmap.put("dict", dictTypeService.selectDictTypeByType(dictType)); |
| | | return prefix + "/tree"; |
| | | } |
| | | |
| | | /** |
| | | * 加载字典列表树 |
| | | */ |
| | | @GetMapping("/treeData") |
| | | @ResponseBody |
| | | public List<Ztree> treeData() |
| | | { |
| | | List<Ztree> ztrees = dictTypeService.selectDictTree(new SysDictType()); |
| | | return ztrees; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import javax.servlet.http.Cookie; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.constant.ShiroConstants; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysMenu; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.text.Convert; |
| | | import com.ruoyi.common.utils.CookieUtils; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.ServletUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.shiro.service.SysPasswordService; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysMenuService; |
| | | |
| | | /** |
| | | * 首页 业务处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | public class SysIndexController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysMenuService menuService; |
| | | |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | |
| | | @Autowired |
| | | private SysPasswordService passwordService; |
| | | |
| | | // 系统首页 |
| | | @GetMapping("/index") |
| | | public String index(ModelMap mmap) |
| | | { |
| | | // 取身份信息 |
| | | SysUser user = getSysUser(); |
| | | // 根据用户id取出菜单 |
| | | List<SysMenu> menus = menuService.selectMenusByUser(user); |
| | | mmap.put("menus", menus); |
| | | mmap.put("user", user); |
| | | mmap.put("sideTheme", configService.selectConfigByKey("sys.index.sideTheme")); |
| | | mmap.put("skinName", configService.selectConfigByKey("sys.index.skinName")); |
| | | Boolean footer = Convert.toBool(configService.selectConfigByKey("sys.index.footer"), true); |
| | | Boolean tagsView = Convert.toBool(configService.selectConfigByKey("sys.index.tagsView"), true); |
| | | mmap.put("footer", footer); |
| | | mmap.put("tagsView", tagsView); |
| | | mmap.put("mainClass", contentMainClass(footer, tagsView)); |
| | | mmap.put("copyrightYear", RuoYiConfig.getCopyrightYear()); |
| | | mmap.put("demoEnabled", RuoYiConfig.isDemoEnabled()); |
| | | mmap.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate())); |
| | | mmap.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate())); |
| | | mmap.put("isMobile", ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent"))); |
| | | |
| | | // 菜单导航显示风格 |
| | | String menuStyle = configService.selectConfigByKey("sys.index.menuStyle"); |
| | | // 移动端,默认使左侧导航菜单,否则取默认配置 |
| | | String indexStyle = ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent")) ? "index" : menuStyle; |
| | | |
| | | // 优先Cookie配置导航菜单 |
| | | Cookie[] cookies = ServletUtils.getRequest().getCookies(); |
| | | for (Cookie cookie : cookies) |
| | | { |
| | | if (StringUtils.isNotEmpty(cookie.getName()) && "nav-style".equalsIgnoreCase(cookie.getName())) |
| | | { |
| | | indexStyle = cookie.getValue(); |
| | | break; |
| | | } |
| | | } |
| | | String webIndex = "topnav".equalsIgnoreCase(indexStyle) ? "index-topnav" : "index"; |
| | | return webIndex; |
| | | } |
| | | |
| | | // 锁定屏幕 |
| | | @GetMapping("/lockscreen") |
| | | public String lockscreen(ModelMap mmap) |
| | | { |
| | | mmap.put("user", getSysUser()); |
| | | ServletUtils.getSession().setAttribute(ShiroConstants.LOCK_SCREEN, true); |
| | | return "lock"; |
| | | } |
| | | |
| | | // 解锁屏幕 |
| | | @PostMapping("/unlockscreen") |
| | | @ResponseBody |
| | | public AjaxResult unlockscreen(String password) |
| | | { |
| | | SysUser user = getSysUser(); |
| | | if (StringUtils.isNull(user)) |
| | | { |
| | | return AjaxResult.error("服务器超时,请重新登录"); |
| | | } |
| | | if (passwordService.matches(user, password)) |
| | | { |
| | | ServletUtils.getSession().removeAttribute(ShiroConstants.LOCK_SCREEN); |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error("密码不正确,请重新输入。"); |
| | | } |
| | | |
| | | // 切换主题 |
| | | @GetMapping("/system/switchSkin") |
| | | public String switchSkin() |
| | | { |
| | | return "skin"; |
| | | } |
| | | |
| | | // 切换菜单 |
| | | @GetMapping("/system/menuStyle/{style}") |
| | | public void menuStyle(@PathVariable String style, HttpServletResponse response) |
| | | { |
| | | CookieUtils.setCookie(response, "nav-style", style); |
| | | } |
| | | |
| | | // 系统介绍 |
| | | @GetMapping("/system/main") |
| | | public String main(ModelMap mmap) |
| | | { |
| | | mmap.put("version", RuoYiConfig.getVersion()); |
| | | return "main"; |
| | | } |
| | | |
| | | // content-main class |
| | | public String contentMainClass(Boolean footer, Boolean tagsView) |
| | | { |
| | | if (!footer && !tagsView) |
| | | { |
| | | return "tagsview-footer-hide"; |
| | | } |
| | | else if (!footer) |
| | | { |
| | | return "footer-hide"; |
| | | } |
| | | else if (!tagsView) |
| | | { |
| | | return "tagsview-hide"; |
| | | } |
| | | return StringUtils.EMPTY; |
| | | } |
| | | |
| | | // 检查初始密码是否提醒修改 |
| | | public boolean initPasswordIsModify(Date pwdUpdateDate) |
| | | { |
| | | Integer initPasswordModify = Convert.toInt(configService.selectConfigByKey("sys.account.initPasswordModify")); |
| | | return initPasswordModify != null && initPasswordModify == 1 && pwdUpdateDate == null; |
| | | } |
| | | |
| | | // 检查密码是否过期 |
| | | public boolean passwordIsExpiration(Date pwdUpdateDate) |
| | | { |
| | | Integer passwordValidateDays = Convert.toInt(configService.selectConfigByKey("sys.account.passwordValidateDays")); |
| | | if (passwordValidateDays != null && passwordValidateDays > 0) |
| | | { |
| | | if (StringUtils.isNull(pwdUpdateDate)) |
| | | { |
| | | // 如果从未修改过初始密码,直接提醒过期 |
| | | return true; |
| | | } |
| | | Date nowDate = DateUtils.getNowDate(); |
| | | return DateUtils.differentDaysByMillisecond(nowDate, pwdUpdateDate) > passwordValidateDays; |
| | | } |
| | | return false; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.authc.AuthenticationException; |
| | | import org.apache.shiro.authc.UsernamePasswordToken; |
| | | import org.apache.shiro.subject.Subject; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.text.Convert; |
| | | import com.ruoyi.common.utils.ServletUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.service.ConfigService; |
| | | |
| | | /** |
| | | * 登录验证 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | public class SysLoginController extends BaseController |
| | | { |
| | | /** |
| | | * 是否开启记住我功能 |
| | | */ |
| | | @Value("${shiro.rememberMe.enabled: false}") |
| | | private boolean rememberMe; |
| | | |
| | | @Autowired |
| | | private ConfigService configService; |
| | | |
| | | @GetMapping("/login") |
| | | public String login(HttpServletRequest request, HttpServletResponse response, ModelMap mmap) |
| | | { |
| | | // 如果是Ajax请求,返回Json字符串。 |
| | | if (ServletUtils.isAjaxRequest(request)) |
| | | { |
| | | return ServletUtils.renderString(response, "{\"code\":\"1\",\"msg\":\"未登录或登录超时。请重新登录\"}"); |
| | | } |
| | | // 是否开启记住我 |
| | | mmap.put("isRemembered", rememberMe); |
| | | // 是否开启用户注册 |
| | | mmap.put("isAllowRegister", Convert.toBool(configService.getKey("sys.account.registerUser"), false)); |
| | | return "login"; |
| | | } |
| | | |
| | | @PostMapping("/login") |
| | | @ResponseBody |
| | | public AjaxResult ajaxLogin(String username, String password, Boolean rememberMe) |
| | | { |
| | | UsernamePasswordToken token = new UsernamePasswordToken(username, password, rememberMe); |
| | | Subject subject = SecurityUtils.getSubject(); |
| | | try |
| | | { |
| | | subject.login(token); |
| | | return success(); |
| | | } |
| | | catch (AuthenticationException e) |
| | | { |
| | | String msg = "用户或密码错误"; |
| | | if (StringUtils.isNotEmpty(e.getMessage())) |
| | | { |
| | | msg = e.getMessage(); |
| | | } |
| | | return error(msg); |
| | | } |
| | | } |
| | | |
| | | @GetMapping("/unauth") |
| | | public String unauth() |
| | | { |
| | | return "error/unauth"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.Ztree; |
| | | import com.ruoyi.common.core.domain.entity.SysMenu; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.ShiroUtils; |
| | | import com.ruoyi.framework.shiro.util.AuthorizationUtils; |
| | | import com.ruoyi.system.service.ISysMenuService; |
| | | |
| | | /** |
| | | * 菜单信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/system/menu") |
| | | public class SysMenuController extends BaseController |
| | | { |
| | | private String prefix = "system/menu"; |
| | | |
| | | @Autowired |
| | | private ISysMenuService menuService; |
| | | |
| | | @RequiresPermissions("system:menu:view") |
| | | @GetMapping() |
| | | public String menu() |
| | | { |
| | | return prefix + "/menu"; |
| | | } |
| | | |
| | | @RequiresPermissions("system:menu:list") |
| | | @PostMapping("/list") |
| | | @ResponseBody |
| | | public List<SysMenu> list(SysMenu menu) |
| | | { |
| | | Long userId = ShiroUtils.getUserId(); |
| | | List<SysMenu> menuList = menuService.selectMenuList(menu, userId); |
| | | return menuList; |
| | | } |
| | | |
| | | /** |
| | | * 删除菜单 |
| | | */ |
| | | @Log(title = "菜单管理", businessType = BusinessType.DELETE) |
| | | @RequiresPermissions("system:menu:remove") |
| | | @GetMapping("/remove/{menuId}") |
| | | @ResponseBody |
| | | public AjaxResult remove(@PathVariable("menuId") Long menuId) |
| | | { |
| | | if (menuService.selectCountMenuByParentId(menuId) > 0) |
| | | { |
| | | return AjaxResult.warn("存在子菜单,不允许删除"); |
| | | } |
| | | if (menuService.selectCountRoleMenuByMenuId(menuId) > 0) |
| | | { |
| | | return AjaxResult.warn("菜单已分配,不允许删除"); |
| | | } |
| | | AuthorizationUtils.clearAllCachedAuthorizationInfo(); |
| | | return toAjax(menuService.deleteMenuById(menuId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequiresPermissions("system:menu:add") |
| | | @GetMapping("/add/{parentId}") |
| | | public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) |
| | | { |
| | | SysMenu menu = null; |
| | | if (0L != parentId) |
| | | { |
| | | menu = menuService.selectMenuById(parentId); |
| | | } |
| | | else |
| | | { |
| | | menu = new SysMenu(); |
| | | menu.setMenuId(0L); |
| | | menu.setMenuName("主目录"); |
| | | } |
| | | mmap.put("menu", menu); |
| | | return prefix + "/add"; |
| | | } |
| | | |
| | | /** |
| | | * 新增保存菜单 |
| | | */ |
| | | @Log(title = "菜单管理", businessType = BusinessType.INSERT) |
| | | @RequiresPermissions("system:menu:add") |
| | | @PostMapping("/add") |
| | | @ResponseBody |
| | | public AjaxResult addSave(@Validated SysMenu menu) |
| | | { |
| | | if (!menuService.checkMenuNameUnique(menu)) |
| | | { |
| | | return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); |
| | | } |
| | | menu.setCreateBy(getLoginName()); |
| | | AuthorizationUtils.clearAllCachedAuthorizationInfo(); |
| | | return toAjax(menuService.insertMenu(menu)); |
| | | } |
| | | |
| | | /** |
| | | * 修改菜单 |
| | | */ |
| | | @RequiresPermissions("system:menu:edit") |
| | | @GetMapping("/edit/{menuId}") |
| | | public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap) |
| | | { |
| | | mmap.put("menu", menuService.selectMenuById(menuId)); |
| | | return prefix + "/edit"; |
| | | } |
| | | |
| | | /** |
| | | * 修改保存菜单 |
| | | */ |
| | | @Log(title = "菜单管理", businessType = BusinessType.UPDATE) |
| | | @RequiresPermissions("system:menu:edit") |
| | | @PostMapping("/edit") |
| | | @ResponseBody |
| | | public AjaxResult editSave(@Validated SysMenu menu) |
| | | { |
| | | if (!menuService.checkMenuNameUnique(menu)) |
| | | { |
| | | return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); |
| | | } |
| | | menu.setUpdateBy(getLoginName()); |
| | | AuthorizationUtils.clearAllCachedAuthorizationInfo(); |
| | | return toAjax(menuService.updateMenu(menu)); |
| | | } |
| | | |
| | | /** |
| | | * 选择菜单图标 |
| | | */ |
| | | @GetMapping("/icon") |
| | | public String icon() |
| | | { |
| | | return prefix + "/icon"; |
| | | } |
| | | |
| | | /** |
| | | * 校验菜单名称 |
| | | */ |
| | | @PostMapping("/checkMenuNameUnique") |
| | | @ResponseBody |
| | | public boolean checkMenuNameUnique(SysMenu menu) |
| | | { |
| | | return menuService.checkMenuNameUnique(menu); |
| | | } |
| | | |
| | | /** |
| | | * 加载角色菜单列表树 |
| | | */ |
| | | @GetMapping("/roleMenuTreeData") |
| | | @ResponseBody |
| | | public List<Ztree> roleMenuTreeData(SysRole role) |
| | | { |
| | | Long userId = ShiroUtils.getUserId(); |
| | | List<Ztree> ztrees = menuService.roleMenuTreeData(role, userId); |
| | | return ztrees; |
| | | } |
| | | |
| | | /** |
| | | * 加载所有菜单列表树 |
| | | */ |
| | | @GetMapping("/menuTreeData") |
| | | @ResponseBody |
| | | public List<Ztree> menuTreeData() |
| | | { |
| | | Long userId = ShiroUtils.getUserId(); |
| | | List<Ztree> ztrees = menuService.menuTreeData(userId); |
| | | return ztrees; |
| | | } |
| | | |
| | | /** |
| | | * 选择菜单树 |
| | | */ |
| | | @GetMapping("/selectMenuTree/{menuId}") |
| | | public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap) |
| | | { |
| | | mmap.put("menu", menuService.selectMenuById(menuId)); |
| | | return prefix + "/tree"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.domain.SysNotice; |
| | | import com.ruoyi.system.service.ISysNoticeService; |
| | | |
| | | /** |
| | | * 公告 信息操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/system/notice") |
| | | public class SysNoticeController extends BaseController |
| | | { |
| | | private String prefix = "system/notice"; |
| | | |
| | | @Autowired |
| | | private ISysNoticeService noticeService; |
| | | |
| | | @RequiresPermissions("system:notice:view") |
| | | @GetMapping() |
| | | public String notice() |
| | | { |
| | | return prefix + "/notice"; |
| | | } |
| | | |
| | | /** |
| | | * 查询公告列表 |
| | | */ |
| | | @RequiresPermissions("system:notice:list") |
| | | @PostMapping("/list") |
| | | @ResponseBody |
| | | public TableDataInfo list(SysNotice notice) |
| | | { |
| | | startPage(); |
| | | List<SysNotice> list = noticeService.selectNoticeList(notice); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 新增公告 |
| | | */ |
| | | @RequiresPermissions("system:notice:add") |
| | | @GetMapping("/add") |
| | | public String add() |
| | | { |
| | | return prefix + "/add"; |
| | | } |
| | | |
| | | /** |
| | | * 新增保存公告 |
| | | */ |
| | | @RequiresPermissions("system:notice:add") |
| | | @Log(title = "通知公告", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | @ResponseBody |
| | | public AjaxResult addSave(@Validated SysNotice notice) |
| | | { |
| | | notice.setCreateBy(getLoginName()); |
| | | return toAjax(noticeService.insertNotice(notice)); |
| | | } |
| | | |
| | | /** |
| | | * 修改公告 |
| | | */ |
| | | @RequiresPermissions("system:notice:edit") |
| | | @GetMapping("/edit/{noticeId}") |
| | | public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap) |
| | | { |
| | | mmap.put("notice", noticeService.selectNoticeById(noticeId)); |
| | | return prefix + "/edit"; |
| | | } |
| | | |
| | | /** |
| | | * 修改保存公告 |
| | | */ |
| | | @RequiresPermissions("system:notice:edit") |
| | | @Log(title = "通知公告", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit") |
| | | @ResponseBody |
| | | public AjaxResult editSave(@Validated SysNotice notice) |
| | | { |
| | | notice.setUpdateBy(getLoginName()); |
| | | return toAjax(noticeService.updateNotice(notice)); |
| | | } |
| | | |
| | | /** |
| | | * 查询公告详细 |
| | | */ |
| | | @RequiresPermissions("system:notice:list") |
| | | @GetMapping("/view/{noticeId}") |
| | | public String view(@PathVariable("noticeId") Long noticeId, ModelMap mmap) |
| | | { |
| | | mmap.put("notice", noticeService.selectNoticeById(noticeId)); |
| | | return prefix + "/view"; |
| | | } |
| | | |
| | | /** |
| | | * 删除公告 |
| | | */ |
| | | @RequiresPermissions("system:notice:remove") |
| | | @Log(title = "通知公告", businessType = BusinessType.DELETE) |
| | | @PostMapping("/remove") |
| | | @ResponseBody |
| | | public AjaxResult remove(String ids) |
| | | { |
| | | return toAjax(noticeService.deleteNoticeByIds(ids)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.domain.SysPost; |
| | | import com.ruoyi.system.service.ISysPostService; |
| | | |
| | | /** |
| | | * 岗位信息操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/system/post") |
| | | public class SysPostController extends BaseController |
| | | { |
| | | private String prefix = "system/post"; |
| | | |
| | | @Autowired |
| | | private ISysPostService postService; |
| | | |
| | | @RequiresPermissions("system:post:view") |
| | | @GetMapping() |
| | | public String operlog() |
| | | { |
| | | return prefix + "/post"; |
| | | } |
| | | |
| | | @RequiresPermissions("system:post:list") |
| | | @PostMapping("/list") |
| | | @ResponseBody |
| | | public TableDataInfo list(SysPost post) |
| | | { |
| | | startPage(); |
| | | List<SysPost> list = postService.selectPostList(post); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "岗位管理", businessType = BusinessType.EXPORT) |
| | | @RequiresPermissions("system:post:export") |
| | | @PostMapping("/export") |
| | | @ResponseBody |
| | | public AjaxResult export(SysPost post) |
| | | { |
| | | List<SysPost> list = postService.selectPostList(post); |
| | | ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class); |
| | | return util.exportExcel(list, "岗位数据"); |
| | | } |
| | | |
| | | @RequiresPermissions("system:post:remove") |
| | | @Log(title = "岗位管理", businessType = BusinessType.DELETE) |
| | | @PostMapping("/remove") |
| | | @ResponseBody |
| | | public AjaxResult remove(String ids) |
| | | { |
| | | return toAjax(postService.deletePostByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | * 新增岗位 |
| | | */ |
| | | @RequiresPermissions("system:post:add") |
| | | @GetMapping("/add") |
| | | public String add() |
| | | { |
| | | return prefix + "/add"; |
| | | } |
| | | |
| | | /** |
| | | * 新增保存岗位 |
| | | */ |
| | | @RequiresPermissions("system:post:add") |
| | | @Log(title = "岗位管理", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | @ResponseBody |
| | | public AjaxResult addSave(@Validated SysPost post) |
| | | { |
| | | if (!postService.checkPostNameUnique(post)) |
| | | { |
| | | return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); |
| | | } |
| | | else if (!postService.checkPostCodeUnique(post)) |
| | | { |
| | | return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); |
| | | } |
| | | post.setCreateBy(getLoginName()); |
| | | return toAjax(postService.insertPost(post)); |
| | | } |
| | | |
| | | /** |
| | | * 修改岗位 |
| | | */ |
| | | @RequiresPermissions("system:post:edit") |
| | | @GetMapping("/edit/{postId}") |
| | | public String edit(@PathVariable("postId") Long postId, ModelMap mmap) |
| | | { |
| | | mmap.put("post", postService.selectPostById(postId)); |
| | | return prefix + "/edit"; |
| | | } |
| | | |
| | | /** |
| | | * 修改保存岗位 |
| | | */ |
| | | @RequiresPermissions("system:post:edit") |
| | | @Log(title = "岗位管理", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit") |
| | | @ResponseBody |
| | | public AjaxResult editSave(@Validated SysPost post) |
| | | { |
| | | if (!postService.checkPostNameUnique(post)) |
| | | { |
| | | return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); |
| | | } |
| | | else if (!postService.checkPostCodeUnique(post)) |
| | | { |
| | | return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); |
| | | } |
| | | post.setUpdateBy(getLoginName()); |
| | | return toAjax(postService.updatePost(post)); |
| | | } |
| | | |
| | | /** |
| | | * 校验岗位名称 |
| | | */ |
| | | @PostMapping("/checkPostNameUnique") |
| | | @ResponseBody |
| | | public boolean checkPostNameUnique(SysPost post) |
| | | { |
| | | return postService.checkPostNameUnique(post); |
| | | } |
| | | |
| | | /** |
| | | * 校验岗位编码 |
| | | */ |
| | | @PostMapping("/checkPostCodeUnique") |
| | | @ResponseBody |
| | | public boolean checkPostCodeUnique(SysPost post) |
| | | { |
| | | return postService.checkPostCodeUnique(post); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.ShiroUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.file.FileUploadUtils; |
| | | import com.ruoyi.common.utils.file.MimeTypeUtils; |
| | | import com.ruoyi.framework.shiro.service.SysPasswordService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | |
| | | /** |
| | | * 个人信息 业务处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/system/user/profile") |
| | | public class SysProfileController extends BaseController |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(SysProfileController.class); |
| | | |
| | | private String prefix = "system/user/profile"; |
| | | |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | @Autowired |
| | | private SysPasswordService passwordService; |
| | | |
| | | /** |
| | | * 个人信息 |
| | | */ |
| | | @GetMapping() |
| | | public String profile(ModelMap mmap) |
| | | { |
| | | SysUser user = getSysUser(); |
| | | mmap.put("user", user); |
| | | mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId())); |
| | | mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId())); |
| | | return prefix + "/profile"; |
| | | } |
| | | |
| | | @GetMapping("/checkPassword") |
| | | @ResponseBody |
| | | public boolean checkPassword(String password) |
| | | { |
| | | SysUser user = getSysUser(); |
| | | return passwordService.matches(user, password); |
| | | } |
| | | |
| | | @GetMapping("/resetPwd") |
| | | public String resetPwd(ModelMap mmap) |
| | | { |
| | | SysUser user = getSysUser(); |
| | | mmap.put("user", userService.selectUserById(user.getUserId())); |
| | | return prefix + "/resetPwd"; |
| | | } |
| | | |
| | | @Log(title = "重置密码", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/resetPwd") |
| | | @ResponseBody |
| | | public AjaxResult resetPwd(String oldPassword, String newPassword) |
| | | { |
| | | SysUser user = getSysUser(); |
| | | if (!passwordService.matches(user, oldPassword)) |
| | | { |
| | | return error("修改密码失败,旧密码错误"); |
| | | } |
| | | if (passwordService.matches(user, newPassword)) |
| | | { |
| | | return error("新密码不能与旧密码相同"); |
| | | } |
| | | user.setSalt(ShiroUtils.randomSalt()); |
| | | user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt())); |
| | | user.setPwdUpdateDate(DateUtils.getNowDate()); |
| | | if (userService.resetUserPwd(user) > 0) |
| | | { |
| | | setSysUser(userService.selectUserById(user.getUserId())); |
| | | return success(); |
| | | } |
| | | return error("修改密码异常,请联系管理员"); |
| | | } |
| | | |
| | | /** |
| | | * 修改用户 |
| | | */ |
| | | @GetMapping("/edit") |
| | | public String edit(ModelMap mmap) |
| | | { |
| | | SysUser user = getSysUser(); |
| | | mmap.put("user", userService.selectUserById(user.getUserId())); |
| | | return prefix + "/edit"; |
| | | } |
| | | |
| | | /** |
| | | * 修改头像 |
| | | */ |
| | | @GetMapping("/avatar") |
| | | public String avatar(ModelMap mmap) |
| | | { |
| | | SysUser user = getSysUser(); |
| | | mmap.put("user", userService.selectUserById(user.getUserId())); |
| | | return prefix + "/avatar"; |
| | | } |
| | | |
| | | /** |
| | | * 修改用户 |
| | | */ |
| | | @Log(title = "个人信息", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/update") |
| | | @ResponseBody |
| | | public AjaxResult update(SysUser user) |
| | | { |
| | | SysUser currentUser = getSysUser(); |
| | | currentUser.setUserName(user.getUserName()); |
| | | currentUser.setEmail(user.getEmail()); |
| | | currentUser.setPhonenumber(user.getPhonenumber()); |
| | | currentUser.setSex(user.getSex()); |
| | | if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser)) |
| | | { |
| | | return error("修改用户'" + currentUser.getLoginName() + "'失败,手机号码已存在"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser)) |
| | | { |
| | | return error("修改用户'" + currentUser.getLoginName() + "'失败,邮箱账号已存在"); |
| | | } |
| | | if (userService.updateUserInfo(currentUser) > 0) |
| | | { |
| | | setSysUser(userService.selectUserById(currentUser.getUserId())); |
| | | return success(); |
| | | } |
| | | return error(); |
| | | } |
| | | |
| | | /** |
| | | * 保存头像 |
| | | */ |
| | | @Log(title = "个人信息", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/updateAvatar") |
| | | @ResponseBody |
| | | public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file) |
| | | { |
| | | SysUser currentUser = getSysUser(); |
| | | try |
| | | { |
| | | if (!file.isEmpty()) |
| | | { |
| | | String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION); |
| | | currentUser.setAvatar(avatar); |
| | | if (userService.updateUserInfo(currentUser) > 0) |
| | | { |
| | | setSysUser(userService.selectUserById(currentUser.getUserId())); |
| | | return success(); |
| | | } |
| | | } |
| | | return error(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("修改头像失败!", e); |
| | | return error(e.getMessage()); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.shiro.service.SysRegisterService; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | |
| | | /** |
| | | * 注册验证 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | public class SysRegisterController extends BaseController |
| | | { |
| | | @Autowired |
| | | private SysRegisterService registerService; |
| | | |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | |
| | | @GetMapping("/register") |
| | | public String register() |
| | | { |
| | | return "register"; |
| | | } |
| | | |
| | | @PostMapping("/register") |
| | | @ResponseBody |
| | | public AjaxResult ajaxRegister(SysUser user) |
| | | { |
| | | if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) |
| | | { |
| | | return error("当前系统没有开启注册功能!"); |
| | | } |
| | | String msg = registerService.register(user); |
| | | return StringUtils.isEmpty(msg) ? success() : error(msg); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.Ztree; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.shiro.util.AuthorizationUtils; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | |
| | | /** |
| | | * 角色信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/system/role") |
| | | public class SysRoleController extends BaseController |
| | | { |
| | | private String prefix = "system/role"; |
| | | |
| | | @Autowired |
| | | private ISysRoleService roleService; |
| | | |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | @Autowired |
| | | private ISysDeptService deptService; |
| | | |
| | | @RequiresPermissions("system:role:view") |
| | | @GetMapping() |
| | | public String role() |
| | | { |
| | | return prefix + "/role"; |
| | | } |
| | | |
| | | @RequiresPermissions("system:role:list") |
| | | @PostMapping("/list") |
| | | @ResponseBody |
| | | public TableDataInfo list(SysRole role) |
| | | { |
| | | startPage(); |
| | | List<SysRole> list = roleService.selectRoleList(role); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "角色管理", businessType = BusinessType.EXPORT) |
| | | @RequiresPermissions("system:role:export") |
| | | @PostMapping("/export") |
| | | @ResponseBody |
| | | public AjaxResult export(SysRole role) |
| | | { |
| | | List<SysRole> list = roleService.selectRoleList(role); |
| | | ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class); |
| | | return util.exportExcel(list, "角色数据"); |
| | | } |
| | | |
| | | /** |
| | | * 新增角色 |
| | | */ |
| | | @RequiresPermissions("system:role:add") |
| | | @GetMapping("/add") |
| | | public String add() |
| | | { |
| | | return prefix + "/add"; |
| | | } |
| | | |
| | | /** |
| | | * 新增保存角色 |
| | | */ |
| | | @RequiresPermissions("system:role:add") |
| | | @Log(title = "角色管理", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | @ResponseBody |
| | | public AjaxResult addSave(@Validated SysRole role) |
| | | { |
| | | if (!roleService.checkRoleNameUnique(role)) |
| | | { |
| | | return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); |
| | | } |
| | | else if (!roleService.checkRoleKeyUnique(role)) |
| | | { |
| | | return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); |
| | | } |
| | | role.setCreateBy(getLoginName()); |
| | | AuthorizationUtils.clearAllCachedAuthorizationInfo(); |
| | | return toAjax(roleService.insertRole(role)); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 修改角色 |
| | | */ |
| | | @RequiresPermissions("system:role:edit") |
| | | @GetMapping("/edit/{roleId}") |
| | | public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap) |
| | | { |
| | | roleService.checkRoleDataScope(roleId); |
| | | mmap.put("role", roleService.selectRoleById(roleId)); |
| | | return prefix + "/edit"; |
| | | } |
| | | |
| | | /** |
| | | * 修改保存角色 |
| | | */ |
| | | @RequiresPermissions("system:role:edit") |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit") |
| | | @ResponseBody |
| | | public AjaxResult editSave(@Validated SysRole role) |
| | | { |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | if (!roleService.checkRoleNameUnique(role)) |
| | | { |
| | | return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); |
| | | } |
| | | else if (!roleService.checkRoleKeyUnique(role)) |
| | | { |
| | | return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); |
| | | } |
| | | role.setUpdateBy(getLoginName()); |
| | | AuthorizationUtils.clearAllCachedAuthorizationInfo(); |
| | | return toAjax(roleService.updateRole(role)); |
| | | } |
| | | |
| | | /** |
| | | * 角色分配数据权限 |
| | | */ |
| | | @GetMapping("/authDataScope/{roleId}") |
| | | public String authDataScope(@PathVariable("roleId") Long roleId, ModelMap mmap) |
| | | { |
| | | mmap.put("role", roleService.selectRoleById(roleId)); |
| | | return prefix + "/dataScope"; |
| | | } |
| | | |
| | | /** |
| | | * 保存角色分配数据权限 |
| | | */ |
| | | @RequiresPermissions("system:role:edit") |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/authDataScope") |
| | | @ResponseBody |
| | | public AjaxResult authDataScopeSave(SysRole role) |
| | | { |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | role.setUpdateBy(getLoginName()); |
| | | if (roleService.authDataScope(role) > 0) |
| | | { |
| | | setSysUser(userService.selectUserById(getUserId())); |
| | | return success(); |
| | | } |
| | | return error(); |
| | | } |
| | | |
| | | @RequiresPermissions("system:role:remove") |
| | | @Log(title = "角色管理", businessType = BusinessType.DELETE) |
| | | @PostMapping("/remove") |
| | | @ResponseBody |
| | | public AjaxResult remove(String ids) |
| | | { |
| | | return toAjax(roleService.deleteRoleByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | * 校验角色名称 |
| | | */ |
| | | @PostMapping("/checkRoleNameUnique") |
| | | @ResponseBody |
| | | public boolean checkRoleNameUnique(SysRole role) |
| | | { |
| | | return roleService.checkRoleNameUnique(role); |
| | | } |
| | | |
| | | /** |
| | | * 校验角色权限 |
| | | */ |
| | | @PostMapping("/checkRoleKeyUnique") |
| | | @ResponseBody |
| | | public boolean checkRoleKeyUnique(SysRole role) |
| | | { |
| | | return roleService.checkRoleKeyUnique(role); |
| | | } |
| | | |
| | | /** |
| | | * 选择菜单树 |
| | | */ |
| | | @GetMapping("/selectMenuTree") |
| | | public String selectMenuTree() |
| | | { |
| | | return prefix + "/tree"; |
| | | } |
| | | |
| | | /** |
| | | * 角色状态修改 |
| | | */ |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @RequiresPermissions("system:role:edit") |
| | | @PostMapping("/changeStatus") |
| | | @ResponseBody |
| | | public AjaxResult changeStatus(SysRole role) |
| | | { |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | return toAjax(roleService.changeStatus(role)); |
| | | } |
| | | |
| | | /** |
| | | * 分配用户 |
| | | */ |
| | | @RequiresPermissions("system:role:edit") |
| | | @GetMapping("/authUser/{roleId}") |
| | | public String authUser(@PathVariable("roleId") Long roleId, ModelMap mmap) |
| | | { |
| | | mmap.put("role", roleService.selectRoleById(roleId)); |
| | | return prefix + "/authUser"; |
| | | } |
| | | |
| | | /** |
| | | * 查询已分配用户角色列表 |
| | | */ |
| | | @RequiresPermissions("system:role:list") |
| | | @PostMapping("/authUser/allocatedList") |
| | | @ResponseBody |
| | | public TableDataInfo allocatedList(SysUser user) |
| | | { |
| | | startPage(); |
| | | List<SysUser> list = userService.selectAllocatedList(user); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 取消授权 |
| | | */ |
| | | @RequiresPermissions("system:role:edit") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PostMapping("/authUser/cancel") |
| | | @ResponseBody |
| | | public AjaxResult cancelAuthUser(SysUserRole userRole) |
| | | { |
| | | return toAjax(roleService.deleteAuthUser(userRole)); |
| | | } |
| | | |
| | | /** |
| | | * 批量取消授权 |
| | | */ |
| | | @RequiresPermissions("system:role:edit") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PostMapping("/authUser/cancelAll") |
| | | @ResponseBody |
| | | public AjaxResult cancelAuthUserAll(Long roleId, String userIds) |
| | | { |
| | | return toAjax(roleService.deleteAuthUsers(roleId, userIds)); |
| | | } |
| | | |
| | | /** |
| | | * 选择用户 |
| | | */ |
| | | @RequiresPermissions("system:role:list") |
| | | @GetMapping("/authUser/selectUser/{roleId}") |
| | | public String selectUser(@PathVariable("roleId") Long roleId, ModelMap mmap) |
| | | { |
| | | mmap.put("role", roleService.selectRoleById(roleId)); |
| | | return prefix + "/selectUser"; |
| | | } |
| | | |
| | | /** |
| | | * 查询未分配用户角色列表 |
| | | */ |
| | | @RequiresPermissions("system:role:list") |
| | | @PostMapping("/authUser/unallocatedList") |
| | | @ResponseBody |
| | | public TableDataInfo unallocatedList(SysUser user) |
| | | { |
| | | startPage(); |
| | | List<SysUser> list = userService.selectUnallocatedList(user); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 批量选择用户授权 |
| | | */ |
| | | @RequiresPermissions("system:role:edit") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PostMapping("/authUser/selectAll") |
| | | @ResponseBody |
| | | public AjaxResult selectAuthUserAll(Long roleId, String userIds) |
| | | { |
| | | roleService.checkRoleDataScope(roleId); |
| | | return toAjax(roleService.insertAuthUsers(roleId, userIds)); |
| | | } |
| | | |
| | | /** |
| | | * 加载角色部门(数据权限)列表树 |
| | | */ |
| | | @RequiresPermissions("system:role:edit") |
| | | @GetMapping("/deptTreeData") |
| | | @ResponseBody |
| | | public List<Ztree> deptTreeData(SysRole role) |
| | | { |
| | | List<Ztree> ztrees = deptService.roleDeptTreeData(role); |
| | | return ztrees; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.Ztree; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.core.text.Convert; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.ShiroUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.shiro.service.SysPasswordService; |
| | | import com.ruoyi.framework.shiro.util.AuthorizationUtils; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import com.ruoyi.system.service.ISysPostService; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | |
| | | /** |
| | | * 用户信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/system/user") |
| | | public class SysUserController extends BaseController |
| | | { |
| | | private String prefix = "system/user"; |
| | | |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | @Autowired |
| | | private ISysRoleService roleService; |
| | | |
| | | @Autowired |
| | | private ISysDeptService deptService; |
| | | |
| | | @Autowired |
| | | private ISysPostService postService; |
| | | |
| | | @Autowired |
| | | private SysPasswordService passwordService; |
| | | |
| | | @RequiresPermissions("system:user:view") |
| | | @GetMapping() |
| | | public String user() |
| | | { |
| | | return prefix + "/user"; |
| | | } |
| | | |
| | | @RequiresPermissions("system:user:list") |
| | | @PostMapping("/list") |
| | | @ResponseBody |
| | | public TableDataInfo list(SysUser user) |
| | | { |
| | | startPage(); |
| | | List<SysUser> list = userService.selectUserList(user); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "用户管理", businessType = BusinessType.EXPORT) |
| | | @RequiresPermissions("system:user:export") |
| | | @PostMapping("/export") |
| | | @ResponseBody |
| | | public AjaxResult export(SysUser user) |
| | | { |
| | | List<SysUser> list = userService.selectUserList(user); |
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); |
| | | return util.exportExcel(list, "用户数据"); |
| | | } |
| | | |
| | | @Log(title = "用户管理", businessType = BusinessType.IMPORT) |
| | | @RequiresPermissions("system:user:import") |
| | | @PostMapping("/importData") |
| | | @ResponseBody |
| | | public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception |
| | | { |
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); |
| | | List<SysUser> userList = util.importExcel(file.getInputStream()); |
| | | String message = userService.importUser(userList, updateSupport, getLoginName()); |
| | | return AjaxResult.success(message); |
| | | } |
| | | |
| | | @RequiresPermissions("system:user:view") |
| | | @GetMapping("/importTemplate") |
| | | @ResponseBody |
| | | public AjaxResult importTemplate() |
| | | { |
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); |
| | | return util.importTemplateExcel("用户数据"); |
| | | } |
| | | |
| | | /** |
| | | * 新增用户 |
| | | */ |
| | | @RequiresPermissions("system:user:add") |
| | | @GetMapping("/add") |
| | | public String add(ModelMap mmap) |
| | | { |
| | | mmap.put("roles", roleService.selectRoleAll().stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |
| | | mmap.put("posts", postService.selectPostAll()); |
| | | return prefix + "/add"; |
| | | } |
| | | |
| | | /** |
| | | * 新增保存用户 |
| | | */ |
| | | @RequiresPermissions("system:user:add") |
| | | @Log(title = "用户管理", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | @ResponseBody |
| | | public AjaxResult addSave(@Validated SysUser user) |
| | | { |
| | | deptService.checkDeptDataScope(user.getDeptId()); |
| | | roleService.checkRoleDataScope(user.getRoleIds()); |
| | | if (!userService.checkLoginNameUnique(user)) |
| | | { |
| | | return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) |
| | | { |
| | | return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) |
| | | { |
| | | return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在"); |
| | | } |
| | | user.setSalt(ShiroUtils.randomSalt()); |
| | | user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt())); |
| | | user.setPwdUpdateDate(DateUtils.getNowDate()); |
| | | user.setCreateBy(getLoginName()); |
| | | return toAjax(userService.insertUser(user)); |
| | | } |
| | | |
| | | /** |
| | | * 修改用户 |
| | | */ |
| | | @RequiresPermissions("system:user:edit") |
| | | @GetMapping("/edit/{userId}") |
| | | public String edit(@PathVariable("userId") Long userId, ModelMap mmap) |
| | | { |
| | | userService.checkUserDataScope(userId); |
| | | List<SysRole> roles = roleService.selectRolesByUserId(userId); |
| | | mmap.put("user", userService.selectUserById(userId)); |
| | | mmap.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |
| | | mmap.put("posts", postService.selectPostsByUserId(userId)); |
| | | return prefix + "/edit"; |
| | | } |
| | | |
| | | /** |
| | | * 查询用户详细 |
| | | */ |
| | | @RequiresPermissions("system:user:list") |
| | | @GetMapping("/view/{userId}") |
| | | public String view(@PathVariable("userId") Long userId, ModelMap mmap) |
| | | { |
| | | userService.checkUserDataScope(userId); |
| | | mmap.put("user", userService.selectUserById(userId)); |
| | | mmap.put("roleGroup", userService.selectUserRoleGroup(userId)); |
| | | mmap.put("postGroup", userService.selectUserPostGroup(userId)); |
| | | return prefix + "/view"; |
| | | } |
| | | |
| | | /** |
| | | * 修改保存用户 |
| | | */ |
| | | @RequiresPermissions("system:user:edit") |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit") |
| | | @ResponseBody |
| | | public AjaxResult editSave(@Validated SysUser user) |
| | | { |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(user.getUserId()); |
| | | deptService.checkDeptDataScope(user.getDeptId()); |
| | | roleService.checkRoleDataScope(user.getRoleIds()); |
| | | if (!userService.checkLoginNameUnique(user)) |
| | | { |
| | | return error("修改用户'" + user.getLoginName() + "'失败,登录账号已存在"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) |
| | | { |
| | | return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) |
| | | { |
| | | return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在"); |
| | | } |
| | | user.setUpdateBy(getLoginName()); |
| | | AuthorizationUtils.clearAllCachedAuthorizationInfo(); |
| | | return toAjax(userService.updateUser(user)); |
| | | } |
| | | |
| | | @RequiresPermissions("system:user:resetPwd") |
| | | @GetMapping("/resetPwd/{userId}") |
| | | public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap) |
| | | { |
| | | mmap.put("user", userService.selectUserById(userId)); |
| | | return prefix + "/resetPwd"; |
| | | } |
| | | |
| | | @RequiresPermissions("system:user:resetPwd") |
| | | @Log(title = "重置密码", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/resetPwd") |
| | | @ResponseBody |
| | | public AjaxResult resetPwdSave(SysUser user) |
| | | { |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(user.getUserId()); |
| | | user.setSalt(ShiroUtils.randomSalt()); |
| | | user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt())); |
| | | if (userService.resetUserPwd(user) > 0) |
| | | { |
| | | if (ShiroUtils.getUserId().longValue() == user.getUserId().longValue()) |
| | | { |
| | | setSysUser(userService.selectUserById(user.getUserId())); |
| | | } |
| | | return success(); |
| | | } |
| | | return error(); |
| | | } |
| | | |
| | | /** |
| | | * 进入授权角色页 |
| | | */ |
| | | @RequiresPermissions("system:user:edit") |
| | | @GetMapping("/authRole/{userId}") |
| | | public String authRole(@PathVariable("userId") Long userId, ModelMap mmap) |
| | | { |
| | | SysUser user = userService.selectUserById(userId); |
| | | // 获取用户所属的角色列表 |
| | | List<SysRole> roles = roleService.selectRolesByUserId(userId); |
| | | mmap.put("user", user); |
| | | mmap.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |
| | | return prefix + "/authRole"; |
| | | } |
| | | |
| | | /** |
| | | * 用户授权角色 |
| | | */ |
| | | @RequiresPermissions("system:user:edit") |
| | | @Log(title = "用户管理", businessType = BusinessType.GRANT) |
| | | @PostMapping("/authRole/insertAuthRole") |
| | | @ResponseBody |
| | | public AjaxResult insertAuthRole(Long userId, Long[] roleIds) |
| | | { |
| | | userService.checkUserDataScope(userId); |
| | | roleService.checkRoleDataScope(roleIds); |
| | | userService.insertUserAuth(userId, roleIds); |
| | | AuthorizationUtils.clearAllCachedAuthorizationInfo(); |
| | | return success(); |
| | | } |
| | | |
| | | @RequiresPermissions("system:user:remove") |
| | | @Log(title = "用户管理", businessType = BusinessType.DELETE) |
| | | @PostMapping("/remove") |
| | | @ResponseBody |
| | | public AjaxResult remove(String ids) |
| | | { |
| | | if (ArrayUtils.contains(Convert.toLongArray(ids), getUserId())) |
| | | { |
| | | return error("当前用户不能删除"); |
| | | } |
| | | return toAjax(userService.deleteUserByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | * 校验用户名 |
| | | */ |
| | | @PostMapping("/checkLoginNameUnique") |
| | | @ResponseBody |
| | | public boolean checkLoginNameUnique(SysUser user) |
| | | { |
| | | return userService.checkLoginNameUnique(user); |
| | | } |
| | | |
| | | /** |
| | | * 校验手机号码 |
| | | */ |
| | | @PostMapping("/checkPhoneUnique") |
| | | @ResponseBody |
| | | public boolean checkPhoneUnique(SysUser user) |
| | | { |
| | | return userService.checkPhoneUnique(user); |
| | | } |
| | | |
| | | /** |
| | | * 校验email邮箱 |
| | | */ |
| | | @PostMapping("/checkEmailUnique") |
| | | @ResponseBody |
| | | public boolean checkEmailUnique(SysUser user) |
| | | { |
| | | return userService.checkEmailUnique(user); |
| | | } |
| | | |
| | | /** |
| | | * 用户状态修改 |
| | | */ |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @RequiresPermissions("system:user:edit") |
| | | @PostMapping("/changeStatus") |
| | | @ResponseBody |
| | | public AjaxResult changeStatus(SysUser user) |
| | | { |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(user.getUserId()); |
| | | return toAjax(userService.changeStatus(user)); |
| | | } |
| | | |
| | | /** |
| | | * 加载部门列表树 |
| | | */ |
| | | @RequiresPermissions("system:user:list") |
| | | @GetMapping("/deptTreeData") |
| | | @ResponseBody |
| | | public List<Ztree> deptTreeData() |
| | | { |
| | | List<Ztree> ztrees = deptService.selectDeptTree(new SysDept()); |
| | | return ztrees; |
| | | } |
| | | |
| | | /** |
| | | * 选择部门树 |
| | | * |
| | | * @param deptId 部门ID |
| | | */ |
| | | @RequiresPermissions("system:user:list") |
| | | @GetMapping("/selectDeptTree/{deptId}") |
| | | public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap) |
| | | { |
| | | mmap.put("dept", deptService.selectDeptById(deptId)); |
| | | return prefix + "/deptTree"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | |
| | | /** |
| | | * build 表单构建 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tool/build") |
| | | public class BuildController extends BaseController |
| | | { |
| | | private String prefix = "tool/build"; |
| | | |
| | | @RequiresPermissions("tool:build:view") |
| | | @GetMapping() |
| | | public String build() |
| | | { |
| | | return prefix + "/build"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | |
| | | /** |
| | | * swagger 接口 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tool/swagger") |
| | | public class SwaggerController extends BaseController |
| | | { |
| | | @RequiresPermissions("tool:swagger:view") |
| | | @GetMapping() |
| | | public String index() |
| | | { |
| | | return redirect("/swagger-ui/index.html"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | /** |
| | | * swagger 用户测试方法 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Api("用户信息管理") |
| | | @RestController |
| | | @RequestMapping("/test/user") |
| | | public class TestController extends BaseController |
| | | { |
| | | private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>(); |
| | | { |
| | | users.put(1, new UserEntity(1, "admin", "admin123", "15888888888")); |
| | | users.put(2, new UserEntity(2, "ry", "admin123", "15666666666")); |
| | | } |
| | | |
| | | @ApiOperation("获取用户列表") |
| | | @GetMapping("/list") |
| | | public R<List<UserEntity>> userList() |
| | | { |
| | | List<UserEntity> userList = new ArrayList<UserEntity>(users.values()); |
| | | return R.ok(userList); |
| | | } |
| | | |
| | | @ApiOperation("获取用户详细") |
| | | @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class) |
| | | @GetMapping("/{userId}") |
| | | public R<UserEntity> getUser(@PathVariable Integer userId) |
| | | { |
| | | if (!users.isEmpty() && users.containsKey(userId)) |
| | | { |
| | | return R.ok(users.get(userId)); |
| | | } |
| | | else |
| | | { |
| | | return R.fail("用户不存在"); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("新增用户") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class) |
| | | }) |
| | | @PostMapping("/save") |
| | | public R<String> save(UserEntity user) |
| | | { |
| | | if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) |
| | | { |
| | | return R.fail("用户ID不能为空"); |
| | | } |
| | | users.put(user.getUserId(), user); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation("更新用户") |
| | | @PutMapping("/update") |
| | | public R<String> update(@RequestBody UserEntity user) |
| | | { |
| | | if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) |
| | | { |
| | | return R.fail("用户ID不能为空"); |
| | | } |
| | | if (users.isEmpty() || !users.containsKey(user.getUserId())) |
| | | { |
| | | return R.fail("用户不存在"); |
| | | } |
| | | users.remove(user.getUserId()); |
| | | users.put(user.getUserId(), user); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation("删除用户信息") |
| | | @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class) |
| | | @DeleteMapping("/{userId}") |
| | | public R<String> delete(@PathVariable Integer userId) |
| | | { |
| | | if (!users.isEmpty() && users.containsKey(userId)) |
| | | { |
| | | users.remove(userId); |
| | | return R.ok(); |
| | | } |
| | | else |
| | | { |
| | | return R.fail("用户不存在"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @ApiModel(value = "UserEntity", description = "用户实体") |
| | | class UserEntity |
| | | { |
| | | @ApiModelProperty("用户ID") |
| | | private Integer userId; |
| | | |
| | | @ApiModelProperty("用户名称") |
| | | private String username; |
| | | |
| | | @ApiModelProperty("用户密码") |
| | | private String password; |
| | | |
| | | @ApiModelProperty("用户手机") |
| | | private String mobile; |
| | | |
| | | public UserEntity() |
| | | { |
| | | |
| | | } |
| | | |
| | | public UserEntity(Integer userId, String username, String password, String mobile) |
| | | { |
| | | this.userId = userId; |
| | | this.username = username; |
| | | this.password = password; |
| | | this.mobile = mobile; |
| | | } |
| | | |
| | | public Integer getUserId() |
| | | { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) |
| | | { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getUsername() |
| | | { |
| | | return username; |
| | | } |
| | | |
| | | public void setUsername(String username) |
| | | { |
| | | this.username = username; |
| | | } |
| | | |
| | | public String getPassword() |
| | | { |
| | | return password; |
| | | } |
| | | |
| | | public void setPassword(String password) |
| | | { |
| | | this.password = password; |
| | | } |
| | | |
| | | public String getMobile() |
| | | { |
| | | return mobile; |
| | | } |
| | | |
| | | public void setMobile(String mobile) |
| | | { |
| | | this.mobile = mobile; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.core.config; |
| | | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import springfox.documentation.builders.ApiInfoBuilder; |
| | | import springfox.documentation.builders.PathSelectors; |
| | | import springfox.documentation.builders.RequestHandlerSelectors; |
| | | import springfox.documentation.service.ApiInfo; |
| | | import springfox.documentation.service.Contact; |
| | | import springfox.documentation.spi.DocumentationType; |
| | | import springfox.documentation.spring.web.plugins.Docket; |
| | | |
| | | /** |
| | | * Swagger2的接口配置 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Configuration |
| | | public class SwaggerConfig |
| | | { |
| | | /** 是否开启swagger */ |
| | | @Value("${swagger.enabled}") |
| | | private boolean enabled; |
| | | |
| | | /** |
| | | * 创建API |
| | | */ |
| | | @Bean |
| | | public Docket createRestApi() |
| | | { |
| | | return new Docket(DocumentationType.OAS_30) |
| | | // 是否启用Swagger |
| | | .enable(enabled) |
| | | // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) |
| | | .apiInfo(apiInfo()) |
| | | // 设置哪些接口暴露给Swagger展示 |
| | | .select() |
| | | // 扫描所有有注解的api,用这种方式更灵活 |
| | | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) |
| | | // 扫描指定包中的swagger注解 |
| | | //.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger")) |
| | | // 扫描所有 .apis(RequestHandlerSelectors.any()) |
| | | .paths(PathSelectors.any()) |
| | | .build(); |
| | | } |
| | | |
| | | /** |
| | | * 添加摘要信息 |
| | | */ |
| | | private ApiInfo apiInfo() |
| | | { |
| | | // 用ApiInfoBuilder进行定制 |
| | | return new ApiInfoBuilder() |
| | | // 设置标题 |
| | | .title("标题:若依管理系统_接口文档") |
| | | // 描述 |
| | | .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...") |
| | | // 作者信息 |
| | | .contact(new Contact(RuoYiConfig.getName(), null, null)) |
| | | // 版本 |
| | | .version("版本号:" + RuoYiConfig.getVersion()) |
| | | .build(); |
| | | } |
| | | } |
New file |
| | |
| | | # 数据源配置 |
| | | spring: |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | druid: |
| | | # 主库数据源 |
| | | master: |
| | | url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: password |
| | | # 从库数据源 |
| | | slave: |
| | | # 从数据源开关/默认关闭 |
| | | enabled: false |
| | | url: |
| | | username: |
| | | password: |
| | | # 初始连接数 |
| | | initialSize: 5 |
| | | # 最小连接池数量 |
| | | minIdle: 10 |
| | | # 最大连接池数量 |
| | | maxActive: 20 |
| | | # 配置获取连接等待超时的时间 |
| | | maxWait: 60000 |
| | | # 配置连接超时时间 |
| | | connectTimeout: 30000 |
| | | # 配置网络超时时间 |
| | | socketTimeout: 60000 |
| | | # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 |
| | | timeBetweenEvictionRunsMillis: 60000 |
| | | # 配置一个连接在池中最小生存的时间,单位是毫秒 |
| | | minEvictableIdleTimeMillis: 300000 |
| | | # 配置一个连接在池中最大生存的时间,单位是毫秒 |
| | | maxEvictableIdleTimeMillis: 900000 |
| | | # 配置检测连接是否有效 |
| | | validationQuery: SELECT 1 FROM DUAL |
| | | testWhileIdle: true |
| | | testOnBorrow: false |
| | | testOnReturn: false |
| | | webStatFilter: |
| | | enabled: true |
| | | statViewServlet: |
| | | enabled: true |
| | | # 设置白名单,不填则允许所有访问 |
| | | allow: |
| | | url-pattern: /druid/* |
| | | # 控制台管理用户名和密码 |
| | | login-username: ruoyi |
| | | login-password: 123456 |
| | | filter: |
| | | stat: |
| | | enabled: true |
| | | # 慢SQL记录 |
| | | log-slow-sql: true |
| | | slow-sql-millis: 1000 |
| | | merge-sql: true |
| | | wall: |
| | | config: |
| | | multi-statement-allow: true |
New file |
| | |
| | | # 项目相关配置 |
| | | ruoyi: |
| | | # 名称 |
| | | name: RuoYi |
| | | # 版本 |
| | | version: 4.8.0 |
| | | # 版权年份 |
| | | copyrightYear: 2025 |
| | | # 实例演示开关 |
| | | demoEnabled: true |
| | | # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) |
| | | profile: D:/ruoyi/uploadPath |
| | | # 获取ip地址开关 |
| | | addressEnabled: false |
| | | |
| | | # 开发环境配置 |
| | | server: |
| | | # 服务器的HTTP端口,默认为80 |
| | | port: 80 |
| | | servlet: |
| | | # 应用的访问路径 |
| | | context-path: / |
| | | tomcat: |
| | | # tomcat的URI编码 |
| | | uri-encoding: UTF-8 |
| | | # 连接数满后的排队数,默认为100 |
| | | accept-count: 1000 |
| | | threads: |
| | | # tomcat最大线程数,默认为200 |
| | | max: 800 |
| | | # Tomcat启动初始化的线程数,默认值10 |
| | | min-spare: 100 |
| | | |
| | | # 日志配置 |
| | | logging: |
| | | level: |
| | | com.ruoyi: debug |
| | | org.springframework: warn |
| | | |
| | | # 用户配置 |
| | | user: |
| | | password: |
| | | # 密码错误{maxRetryCount}次锁定10分钟 |
| | | maxRetryCount: 5 |
| | | |
| | | # Spring配置 |
| | | spring: |
| | | # 模板引擎 |
| | | thymeleaf: |
| | | mode: HTML |
| | | encoding: utf-8 |
| | | # 禁用缓存 |
| | | cache: false |
| | | # 资源信息 |
| | | messages: |
| | | # 国际化资源文件路径 |
| | | basename: static/i18n/messages |
| | | jackson: |
| | | time-zone: GMT+8 |
| | | date-format: yyyy-MM-dd HH:mm:ss |
| | | profiles: |
| | | active: druid |
| | | # 文件上传 |
| | | servlet: |
| | | multipart: |
| | | # 单个文件大小 |
| | | max-file-size: 10MB |
| | | # 设置总上传的文件大小 |
| | | max-request-size: 20MB |
| | | # 服务模块 |
| | | devtools: |
| | | restart: |
| | | # 热部署开关 |
| | | enabled: true |
| | | |
| | | # MyBatis |
| | | mybatis: |
| | | # 搜索指定包别名 |
| | | typeAliasesPackage: com.ruoyi.**.domain |
| | | # 配置mapper的扫描,找到所有的mapper.xml映射文件 |
| | | mapperLocations: classpath*:mapper/**/*Mapper.xml |
| | | # 加载全局的配置文件 |
| | | configLocation: classpath:mybatis/mybatis-config.xml |
| | | |
| | | # PageHelper分页插件 |
| | | pagehelper: |
| | | helperDialect: mysql |
| | | supportMethodsArguments: true |
| | | params: count=countSql |
| | | |
| | | # Shiro |
| | | shiro: |
| | | user: |
| | | # 登录地址 |
| | | loginUrl: /login |
| | | # 权限认证失败地址 |
| | | unauthorizedUrl: /unauth |
| | | # 首页地址 |
| | | indexUrl: /index |
| | | # 验证码开关 |
| | | captchaEnabled: true |
| | | # 验证码类型 math 数字计算 char 字符验证 |
| | | captchaType: math |
| | | cookie: |
| | | # 设置Cookie的域名 默认空,即当前访问的域名 |
| | | domain: |
| | | # 设置cookie的有效访问路径 |
| | | path: / |
| | | # 设置HttpOnly属性 |
| | | httpOnly: true |
| | | # 设置Cookie的过期时间,天为单位 |
| | | maxAge: 30 |
| | | # 设置密钥,务必保持唯一性(生成方式,直接拷贝到main运行即可)Base64.encodeToString(CipherUtils.generateNewKey(128, "AES").getEncoded()) (默认启动生成随机秘钥,随机秘钥会导致之前客户端RememberMe Cookie无效,如设置固定秘钥RememberMe Cookie则有效) |
| | | cipherKey: |
| | | session: |
| | | # Session超时时间,-1代表永不过期(默认30分钟) |
| | | expireTime: 30 |
| | | # 同步session到数据库的周期(默认1分钟) |
| | | dbSyncPeriod: 1 |
| | | # 相隔多久检查一次session的有效性,默认就是10分钟 |
| | | validationInterval: 10 |
| | | # 同一个用户最大会话数,比如2的意思是同一个账号允许最多同时两个人登录(默认-1不限制) |
| | | maxSession: -1 |
| | | # 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户 |
| | | kickoutAfter: false |
| | | rememberMe: |
| | | # 是否开启记住我 |
| | | enabled: true |
| | | |
| | | # 防止XSS攻击 |
| | | xss: |
| | | # 过滤开关 |
| | | enabled: true |
| | | # 排除链接(多个用逗号分隔) |
| | | excludes: /system/notice/* |
| | | # 匹配链接 |
| | | urlPatterns: /system/*,/monitor/*,/tool/* |
| | | |
| | | # Swagger配置 |
| | | swagger: |
| | | # 是否开启swagger |
| | | enabled: true |
New file |
| | |
| | | Application Version: ${ruoyi.version} |
| | | Spring Boot Version: ${spring-boot.version} |
| | | //////////////////////////////////////////////////////////////////// |
| | | // _ooOoo_ // |
| | | // o8888888o // |
| | | // 88" . "88 // |
| | | // (| ^_^ |) // |
| | | // O\ = /O // |
| | | // ____/`---'\____ // |
| | | // .' \\| |// `. // |
| | | // / \\||| : |||// \ // |
| | | // / _||||| -:- |||||- \ // |
| | | // | | \\\ - /// | | // |
| | | // | \_| ''\---/'' | | // |
| | | // \ .-\__ `-` ___/-. / // |
| | | // ___`. .' /--.--\ `. . ___ // |
| | | // ."" '< `.___\_<|>_/___.' >'"". // |
| | | // | | : `- \`.;`\ _ /`;.`/ - ` : | | // |
| | | // \ \ `-. \_ __\ /__ _/ .-` / / // |
| | | // ========`-.____`-.___\_____/___.-`____.-'======== // |
| | | // `=---=' // |
| | | // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // |
| | | // 佛祖保佑 永不宕机 永无BUG // |
| | | //////////////////////////////////////////////////////////////////// |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ehcache name="ruoyi" updateCheck="false"> |
| | | |
| | | <!-- 磁盘缓存位置 --> |
| | | <diskStore path="java.io.tmpdir"/> |
| | | |
| | | <!-- maxEntriesLocalHeap:堆内存中最大缓存对象数,0没有限制 --> |
| | | <!-- maxElementsInMemory: 在内存中缓存的element的最大数目。--> |
| | | <!-- eternal:elements是否永久有效,如果为true,timeouts将被忽略,element将永不过期 --> |
| | | <!-- timeToIdleSeconds:失效前的空闲秒数,当eternal为false时,这个属性才有效,0为不限制 --> |
| | | <!-- timeToLiveSeconds:失效前的存活秒数,创建时间到失效时间的间隔为存活时间,当eternal为false时,这个属性才有效,0为不限制 --> |
| | | <!-- overflowToDisk: 如果内存中数据超过内存限制,是否要缓存到磁盘上 --> |
| | | <!-- statistics:是否收集统计信息。如果需要监控缓存使用情况,应该打开这个选项。默认为关闭(统计会影响性能)。设置statistics="true"开启统计 --> |
| | | |
| | | <!-- 默认缓存 --> |
| | | <defaultCache |
| | | maxEntriesLocalHeap="1000" |
| | | eternal="false" |
| | | timeToIdleSeconds="3600" |
| | | timeToLiveSeconds="3600" |
| | | overflowToDisk="false"> |
| | | </defaultCache> |
| | | |
| | | <!-- 登录记录缓存 锁定10分钟 --> |
| | | <cache name="loginRecordCache" |
| | | maxEntriesLocalHeap="2000" |
| | | eternal="false" |
| | | timeToIdleSeconds="600" |
| | | timeToLiveSeconds="0" |
| | | overflowToDisk="false" |
| | | statistics="false"> |
| | | </cache> |
| | | |
| | | <!-- 系统活跃用户缓存 --> |
| | | <cache name="sys-userCache" |
| | | maxEntriesLocalHeap="10000" |
| | | overflowToDisk="false" |
| | | eternal="false" |
| | | diskPersistent="false" |
| | | timeToLiveSeconds="0" |
| | | timeToIdleSeconds="0" |
| | | statistics="false"> |
| | | </cache> |
| | | |
| | | <!-- 系统用户授权缓存 没必要过期 --> |
| | | <cache name="sys-authCache" |
| | | maxEntriesLocalHeap="10000" |
| | | overflowToDisk="false" |
| | | eternal="false" |
| | | diskPersistent="false" |
| | | timeToLiveSeconds="0" |
| | | timeToIdleSeconds="0" |
| | | memoryStoreEvictionPolicy="LRU" |
| | | statistics="false"/> |
| | | |
| | | <!-- 系统缓存 --> |
| | | <cache name="sys-cache" |
| | | maxEntriesLocalHeap="1000" |
| | | eternal="true" |
| | | overflowToDisk="true" |
| | | statistics="false"> |
| | | </cache> |
| | | |
| | | <!-- 系统参数缓存 --> |
| | | <cache name="sys-config" |
| | | maxEntriesLocalHeap="1000" |
| | | eternal="true" |
| | | overflowToDisk="true" |
| | | statistics="false"> |
| | | </cache> |
| | | |
| | | <!-- 系统字典缓存 --> |
| | | <cache name="sys-dict" |
| | | maxEntriesLocalHeap="1000" |
| | | eternal="true" |
| | | overflowToDisk="true" |
| | | statistics="false"> |
| | | </cache> |
| | | |
| | | <!-- 系统会话缓存 --> |
| | | <cache name="shiro-activeSessionCache" |
| | | maxEntriesLocalHeap="10000" |
| | | overflowToDisk="false" |
| | | eternal="false" |
| | | diskPersistent="false" |
| | | timeToLiveSeconds="0" |
| | | timeToIdleSeconds="0" |
| | | statistics="false"/> |
| | | |
| | | </ehcache> |
| | | |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <configuration> |
| | | <!-- 日志存放路径 --> |
| | | <property name="log.path" value="/home/ruoyi/logs" /> |
| | | <!-- 日志输出格式 --> |
| | | <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> |
| | | |
| | | <!-- 控制台输出 --> |
| | | <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <!-- 系统日志输出 --> |
| | | <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/sys-info.log</file> |
| | | <!-- 循环政策:基于时间创建日志文件 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 日志文件名格式 --> |
| | | <fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern> |
| | | <!-- 日志最大的历史 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <!-- 过滤的级别 --> |
| | | <level>INFO</level> |
| | | <!-- 匹配时的操作:接收(记录) --> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <!-- 不匹配时的操作:拒绝(不记录) --> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/sys-error.log</file> |
| | | <!-- 循环政策:基于时间创建日志文件 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 日志文件名格式 --> |
| | | <fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern> |
| | | <!-- 日志最大的历史 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <!-- 过滤的级别 --> |
| | | <level>ERROR</level> |
| | | <!-- 匹配时的操作:接收(记录) --> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <!-- 不匹配时的操作:拒绝(不记录) --> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 用户访问日志输出 --> |
| | | <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/sys-user.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 按天回滚 daily --> |
| | | <fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern> |
| | | <!-- 日志最大的历史 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <!-- 系统模块日志级别控制 --> |
| | | <logger name="com.ruoyi" level="info" /> |
| | | <!-- Spring日志级别控制 --> |
| | | <logger name="org.springframework" level="warn" /> |
| | | |
| | | <root level="info"> |
| | | <appender-ref ref="console" /> |
| | | </root> |
| | | |
| | | <!--系统操作日志--> |
| | | <root level="info"> |
| | | <appender-ref ref="file_info" /> |
| | | <appender-ref ref="file_error" /> |
| | | </root> |
| | | |
| | | <!--系统用户操作日志--> |
| | | <logger name="sys-user" level="info"> |
| | | <appender-ref ref="sys-user"/> |
| | | </logger> |
| | | </configuration> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE configuration |
| | | PUBLIC "-//mybatis.org//DTD Config 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-config.dtd"> |
| | | <configuration> |
| | | <!-- 全局参数 --> |
| | | <settings> |
| | | <!-- 使全局的映射器启用或禁用缓存 --> |
| | | <setting name="cacheEnabled" value="true" /> |
| | | <!-- 允许JDBC 支持自动生成主键 --> |
| | | <setting name="useGeneratedKeys" value="true" /> |
| | | <!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 --> |
| | | <setting name="defaultExecutorType" value="SIMPLE" /> |
| | | <!-- 指定 MyBatis 所用日志的具体实现 --> |
| | | <setting name="logImpl" value="SLF4J" /> |
| | | <!-- 使用驼峰命名法转换字段 --> |
| | | <!-- <setting name="mapUnderscoreToCamelCase" value="true"/> --> |
| | | </settings> |
| | | |
| | | </configuration> |
New file |
| | |
| | | /*jshint curly:true, eqeqeq:true, laxbreak:true, noempty:false */ |
| | | /* |
| | | |
| | | The MIT License (MIT) |
| | | |
| | | Copyright (c) 2007-2013 Einar Lielmanis and contributors. |
| | | |
| | | Permission is hereby granted, free of charge, to any person |
| | | obtaining a copy of this software and associated documentation files |
| | | (the "Software"), to deal in the Software without restriction, |
| | | including without limitation the rights to use, copy, modify, merge, |
| | | publish, distribute, sublicense, and/or sell copies of the Software, |
| | | and to permit persons to whom the Software is furnished to do so, |
| | | subject to the following conditions: |
| | | |
| | | The above copyright notice and this permission notice shall be |
| | | included in all copies or substantial portions of the Software. |
| | | |
| | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| | | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| | | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| | | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| | | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| | | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| | | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| | | SOFTWARE. |
| | | |
| | | |
| | | Style HTML |
| | | --------------- |
| | | |
| | | Written by Nochum Sossonko, (nsossonko@hotmail.com) |
| | | |
| | | Based on code initially developed by: Einar Lielmanis, <elfz@laacz.lv> |
| | | http://jsbeautifier.org/ |
| | | |
| | | Usage: |
| | | style_html(html_source); |
| | | |
| | | style_html(html_source, options); |
| | | |
| | | The options are: |
| | | indent_size (default 4) — indentation size, |
| | | indent_char (default space) — character to indent with, |
| | | max_char (default 250) - maximum amount of characters per line (0 = disable) |
| | | brace_style (default "collapse") - "collapse" | "expand" | "end-expand" |
| | | put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line. |
| | | unformatted (defaults to inline tags) - list of tags, that shouldn't be reformatted |
| | | indent_scripts (default normal) - "keep"|"separate"|"normal" |
| | | |
| | | e.g. |
| | | |
| | | style_html(html_source, { |
| | | 'indent_size': 2, |
| | | 'indent_char': ' ', |
| | | 'max_char': 78, |
| | | 'brace_style': 'expand', |
| | | 'unformatted': ['a', 'sub', 'sup', 'b', 'i', 'u'] |
| | | }); |
| | | */ |
| | | |
| | | (function() { |
| | | |
| | | function style_html(html_source, options, js_beautify, css_beautify) { |
| | | //Wrapper function to invoke all the necessary constructors and deal with the output. |
| | | |
| | | var multi_parser, |
| | | indent_size, |
| | | indent_character, |
| | | max_char, |
| | | brace_style, |
| | | unformatted; |
| | | |
| | | options = options || {}; |
| | | indent_size = options.indent_size || 4; |
| | | indent_character = options.indent_char || ' '; |
| | | brace_style = options.brace_style || 'collapse'; |
| | | max_char = options.max_char === 0 ? Infinity : options.max_char || 250; |
| | | unformatted = options.unformatted || ['a', 'span', 'bdo', 'em', 'strong', 'dfn', 'code', 'samp', 'kbd', 'var', 'cite', 'abbr', 'acronym', 'q', 'sub', 'sup', 'tt', 'i', 'b', 'big', 'small', 'u', 's', 'strike', 'font', 'ins', 'del', 'pre', 'address', 'dt', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']; |
| | | |
| | | function Parser() { |
| | | |
| | | this.pos = 0; //Parser position |
| | | this.token = ''; |
| | | this.current_mode = 'CONTENT'; //reflects the current Parser mode: TAG/CONTENT |
| | | this.tags = { //An object to hold tags, their position, and their parent-tags, initiated with default values |
| | | parent: 'parent1', |
| | | parentcount: 1, |
| | | parent1: '' |
| | | }; |
| | | this.tag_type = ''; |
| | | this.token_text = this.last_token = this.last_text = this.token_type = ''; |
| | | |
| | | this.Utils = { //Uilities made available to the various functions |
| | | whitespace: "\n\r\t ".split(''), |
| | | single_token: 'br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed,?php,?,?='.split(','), //all the single tags for HTML |
| | | extra_liners: 'head,body,/html'.split(','), //for tags that need a line of whitespace before them |
| | | in_array: function (what, arr) { |
| | | for (var i=0; i<arr.length; i++) { |
| | | if (what === arr[i]) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | }; |
| | | |
| | | this.get_content = function () { //function to capture regular content between tags |
| | | |
| | | var input_char = '', |
| | | content = [], |
| | | space = false; //if a space is needed |
| | | |
| | | while (this.input.charAt(this.pos) !== '<') { |
| | | if (this.pos >= this.input.length) { |
| | | return content.length?content.join(''):['', 'TK_EOF']; |
| | | } |
| | | |
| | | input_char = this.input.charAt(this.pos); |
| | | this.pos++; |
| | | this.line_char_count++; |
| | | |
| | | if (this.Utils.in_array(input_char, this.Utils.whitespace)) { |
| | | if (content.length) { |
| | | space = true; |
| | | } |
| | | this.line_char_count--; |
| | | continue; //don't want to insert unnecessary space |
| | | } |
| | | else if (space) { |
| | | if (this.line_char_count >= this.max_char) { //insert a line when the max_char is reached |
| | | content.push('\n'); |
| | | for (var i=0; i<this.indent_level; i++) { |
| | | content.push(this.indent_string); |
| | | } |
| | | this.line_char_count = 0; |
| | | } |
| | | else{ |
| | | content.push(' '); |
| | | this.line_char_count++; |
| | | } |
| | | space = false; |
| | | } |
| | | content.push(input_char); //letter at-a-time (or string) inserted to an array |
| | | } |
| | | return content.length?content.join(''):''; |
| | | }; |
| | | |
| | | this.get_contents_to = function (name) { //get the full content of a script or style to pass to js_beautify |
| | | if (this.pos === this.input.length) { |
| | | return ['', 'TK_EOF']; |
| | | } |
| | | var input_char = ''; |
| | | var content = ''; |
| | | var reg_match = new RegExp('</' + name + '\\s*>', 'igm'); |
| | | reg_match.lastIndex = this.pos; |
| | | var reg_array = reg_match.exec(this.input); |
| | | var end_script = reg_array?reg_array.index:this.input.length; //absolute end of script |
| | | if(this.pos < end_script) { //get everything in between the script tags |
| | | content = this.input.substring(this.pos, end_script); |
| | | this.pos = end_script; |
| | | } |
| | | return content; |
| | | }; |
| | | |
| | | this.record_tag = function (tag){ //function to record a tag and its parent in this.tags Object |
| | | if (this.tags[tag + 'count']) { //check for the existence of this tag type |
| | | this.tags[tag + 'count']++; |
| | | this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level |
| | | } |
| | | else { //otherwise initialize this tag type |
| | | this.tags[tag + 'count'] = 1; |
| | | this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level |
| | | } |
| | | this.tags[tag + this.tags[tag + 'count'] + 'parent'] = this.tags.parent; //set the parent (i.e. in the case of a div this.tags.div1parent) |
| | | this.tags.parent = tag + this.tags[tag + 'count']; //and make this the current parent (i.e. in the case of a div 'div1') |
| | | }; |
| | | |
| | | this.retrieve_tag = function (tag) { //function to retrieve the opening tag to the corresponding closer |
| | | if (this.tags[tag + 'count']) { //if the openener is not in the Object we ignore it |
| | | var temp_parent = this.tags.parent; //check to see if it's a closable tag. |
| | | while (temp_parent) { //till we reach '' (the initial value); |
| | | if (tag + this.tags[tag + 'count'] === temp_parent) { //if this is it use it |
| | | break; |
| | | } |
| | | temp_parent = this.tags[temp_parent + 'parent']; //otherwise keep on climbing up the DOM Tree |
| | | } |
| | | if (temp_parent) { //if we caught something |
| | | this.indent_level = this.tags[tag + this.tags[tag + 'count']]; //set the indent_level accordingly |
| | | this.tags.parent = this.tags[temp_parent + 'parent']; //and set the current parent |
| | | } |
| | | delete this.tags[tag + this.tags[tag + 'count'] + 'parent']; //delete the closed tags parent reference... |
| | | delete this.tags[tag + this.tags[tag + 'count']]; //...and the tag itself |
| | | if (this.tags[tag + 'count'] === 1) { |
| | | delete this.tags[tag + 'count']; |
| | | } |
| | | else { |
| | | this.tags[tag + 'count']--; |
| | | } |
| | | } |
| | | }; |
| | | |
| | | this.get_tag = function (peek) { //function to get a full tag and parse its type |
| | | var input_char = '', |
| | | content = [], |
| | | comment = '', |
| | | space = false, |
| | | tag_start, tag_end, |
| | | orig_pos = this.pos, |
| | | orig_line_char_count = this.line_char_count; |
| | | |
| | | peek = peek !== undefined ? peek : false; |
| | | |
| | | do { |
| | | if (this.pos >= this.input.length) { |
| | | if (peek) { |
| | | this.pos = orig_pos; |
| | | this.line_char_count = orig_line_char_count; |
| | | } |
| | | return content.length?content.join(''):['', 'TK_EOF']; |
| | | } |
| | | |
| | | input_char = this.input.charAt(this.pos); |
| | | this.pos++; |
| | | this.line_char_count++; |
| | | |
| | | if (this.Utils.in_array(input_char, this.Utils.whitespace)) { //don't want to insert unnecessary space |
| | | space = true; |
| | | this.line_char_count--; |
| | | continue; |
| | | } |
| | | |
| | | if (input_char === "'" || input_char === '"') { |
| | | if (!content[1] || content[1] !== '!') { //if we're in a comment strings don't get treated specially |
| | | input_char += this.get_unformatted(input_char); |
| | | space = true; |
| | | } |
| | | } |
| | | |
| | | if (input_char === '=') { //no space before = |
| | | space = false; |
| | | } |
| | | |
| | | if (content.length && content[content.length-1] !== '=' && input_char !== '>' && space) { |
| | | //no space after = or before > |
| | | if (this.line_char_count >= this.max_char) { |
| | | this.print_newline(false, content); |
| | | this.line_char_count = 0; |
| | | } |
| | | else { |
| | | content.push(' '); |
| | | this.line_char_count++; |
| | | } |
| | | space = false; |
| | | } |
| | | if (input_char === '<') { |
| | | tag_start = this.pos - 1; |
| | | } |
| | | content.push(input_char); //inserts character at-a-time (or string) |
| | | } while (input_char !== '>'); |
| | | |
| | | var tag_complete = content.join(''); |
| | | var tag_index; |
| | | if (tag_complete.indexOf(' ') !== -1) { //if there's whitespace, thats where the tag name ends |
| | | tag_index = tag_complete.indexOf(' '); |
| | | } |
| | | else { //otherwise go with the tag ending |
| | | tag_index = tag_complete.indexOf('>'); |
| | | } |
| | | var tag_check = tag_complete.substring(1, tag_index).toLowerCase(); |
| | | if (tag_complete.charAt(tag_complete.length-2) === '/' || |
| | | this.Utils.in_array(tag_check, this.Utils.single_token)) { //if this tag name is a single tag type (either in the list or has a closing /) |
| | | if ( ! peek) { |
| | | this.tag_type = 'SINGLE'; |
| | | } |
| | | } |
| | | else if (tag_check === 'script') { //for later script handling |
| | | if ( ! peek) { |
| | | this.record_tag(tag_check); |
| | | this.tag_type = 'SCRIPT'; |
| | | } |
| | | } |
| | | else if (tag_check === 'style') { //for future style handling (for now it justs uses get_content) |
| | | if ( ! peek) { |
| | | this.record_tag(tag_check); |
| | | this.tag_type = 'STYLE'; |
| | | } |
| | | } |
| | | else if (this.is_unformatted(tag_check, unformatted)) { // do not reformat the "unformatted" tags |
| | | comment = this.get_unformatted('</'+tag_check+'>', tag_complete); //...delegate to get_unformatted function |
| | | content.push(comment); |
| | | // Preserve collapsed whitespace either before or after this tag. |
| | | if (tag_start > 0 && this.Utils.in_array(this.input.charAt(tag_start - 1), this.Utils.whitespace)){ |
| | | content.splice(0, 0, this.input.charAt(tag_start - 1)); |
| | | } |
| | | tag_end = this.pos - 1; |
| | | if (this.Utils.in_array(this.input.charAt(tag_end + 1), this.Utils.whitespace)){ |
| | | content.push(this.input.charAt(tag_end + 1)); |
| | | } |
| | | this.tag_type = 'SINGLE'; |
| | | } |
| | | else if (tag_check.charAt(0) === '!') { //peek for <!-- comment |
| | | if (tag_check.indexOf('[if') !== -1) { //peek for <!--[if conditional comment |
| | | if (tag_complete.indexOf('!IE') !== -1) { //this type needs a closing --> so... |
| | | comment = this.get_unformatted('-->', tag_complete); //...delegate to get_unformatted |
| | | content.push(comment); |
| | | } |
| | | if ( ! peek) { |
| | | this.tag_type = 'START'; |
| | | } |
| | | } |
| | | else if (tag_check.indexOf('[endif') !== -1) {//peek for <!--[endif end conditional comment |
| | | this.tag_type = 'END'; |
| | | this.unindent(); |
| | | } |
| | | else if (tag_check.indexOf('[cdata[') !== -1) { //if it's a <[cdata[ comment... |
| | | comment = this.get_unformatted(']]>', tag_complete); //...delegate to get_unformatted function |
| | | content.push(comment); |
| | | if ( ! peek) { |
| | | this.tag_type = 'SINGLE'; //<![CDATA[ comments are treated like single tags |
| | | } |
| | | } |
| | | else { |
| | | comment = this.get_unformatted('-->', tag_complete); |
| | | content.push(comment); |
| | | this.tag_type = 'SINGLE'; |
| | | } |
| | | } |
| | | else if ( ! peek) { |
| | | if (tag_check.charAt(0) === '/') { //this tag is a double tag so check for tag-ending |
| | | this.retrieve_tag(tag_check.substring(1)); //remove it and all ancestors |
| | | this.tag_type = 'END'; |
| | | } |
| | | else { //otherwise it's a start-tag |
| | | this.record_tag(tag_check); //push it on the tag stack |
| | | this.tag_type = 'START'; |
| | | } |
| | | if (this.Utils.in_array(tag_check, this.Utils.extra_liners)) { //check if this double needs an extra line |
| | | this.print_newline(true, this.output); |
| | | } |
| | | } |
| | | |
| | | if (peek) { |
| | | this.pos = orig_pos; |
| | | this.line_char_count = orig_line_char_count; |
| | | } |
| | | |
| | | return content.join(''); //returns fully formatted tag |
| | | }; |
| | | |
| | | this.get_unformatted = function (delimiter, orig_tag) { //function to return unformatted content in its entirety |
| | | |
| | | if (orig_tag && orig_tag.toLowerCase().indexOf(delimiter) !== -1) { |
| | | return ''; |
| | | } |
| | | var input_char = ''; |
| | | var content = ''; |
| | | var space = true; |
| | | do { |
| | | |
| | | if (this.pos >= this.input.length) { |
| | | return content; |
| | | } |
| | | |
| | | input_char = this.input.charAt(this.pos); |
| | | this.pos++; |
| | | |
| | | if (this.Utils.in_array(input_char, this.Utils.whitespace)) { |
| | | if (!space) { |
| | | this.line_char_count--; |
| | | continue; |
| | | } |
| | | if (input_char === '\n' || input_char === '\r') { |
| | | content += '\n'; |
| | | /* Don't change tab indention for unformatted blocks. If using code for html editing, this will greatly affect <pre> tags if they are specified in the 'unformatted array' |
| | | for (var i=0; i<this.indent_level; i++) { |
| | | content += this.indent_string; |
| | | } |
| | | space = false; //...and make sure other indentation is erased |
| | | */ |
| | | this.line_char_count = 0; |
| | | continue; |
| | | } |
| | | } |
| | | content += input_char; |
| | | this.line_char_count++; |
| | | space = true; |
| | | |
| | | |
| | | } while (content.toLowerCase().indexOf(delimiter) === -1); |
| | | return content; |
| | | }; |
| | | |
| | | this.get_token = function () { //initial handler for token-retrieval |
| | | var token; |
| | | |
| | | if (this.last_token === 'TK_TAG_SCRIPT' || this.last_token === 'TK_TAG_STYLE') { //check if we need to format javascript |
| | | var type = this.last_token.substr(7); |
| | | token = this.get_contents_to(type); |
| | | if (typeof token !== 'string') { |
| | | return token; |
| | | } |
| | | return [token, 'TK_' + type]; |
| | | } |
| | | if (this.current_mode === 'CONTENT') { |
| | | token = this.get_content(); |
| | | if (typeof token !== 'string') { |
| | | return token; |
| | | } |
| | | else { |
| | | return [token, 'TK_CONTENT']; |
| | | } |
| | | } |
| | | |
| | | if (this.current_mode === 'TAG') { |
| | | token = this.get_tag(); |
| | | if (typeof token !== 'string') { |
| | | return token; |
| | | } |
| | | else { |
| | | var tag_name_type = 'TK_TAG_' + this.tag_type; |
| | | return [token, tag_name_type]; |
| | | } |
| | | } |
| | | }; |
| | | |
| | | this.get_full_indent = function (level) { |
| | | level = this.indent_level + level || 0; |
| | | if (level < 1) { |
| | | return ''; |
| | | } |
| | | |
| | | return Array(level + 1).join(this.indent_string); |
| | | }; |
| | | |
| | | this.is_unformatted = function(tag_check, unformatted) { |
| | | //is this an HTML5 block-level link? |
| | | if (!this.Utils.in_array(tag_check, unformatted)){ |
| | | return false; |
| | | } |
| | | |
| | | if (tag_check.toLowerCase() !== 'a' || !this.Utils.in_array('a', unformatted)){ |
| | | return true; |
| | | } |
| | | |
| | | //at this point we have an tag; is its first child something we want to remain |
| | | //unformatted? |
| | | var next_tag = this.get_tag(true /* peek. */); |
| | | |
| | | // tets next_tag to see if it is just html tag (no external content) |
| | | var tag = (next_tag || "").match(/^\s*<\s*\/?([a-z]*)\s*[^>]*>\s*$/); |
| | | |
| | | // if next_tag comes back but is not an isolated tag, then |
| | | // let's treat the 'a' tag as having content |
| | | // and respect the unformatted option |
| | | if (!tag || this.Utils.in_array(tag, unformatted)){ |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | }; |
| | | |
| | | this.printer = function (js_source, indent_character, indent_size, max_char, brace_style) { //handles input/output and some other printing functions |
| | | |
| | | this.input = js_source || ''; //gets the input for the Parser |
| | | this.output = []; |
| | | this.indent_character = indent_character; |
| | | this.indent_string = ''; |
| | | this.indent_size = indent_size; |
| | | this.brace_style = brace_style; |
| | | this.indent_level = 0; |
| | | this.max_char = max_char; |
| | | this.line_char_count = 0; //count to see if max_char was exceeded |
| | | |
| | | for (var i=0; i<this.indent_size; i++) { |
| | | this.indent_string += this.indent_character; |
| | | } |
| | | |
| | | this.print_newline = function (ignore, arr) { |
| | | this.line_char_count = 0; |
| | | if (!arr || !arr.length) { |
| | | return; |
| | | } |
| | | if (!ignore) { //we might want the extra line |
| | | while (this.Utils.in_array(arr[arr.length-1], this.Utils.whitespace)) { |
| | | arr.pop(); |
| | | } |
| | | } |
| | | arr.push('\n'); |
| | | for (var i=0; i<this.indent_level; i++) { |
| | | arr.push(this.indent_string); |
| | | } |
| | | }; |
| | | |
| | | this.print_token = function (text) { |
| | | this.output.push(text); |
| | | }; |
| | | |
| | | this.indent = function () { |
| | | this.indent_level++; |
| | | }; |
| | | |
| | | this.unindent = function () { |
| | | if (this.indent_level > 0) { |
| | | this.indent_level--; |
| | | } |
| | | }; |
| | | }; |
| | | return this; |
| | | } |
| | | |
| | | /*_____________________--------------------_____________________*/ |
| | | |
| | | multi_parser = new Parser(); //wrapping functions Parser |
| | | multi_parser.printer(html_source, indent_character, indent_size, max_char, brace_style); //initialize starting values |
| | | |
| | | while (true) { |
| | | var t = multi_parser.get_token(); |
| | | multi_parser.token_text = t[0]; |
| | | multi_parser.token_type = t[1]; |
| | | |
| | | if (multi_parser.token_type === 'TK_EOF') { |
| | | break; |
| | | } |
| | | |
| | | switch (multi_parser.token_type) { |
| | | case 'TK_TAG_START': |
| | | multi_parser.print_newline(false, multi_parser.output); |
| | | multi_parser.print_token(multi_parser.token_text); |
| | | multi_parser.indent(); |
| | | multi_parser.current_mode = 'CONTENT'; |
| | | break; |
| | | case 'TK_TAG_STYLE': |
| | | case 'TK_TAG_SCRIPT': |
| | | multi_parser.print_newline(false, multi_parser.output); |
| | | multi_parser.print_token(multi_parser.token_text); |
| | | multi_parser.current_mode = 'CONTENT'; |
| | | break; |
| | | case 'TK_TAG_END': |
| | | //Print new line only if the tag has no content and has child |
| | | if (multi_parser.last_token === 'TK_CONTENT' && multi_parser.last_text === '') { |
| | | var tag_name = multi_parser.token_text.match(/\w+/)[0]; |
| | | var tag_extracted_from_last_output = multi_parser.output[multi_parser.output.length -1].match(/<\s*(\w+)/); |
| | | if (tag_extracted_from_last_output === null || tag_extracted_from_last_output[1] !== tag_name) { |
| | | multi_parser.print_newline(true, multi_parser.output); |
| | | } |
| | | } |
| | | multi_parser.print_token(multi_parser.token_text); |
| | | multi_parser.current_mode = 'CONTENT'; |
| | | break; |
| | | case 'TK_TAG_SINGLE': |
| | | // Don't add a newline before elements that should remain unformatted. |
| | | var tag_check = multi_parser.token_text.match(/^\s*<([a-z]+)/i); |
| | | if (!tag_check || !multi_parser.Utils.in_array(tag_check[1], unformatted)){ |
| | | multi_parser.print_newline(false, multi_parser.output); |
| | | } |
| | | multi_parser.print_token(multi_parser.token_text); |
| | | multi_parser.current_mode = 'CONTENT'; |
| | | break; |
| | | case 'TK_CONTENT': |
| | | if (multi_parser.token_text !== '') { |
| | | multi_parser.print_token(multi_parser.token_text); |
| | | } |
| | | multi_parser.current_mode = 'TAG'; |
| | | break; |
| | | case 'TK_STYLE': |
| | | case 'TK_SCRIPT': |
| | | if (multi_parser.token_text !== '') { |
| | | multi_parser.output.push('\n'); |
| | | var text = multi_parser.token_text, |
| | | _beautifier, |
| | | script_indent_level = 1; |
| | | if (multi_parser.token_type === 'TK_SCRIPT') { |
| | | _beautifier = typeof js_beautify === 'function' && js_beautify; |
| | | } else if (multi_parser.token_type === 'TK_STYLE') { |
| | | _beautifier = typeof css_beautify === 'function' && css_beautify; |
| | | } |
| | | |
| | | if (options.indent_scripts === "keep") { |
| | | script_indent_level = 0; |
| | | } else if (options.indent_scripts === "separate") { |
| | | script_indent_level = -multi_parser.indent_level; |
| | | } |
| | | |
| | | var indentation = multi_parser.get_full_indent(script_indent_level); |
| | | if (_beautifier) { |
| | | // call the Beautifier if avaliable |
| | | text = _beautifier(text.replace(/^\s*/, indentation), options); |
| | | } else { |
| | | // simply indent the string otherwise |
| | | var white = text.match(/^\s*/)[0]; |
| | | var _level = white.match(/[^\n\r]*$/)[0].split(multi_parser.indent_string).length - 1; |
| | | var reindent = multi_parser.get_full_indent(script_indent_level -_level); |
| | | text = text.replace(/^\s*/, indentation) |
| | | .replace(/\r\n|\r|\n/g, '\n' + reindent) |
| | | .replace(/\s*$/, ''); |
| | | } |
| | | if (text) { |
| | | multi_parser.print_token(text); |
| | | multi_parser.print_newline(true, multi_parser.output); |
| | | } |
| | | } |
| | | multi_parser.current_mode = 'TAG'; |
| | | break; |
| | | } |
| | | multi_parser.last_token = multi_parser.token_type; |
| | | multi_parser.last_text = multi_parser.token_text; |
| | | } |
| | | return multi_parser.output.join(''); |
| | | } |
| | | |
| | | // If we're running a web page and don't have either of the above, add our one global |
| | | window.html_beautify = function(html_source, options) { |
| | | return style_html(html_source, options, window.js_beautify, window.css_beautify); |
| | | }; |
| | | |
| | | }()); |
New file |
| | |
| | | /*! |
| | | * jQuery blockUI plugin |
| | | * Version 2.70.0-2014.11.23 |
| | | * Requires jQuery v1.7 or later |
| | | * |
| | | * Examples at: http://malsup.com/jquery/block/ |
| | | * Copyright (c) 2007-2013 M. Alsup |
| | | * Dual licensed under the MIT and GPL licenses: |
| | | * http://www.opensource.org/licenses/mit-license.php |
| | | * http://www.gnu.org/licenses/gpl.html |
| | | * |
| | | * Thanks to Amir-Hossein Sobhi for some excellent contributions! |
| | | */ |
| | | |
| | | ;(function() { |
| | | /*jshint eqeqeq:false curly:false latedef:false */ |
| | | "use strict"; |
| | | |
| | | function setup($) { |
| | | $.fn._fadeIn = $.fn.fadeIn; |
| | | |
| | | var noOp = $.noop || function() {}; |
| | | |
| | | // this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle |
| | | // confusing userAgent strings on Vista) |
| | | var msie = /MSIE/.test(navigator.userAgent); |
| | | var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent); |
| | | var mode = document.documentMode || 0; |
| | | var setExpr = $.isFunction( document.createElement('div').style.setExpression ); |
| | | |
| | | // global $ methods for blocking/unblocking the entire page |
| | | $.blockUI = function(opts) { install(window, opts); }; |
| | | $.unblockUI = function(opts) { remove(window, opts); }; |
| | | |
| | | // convenience method for quick growl-like notifications (http://www.google.com/search?q=growl) |
| | | $.growlUI = function(title, message, timeout, onClose) { |
| | | var $m = $('<div class="growlUI"></div>'); |
| | | if (title) $m.append('<h1>'+title+'</h1>'); |
| | | if (message) $m.append('<h2>'+message+'</h2>'); |
| | | if (timeout === undefined) timeout = 3000; |
| | | |
| | | // Added by konapun: Set timeout to 30 seconds if this growl is moused over, like normal toast notifications |
| | | var callBlock = function(opts) { |
| | | opts = opts || {}; |
| | | |
| | | $.blockUI({ |
| | | message: $m, |
| | | fadeIn : typeof opts.fadeIn !== 'undefined' ? opts.fadeIn : 700, |
| | | fadeOut: typeof opts.fadeOut !== 'undefined' ? opts.fadeOut : 1000, |
| | | timeout: typeof opts.timeout !== 'undefined' ? opts.timeout : timeout, |
| | | centerY: false, |
| | | showOverlay: false, |
| | | onUnblock: onClose, |
| | | css: $.blockUI.defaults.growlCSS |
| | | }); |
| | | }; |
| | | |
| | | callBlock(); |
| | | var nonmousedOpacity = $m.css('opacity'); |
| | | $m.mouseover(function() { |
| | | callBlock({ |
| | | fadeIn: 0, |
| | | timeout: 30000 |
| | | }); |
| | | |
| | | var displayBlock = $('.blockMsg'); |
| | | displayBlock.stop(); // cancel fadeout if it has started |
| | | displayBlock.fadeTo(300, 1); // make it easier to read the message by removing transparency |
| | | }).mouseout(function() { |
| | | $('.blockMsg').fadeOut(1000); |
| | | }); |
| | | // End konapun additions |
| | | }; |
| | | |
| | | // plugin method for blocking element content |
| | | $.fn.block = function(opts) { |
| | | if ( this[0] === window ) { |
| | | $.blockUI( opts ); |
| | | return this; |
| | | } |
| | | var fullOpts = $.extend({}, $.blockUI.defaults, opts || {}); |
| | | this.each(function() { |
| | | var $el = $(this); |
| | | if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked')) |
| | | return; |
| | | $el.unblock({ fadeOut: 0 }); |
| | | }); |
| | | |
| | | return this.each(function() { |
| | | if ($.css(this,'position') == 'static') { |
| | | this.style.position = 'relative'; |
| | | $(this).data('blockUI.static', true); |
| | | } |
| | | this.style.zoom = 1; // force 'hasLayout' in ie |
| | | install(this, opts); |
| | | }); |
| | | }; |
| | | |
| | | // plugin method for unblocking element content |
| | | $.fn.unblock = function(opts) { |
| | | if ( this[0] === window ) { |
| | | $.unblockUI( opts ); |
| | | return this; |
| | | } |
| | | return this.each(function() { |
| | | remove(this, opts); |
| | | }); |
| | | }; |
| | | |
| | | $.blockUI.version = 2.70; // 2nd generation blocking at no extra cost! |
| | | |
| | | // override these in your code to change the default behavior and style |
| | | $.blockUI.defaults = { |
| | | // message displayed when blocking (use null for no message) |
| | | message: '<div class="loaderbox"><div class="loading-activity"></div> 加载中......</div>', |
| | | |
| | | title: null, // title string; only used when theme == true |
| | | draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded) |
| | | |
| | | theme: false, // set to true to use with jQuery UI themes |
| | | |
| | | // styles for the message when blocking; if you wish to disable |
| | | // these and use an external stylesheet then do this in your code: |
| | | // $.blockUI.defaults.css = {}; |
| | | css: { |
| | | padding: 0, |
| | | margin: 0, |
| | | width: '30%', |
| | | top: '40%', |
| | | left: '35%', |
| | | textAlign: 'center', |
| | | color: '#000', |
| | | border: '0px', |
| | | backgroundColor:'transparent', |
| | | cursor: 'wait' |
| | | }, |
| | | |
| | | // minimal style set used when themes are used |
| | | themedCSS: { |
| | | width: '30%', |
| | | top: '40%', |
| | | left: '35%' |
| | | }, |
| | | |
| | | // styles for the overlay |
| | | overlayCSS: { |
| | | backgroundColor: '#000', |
| | | opacity: 0.6, |
| | | cursor: 'wait' |
| | | }, |
| | | |
| | | // style to replace wait cursor before unblocking to correct issue |
| | | // of lingering wait cursor |
| | | cursorReset: 'default', |
| | | |
| | | // styles applied when using $.growlUI |
| | | growlCSS: { |
| | | width: '350px', |
| | | top: '10px', |
| | | left: '', |
| | | right: '10px', |
| | | border: 'none', |
| | | padding: '5px', |
| | | opacity: 0.6, |
| | | cursor: 'default', |
| | | color: '#fff', |
| | | backgroundColor: '#000', |
| | | '-webkit-border-radius':'10px', |
| | | '-moz-border-radius': '10px', |
| | | 'border-radius': '10px' |
| | | }, |
| | | |
| | | // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w |
| | | // (hat tip to Jorge H. N. de Vasconcelos) |
| | | /*jshint scripturl:true */ |
| | | iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', |
| | | |
| | | // force usage of iframe in non-IE browsers (handy for blocking applets) |
| | | forceIframe: false, |
| | | |
| | | // z-index for the blocking overlay |
| | | baseZ: 1000, |
| | | |
| | | // set these to true to have the message automatically centered |
| | | centerX: true, // <-- only effects element blocking (page block controlled via css above) |
| | | centerY: true, |
| | | |
| | | // allow body element to be stetched in ie6; this makes blocking look better |
| | | // on "short" pages. disable if you wish to prevent changes to the body height |
| | | allowBodyStretch: true, |
| | | |
| | | // enable if you want key and mouse events to be disabled for content that is blocked |
| | | bindEvents: true, |
| | | |
| | | // be default blockUI will supress tab navigation from leaving blocking content |
| | | // (if bindEvents is true) |
| | | constrainTabKey: true, |
| | | |
| | | // fadeIn time in millis; set to 0 to disable fadeIn on block |
| | | fadeIn: 200, |
| | | |
| | | // fadeOut time in millis; set to 0 to disable fadeOut on unblock |
| | | fadeOut: 400, |
| | | |
| | | // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock |
| | | timeout: 0, |
| | | |
| | | // disable if you don't want to show the overlay |
| | | showOverlay: true, |
| | | |
| | | // if true, focus will be placed in the first available input field when |
| | | // page blocking |
| | | focusInput: true, |
| | | |
| | | // elements that can receive focus |
| | | focusableElements: ':input:enabled:visible', |
| | | |
| | | // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity) |
| | | // no longer needed in 2012 |
| | | // applyPlatformOpacityRules: true, |
| | | |
| | | // callback method invoked when fadeIn has completed and blocking message is visible |
| | | onBlock: null, |
| | | |
| | | // callback method invoked when unblocking has completed; the callback is |
| | | // passed the element that has been unblocked (which is the window object for page |
| | | // blocks) and the options that were passed to the unblock call: |
| | | // onUnblock(element, options) |
| | | onUnblock: null, |
| | | |
| | | // callback method invoked when the overlay area is clicked. |
| | | // setting this will turn the cursor to a pointer, otherwise cursor defined in overlayCss will be used. |
| | | onOverlayClick: null, |
| | | |
| | | // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493 |
| | | quirksmodeOffsetHack: 4, |
| | | |
| | | // class name of the message block |
| | | blockMsgClass: 'blockMsg', |
| | | |
| | | // if it is already blocked, then ignore it (don't unblock and reblock) |
| | | ignoreIfBlocked: false |
| | | }; |
| | | |
| | | // private data and functions follow... |
| | | |
| | | var pageBlock = null; |
| | | var pageBlockEls = []; |
| | | |
| | | function install(el, opts) { |
| | | var css, themedCSS; |
| | | var full = (el == window); |
| | | var msg = (opts && opts.message !== undefined ? opts.message : undefined); |
| | | opts = $.extend({}, $.blockUI.defaults, opts || {}); |
| | | |
| | | if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked')) |
| | | return; |
| | | |
| | | opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {}); |
| | | css = $.extend({}, $.blockUI.defaults.css, opts.css || {}); |
| | | if (opts.onOverlayClick) |
| | | opts.overlayCSS.cursor = 'pointer'; |
| | | |
| | | themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {}); |
| | | msg = msg === undefined ? opts.message : msg; |
| | | |
| | | // remove the current block (if there is one) |
| | | if (full && pageBlock) |
| | | remove(window, {fadeOut:0}); |
| | | |
| | | // if an existing element is being used as the blocking content then we capture |
| | | // its current place in the DOM (and current display style) so we can restore |
| | | // it when we unblock |
| | | if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) { |
| | | var node = msg.jquery ? msg[0] : msg; |
| | | var data = {}; |
| | | $(el).data('blockUI.history', data); |
| | | data.el = node; |
| | | data.parent = node.parentNode; |
| | | data.display = node.style.display; |
| | | data.position = node.style.position; |
| | | if (data.parent) |
| | | data.parent.removeChild(node); |
| | | } |
| | | |
| | | $(el).data('blockUI.onUnblock', opts.onUnblock); |
| | | var z = opts.baseZ; |
| | | |
| | | // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform; |
| | | // layer1 is the iframe layer which is used to supress bleed through of underlying content |
| | | // layer2 is the overlay layer which has opacity and a wait cursor (by default) |
| | | // layer3 is the message content that is displayed while blocking |
| | | var lyr1, lyr2, lyr3, s; |
| | | if (msie || opts.forceIframe) |
| | | lyr1 = $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>'); |
| | | else |
| | | lyr1 = $('<div class="blockUI" style="display:none"></div>'); |
| | | |
| | | if (opts.theme) |
| | | lyr2 = $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+ (z++) +';display:none"></div>'); |
| | | else |
| | | lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>'); |
| | | |
| | | if (opts.theme && full) { |
| | | s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">'; |
| | | if ( opts.title ) { |
| | | s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || ' ')+'</div>'; |
| | | } |
| | | s += '<div class="ui-widget-content ui-dialog-content"></div>'; |
| | | s += '</div>'; |
| | | } |
| | | else if (opts.theme) { |
| | | s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">'; |
| | | if ( opts.title ) { |
| | | s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || ' ')+'</div>'; |
| | | } |
| | | s += '<div class="ui-widget-content ui-dialog-content"></div>'; |
| | | s += '</div>'; |
| | | } |
| | | else if (full) { |
| | | s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+(z+10)+';display:none;position:fixed"></div>'; |
| | | } |
| | | else { |
| | | s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+(z+10)+';display:none;position:absolute"></div>'; |
| | | } |
| | | lyr3 = $(s); |
| | | |
| | | // if we have a message, style it |
| | | if (msg) { |
| | | if (opts.theme) { |
| | | lyr3.css(themedCSS); |
| | | lyr3.addClass('ui-widget-content'); |
| | | } |
| | | else |
| | | lyr3.css(css); |
| | | } |
| | | |
| | | // style the overlay |
| | | if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/) |
| | | lyr2.css(opts.overlayCSS); |
| | | lyr2.css('position', full ? 'fixed' : 'absolute'); |
| | | |
| | | // make iframe layer transparent in IE |
| | | if (msie || opts.forceIframe) |
| | | lyr1.css('opacity',0.0); |
| | | |
| | | //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el); |
| | | var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el); |
| | | $.each(layers, function() { |
| | | this.appendTo($par); |
| | | }); |
| | | |
| | | if (opts.theme && opts.draggable && $.fn.draggable) { |
| | | lyr3.draggable({ |
| | | handle: '.ui-dialog-titlebar', |
| | | cancel: 'li' |
| | | }); |
| | | } |
| | | |
| | | // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling) |
| | | var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null : el).length > 0); |
| | | if (ie6 || expr) { |
| | | // give body 100% height |
| | | if (full && opts.allowBodyStretch && $.support.boxModel) |
| | | $('html,body').css('height','100%'); |
| | | |
| | | // fix ie6 issue when blocked element has a border width |
| | | if ((ie6 || !$.support.boxModel) && !full) { |
| | | var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth'); |
| | | var fixT = t ? '(0 - '+t+')' : 0; |
| | | var fixL = l ? '(0 - '+l+')' : 0; |
| | | } |
| | | |
| | | // simulate fixed position |
| | | $.each(layers, function(i,o) { |
| | | var s = o[0].style; |
| | | s.position = 'absolute'; |
| | | if (i < 2) { |
| | | if (full) |
| | | s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"'); |
| | | else |
| | | s.setExpression('height','this.parentNode.offsetHeight + "px"'); |
| | | if (full) |
| | | s.setExpression('width','jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'); |
| | | else |
| | | s.setExpression('width','this.parentNode.offsetWidth + "px"'); |
| | | if (fixL) s.setExpression('left', fixL); |
| | | if (fixT) s.setExpression('top', fixT); |
| | | } |
| | | else if (opts.centerY) { |
| | | if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'); |
| | | s.marginTop = 0; |
| | | } |
| | | else if (!opts.centerY && full) { |
| | | var top = (opts.css && opts.css.top) ? parseInt(opts.css.top, 10) : 0; |
| | | var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"'; |
| | | s.setExpression('top',expression); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // show the message |
| | | if (msg) { |
| | | if (opts.theme) |
| | | lyr3.find('.ui-widget-content').append(msg); |
| | | else |
| | | lyr3.append(msg); |
| | | if (msg.jquery || msg.nodeType) |
| | | $(msg).show(); |
| | | } |
| | | |
| | | if ((msie || opts.forceIframe) && opts.showOverlay) |
| | | lyr1.show(); // opacity is zero |
| | | if (opts.fadeIn) { |
| | | var cb = opts.onBlock ? opts.onBlock : noOp; |
| | | var cb1 = (opts.showOverlay && !msg) ? cb : noOp; |
| | | var cb2 = msg ? cb : noOp; |
| | | if (opts.showOverlay) |
| | | lyr2._fadeIn(opts.fadeIn, cb1); |
| | | if (msg) |
| | | lyr3._fadeIn(opts.fadeIn, cb2); |
| | | } |
| | | else { |
| | | if (opts.showOverlay) |
| | | lyr2.show(); |
| | | if (msg) |
| | | lyr3.show(); |
| | | if (opts.onBlock) |
| | | opts.onBlock.bind(lyr3)(); |
| | | } |
| | | |
| | | // bind key and mouse events |
| | | bind(1, el, opts); |
| | | |
| | | if (full) { |
| | | pageBlock = lyr3[0]; |
| | | pageBlockEls = $(opts.focusableElements,pageBlock); |
| | | if (opts.focusInput) |
| | | setTimeout(focus, 20); |
| | | } |
| | | else |
| | | center(lyr3[0], opts.centerX, opts.centerY); |
| | | |
| | | if (opts.timeout) { |
| | | // auto-unblock |
| | | var to = setTimeout(function() { |
| | | if (full) |
| | | $.unblockUI(opts); |
| | | else |
| | | $(el).unblock(opts); |
| | | }, opts.timeout); |
| | | $(el).data('blockUI.timeout', to); |
| | | } |
| | | } |
| | | |
| | | // remove the block |
| | | function remove(el, opts) { |
| | | var count; |
| | | var full = (el == window); |
| | | var $el = $(el); |
| | | var data = $el.data('blockUI.history'); |
| | | var to = $el.data('blockUI.timeout'); |
| | | if (to) { |
| | | clearTimeout(to); |
| | | $el.removeData('blockUI.timeout'); |
| | | } |
| | | opts = $.extend({}, $.blockUI.defaults, opts || {}); |
| | | bind(0, el, opts); // unbind events |
| | | |
| | | if (opts.onUnblock === null) { |
| | | opts.onUnblock = $el.data('blockUI.onUnblock'); |
| | | $el.removeData('blockUI.onUnblock'); |
| | | } |
| | | |
| | | var els; |
| | | if (full) // crazy selector to handle odd field errors in ie6/7 |
| | | els = $('body').children().filter('.blockUI').add('body > .blockUI'); |
| | | else |
| | | els = $el.find('>.blockUI'); |
| | | |
| | | // fix cursor issue |
| | | if ( opts.cursorReset ) { |
| | | if ( els.length > 1 ) |
| | | els[1].style.cursor = opts.cursorReset; |
| | | if ( els.length > 2 ) |
| | | els[2].style.cursor = opts.cursorReset; |
| | | } |
| | | |
| | | if (full) |
| | | pageBlock = pageBlockEls = null; |
| | | |
| | | if (opts.fadeOut) { |
| | | count = els.length; |
| | | els.stop().fadeOut(opts.fadeOut, function() { |
| | | if ( --count === 0) |
| | | reset(els,data,opts,el); |
| | | }); |
| | | } |
| | | else |
| | | reset(els, data, opts, el); |
| | | } |
| | | |
| | | // move blocking element back into the DOM where it started |
| | | function reset(els,data,opts,el) { |
| | | var $el = $(el); |
| | | if ( $el.data('blockUI.isBlocked') ) |
| | | return; |
| | | |
| | | els.each(function(i,o) { |
| | | // remove via DOM calls so we don't lose event handlers |
| | | if (this.parentNode) |
| | | this.parentNode.removeChild(this); |
| | | }); |
| | | |
| | | if (data && data.el) { |
| | | data.el.style.display = data.display; |
| | | data.el.style.position = data.position; |
| | | data.el.style.cursor = 'default'; // #59 |
| | | if (data.parent) |
| | | data.parent.appendChild(data.el); |
| | | $el.removeData('blockUI.history'); |
| | | } |
| | | |
| | | if ($el.data('blockUI.static')) { |
| | | $el.css('position', 'static'); // #22 |
| | | } |
| | | |
| | | if (typeof opts.onUnblock == 'function') |
| | | opts.onUnblock(el,opts); |
| | | |
| | | // fix issue in Safari 6 where block artifacts remain until reflow |
| | | var body = $(document.body), w = body.width(), cssW = body[0].style.width; |
| | | body.width(w-1).width(w); |
| | | body[0].style.width = cssW; |
| | | } |
| | | |
| | | // bind/unbind the handler |
| | | function bind(b, el, opts) { |
| | | var full = el == window, $el = $(el); |
| | | |
| | | // don't bother unbinding if there is nothing to unbind |
| | | if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked'))) |
| | | return; |
| | | |
| | | $el.data('blockUI.isBlocked', b); |
| | | |
| | | // don't bind events when overlay is not in use or if bindEvents is false |
| | | if (!full || !opts.bindEvents || (b && !opts.showOverlay)) |
| | | return; |
| | | |
| | | // bind anchors and inputs for mouse and key events |
| | | var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove'; |
| | | if (b) |
| | | $(document).bind(events, opts, handler); |
| | | else |
| | | $(document).unbind(events, handler); |
| | | |
| | | // former impl... |
| | | // var $e = $('a,:input'); |
| | | // b ? $e.bind(events, opts, handler) : $e.unbind(events, handler); |
| | | } |
| | | |
| | | // event handler to suppress keyboard/mouse events when blocking |
| | | function handler(e) { |
| | | // allow tab navigation (conditionally) |
| | | if (e.type === 'keydown' && e.keyCode && e.keyCode == 9) { |
| | | if (pageBlock && e.data.constrainTabKey) { |
| | | var els = pageBlockEls; |
| | | var fwd = !e.shiftKey && e.target === els[els.length-1]; |
| | | var back = e.shiftKey && e.target === els[0]; |
| | | if (fwd || back) { |
| | | setTimeout(function(){focus(back);},10); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | var opts = e.data; |
| | | var target = $(e.target); |
| | | if (target.hasClass('blockOverlay') && opts.onOverlayClick) |
| | | opts.onOverlayClick(e); |
| | | |
| | | // allow events within the message content |
| | | if (target.parents('div.' + opts.blockMsgClass).length > 0) |
| | | return true; |
| | | |
| | | // allow events for content that is not being blocked |
| | | return target.parents().children().filter('div.blockUI').length === 0; |
| | | } |
| | | |
| | | function focus(back) { |
| | | if (!pageBlockEls) |
| | | return; |
| | | var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0]; |
| | | if (e) |
| | | e.focus(); |
| | | } |
| | | |
| | | function center(el, x, y) { |
| | | var p = el.parentNode, s = el.style; |
| | | var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth'); |
| | | var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth'); |
| | | if (x) s.left = l > 0 ? (l+'px') : '0'; |
| | | if (y) s.top = t > 0 ? (t+'px') : '0'; |
| | | } |
| | | |
| | | function sz(el, p) { |
| | | return parseInt($.css(el,p),10)||0; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /*global define:true */ |
| | | if (typeof define === 'function' && define.amd && define.amd.jQuery) { |
| | | define(['jquery'], setup); |
| | | } else { |
| | | setup(jQuery); |
| | | } |
| | | |
| | | })(); |
New file |
| | |
| | | /*! |
| | | * bootstrap-fileinput v5.5.2 |
| | | * http://plugins.krajee.com/file-input |
| | | * |
| | | * Krajee default styling for bootstrap-fileinput. |
| | | * |
| | | * Author: Kartik Visweswaran |
| | | * Copyright: 2014 - 2022, Kartik Visweswaran, Krajee.com |
| | | * |
| | | * Licensed under the BSD-3-Clause |
| | | * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md |
| | | */ |
| | | |
| | | .file-loading input[type=file], |
| | | input[type=file].file-loading { |
| | | width: 0; |
| | | height: 0; |
| | | } |
| | | |
| | | .file-no-browse { |
| | | position: absolute; |
| | | left: 50%; |
| | | bottom: 20%; |
| | | width: 1px; |
| | | height: 1px; |
| | | font-size: 0; |
| | | opacity: 0; |
| | | border: none; |
| | | background: none; |
| | | outline: none; |
| | | box-shadow: none; |
| | | } |
| | | |
| | | .kv-hidden, |
| | | .file-caption-icon, |
| | | .file-zoom-dialog .modal-header:before, |
| | | .file-zoom-dialog .modal-header:after, |
| | | .file-input-new .file-preview, |
| | | .file-input-new .close, |
| | | .file-input-new .glyphicon-file, |
| | | .file-input-new .fileinput-remove-button, |
| | | .file-input-new .fileinput-upload-button, |
| | | .file-input-new .no-browse .input-group-btn, |
| | | .file-input-ajax-new .fileinput-remove-button, |
| | | .file-input-ajax-new .fileinput-upload-button, |
| | | .file-input-ajax-new .no-browse .input-group-btn, |
| | | .hide-content .kv-file-content, |
| | | .is-locked .fileinput-upload-button, |
| | | .is-locked .fileinput-remove-button { |
| | | display: none; |
| | | } |
| | | |
| | | .file-caption .input-group { |
| | | align-items: center; |
| | | } |
| | | |
| | | .btn-file input[type=file], |
| | | .file-caption-icon, |
| | | .file-preview .fileinput-remove, |
| | | .krajee-default .file-thumb-progress, |
| | | .file-zoom-dialog .btn-navigate, |
| | | .file-zoom-dialog .floating-buttons { |
| | | position: absolute; |
| | | } |
| | | |
| | | .file-caption-icon .kv-caption-icon { |
| | | line-height: inherit; |
| | | } |
| | | |
| | | .file-input, |
| | | .file-loading:before, |
| | | .btn-file, |
| | | .file-caption, |
| | | .file-preview, |
| | | .krajee-default.file-preview-frame, |
| | | .krajee-default .file-thumbnail-footer, |
| | | .file-zoom-dialog .modal-dialog { |
| | | position: relative; |
| | | } |
| | | |
| | | .file-error-message pre, |
| | | .file-error-message ul, |
| | | .krajee-default .file-actions, |
| | | .krajee-default .file-other-error { |
| | | text-align: left; |
| | | } |
| | | |
| | | .file-error-message pre, |
| | | .file-error-message ul { |
| | | margin: 0; |
| | | } |
| | | |
| | | .krajee-default .file-drag-handle, |
| | | .krajee-default .file-upload-indicator { |
| | | float: left; |
| | | margin-top: 10px; |
| | | width: 16px; |
| | | height: 16px; |
| | | } |
| | | |
| | | .file-thumb-progress .progress, |
| | | .file-thumb-progress .progress-bar { |
| | | font-family: Verdana, Helvetica, sans-serif; |
| | | font-size: 0.7rem; |
| | | } |
| | | |
| | | .krajee-default .file-thumb-progress .progress, |
| | | .kv-upload-progress .progress { |
| | | background-color: #ccc; |
| | | } |
| | | |
| | | .krajee-default .file-caption-info, |
| | | .krajee-default .file-size-info { |
| | | display: block; |
| | | white-space: nowrap; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | width: 160px; |
| | | height: 15px; |
| | | margin: auto; |
| | | } |
| | | |
| | | .file-zoom-content > .file-object.type-video, |
| | | .file-zoom-content > .file-object.type-flash, |
| | | .file-zoom-content > .file-object.type-image { |
| | | max-width: 100%; |
| | | max-height: 100%; |
| | | width: auto; |
| | | } |
| | | |
| | | .file-zoom-content > .file-object.type-video, |
| | | .file-zoom-content > .file-object.type-flash { |
| | | height: 100%; |
| | | } |
| | | |
| | | .file-zoom-content > .file-object.type-pdf, |
| | | .file-zoom-content > .file-object.type-html, |
| | | .file-zoom-content > .file-object.type-text, |
| | | .file-zoom-content > .file-object.type-default { |
| | | width: 100%; |
| | | } |
| | | |
| | | .file-loading:before { |
| | | content: " Loading..."; |
| | | display: inline-block; |
| | | padding-left: 20px; |
| | | line-height: 16px; |
| | | font-size: 13px; |
| | | font-variant: small-caps; |
| | | color: #999; |
| | | background: transparent url(loading.gif) top left no-repeat; |
| | | } |
| | | |
| | | .file-object { |
| | | margin: 0 0 -5px 0; |
| | | padding: 0; |
| | | } |
| | | |
| | | .btn-file { |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .btn-file input[type=file] { |
| | | top: 0; |
| | | left: 0; |
| | | min-width: 100%; |
| | | min-height: 100%; |
| | | text-align: right; |
| | | opacity: 0; |
| | | background: none repeat scroll 0 0 transparent; |
| | | cursor: inherit; |
| | | display: block; |
| | | } |
| | | |
| | | .btn-file ::-ms-browse { |
| | | font-size: 10000px; |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | |
| | | .file-caption.icon-visible .file-caption-icon { |
| | | display: inline-block; |
| | | } |
| | | |
| | | .file-caption.icon-visible .file-caption-name { |
| | | padding-left: 25px; |
| | | } |
| | | |
| | | .file-caption.icon-visible > .input-group-lg .file-caption-name { |
| | | padding-left: 30px; |
| | | } |
| | | |
| | | .file-caption.icon-visible > .input-group-sm .file-caption-name { |
| | | padding-left: 22px; |
| | | } |
| | | |
| | | .file-caption-name:not(.file-caption-disabled) { |
| | | background-color: transparent; |
| | | } |
| | | |
| | | .file-caption-name.file-processing { |
| | | font-style: italic; |
| | | border-color: #bbb; |
| | | opacity: 0.5; |
| | | } |
| | | |
| | | .file-caption-icon { |
| | | padding: 7px 5px; |
| | | left: 4px; |
| | | } |
| | | |
| | | .input-group-lg .file-caption-icon { |
| | | font-size: 1.25rem; |
| | | } |
| | | |
| | | .input-group-sm .file-caption-icon { |
| | | font-size: 0.875rem; |
| | | padding: 0.25rem; |
| | | } |
| | | |
| | | .file-error-message { |
| | | color: #a94442; |
| | | background-color: #f2dede; |
| | | margin: 5px; |
| | | border: 1px solid #ebccd1; |
| | | border-radius: 4px; |
| | | padding: 15px; |
| | | } |
| | | |
| | | .file-error-message pre { |
| | | margin: 5px 0; |
| | | } |
| | | |
| | | .file-caption-disabled { |
| | | background-color: #eee; |
| | | cursor: not-allowed; |
| | | opacity: 1; |
| | | } |
| | | |
| | | .file-preview { |
| | | border-radius: 5px; |
| | | border: 1px solid #ddd; |
| | | padding: 8px; |
| | | width: 100%; |
| | | margin-bottom: 5px; |
| | | } |
| | | |
| | | .file-preview .btn-xs { |
| | | padding: 1px 5px; |
| | | font-size: 12px; |
| | | line-height: 1.5; |
| | | border-radius: 3px; |
| | | } |
| | | |
| | | .file-preview .fileinput-remove { |
| | | top: 1px; |
| | | right: 1px; |
| | | line-height: 10px; |
| | | } |
| | | |
| | | .file-preview .clickable { |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .file-preview-image { |
| | | font: 40px Impact, Charcoal, sans-serif; |
| | | color: #008000; |
| | | width: auto; |
| | | height: auto; |
| | | max-width: 100%; |
| | | max-height: 100%; |
| | | } |
| | | |
| | | .krajee-default.file-preview-frame { |
| | | margin: 8px; |
| | | border: 1px solid rgba(0, 0, 0, 0.2); |
| | | box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.2); |
| | | padding: 6px; |
| | | float: left; |
| | | text-align: center; |
| | | |
| | | } |
| | | |
| | | .krajee-default.file-preview-frame .kv-file-content { |
| | | width: 213px; |
| | | height: 160px; |
| | | } |
| | | |
| | | .krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered { |
| | | width: 400px; |
| | | } |
| | | |
| | | .krajee-default.file-preview-frame[data-template="audio"] .kv-file-content { |
| | | width: 240px; |
| | | height: 55px; |
| | | } |
| | | |
| | | .krajee-default.file-preview-frame .file-thumbnail-footer { |
| | | height: 70px; |
| | | } |
| | | |
| | | .krajee-default.file-preview-frame:not(.file-preview-error):hover { |
| | | border: 1px solid rgba(0, 0, 0, 0.3); |
| | | box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.4); |
| | | } |
| | | |
| | | .krajee-default .file-preview-text { |
| | | color: #428bca; |
| | | border: 1px solid #ddd; |
| | | outline: none; |
| | | resize: none; |
| | | } |
| | | |
| | | .krajee-default .file-preview-html { |
| | | border: 1px solid #ddd; |
| | | } |
| | | |
| | | .krajee-default .file-other-icon { |
| | | font-size: 6em; |
| | | line-height: 1; |
| | | } |
| | | |
| | | .krajee-default .file-footer-buttons { |
| | | float: right; |
| | | } |
| | | |
| | | .krajee-default .file-footer-caption { |
| | | display: block; |
| | | text-align: center; |
| | | padding-top: 4px; |
| | | font-size: 11px; |
| | | color: #999; |
| | | margin-bottom: 30px; |
| | | } |
| | | |
| | | .file-upload-stats { |
| | | font-size: 10px; |
| | | text-align: center; |
| | | width: 100%; |
| | | } |
| | | |
| | | .kv-upload-progress .file-upload-stats { |
| | | font-size: 12px; |
| | | margin: -10px 0 5px; |
| | | } |
| | | |
| | | .krajee-default .file-preview-error { |
| | | opacity: 0.65; |
| | | box-shadow: none; |
| | | } |
| | | |
| | | .krajee-default .file-thumb-progress { |
| | | top: 37px; |
| | | left: 0; |
| | | right: 0; |
| | | } |
| | | |
| | | .krajee-default.kvsortable-ghost { |
| | | background: #e1edf7; |
| | | border: 2px solid #a1abff; |
| | | } |
| | | |
| | | .krajee-default .file-preview-other:hover { |
| | | opacity: 0.8; |
| | | } |
| | | |
| | | .krajee-default .file-preview-frame:not(.file-preview-error) .file-footer-caption:hover { |
| | | color: #000; |
| | | } |
| | | |
| | | .kv-upload-progress .progress { |
| | | height: 20px; |
| | | margin: 10px 0; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .kv-upload-progress .progress-bar { |
| | | height: 20px; |
| | | font-family: Verdana, Helvetica, sans-serif; |
| | | } |
| | | |
| | | |
| | | /*noinspection CssOverwrittenProperties*/ |
| | | |
| | | .file-zoom-dialog .file-other-icon { |
| | | font-size: 22em; |
| | | font-size: 50vmin; |
| | | } |
| | | |
| | | .file-zoom-dialog .modal-dialog { |
| | | width: auto; |
| | | } |
| | | |
| | | .file-zoom-dialog .modal-header { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | .file-zoom-dialog .btn-navigate { |
| | | margin: 0 0.1rem; |
| | | padding: 0; |
| | | font-size: 1.2rem; |
| | | width: 2.4rem; |
| | | height: 2.4rem; |
| | | top: 50%; |
| | | border-radius: 50%; |
| | | text-align: center; |
| | | } |
| | | |
| | | .btn-navigate * { |
| | | width: auto; |
| | | } |
| | | |
| | | .file-zoom-dialog .floating-buttons { |
| | | top: 5px; |
| | | right: 10px; |
| | | } |
| | | |
| | | .file-zoom-dialog .btn-kv-prev { |
| | | left: 0; |
| | | } |
| | | |
| | | .file-zoom-dialog .btn-kv-next { |
| | | right: 0; |
| | | } |
| | | |
| | | .file-zoom-dialog .kv-zoom-header { |
| | | padding: 0.5rem; |
| | | } |
| | | |
| | | .file-zoom-dialog .kv-zoom-body { |
| | | padding: 0.25rem; |
| | | } |
| | | |
| | | .file-zoom-dialog .kv-zoom-description { |
| | | position: absolute; |
| | | opacity: 0.8; |
| | | font-size: 0.8rem; |
| | | background-color: #1a1a1a; |
| | | padding: 1rem; |
| | | text-align: center; |
| | | border-radius: 0.5rem; |
| | | color: #fff; |
| | | left: 15%; |
| | | right: 15%; |
| | | bottom: 15%; |
| | | } |
| | | |
| | | .file-zoom-dialog .kv-desc-hide { |
| | | float: right; |
| | | color: #fff; |
| | | padding: 0 0.1rem; |
| | | background: none; |
| | | border: none; |
| | | } |
| | | |
| | | .file-zoom-dialog .kv-desc-hide:hover { |
| | | opacity: 0.7; |
| | | } |
| | | |
| | | .file-zoom-dialog .kv-desc-hide:focus { |
| | | opacity: 0.9; |
| | | } |
| | | |
| | | .file-input-new .no-browse .form-control { |
| | | border-top-right-radius: 4px; |
| | | border-bottom-right-radius: 4px; |
| | | } |
| | | |
| | | .file-input-ajax-new .no-browse .form-control { |
| | | border-top-right-radius: 4px; |
| | | border-bottom-right-radius: 4px; |
| | | } |
| | | |
| | | .file-caption { |
| | | width: 100%; |
| | | position: relative; |
| | | } |
| | | |
| | | .file-thumb-loading { |
| | | background: transparent url(loading.gif) no-repeat scroll center center content-box !important; |
| | | } |
| | | |
| | | .file-drop-zone { |
| | | border: 1px dashed #aaa; |
| | | min-height: 260px; |
| | | border-radius: 4px; |
| | | text-align: center; |
| | | vertical-align: middle; |
| | | margin: 12px 15px 12px 12px; |
| | | padding: 5px; |
| | | } |
| | | |
| | | .file-drop-zone.clickable:hover { |
| | | border: 2px dashed #999; |
| | | } |
| | | |
| | | .file-drop-zone.clickable:focus { |
| | | border: 2px solid #5acde2; |
| | | } |
| | | |
| | | .file-drop-zone .file-preview-thumbnails { |
| | | cursor: default; |
| | | } |
| | | |
| | | .file-drop-zone-title { |
| | | color: #aaa; |
| | | font-size: 1.6em; |
| | | text-align: center; |
| | | padding: 85px 10px; |
| | | cursor: default; |
| | | } |
| | | |
| | | .file-highlighted { |
| | | border: 2px dashed #999 !important; |
| | | background-color: #eee; |
| | | } |
| | | |
| | | .file-uploading { |
| | | background: url(loading-sm.gif) no-repeat center bottom 10px; |
| | | opacity: 0.65; |
| | | } |
| | | |
| | | .file-zoom-fullscreen .modal-dialog { |
| | | min-width: 100%; |
| | | margin: 0; |
| | | } |
| | | |
| | | .file-zoom-fullscreen .modal-content { |
| | | border-radius: 0; |
| | | box-shadow: none; |
| | | min-height: 100vh; |
| | | } |
| | | |
| | | .file-zoom-fullscreen .kv-zoom-body { |
| | | overflow-y: auto; |
| | | } |
| | | |
| | | .floating-buttons { |
| | | z-index: 3000; |
| | | } |
| | | |
| | | .floating-buttons .btn-kv { |
| | | margin-left: 3px; |
| | | z-index: 3000; |
| | | } |
| | | |
| | | .kv-zoom-actions { |
| | | min-width: 140px; |
| | | } |
| | | |
| | | .kv-zoom-actions .btn-kv { |
| | | margin-left: 3px; |
| | | } |
| | | |
| | | .file-zoom-content { |
| | | text-align: center; |
| | | white-space: nowrap; |
| | | min-height: 300px; |
| | | } |
| | | |
| | | .file-zoom-content:hover { |
| | | background: transparent; |
| | | } |
| | | |
| | | .file-zoom-content .file-preview-image { |
| | | max-height: 100%; |
| | | } |
| | | |
| | | .file-zoom-content .file-preview-video { |
| | | max-height: 100%; |
| | | } |
| | | |
| | | .file-zoom-content > .file-object.type-image { |
| | | height: auto; |
| | | min-height: inherit; |
| | | } |
| | | |
| | | .file-zoom-content > .file-object.type-audio { |
| | | width: auto; |
| | | height: 30px; |
| | | } |
| | | |
| | | @media (min-width: 576px) { |
| | | .file-zoom-dialog .modal-dialog { |
| | | max-width: 500px; |
| | | } |
| | | } |
| | | |
| | | @media (min-width: 992px) { |
| | | .file-zoom-dialog .modal-lg { |
| | | max-width: 800px; |
| | | } |
| | | } |
| | | |
| | | @media (max-width: 767px) { |
| | | .file-preview-thumbnails { |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | flex-direction: column; |
| | | } |
| | | |
| | | .file-zoom-dialog .modal-header { |
| | | flex-direction: column; |
| | | } |
| | | } |
| | | |
| | | @media (max-width: 350px) { |
| | | .krajee-default.file-preview-frame:not([data-template="audio"]) .kv-file-content { |
| | | width: 160px; |
| | | } |
| | | } |
| | | |
| | | @media (max-width: 420px) { |
| | | .krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered { |
| | | width: 100%; |
| | | } |
| | | } |
| | | |
| | | .file-loading[dir=rtl]:before { |
| | | background: transparent url(loading.gif) top right no-repeat; |
| | | padding-left: 0; |
| | | padding-right: 20px; |
| | | } |
| | | |
| | | .clickable .file-drop-zone-title { |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .file-sortable .file-drag-handle:hover { |
| | | opacity: 0.7; |
| | | } |
| | | |
| | | .file-sortable .file-drag-handle { |
| | | cursor: grab; |
| | | opacity: 1; |
| | | } |
| | | |
| | | .file-grabbing, |
| | | .file-grabbing * { |
| | | cursor: not-allowed !important; |
| | | } |
| | | |
| | | .file-grabbing .file-preview-thumbnails * { |
| | | cursor: grabbing !important; |
| | | } |
| | | |
| | | .file-preview-frame.sortable-chosen { |
| | | background-color: #d9edf7; |
| | | border-color: #17a2b8; |
| | | box-shadow: none !important; |
| | | } |
| | | |
| | | .file-preview .kv-zoom-cache { |
| | | display: none; |
| | | } |
| | | |
| | | .file-preview-other-frame, .file-preview-object, .kv-file-content, .kv-zoom-body { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .btn-kv-rotate, |
| | | .kv-file-rotate { |
| | | display: none; |
| | | } |
| | | |
| | | .rotatable:not(.hide-rotate) .btn-kv-rotate, |
| | | .rotatable:not(.hide-rotate) .kv-file-rotate { |
| | | display: inline-block; |
| | | } |
| | | |
| | | .rotatable .file-zoom-detail, |
| | | .rotatable .kv-file-content, |
| | | .rotatable .kv-file-content > :first-child { |
| | | transform-origin: center center; |
| | | } |
| | | |
| | | .rotate-animate { |
| | | transition: transform 0.3s ease; |
| | | } |
| | | |
| | | .kv-overflow-hidden { |
| | | overflow: hidden; |
| | | } |
New file |
| | |
| | | /*! |
| | | * bootstrap-fileinput v5.5.2 |
| | | * http://plugins.krajee.com/file-input |
| | | * |
| | | * Krajee default styling for bootstrap-fileinput. |
| | | * |
| | | * Author: Kartik Visweswaran |
| | | * Copyright: 2014 - 2022, Kartik Visweswaran, Krajee.com |
| | | * |
| | | * Licensed under the BSD-3-Clause |
| | | * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md |
| | | */ |
| | | .file-loading input[type=file],input[type=file].file-loading{width:0;height:0;}.file-no-browse{position:absolute;left:50%;bottom:20%;width:1px;height:1px;font-size:0;opacity:0;border:none;background:none;outline:none;box-shadow:none;}.kv-hidden,.file-caption-icon,.file-zoom-dialog .modal-header:before,.file-zoom-dialog .modal-header:after,.file-input-new .file-preview,.file-input-new .close,.file-input-new .glyphicon-file,.file-input-new .fileinput-remove-button,.file-input-new .fileinput-upload-button,.file-input-new .no-browse .input-group-btn,.file-input-ajax-new .fileinput-remove-button,.file-input-ajax-new .fileinput-upload-button,.file-input-ajax-new .no-browse .input-group-btn,.hide-content .kv-file-content,.is-locked .fileinput-upload-button,.is-locked .fileinput-remove-button{display:none;}.file-caption .input-group{align-items:center;}.btn-file input[type=file],.file-caption-icon,.file-preview .fileinput-remove,.krajee-default .file-thumb-progress,.file-zoom-dialog .btn-navigate,.file-zoom-dialog .floating-buttons{position:absolute;}.file-caption-icon .kv-caption-icon{line-height:inherit;}.file-input,.file-loading:before,.btn-file,.file-caption,.file-preview,.krajee-default.file-preview-frame,.krajee-default .file-thumbnail-footer,.file-zoom-dialog .modal-dialog{position:relative;}.file-error-message pre,.file-error-message ul,.krajee-default .file-actions,.krajee-default .file-other-error{text-align:left;}.file-error-message pre,.file-error-message ul{margin:0;}.krajee-default .file-drag-handle,.krajee-default .file-upload-indicator{float:left;margin-top:10px;width:16px;height:16px;}.file-thumb-progress .progress,.file-thumb-progress .progress-bar{font-family:Verdana,Helvetica,sans-serif;font-size:0.7rem;}.krajee-default .file-thumb-progress .progress,.kv-upload-progress .progress{background-color:#ccc;}.krajee-default .file-caption-info,.krajee-default .file-size-info{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:160px;height:15px;margin:auto;}.file-zoom-content > .file-object.type-video,.file-zoom-content > .file-object.type-flash,.file-zoom-content > .file-object.type-image{max-width:100%;max-height:100%;width:auto;}.file-zoom-content > .file-object.type-video,.file-zoom-content > .file-object.type-flash{height:100%;}.file-zoom-content > .file-object.type-pdf,.file-zoom-content > .file-object.type-html,.file-zoom-content > .file-object.type-text,.file-zoom-content > .file-object.type-default{width:100%;}.file-loading:before{content:" Loading...";display:inline-block;padding-left:20px;line-height:16px;font-size:13px;font-variant:small-caps;color:#999;background:transparent url(loading.gif) top left no-repeat;}.file-object{margin:0 0 -5px 0;padding:0;}.btn-file{overflow:hidden;}.btn-file input[type=file]{top:0;left:0;min-width:100%;min-height:100%;text-align:right;opacity:0;background:none repeat scroll 0 0 transparent;cursor:inherit;display:block;}.btn-file::-ms-browse{font-size:10000px;width:100%;height:100%;}.file-caption.icon-visible .file-caption-icon{display:inline-block;}.file-caption.icon-visible .file-caption-name{padding-left:25px;}.file-caption.icon-visible > .input-group-lg .file-caption-name{padding-left:30px;}.file-caption.icon-visible > .input-group-sm .file-caption-name{padding-left:22px;}.file-caption-name:not(.file-caption-disabled){background-color:transparent;}.file-caption-name.file-processing{font-style:italic;border-color:#bbb;opacity:0.5;}.file-caption-icon{padding:7px 5px;left:4px;}.input-group-lg .file-caption-icon{font-size:1.25rem;}.input-group-sm .file-caption-icon{font-size:0.875rem;padding:0.25rem;}.file-error-message{color:#a94442;background-color:#f2dede;margin:5px;border:1px solid #ebccd1;border-radius:4px;padding:15px;}.file-error-message pre{margin:5px 0;}.file-caption-disabled{background-color:#eee;cursor:not-allowed;opacity:1;}.file-preview{border-radius:5px;border:1px solid #ddd;padding:8px;width:100%;margin-bottom:5px;}.file-preview .btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px;}.file-preview .fileinput-remove{top:1px;right:1px;line-height:10px;}.file-preview .clickable{cursor:pointer;}.file-preview-image{font:40px Impact,Charcoal,sans-serif;color:#008000;width:auto;height:auto;max-width:100%;max-height:100%;}.krajee-default.file-preview-frame{margin:8px;border:1px solid rgba(0,0,0,0.2);box-shadow:0 0 10px 0 rgba(0,0,0,0.2);padding:6px;float:left;text-align:center;}.krajee-default.file-preview-frame .kv-file-content{width:213px;height:160px;}.krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered{width:400px;}.krajee-default.file-preview-frame[data-template="audio"] .kv-file-content{width:240px;height:55px;}.krajee-default.file-preview-frame .file-thumbnail-footer{height:70px;}.krajee-default.file-preview-frame:not(.file-preview-error):hover{border:1px solid rgba(0,0,0,0.3);box-shadow:0 0 10px 0 rgba(0,0,0,0.4);}.krajee-default .file-preview-text{color:#428bca;border:1px solid #ddd;outline:none;resize:none;}.krajee-default .file-preview-html{border:1px solid #ddd;}.krajee-default .file-other-icon{font-size:6em;line-height:1;}.krajee-default .file-footer-buttons{float:right;}.krajee-default .file-footer-caption{display:block;text-align:center;padding-top:4px;font-size:11px;color:#999;margin-bottom:30px;}.file-upload-stats{font-size:10px;text-align:center;width:100%;}.kv-upload-progress .file-upload-stats{font-size:12px;margin:-10px 0 5px;}.krajee-default .file-preview-error{opacity:0.65;box-shadow:none;}.krajee-default .file-thumb-progress{top:37px;left:0;right:0;}.krajee-default.kvsortable-ghost{background:#e1edf7;border:2px solid #a1abff;}.krajee-default .file-preview-other:hover{opacity:0.8;}.krajee-default .file-preview-frame:not(.file-preview-error) .file-footer-caption:hover{color:#000;}.kv-upload-progress .progress{height:20px;margin:10px 0;overflow:hidden;}.kv-upload-progress .progress-bar{height:20px;font-family:Verdana,Helvetica,sans-serif;}.file-zoom-dialog .file-other-icon{font-size:22em;font-size:50vmin;}.file-zoom-dialog .modal-dialog{width:auto;}.file-zoom-dialog .modal-header{display:flex;align-items:center;justify-content:space-between;}.file-zoom-dialog .btn-navigate{margin:0 0.1rem;padding:0;font-size:1.2rem;width:2.4rem;height:2.4rem;top:50%;border-radius:50%;text-align:center;}.btn-navigate *{width:auto;}.file-zoom-dialog .floating-buttons{top:5px;right:10px;}.file-zoom-dialog .btn-kv-prev{left:0;}.file-zoom-dialog .btn-kv-next{right:0;}.file-zoom-dialog .kv-zoom-header{padding:0.5rem;}.file-zoom-dialog .kv-zoom-body{padding:0.25rem;}.file-zoom-dialog .kv-zoom-description{position:absolute;opacity:0.8;font-size:0.8rem;background-color:#1a1a1a;padding:1rem;text-align:center;border-radius:0.5rem;color:#fff;left:15%;right:15%;bottom:15%;}.file-zoom-dialog .kv-desc-hide{float:right;color:#fff;padding:0 0.1rem;background:none;border:none;}.file-zoom-dialog .kv-desc-hide:hover{opacity:0.7;}.file-zoom-dialog .kv-desc-hide:focus{opacity:0.9;}.file-input-new .no-browse .form-control{border-top-right-radius:4px;border-bottom-right-radius:4px;}.file-input-ajax-new .no-browse .form-control{border-top-right-radius:4px;border-bottom-right-radius:4px;}.file-caption{width:100%;position:relative;}.file-thumb-loading{background:transparent url(loading.gif) no-repeat scroll center center content-box !important;}.file-drop-zone{border:1px dashed #aaa;min-height:260px;border-radius:4px;text-align:center;vertical-align:middle;margin:12px 15px 12px 12px;padding:5px;}.file-drop-zone.clickable:hover{border:2px dashed #999;}.file-drop-zone.clickable:focus{border:2px solid #5acde2;}.file-drop-zone .file-preview-thumbnails{cursor:default;}.file-drop-zone-title{color:#aaa;font-size:1.6em;text-align:center;padding:85px 10px;cursor:default;}.file-highlighted{border:2px dashed #999 !important;background-color:#eee;}.file-uploading{background:url(loading-sm.gif) no-repeat center bottom 10px;opacity:0.65;}.file-zoom-fullscreen .modal-dialog{min-width:100%;margin:0;}.file-zoom-fullscreen .modal-content{border-radius:0;box-shadow:none;min-height:100vh;}.file-zoom-fullscreen .kv-zoom-body{overflow-y:auto;}.floating-buttons{z-index:3000;}.floating-buttons .btn-kv{margin-left:3px;z-index:3000;}.kv-zoom-actions{min-width:140px;}.kv-zoom-actions .btn-kv{margin-left:3px;}.file-zoom-content{text-align:center;white-space:nowrap;min-height:300px;}.file-zoom-content:hover{background:transparent;}.file-zoom-content .file-preview-image{max-height:100%;}.file-zoom-content .file-preview-video{max-height:100%;}.file-zoom-content > .file-object.type-image{height:auto;min-height:inherit;}.file-zoom-content > .file-object.type-audio{width:auto;height:30px;}@media (min-width:576px){.file-zoom-dialog .modal-dialog{max-width:500px;}}@media (min-width:992px){.file-zoom-dialog .modal-lg{max-width:800px;}}@media (max-width:767px){.file-preview-thumbnails{display:flex;justify-content:center;align-items:center;flex-direction:column;}.file-zoom-dialog .modal-header{flex-direction:column;}}@media (max-width:350px){.krajee-default.file-preview-frame:not([data-template="audio"]) .kv-file-content{width:160px;}}@media (max-width:420px){.krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered{width:100%;}}.file-loading[dir=rtl]:before{background:transparent url(loading.gif) top right no-repeat;padding-left:0;padding-right:20px;}.clickable .file-drop-zone-title{cursor:pointer;}.file-sortable .file-drag-handle:hover{opacity:0.7;}.file-sortable .file-drag-handle{cursor:grab;opacity:1;}.file-grabbing,.file-grabbing *{cursor:not-allowed !important;}.file-grabbing .file-preview-thumbnails *{cursor:grabbing !important;}.file-preview-frame.sortable-chosen{background-color:#d9edf7;border-color:#17a2b8;box-shadow:none !important;}.file-preview .kv-zoom-cache{display:none;}.file-preview-other-frame,.file-preview-object,.kv-file-content,.kv-zoom-body{display:flex;align-items:center;justify-content:center;}.btn-kv-rotate,.kv-file-rotate{display:none;}.rotatable:not(.hide-rotate) .btn-kv-rotate,.rotatable:not(.hide-rotate) .kv-file-rotate{display:inline-block;}.rotatable .file-zoom-detail,.rotatable .kv-file-content,.rotatable .kv-file-content >:first-child{transform-origin:center center;}.rotate-animate{transition:transform 0.3s ease;}.kv-overflow-hidden{overflow:hidden;} |
New file |
| | |
| | | /*! |
| | | * bootstrap-fileinput v5.5.2 |
| | | * http://plugins.krajee.com/file-input |
| | | * |
| | | * Author: Kartik Visweswaran |
| | | * Copyright: 2014 - 2022, Kartik Visweswaran, Krajee.com |
| | | * |
| | | * Licensed under the BSD-3-Clause |
| | | * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md |
| | | */ |
| | | (function(factory){'use strict';if(typeof define==='function'&&define.amd){define(['jquery'],factory)}else if(typeof module==='object'&&typeof module.exports==='object'){factory(require('jquery'))}else{factory(window.jQuery)}}(function($){'use strict';$.fn.fileinputLocales={};$.fn.fileinputThemes={};if(!$.fn.fileinputBsVersion){$.fn.fileinputBsVersion=(window.bootstrap&&window.bootstrap.Alert&&window.bootstrap.Alert.VERSION)||(window.Alert&&window.Alert.VERSION)||'3.x.x'}String.prototype.setTokens=function(replacePairs){var str=this.toString(),key,re;for(key in replacePairs){if(replacePairs.hasOwnProperty(key)){re=new RegExp('\{'+key+'\}','g');str=str.replace(re,replacePairs[key])}}return str};if(!Array.prototype.flatMap){Array.prototype.flatMap=function(lambda){return[].concat(this.map(lambda))}}var $h,FileInput;$h={FRAMES:'.kv-preview-thumb',SORT_CSS:'file-sortable',INIT_FLAG:'init-',SCRIPT_SRC:document&&document.currentScript&&document.currentScript.src||null,OBJECT_PARAMS:'<param name="controller" value="true" />\n<param name="allowFullScreen" value="true" />\n<param name="allowScriptAccess" value="always" />\n<param name="autoPlay" value="false" />\n<param name="autoStart" value="false" />\n<param name="quality" value="high" />\n',DEFAULT_PREVIEW:'<div class="file-preview-other">\n<span class="{previewFileIconClass}">{previewFileIcon}</span>\n</div>',MODAL_ID:'kvFileinputModal',MODAL_EVENTS:['show','shown','hide','hidden','loaded'],logMessages:{ajaxError:'{status}: {error}. Error Details: {text}.',badDroppedFiles:'Error scanning dropped files!',badExifParser:'Error loading the piexif.js library. {details}',badInputType:'The input "type" must be set to "file" for initializing the "bootstrap-fileinput" plugin.',exifWarning:'To avoid this warning, either set "autoOrientImage" to "false" OR ensure you have loaded the "piexif.js" library correctly on your page before the "fileinput.js" script.',invalidChunkSize:'Invalid upload chunk size: "{chunkSize}". Resumable uploads are disabled.',invalidThumb:'Invalid thumb frame with id: "{id}".',noResumableSupport:'The browser does not support resumable or chunk uploads.',noUploadUrl:'The "uploadUrl" is not set. Ajax uploads and resumable uploads have been disabled.',retryStatus:'Retrying upload for chunk # {chunk} for {filename}... retry # {retry}.',chunkQueueError:'Could not push task to ajax pool for chunk index # {index}.',resumableMaxRetriesReached:'Maximum resumable ajax retries ({n}) reached.',resumableRetryError:'Could not retry the resumable request (try # {n})... aborting.',resumableAborting:'Aborting / cancelling the resumable request.',resumableRequestError:'Error processing resumable request. {msg}'},objUrl:window.URL||window.webkitURL,getZoomPlaceholder:function(){var src=$h.SCRIPT_SRC,srcPath,zoomVar='?kvTemp__2873389129__=';if(!src){return zoomVar}srcPath=src.substring(0,src.lastIndexOf("/"));return srcPath.substring(0,srcPath.lastIndexOf("/")+1)+'img/loading.gif'+zoomVar},isBs:function(ver){var chk=$.trim(($.fn.fileinputBsVersion||'')+'');ver=parseInt(ver,10);if(!chk){return ver===4}return ver===parseInt(chk.charAt(0),10)},defaultButtonCss:function(fill){return'btn-default btn-'+(fill?'':'outline-')+'secondary'},now:function(){return new Date().getTime()},round:function(num){num=parseFloat(num);return isNaN(num)?0:Math.floor(Math.round(num))},getArray:function(obj){var i,arr=[],len=obj&&obj.length||0;for(i=0;i<len;i++){arr.push(obj[i])}return arr},getFileRelativePath:function(file){return String(file.newPath||file.relativePath||file.webkitRelativePath||$h.getFileName(file)||null)},getFileId:function(file,generateFileId){var relativePath=$h.getFileRelativePath(file);if(typeof generateFileId==='function'){return generateFileId(file)}if(!file){return null}if(!relativePath){return null}return(file.size+'_'+encodeURIComponent(relativePath).replace(/%/g,'_'))},getFrameSelector:function(id,selector){selector=selector||'';return'[id="'+id+'"]'+selector},getZoomSelector:function(id,selector){return $h.getFrameSelector('zoom-'+id,selector)},getFrameElement:function($element,id,selector){return $element.find($h.getFrameSelector(id,selector))},getZoomElement:function($element,id,selector){return $element.find($h.getZoomSelector(id,selector))},getElapsed:function(seconds){var delta=seconds,out='',result={},structure={year:31536000,month:2592000,week:604800,day:86400,hour:3600,minute:60,second:1};$h.getObjectKeys(structure).forEach(function(key){result[key]=Math.floor(delta/structure[key]);delta-=result[key]*structure[key]});$.each(result,function(key,value){if(value>0){out+=(out?' ':'')+value+key.substring(0,1)}});return out},debounce:function(func,delay){var inDebounce;return function(){var args=arguments,context=this;clearTimeout(inDebounce);inDebounce=setTimeout(function(){func.apply(context,args)},delay)}},stopEvent:function(e){e.stopPropagation();e.preventDefault()},getFileName:function(file){return file?(file.fileName||file.name||''):''},createObjectURL:function(data){if($h.objUrl&&$h.objUrl.createObjectURL&&data){return $h.objUrl.createObjectURL(data)}return''},revokeObjectURL:function(data){if($h.objUrl&&$h.objUrl.revokeObjectURL&&data){$h.objUrl.revokeObjectURL(data)}},compare:function(input,str,exact){return input!==undefined&&(exact?input===str:input.match(str))},isIE:function(ver){var div,status;if(navigator.appName!=='Microsoft Internet Explorer'){return false}if(ver===10){return new RegExp('msie\\s'+ver,'i').test(navigator.userAgent)}div=document.createElement('div');div.innerHTML='<!--[if IE '+ver+']> <i></i> <![endif]-->';status=div.getElementsByTagName('i').length;document.body.appendChild(div);div.parentNode.removeChild(div);return status},canOrientImage:function($el){var $img=$(document.createElement('img')).css({width:'1px',height:'1px'}).insertAfter($el),flag=$img.css('image-orientation');$img.remove();return!!flag},canAssignFilesToInput:function(){var input=document.createElement('input');try{input.type='file';input.files=null;return true}catch(err){return false}},getDragDropFolders:function(items){var i,item,len=items?items.length:0,folders=0;if(len>0&&items[0].webkitGetAsEntry()){for(i=0;i<len;i++){item=items[i].webkitGetAsEntry();if(item&&item.isDirectory){folders++}}}return folders},initModal:function($modal){var $body=$('body');if($body.length){$modal.appendTo($body)}},isFunction:function(v){return typeof v==='function'},isEmpty:function(value,trim){if(value===undefined||value===null||value===''){return true}if($h.isString(value)&&trim){return $.trim(value)===''}if($h.isArray(value)){return value.length===0}if($.isPlainObject(value)&&$.isEmptyObject(value)){return true}return false},isArray:function(a){return Array.isArray(a)||Object.prototype.toString.call(a)==='[object Array]'},isString:function(a){return Object.prototype.toString.call(a)==='[object String]'},ifSet:function(needle,haystack,def){def=def||'';return(haystack&&typeof haystack==='object'&&needle in haystack)?haystack[needle]:def},cleanArray:function(arr){if(!(arr instanceof Array)){arr=[]}return arr.filter(function(e){return(e!==undefined&&e!==null)})},spliceArray:function(arr,index,reverseOrder){var i,j=0,out=[],newArr;if(!(arr instanceof Array)){return[]}newArr=$.extend(true,[],arr);if(reverseOrder){newArr.reverse()}for(i=0;i<newArr.length;i++){if(i!==index){out[j]=newArr[i];j++}}if(reverseOrder){out.reverse()}return out},getNum:function(num,def){def=def||0;if(typeof num==='number'){return num}if(typeof num==='string'){num=parseFloat(num)}return isNaN(num)?def:num},hasFileAPISupport:function(){return!!(window.File&&window.FileReader)},hasDragDropSupport:function(){var div=document.createElement('div');return!$h.isIE(9)&&(div.draggable!==undefined||(div.ondragstart!==undefined&&div.ondrop!==undefined))},hasFileUploadSupport:function(){return $h.hasFileAPISupport()&&window.FormData},hasBlobSupport:function(){try{return!!window.Blob&&Boolean(new Blob())}catch(e){return false}},hasArrayBufferViewSupport:function(){try{return new Blob([new Uint8Array(100)]).size===100}catch(e){return false}},hasResumableUploadSupport:function(){return $h.hasFileUploadSupport()&&$h.hasBlobSupport()&&$h.hasArrayBufferViewSupport()&&(!!Blob.prototype.webkitSlice||!!Blob.prototype.mozSlice||!!Blob.prototype.slice||false)},dataURI2Blob:function(dataURI){var BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,canBlob=$h.hasBlobSupport(),byteStr,arrayBuffer,intArray,i,mimeStr,bb,canProceed=(canBlob||BlobBuilder)&&window.atob&&window.ArrayBuffer&&window.Uint8Array;if(!canProceed){return null}if(dataURI.split(',')[0].indexOf('base64')>=0){byteStr=atob(dataURI.split(',')[1])}else{byteStr=decodeURIComponent(dataURI.split(',')[1])}arrayBuffer=new ArrayBuffer(byteStr.length);intArray=new Uint8Array(arrayBuffer);for(i=0;i<byteStr.length;i+=1){intArray[i]=byteStr.charCodeAt(i)}mimeStr=dataURI.split(',')[0].split(':')[1].split(';')[0];if(canBlob){return new Blob([$h.hasArrayBufferViewSupport()?intArray:arrayBuffer],{type:mimeStr})}bb=new BlobBuilder();bb.append(arrayBuffer);return bb.getBlob(mimeStr)},arrayBuffer2String:function(buffer){if(window.TextDecoder){return new TextDecoder('utf-8').decode(buffer)}var array=Array.prototype.slice.apply(new Uint8Array(buffer)),out='',i=0,len,c,char2,char3;len=array.length;while(i<len){c=array[i++];switch(c>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:out+=String.fromCharCode(c);break;case 12:case 13:char2=array[i++];out+=String.fromCharCode(((c&0x1F)<<6)|(char2&0x3F));break;case 14:char2=array[i++];char3=array[i++];out+=String.fromCharCode(((c&0x0F)<<12)|((char2&0x3F)<<6)|((char3&0x3F)<<0));break}}return out},isHtml:function(str){var a=document.createElement('div');a.innerHTML=str;for(var c=a.childNodes,i=c.length;i--;){if(c[i].nodeType===1){return true}}return false},isPdf:function(str){if($h.isEmpty(str)){return false}str=str.toString().trim().replace(/\n/g,' ');if(str.length===0){return false}},isSvg:function(str){if($h.isEmpty(str)){return false}str=str.toString().trim().replace(/\n/g,' ');if(str.length===0){return false}return str.match(/^\s*<\?xml/i)&&(str.match(/<!DOCTYPE svg/i)||str.match(/<svg/i))},getMimeType:function(sign,contents,type){var signature=sign||"";switch(signature){case'ffd8ffe0':case'ffd8ffe1':case'ffd8ffe2':return'image/jpeg';case'89504e47':return'image/png';case'47494638':return'image/gif';case'49492a00':return'image/tiff';case'52494646':return'image/webp';case'41433130':return'image/vnd.dwg';case'66747970':return'video/3gp';case'4f676753':return'video/ogg';case'1a45dfa3':return'video/mkv';case'000001ba':case'000001b3':return'video/mpeg';case'3026b275':return'video/wmv';case'25504446':return'application/pdf';case'25215053':return'application/ps';case'504b0304':case'504b0506':case'504b0508':return'application/zip';case'377abcaf':return'application/7z';case'75737461':return'application/tar';case'7801730d':return'application/dmg';default:switch(signature.substring(0,6)){case'435753':return'application/x-shockwave-flash';case'494433':return'audio/mp3';case'425a68':return'application/bzip';default:switch(signature.substring(0,4)){case'424d':return'image/bmp';case'fffb':return'audio/mp3';case'4d5a':return'application/exe';case'1f9d':case'1fa0':return'application/zip';case'1f8b':return'application/gzip';default:return contents&&!contents.match(/[^\u0000-\u007f]/)?'application/text-plain':type}}}},addCss:function($el,css){$el.removeClass(css).addClass(css)},getElement:function(options,param,value){return($h.isEmpty(options)||$h.isEmpty(options[param]))?value:$(options[param])},createElement:function(str,tag){tag=tag||'div';return $($.parseHTML('<'+tag+'>'+str+'</'+tag+'>'))},uniqId:function(){return(new Date().getTime()+Math.floor(Math.random()*Math.pow(10,15))).toString(36)},cspBuffer:{CSP_ATTRIB:'data-csp-01928735',domElementsStyles:{},stash:function(htmlString){var self=this,outerDom=$.parseHTML('<div>'+htmlString+'</div>'),$el=$(outerDom);$el.find('[style]').each(function(key,elem){var $elem=$(elem),styleDeclaration=$elem[0].style,id=$h.uniqId(),styles={};if(styleDeclaration&&styleDeclaration.length){$(styleDeclaration).each(function(){styles[this]=styleDeclaration[this]});self.domElementsStyles[id]=styles;$elem.removeAttr('style').attr(self.CSP_ATTRIB,id)}});$el.filter('*').removeAttr('style');var values=Object.values?Object.values(outerDom):Object.keys(outerDom).map(function(itm){return outerDom[itm]});return values.flatMap(function(elem){return elem.innerHTML}).join('')},apply:function(domElement){var self=this,$el=$(domElement);$el.find('['+self.CSP_ATTRIB+']').each(function(key,elem){var $elem=$(elem),id=$elem.attr(self.CSP_ATTRIB),styles=self.domElementsStyles[id];if(styles){$elem.css(styles)}$elem.removeAttr(self.CSP_ATTRIB)});self.domElementsStyles={}}},setHtml:function($elem,htmlString){var buf=$h.cspBuffer;$elem.html(buf.stash(htmlString));buf.apply($elem);return $elem},htmlEncode:function(str,undefVal){if(str===undefined){return undefVal||null}return str.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,''')},replaceTags:function(str,tags){var out=str;if(!tags){return out}$.each(tags,function(key,value){if(typeof value==='function'){value=value()}out=out.split(key).join(value)});return out},cleanMemory:function($thumb){var data=$thumb.is('img')?$thumb.attr('src'):$thumb.find('source').attr('src');$h.revokeObjectURL(data)},findFileName:function(filePath){var sepIndex=filePath.lastIndexOf('/');if(sepIndex===-1){sepIndex=filePath.lastIndexOf('\\')}return filePath.split(filePath.substring(sepIndex,sepIndex+1)).pop()},checkFullScreen:function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},toggleFullScreen:function(maximize){var doc=document,de=doc.documentElement,isFullScreen=$h.checkFullScreen();if(de&&maximize&&!isFullScreen){if(de.requestFullscreen){de.requestFullscreen()}else{if(de.msRequestFullscreen){de.msRequestFullscreen()}else{if(de.mozRequestFullScreen){de.mozRequestFullScreen()}else{if(de.webkitRequestFullscreen){de.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}}}}}else{if(isFullScreen){if(doc.exitFullscreen){doc.exitFullscreen()}else{if(doc.msExitFullscreen){doc.msExitFullscreen()}else{if(doc.mozCancelFullScreen){doc.mozCancelFullScreen()}else{if(doc.webkitExitFullscreen){doc.webkitExitFullscreen()}}}}}}},moveArray:function(arr,oldIndex,newIndex,reverseOrder){var newArr=$.extend(true,[],arr);if(reverseOrder){newArr.reverse()}if(newIndex>=newArr.length){var k=newIndex-newArr.length;while((k--)+1){newArr.push(undefined)}}newArr.splice(newIndex,0,newArr.splice(oldIndex,1)[0]);if(reverseOrder){newArr.reverse()}return newArr},closeButton:function(css){css=($h.isBs(5)?'btn-close':'close')+(css?' '+css:'');return'<button type="button" class="'+css+'" aria-label="Close">\n'+($h.isBs(5)?'':' <span aria-hidden="true">×</span>\n')+'</button>'},getRotation:function(value){switch(value){case 2:return'rotateY(180deg)';case 3:return'rotate(180deg)';case 4:return'rotate(180deg) rotateY(180deg)';case 5:return'rotate(270deg) rotateY(180deg)';case 6:return'rotate(90deg)';case 7:return'rotate(90deg) rotateY(180deg)';case 8:return'rotate(270deg)';default:return''}},setTransform:function(el,val){if(!el){return}el.style.transform=val;el.style.webkitTransform=val;el.style['-moz-transform']=val;el.style['-ms-transform']=val;el.style['-o-transform']=val},getObjectKeys:function(obj){var keys=[];if(obj){$.each(obj,function(key){keys.push(key)})}return keys},getObjectSize:function(obj){return $h.getObjectKeys(obj).length},whenAll:function(array){var s=[].slice,resolveValues=arguments.length===1&&$h.isArray(array)?array:s.call(arguments),deferred=$.Deferred(),i,failed=0,value,length=resolveValues.length,remaining=length,rejectContexts,rejectValues,resolveContexts,updateFunc;rejectContexts=rejectValues=resolveContexts=Array(length);updateFunc=function(index,contexts,values){return function(){if(values!==resolveValues){failed++}deferred.notifyWith(contexts[index]=this,values[index]=s.call(arguments));if(!(--remaining)){deferred[(!failed?'resolve':'reject')+'With'](contexts,values)}}};for(i=0;i<length;i++){if((value=resolveValues[i])&&$.isFunction(value.promise)){value.promise().done(updateFunc(i,resolveContexts,resolveValues)).fail(updateFunc(i,rejectContexts,rejectValues))}else{deferred.notifyWith(this,value);--remaining}}if(!remaining){deferred.resolveWith(resolveContexts,resolveValues)}return deferred.promise()}};FileInput=function(element,options){var self=this;self.$element=$(element);self.$parent=self.$element.parent();if(!self._validate()){return}self.isPreviewable=$h.hasFileAPISupport();self.isIE9=$h.isIE(9);self.isIE10=$h.isIE(10);if(self.isPreviewable||self.isIE9){self._init(options);self._listen()}self.$element.removeClass('file-loading')};FileInput.prototype={constructor:FileInput,_cleanup:function(){var self=this;self.reader=null;self.clearFileStack();self.fileBatchCompleted=true;self.isError=false;self.isDuplicateError=false;self.isPersistentError=false;self.cancelling=false;self.paused=false;self.lastProgress=0;self._initAjax()},_isAborted:function(){var self=this;return self.cancelling||self.paused},_initAjax:function(){var self=this,tm=self.taskManager={pool:{},addPool:function(id){return(tm.pool[id]=new tm.TasksPool(id))},getPool:function(id){return tm.pool[id]},addTask:function(id,logic){return new tm.Task(id,logic)},TasksPool:function(id){var tp=this;tp.id=id;tp.cancelled=false;tp.cancelledDeferrer=$.Deferred();tp.tasks={};tp.addTask=function(id,logic){return(tp.tasks[id]=new tm.Task(id,logic))};tp.size=function(){return $h.getObjectSize(tp.tasks)};tp.run=function(maxThreads){var i=0,failed=false,task,tasksList=$h.getObjectKeys(tp.tasks).map(function(key){return tp.tasks[key]}),tasksDone=[],deferred=$.Deferred(),enqueue,callback;if(tp.cancelled){tp.cancelledDeferrer.resolve();return deferred.reject()}if(!maxThreads){var tasksDeferredList=$h.getObjectKeys(tp.tasks).map(function(key){return tp.tasks[key].deferred});$h.whenAll(tasksDeferredList).done(function(){var argv=$h.getArray(arguments);if(!tp.cancelled){deferred.resolve.apply(null,argv);tp.cancelledDeferrer.reject()}else{deferred.reject.apply(null,argv);tp.cancelledDeferrer.resolve()}}).fail(function(){var argv=$h.getArray(arguments);deferred.reject.apply(null,argv);if(!tp.cancelled){tp.cancelledDeferrer.reject()}else{tp.cancelledDeferrer.resolve()}});$.each(tp.tasks,function(id){task=tp.tasks[id];task.run()});return deferred}enqueue=function(task){$.when(task.deferred).fail(function(){failed=true;callback.apply(null,arguments)}).always(callback)};callback=function(){var argv=$h.getArray(arguments);deferred.notify(argv);tasksDone.push(argv);if(tp.cancelled){deferred.reject.apply(null,tasksDone);tp.cancelledDeferrer.resolve();return}if(tasksDone.length===tp.size()){if(failed){deferred.reject.apply(null,tasksDone)}else{deferred.resolve.apply(null,tasksDone)}}if(tasksList.length){task=tasksList.shift();enqueue(task);task.run()}};while(tasksList.length&&i++<maxThreads){task=tasksList.shift();enqueue(task);task.run()}return deferred};tp.cancel=function(){tp.cancelled=true;return tp.cancelledDeferrer}},Task:function(id,logic){var tk=this;tk.id=id;tk.deferred=$.Deferred();tk.logic=logic;tk.context=null;tk.run=function(){var argv=$h.getArray(arguments);argv.unshift(tk.deferred);logic.apply(tk.context,argv);return tk.deferred};tk.runWithContext=function(context){tk.context=context;return tk.run()}}};self.ajaxQueue=[];self.ajaxRequests=[];self.ajaxPool=null;self.ajaxAborted=false},_init:function(options,refreshMode){var self=this,f,$el=self.$element,$cont,t,tmp;self.options=options;self.zoomPlaceholder=$h.getZoomPlaceholder();self.canOrientImage=$h.canOrientImage($el);$.each(options,function(key,value){switch(key){case'minFileCount':case'maxFileCount':case'maxTotalFileCount':case'minFileSize':case'maxFileSize':case'maxFilePreviewSize':case'resizeQuality':case'resizeIfSizeMoreThan':case'progressUploadThreshold':case'initialPreviewCount':case'zoomModalHeight':case'minImageHeight':case'maxImageHeight':case'minImageWidth':case'maxImageWidth':case'bytesToKB':self[key]=$h.getNum(value);break;default:self[key]=value;break}});if(!self.bytesToKB||self.bytesToKB<=0){self.bytesToKB=1024}if(self.errorCloseButton===undefined){self.errorCloseButton=$h.closeButton('kv-error-close'+($h.isBs(5)?' float-end':''))}if(self.maxTotalFileCount>0&&self.maxTotalFileCount<self.maxFileCount){self.maxTotalFileCount=self.maxFileCount}if(self.rtl){tmp=self.previewZoomButtonIcons.prev;self.previewZoomButtonIcons.prev=self.previewZoomButtonIcons.next;self.previewZoomButtonIcons.next=tmp}if(!isNaN(self.maxAjaxThreads)&&self.maxAjaxThreads<self.resumableUploadOptions.maxThreads){self.resumableUploadOptions.maxThreads=self.maxAjaxThreads}self._initFileManager();if(typeof self.autoOrientImage==='function'){self.autoOrientImage=self.autoOrientImage()}if(typeof self.autoOrientImageInitial==='function'){self.autoOrientImageInitial=self.autoOrientImageInitial()}if(!refreshMode){self._cleanup()}self.duplicateErrors=[];self.$form=$el.closest('form');self._initTemplateDefaults();self.uploadFileAttr=!$h.isEmpty($el.attr('name'))?$el.attr('name'):'file_data';t=self._getLayoutTemplate('progress');self.progressTemplate=t.replace('{class}',self.progressClass);self.progressInfoTemplate=t.replace('{class}',self.progressInfoClass);self.progressPauseTemplate=t.replace('{class}',self.progressPauseClass);self.progressCompleteTemplate=t.replace('{class}',self.progressCompleteClass);self.progressErrorTemplate=t.replace('{class}',self.progressErrorClass);self.isDisabled=$el.attr('disabled')||$el.attr('readonly');if(self.isDisabled){$el.attr('disabled',true)}self.isClickable=self.browseOnZoneClick&&self.showPreview&&(self.dropZoneEnabled||!$h.isEmpty(self.defaultPreviewContent));self.isAjaxUpload=$h.hasFileUploadSupport()&&!$h.isEmpty(self.uploadUrl);self.dropZoneEnabled=$h.hasDragDropSupport()&&self.dropZoneEnabled;if(!self.isAjaxUpload){self.dropZoneEnabled=self.dropZoneEnabled&&$h.canAssignFilesToInput()}self.slug=typeof options.slugCallback==='function'?options.slugCallback:self._slugDefault;self.mainTemplate=self.showCaption?self._getLayoutTemplate('main1'):self._getLayoutTemplate('main2');self.captionTemplate=self._getLayoutTemplate('caption');self.previewGenericTemplate=self._getPreviewTemplate('generic');if(!self.imageCanvas&&self.resizeImage&&(self.maxImageWidth||self.maxImageHeight)){self.imageCanvas=document.createElement('canvas');self.imageCanvasContext=self.imageCanvas.getContext('2d')}if($h.isEmpty($el.attr('id'))){$el.attr('id',$h.uniqId())}self.namespace='.fileinput_'+$el.attr('id').replace(/-/g,'_');if(self.$container===undefined){self.$container=self._createContainer()}else{self._refreshContainer()}$cont=self.$container;self.$dropZone=$cont.find('.file-drop-zone');self.$progress=$cont.find('.kv-upload-progress');self.$btnUpload=$cont.find('.fileinput-upload');self.$captionContainer=$h.getElement(options,'elCaptionContainer',$cont.find('.file-caption'));self.$caption=$h.getElement(options,'elCaptionText',$cont.find('.file-caption-name'));if(!$h.isEmpty(self.msgPlaceholder)){f=$el.attr('multiple')?self.filePlural:self.fileSingle;self.$caption.attr('placeholder',self.msgPlaceholder.replace('{files}',f))}self.$captionIcon=self.$captionContainer.find('.file-caption-icon');self.$previewContainer=$h.getElement(options,'elPreviewContainer',$cont.find('.file-preview'));self.$preview=$h.getElement(options,'elPreviewImage',$cont.find('.file-preview-thumbnails'));self.$previewStatus=$h.getElement(options,'elPreviewStatus',$cont.find('.file-preview-status'));self.$errorContainer=$h.getElement(options,'elErrorContainer',self.$previewContainer.find('.kv-fileinput-error'));self._validateDisabled();if(!$h.isEmpty(self.msgErrorClass)){$h.addCss(self.$errorContainer,self.msgErrorClass)}if(!refreshMode){self._resetErrors();self.$errorContainer.hide();self.previewInitId='thumb-'+$el.attr('id');self._initPreviewCache();self._initPreview(true);self._initPreviewActions();if(self.$parent.hasClass('file-loading')){self.$container.insertBefore(self.$parent);self.$parent.remove()}}else{if(!self._errorsExist()){self.$errorContainer.hide()}}self._setFileDropZoneTitle();if($el.attr('disabled')){self.disable()}self._initZoom();if(self.hideThumbnailContent){$h.addCss(self.$preview,'hide-content')}},_initFileManager:function(){var self=this;self.uploadStartTime=$h.now();self.fileManager={stack:{},filesProcessed:[],errors:[],loadedImages:{},totalImages:0,totalFiles:null,totalSize:null,uploadedSize:0,stats:{},bpsLog:[],bps:0,initStats:function(id){var data={started:$h.now()};if(id){self.fileManager.stats[id]=data}else{self.fileManager.stats=data}},getUploadStats:function(id,loaded,total){var fm=self.fileManager,started=id?fm.stats[id]&&fm.stats[id].started||$h.now():self.uploadStartTime,elapsed=($h.now()-started)/1000,bps=Math.ceil(elapsed?loaded/elapsed:0),pendingBytes=total-loaded,out,delay=fm.bpsLog.length?self.bitrateUpdateDelay:0;setTimeout(function(){var i,j=0,n=0,len,beg;fm.bpsLog.push(bps);fm.bpsLog.sort(function(a,b){return a-b});len=fm.bpsLog.length;beg=len>10?len-10:Math.ceil(len/2);for(i=len;i>beg;i--){n=parseFloat(fm.bpsLog[i]);j++}fm.bps=(j>0?n/j:0)*64},delay);out={fileId:id,started:started,elapsed:elapsed,loaded:loaded,total:total,bps:fm.bps,bitrate:self._getSize(fm.bps,false,self.bitRateUnits),pendingBytes:pendingBytes};if(id){fm.stats[id]=out}else{fm.stats=out}return out},exists:function(id){return $.inArray(id,self.fileManager.getIdList())!==-1},count:function(){return self.fileManager.getIdList().length},total:function(){var fm=self.fileManager;if(!fm.totalFiles){fm.totalFiles=fm.count()}return fm.totalFiles},getTotalSize:function(){var fm=self.fileManager;if(fm.totalSize){return fm.totalSize}fm.totalSize=0;$.each(self.getFileStack(),function(id,f){var size=parseFloat(f.size);fm.totalSize+=isNaN(size)?0:size});return fm.totalSize},add:function(file,id){if(!id){id=self.fileManager.getId(file)}if(!id){return}self.fileManager.stack[id]={file:file,name:$h.getFileName(file),relativePath:$h.getFileRelativePath(file),size:file.size,nameFmt:self._getFileName(file,''),sizeFmt:self._getSize(file.size)}},remove:function($thumb){var id=self._getThumbFileId($thumb);self.fileManager.removeFile(id)},removeFile:function(id){var fm=self.fileManager;if(!id){return}delete fm.stack[id];delete fm.loadedImages[id]},move:function(idFrom,idTo){var result={},stack=self.fileManager.stack;if(!idFrom&&!idTo||idFrom===idTo){return}$.each(stack,function(k,v){if(k!==idFrom){result[k]=v}if(k===idTo){result[idFrom]=stack[idFrom]}});self.fileManager.stack=result},list:function(){var files=[];$.each(self.getFileStack(),function(k,v){if(v&&v.file){files.push(v.file)}});return files},isPending:function(id){return $.inArray(id,self.fileManager.filesProcessed)===-1&&self.fileManager.exists(id)},isProcessed:function(){var filesProcessed=true,fm=self.fileManager;$.each(self.getFileStack(),function(id){if(fm.isPending(id)){filesProcessed=false}});return filesProcessed},clear:function(){var fm=self.fileManager;self.isDuplicateError=false;self.isPersistentError=false;fm.totalFiles=null;fm.totalSize=null;fm.uploadedSize=0;fm.stack={};fm.errors=[];fm.filesProcessed=[];fm.stats={};fm.bpsLog=[];fm.bps=0;fm.clearImages()},clearImages:function(){self.fileManager.loadedImages={};self.fileManager.totalImages=0},addImage:function(id,config){self.fileManager.loadedImages[id]=config},removeImage:function(id){delete self.fileManager.loadedImages[id]},getImageIdList:function(){return $h.getObjectKeys(self.fileManager.loadedImages)},getImageCount:function(){return self.fileManager.getImageIdList().length},getId:function(file){return self._getFileId(file)},getIndex:function(id){return self.fileManager.getIdList().indexOf(id)},getThumb:function(id){var $thumb=null;self._getThumbs().each(function(){var $t=$(this);if(self._getThumbFileId($t)===id){$thumb=$t}});return $thumb},getThumbIndex:function($thumb){var id=self._getThumbFileId($thumb);return self.fileManager.getIndex(id)},getIdList:function(){return $h.getObjectKeys(self.fileManager.stack)},getFile:function(id){return self.fileManager.stack[id]||null},getFileName:function(id,fmt){var file=self.fileManager.getFile(id);if(!file){return''}return fmt?(file.nameFmt||''):file.name||''},getFirstFile:function(){var ids=self.fileManager.getIdList(),id=ids&&ids.length?ids[0]:null;return self.fileManager.getFile(id)},setFile:function(id,file){if(self.fileManager.getFile(id)){self.fileManager.stack[id].file=file}else{self.fileManager.add(file,id)}},setProcessed:function(id){self.fileManager.filesProcessed.push(id)},getProgress:function(){var total=self.fileManager.total(),filesProcessed=self.fileManager.filesProcessed.length;if(!total){return 0}return Math.ceil(filesProcessed/total*100)},setProgress:function(id,pct){var f=self.fileManager.getFile(id);if(!isNaN(pct)&&f){f.progress=pct}}}},_setUploadData:function(fd,config){var self=this;$.each(config,function(key,value){var param=self.uploadParamNames[key]||key;if($h.isArray(value)){fd.append(param,value[0],value[1])}else{fd.append(param,value)}})},_initResumableUpload:function(){var self=this,opts=self.resumableUploadOptions,logs=$h.logMessages,rm,fm=self.fileManager;if(!self.enableResumableUpload){return}if(opts.fallback!==false&&typeof opts.fallback!=='function'){opts.fallback=function(s){s._log(logs.noResumableSupport);s.enableResumableUpload=false}}if(!$h.hasResumableUploadSupport()&&opts.fallback!==false){opts.fallback(self);return}if(!self.uploadUrl&&self.enableResumableUpload){self._log(logs.noUploadUrl);self.enableResumableUpload=false;return}opts.chunkSize=parseFloat(opts.chunkSize);if(opts.chunkSize<=0||isNaN(opts.chunkSize)){self._log(logs.invalidChunkSize,{chunkSize:opts.chunkSize});self.enableResumableUpload=false;return}rm=self.resumableManager={init:function(id,f,index){rm.logs=[];rm.stack=[];rm.error='';rm.id=id;rm.file=f.file;rm.fileName=f.name;rm.fileIndex=index;rm.completed=false;rm.lastProgress=0;if(self.showPreview){rm.$thumb=fm.getThumb(id)||null;rm.$progress=rm.$btnDelete=null;if(rm.$thumb&&rm.$thumb.length){rm.$progress=rm.$thumb.find('.file-thumb-progress');rm.$btnDelete=rm.$thumb.find('.kv-file-remove')}}rm.chunkSize=opts.chunkSize*self.bytesToKB;rm.chunkCount=rm.getTotalChunks()},setAjaxError:function(jqXHR,textStatus,errorThrown,isTest){if(jqXHR.responseJSON&&jqXHR.responseJSON.error){errorThrown=jqXHR.responseJSON.error.toString()}if(!isTest){rm.error=errorThrown}if(opts.showErrorLog){self._log(logs.ajaxError,{status:jqXHR.status,error:errorThrown,text:jqXHR.responseText||''})}},reset:function(){rm.stack=[];rm.chunksProcessed={}},setProcessed:function(status){var id=rm.id,msg,$thumb=rm.$thumb,$prog=rm.$progress,hasThumb=$thumb&&$thumb.length,params={id:hasThumb?$thumb.attr('id'):'',index:fm.getIndex(id),fileId:id},tokens,skipErrorsAndProceed=self.resumableUploadOptions.skipErrorsAndProceed;rm.completed=true;rm.lastProgress=0;if(hasThumb){$thumb.removeClass('file-uploading')}if(status==='success'){fm.uploadedSize+=rm.file.size;if(self.showPreview){self._setProgress(101,$prog);self._setThumbStatus($thumb,'Success');self._initUploadSuccess(rm.chunksProcessed[id].data,$thumb)}fm.removeFile(id);delete rm.chunksProcessed[id];self._raise('fileuploaded',[params.id,params.index,params.fileId]);if(fm.isProcessed()){self._setProgress(101)}}else{if(status!=='cancel'){if(self.showPreview){self._setThumbStatus($thumb,'Error');self._setPreviewError($thumb,true);self._setProgress(101,$prog,self.msgProgressError);self._setProgress(101,self.$progress,self.msgProgressError);self.cancelling=!skipErrorsAndProceed}if(!self.$errorContainer.find('li[data-file-id="'+params.fileId+'"]').length){tokens={file:rm.fileName,max:opts.maxRetries,error:rm.error};msg=self.msgResumableUploadRetriesExceeded.setTokens(tokens);$.extend(params,tokens);self._showFileError(msg,params,'filemaxretries');if(skipErrorsAndProceed){fm.removeFile(id);delete rm.chunksProcessed[id];if(fm.isProcessed()){self._setProgress(101)}}}}}if(fm.isProcessed()){rm.reset()}},check:function(){var status=true;$.each(rm.logs,function(index,value){if(!value){status=false;return false}})},processedResumables:function(){var logs=rm.logs,i,count=0;if(!logs||!logs.length){return 0}for(i=0;i<logs.length;i++){if(logs[i]===true){count++}}return count},getUploadedSize:function(){var size=rm.processedResumables()*rm.chunkSize;return size>rm.file.size?rm.file.size:size},getTotalChunks:function(){var chunkSize=parseFloat(rm.chunkSize);if(!isNaN(chunkSize)&&chunkSize>0){return Math.ceil(rm.file.size/chunkSize)}return 0},getProgress:function(){var chunksProcessed=rm.processedResumables(),total=rm.chunkCount;if(total===0){return 0}return Math.ceil(chunksProcessed/total*100)},checkAborted:function(intervalId){if(self._isAborted()){clearInterval(intervalId);self.unlock()}},upload:function(){var ids=fm.getIdList(),flag='new',intervalId;intervalId=setInterval(function(){var id;rm.checkAborted(intervalId);if(flag==='new'){self.lock();flag='processing';id=ids.shift();fm.initStats(id);if(fm.stack[id]){rm.init(id,fm.stack[id],fm.getIndex(id));rm.processUpload()}}if(!fm.isPending(id)&&rm.completed){flag='new'}if(fm.isProcessed()){var $initThumbs=self.$preview.find('.file-preview-initial');if($initThumbs.length){$h.addCss($initThumbs,$h.SORT_CSS);self._initSortable()}clearInterval(intervalId);self._clearFileInput();self.unlock();setTimeout(function(){var data=self.previewCache.data;if(data){self.initialPreview=data.content;self.initialPreviewConfig=data.config;self.initialPreviewThumbTags=data.tags}self._raise('filebatchuploadcomplete',[self.initialPreview,self.initialPreviewConfig,self.initialPreviewThumbTags,self._getExtraData()])},self.processDelay)}},self.processDelay)},uploadResumable:function(){var i,pool,tm=self.taskManager,total=rm.chunkCount;pool=tm.addPool(rm.id);for(i=0;i<total;i++){rm.logs[i]=!!(rm.chunksProcessed[rm.id]&&rm.chunksProcessed[rm.id][i]);if(!rm.logs[i]){rm.pushAjax(i,0)}}pool.run(opts.maxThreads).done(function(){rm.setProcessed('success')}).fail(function(){rm.setProcessed(pool.cancelled?'cancel':'error')})},processUpload:function(){var fd,f,id=rm.id,fnBefore,fnSuccess,fnError,fnComplete,outData;if(!opts.testUrl){rm.uploadResumable();return}fd=new FormData();f=fm.stack[id];self._setUploadData(fd,{fileId:id,fileName:f.fileName,fileSize:f.size,fileRelativePath:f.relativePath,chunkSize:rm.chunkSize,chunkCount:rm.chunkCount});fnBefore=function(jqXHR){outData=self._getOutData(fd,jqXHR);self._raise('filetestbeforesend',[id,fm,rm,outData])};fnSuccess=function(data,textStatus,jqXHR){outData=self._getOutData(fd,jqXHR,data);var pNames=self.uploadParamNames,chunksUploaded=pNames.chunksUploaded||'chunksUploaded',params=[id,fm,rm,outData];if(!data[chunksUploaded]||!$h.isArray(data[chunksUploaded])){self._raise('filetesterror',params)}else{if(!rm.chunksProcessed[id]){rm.chunksProcessed[id]={}}$.each(data[chunksUploaded],function(key,index){rm.logs[index]=true;rm.chunksProcessed[id][index]=true});rm.chunksProcessed[id].data=data;self._raise('filetestsuccess',params)}rm.uploadResumable()};fnError=function(jqXHR,textStatus,errorThrown){outData=self._getOutData(fd,jqXHR);self._raise('filetestajaxerror',[id,fm,rm,outData]);rm.setAjaxError(jqXHR,textStatus,errorThrown,true);rm.uploadResumable()};fnComplete=function(){self._raise('filetestcomplete',[id,fm,rm,self._getOutData(fd)])};self._ajaxSubmit(fnBefore,fnSuccess,fnComplete,fnError,fd,id,rm.fileIndex,opts.testUrl)},pushAjax:function(index,retry){var tm=self.taskManager,pool=tm.getPool(rm.id);pool.addTask(pool.size()+1,function(deferrer){var arr=rm.stack.shift(),index;index=arr[0];if(!rm.chunksProcessed[rm.id]||!rm.chunksProcessed[rm.id][index]){rm.sendAjax(index,arr[1],deferrer)}else{self._log(logs.chunkQueueError,{index:index})}});rm.stack.push([index,retry])},sendAjax:function(index,retry,deferrer){var f,chunkSize=rm.chunkSize,id=rm.id,file=rm.file,$thumb=rm.$thumb,msgs=$h.logMessages,$btnDelete=rm.$btnDelete,logError=function(msg,tokens){if(tokens){msg=msg.setTokens(tokens)}msg=msgs.resumableRequestError.setTokens({msg:msg});self._log(msg);deferrer.reject(msg)};if(rm.chunksProcessed[id]&&rm.chunksProcessed[id][index]){return}if(retry>opts.maxRetries){logError(msgs.resumableMaxRetriesReached,{n:opts.maxRetries});rm.setProcessed('error');return}var fd,outData,fnBefore,fnSuccess,fnError,fnComplete,slice=file.slice?'slice':(file.mozSlice?'mozSlice':(file.webkitSlice?'webkitSlice':'slice')),blob=file[slice](chunkSize*index,chunkSize*(index+1));fd=new FormData();f=fm.stack[id];self._setUploadData(fd,{chunkCount:rm.chunkCount,chunkIndex:index,chunkSize:chunkSize,chunkSizeStart:chunkSize*index,fileBlob:[blob,rm.fileName],fileId:id,fileName:rm.fileName,fileRelativePath:f.relativePath,fileSize:file.size,retryCount:retry});if(rm.$progress&&rm.$progress.length){rm.$progress.show()}fnBefore=function(jqXHR){outData=self._getOutData(fd,jqXHR);if(self.showPreview){if(!$thumb.hasClass('file-preview-success')){self._setThumbStatus($thumb,'Loading');$h.addCss($thumb,'file-uploading')}$btnDelete.attr('disabled',true)}self._raise('filechunkbeforesend',[id,index,retry,fm,rm,outData])};fnSuccess=function(data,textStatus,jqXHR){if(self._isAborted()){logError(msgs.resumableAborting);return}outData=self._getOutData(fd,jqXHR,data);var paramNames=self.uploadParamNames,chunkIndex=paramNames.chunkIndex||'chunkIndex',params=[id,index,retry,fm,rm,outData];if(data.error){if(opts.showErrorLog){self._log(logs.retryStatus,{retry:retry+1,filename:rm.fileName,chunk:index})}self._raise('filechunkerror',params);rm.pushAjax(index,retry+1);rm.error=data.error;logError(data.error)}else{rm.logs[data[chunkIndex]]=true;if(!rm.chunksProcessed[id]){rm.chunksProcessed[id]={}}rm.chunksProcessed[id][data[chunkIndex]]=true;rm.chunksProcessed[id].data=data;deferrer.resolve.call(null,data);self._raise('filechunksuccess',params);rm.check()}};fnError=function(jqXHR,textStatus,errorThrown){if(self._isAborted()){logError(msgs.resumableAborting);return}outData=self._getOutData(fd,jqXHR);rm.setAjaxError(jqXHR,textStatus,errorThrown);self._raise('filechunkajaxerror',[id,index,retry,fm,rm,outData]);rm.pushAjax(index,retry+1);logError(msgs.resumableRetryError,{n:retry-1})};fnComplete=function(){if(!self._isAborted()){self._raise('filechunkcomplete',[id,index,retry,fm,rm,self._getOutData(fd)])}};self._ajaxSubmit(fnBefore,fnSuccess,fnComplete,fnError,fd,id,rm.fileIndex)}};rm.reset()},_initTemplateDefaults:function(){var self=this,tMain1,tMain2,tPreview,tFileIcon,tClose,tCaption,tBtnDefault,tBtnLink,tBtnBrowse,tModalMain,tModal,tProgress,tSize,tFooter,tActions,tActionDelete,tActionUpload,tActionDownload,tActionZoom,tActionDrag,tIndicator,tTagBef,tTagBef1,tTagBef2,tTagAft,tGeneric,tHtml,tImage,tText,tOffice,tGdocs,tVideo,tAudio,tFlash,tObject,tPdf,tOther,tStyle,tZoomCache,vDefaultDim,tActionRotate,tStats,tModalLabel,tDescClose,renderObject=function(type,mime){return'<object class="kv-preview-data file-preview-'+type+'" title="{caption}" data="{data}" type="'+mime+'"'+tStyle+'>\n'+$h.DEFAULT_PREVIEW+'\n</object>\n'},defBtnCss1='btn btn-sm btn-kv '+$h.defaultButtonCss();tMain1='{preview}\n<div class="kv-upload-progress kv-hidden"></div><div class="clearfix"></div>\n<div class="file-caption {class}">\n <div class="input-group {inputGroupClass}">\n {caption}\n<span class="file-caption-icon"></span>\n'+($h.isBs(5)?'':'<div class="input-group-btn input-group-append">\n')+' {remove}\n {cancel}\n {pause}\n {upload}\n {browse}\n'+($h.isBs(5)?'':' </div>\n')+' </div>';'</div>';tMain2='{preview}\n<div class="kv-upload-progress kv-hidden"></div>\n<div class="clearfix"></div>\n<span class="{class}">{remove}\n{cancel}\n{upload}\n{browse}\n</span>';tPreview='<div class="file-preview {class}">\n {close} <div class="{dropClass} clearfix">\n <div class="file-preview-thumbnails clearfix">\n </div>\n <div class="file-preview-status text-center text-success"></div>\n <div class="kv-fileinput-error"></div>\n </div>\n</div>';tClose=$h.closeButton('fileinput-remove');tFileIcon='<i class="glyphicon glyphicon-file"></i>';tCaption='<input readonly class="file-caption-name form-control {class}">\n';tBtnDefault='<button type="{type}" title="{title}" class="{css}" {status} {tabIndexConfig}>{icon} {label}</button>';tBtnLink='<a href="{href}" title="{title}" class="{css}" {status} {tabIndexConfig}>{icon} {label}</a>';tBtnBrowse='<div class="{css}" {status} {tabIndexConfig}>{icon} {label}</div>';tModalLabel=$h.MODAL_ID+'Label';tModalMain='<div id="'+$h.MODAL_ID+'" class="file-zoom-dialog modal fade" aria-labelledby="'+tModalLabel+'" {tabIndexConfig}></div>';tModal='<div class="modal-dialog modal-lg{rtl}" role="document">\n <div class="modal-content">\n <div class="modal-header kv-zoom-header">\n <h6 class="modal-title kv-zoom-title" id="'+tModalLabel+'"><span class="kv-zoom-caption"></span> <span class="kv-zoom-size"></span></h6>\n <div class="kv-zoom-actions">{toggleheader}{fullscreen}{borderless}{close}</div>\n </div>\n <div class="floating-buttons"></div>\n <div class="kv-zoom-body file-zoom-content {zoomFrameClass}"></div>\n{prev} {next}\n <div class="kv-zoom-description"></div>\n </div>\n</div>\n';tDescClose='<button type="button" class="kv-desc-hide" aria-label="Close">{closeIcon}</button>';tProgress='<div class="progress">\n <div class="{class}" role="progressbar" aria-valuenow="{percent}" aria-valuemin="0" aria-valuemax="100" style="width:{percent}%;">\n {status}\n </div>\n</div>{stats}';tStats='<div class="text-primary file-upload-stats"><span class="pending-time">{pendingTime}</span> <span class="upload-speed">{uploadSpeed}</span></div>';tSize=' <samp>({sizeText})</samp>';tFooter='<div class="file-thumbnail-footer">\n <div class="file-footer-caption" title="{caption}">\n <div class="file-caption-info">{caption}</div>\n <div class="file-size-info">{size}</div>\n </div>\n {progress}\n{indicator}\n{actions}\n</div>';tActions='<div class="file-actions">\n <div class="file-footer-buttons">\n {rotate} {download} {upload} {delete} {zoom} {other} </div>\n</div>\n{drag}\n<div class="clearfix"></div>';tActionDelete='<button type="button" class="kv-file-remove {removeClass}" title="{removeTitle}" {dataUrl}{dataKey}>{removeIcon}</button>\n';tActionUpload='<button type="button" class="kv-file-upload {uploadClass}" title="{uploadTitle}">{uploadIcon}</button>';tActionRotate='<button type="button" class="kv-file-rotate {rotateClass}" title="{rotateTitle}">{rotateIcon}</button>';tActionDownload='<a class="kv-file-download {downloadClass}" title="{downloadTitle}" href="{downloadUrl}" download="{caption}" target="_blank">{downloadIcon}</a>';tActionZoom='<button type="button" class="kv-file-zoom {zoomClass}" title="{zoomTitle}">{zoomIcon}</button>';tActionDrag='<span class="file-drag-handle {dragClass}" title="{dragTitle}">{dragIcon}</span>';tIndicator='<div class="file-upload-indicator" title="{indicatorTitle}">{indicator}</div>';tTagBef='<div class="file-preview-frame {frameClass}" id="{previewId}" data-fileindex="{fileindex}" data-fileid="{fileid}" data-filename="{filename}" data-template="{template}" data-zoom="{zoomData}"';tTagBef1=tTagBef+'><div class="kv-file-content">\n';tTagBef2=tTagBef+' title="{caption}"><div class="kv-file-content">\n';tTagAft='</div>{footer}\n{zoomCache}</div>\n';tGeneric='{content}\n';tStyle=' {style}';tHtml=renderObject('html','text/html');tText=renderObject('text','text/plain;charset=UTF-8');tPdf=renderObject('pdf','application/pdf');tImage='<img src="{data}" class="file-preview-image kv-preview-data" title="{title}" alt="{alt}"'+tStyle+'>\n';tOffice='<iframe class="kv-preview-data file-preview-office" src="https://view.officeapps.live.com/op/embed.aspx?src={data}"'+tStyle+'></iframe>';tGdocs='<iframe class="kv-preview-data file-preview-gdocs" src="https://docs.google.com/gview?url={data}&embedded=true"'+tStyle+'></iframe>';tVideo='<video class="kv-preview-data file-preview-video" controls'+tStyle+'>\n<source src="{data}" type="{type}">\n'+$h.DEFAULT_PREVIEW+'\n</video>\n';tAudio='<!--suppress ALL --><audio class="kv-preview-data file-preview-audio" controls'+tStyle+'>\n<source src="{data}" type="{type}">\n'+$h.DEFAULT_PREVIEW+'\n</audio>\n';tFlash='<embed class="kv-preview-data file-preview-flash" src="{data}" type="application/x-shockwave-flash"'+tStyle+'>\n';tObject='<object class="kv-preview-data file-preview-object file-object {typeCss}" data="{data}" type="{type}"'+tStyle+'>\n<param name="movie" value="{caption}" />\n'+$h.OBJECT_PARAMS+' '+$h.DEFAULT_PREVIEW+'\n</object>\n';tOther='<div class="kv-preview-data file-preview-other-frame"'+tStyle+'>\n'+$h.DEFAULT_PREVIEW+'\n</div>\n';tZoomCache='<div class="kv-zoom-cache">{zoomContent}</div>';vDefaultDim={width:'100%',height:'100%','min-height':'480px'};if(self._isPdfRendered()){tPdf=self.pdfRendererTemplate.replace('{renderer}',self._encodeURI(self.pdfRendererUrl))}self.defaults={layoutTemplates:{main1:tMain1,main2:tMain2,preview:tPreview,close:tClose,fileIcon:tFileIcon,caption:tCaption,modalMain:tModalMain,modal:tModal,descriptionClose:tDescClose,progress:tProgress,stats:tStats,size:tSize,footer:tFooter,indicator:tIndicator,actions:tActions,actionDelete:tActionDelete,actionRotate:tActionRotate,actionUpload:tActionUpload,actionDownload:tActionDownload,actionZoom:tActionZoom,actionDrag:tActionDrag,btnDefault:tBtnDefault,btnLink:tBtnLink,btnBrowse:tBtnBrowse,zoomCache:tZoomCache},previewMarkupTags:{tagBefore1:tTagBef1,tagBefore2:tTagBef2,tagAfter:tTagAft},previewContentTemplates:{generic:tGeneric,html:tHtml,image:tImage,text:tText,office:tOffice,gdocs:tGdocs,video:tVideo,audio:tAudio,flash:tFlash,object:tObject,pdf:tPdf,other:tOther},allowedPreviewTypes:['image','html','text','video','audio','flash','pdf','object'],previewTemplates:{},previewSettings:{image:{width:'auto',height:'auto','max-width':'100%','max-height':'100%'},html:{width:'213px',height:'160px'},text:{width:'213px',height:'160px'},office:{width:'213px',height:'160px'},gdocs:{width:'213px',height:'160px'},video:{width:'213px',height:'160px'},audio:{width:'100%',height:'30px'},flash:{width:'213px',height:'160px'},object:{width:'213px',height:'160px'},pdf:{width:'100%',height:'160px','position':'relative'},other:{width:'213px',height:'160px'}},previewSettingsSmall:{image:{width:'auto',height:'auto','max-width':'100%','max-height':'100%'},html:{width:'100%',height:'160px'},text:{width:'100%',height:'160px'},office:{width:'100%',height:'160px'},gdocs:{width:'100%',height:'160px'},video:{width:'100%',height:'auto'},audio:{width:'100%',height:'30px'},flash:{width:'100%',height:'auto'},object:{width:'100%',height:'auto'},pdf:{width:'100%',height:'160px'},other:{width:'100%',height:'160px'}},previewZoomSettings:{image:{width:'auto',height:'auto','max-width':'100%','max-height':'100%'},html:vDefaultDim,text:vDefaultDim,office:{width:'100%',height:'100%','max-width':'100%','min-height':'480px'},gdocs:{width:'100%',height:'100%','max-width':'100%','min-height':'480px'},video:{width:'auto',height:'100%','max-width':'100%'},audio:{width:'100%',height:'30px'},flash:{width:'auto',height:'480px'},object:{width:'auto',height:'100%','max-width':'100%','min-height':'480px'},pdf:vDefaultDim,other:{width:'auto',height:'100%','min-height':'480px'}},mimeTypeAliases:{'video/quicktime':'video/mp4'},fileTypeSettings:{image:function(vType,vName){return($h.compare(vType,'image.*')&&!$h.compare(vType,/(tiff?|wmf)$/i)||$h.compare(vName,/\.(gif|png|jpe?g)$/i))},html:function(vType,vName){return $h.compare(vType,'text/html')||$h.compare(vName,/\.(htm|html)$/i)},office:function(vType,vName){return $h.compare(vType,/(word|excel|powerpoint|office)$/i)||$h.compare(vName,/\.(docx?|xlsx?|pptx?|pps|potx?)$/i)},gdocs:function(vType,vName){return $h.compare(vType,/(word|excel|powerpoint|office|iwork-pages|tiff?)$/i)||$h.compare(vName,/\.(docx?|xlsx?|pptx?|pps|potx?|rtf|ods|odt|pages|ai|dxf|ttf|tiff?|wmf|e?ps)$/i)},text:function(vType,vName){return $h.compare(vType,'text.*')||$h.compare(vName,/\.(xml|javascript)$/i)||$h.compare(vName,/\.(txt|md|nfo|ini|json|php|js|css)$/i)},video:function(vType,vName){return $h.compare(vType,'video.*')&&($h.compare(vType,/(ogg|mp4|mp?g|mov|webm|3gp)$/i)||$h.compare(vName,/\.(og?|mp4|webm|mp?g|mov|3gp)$/i))},audio:function(vType,vName){return $h.compare(vType,'audio.*')&&($h.compare(vName,/(ogg|mp3|mp?g|wav)$/i)||$h.compare(vName,/\.(og?|mp3|mp?g|wav)$/i))},flash:function(vType,vName){return $h.compare(vType,'application/x-shockwave-flash',true)||$h.compare(vName,/\.(swf)$/i)},pdf:function(vType,vName){return $h.compare(vType,'application/pdf',true)||$h.compare(vName,/\.(pdf)$/i)},object:function(){return true},other:function(){return true}},fileActionSettings:{showRemove:true,showUpload:true,showDownload:true,showZoom:true,showDrag:true,showRotate:false,removeIcon:'<i class="glyphicon glyphicon-trash"></i>',removeClass:defBtnCss1,removeErrorClass:'btn btn-sm btn-kv btn-danger',removeTitle:'Remove file',uploadIcon:'<i class="glyphicon glyphicon-upload"></i>',uploadClass:defBtnCss1,uploadTitle:'Upload file',uploadRetryIcon:'<i class="glyphicon glyphicon-repeat"></i>',uploadRetryTitle:'Retry upload',downloadIcon:'<i class="glyphicon glyphicon-download"></i>',downloadClass:defBtnCss1,downloadTitle:'Download file',rotateIcon:'<i class="glyphicon glyphicon-repeat"></i>',rotateClass:defBtnCss1,rotateTitle:'Rotate 90 deg. clockwise',zoomIcon:'<i class="glyphicon glyphicon-zoom-in"></i>',zoomClass:defBtnCss1,zoomTitle:'View Details',dragIcon:'<i class="glyphicon glyphicon-move"></i>',dragClass:'text-primary',dragTitle:'Move / Rearrange',dragSettings:{},indicatorNew:'<i class="glyphicon glyphicon-plus-sign text-warning"></i>',indicatorSuccess:'<i class="glyphicon glyphicon-ok-sign text-success"></i>',indicatorError:'<i class="glyphicon glyphicon-exclamation-sign text-danger"></i>',indicatorLoading:'<i class="glyphicon glyphicon-hourglass text-muted"></i>',indicatorPaused:'<i class="glyphicon glyphicon-pause text-primary"></i>',indicatorNewTitle:'Not uploaded yet',indicatorSuccessTitle:'Uploaded',indicatorErrorTitle:'Upload Error',indicatorLoadingTitle:'Uploading …',indicatorPausedTitle:'Upload Paused'}};$.each(self.defaults,function(key,setting){if(key==='allowedPreviewTypes'){if(self.allowedPreviewTypes===undefined){self.allowedPreviewTypes=setting}return}self[key]=$.extend(true,{},setting,self[key])});self._initPreviewTemplates()},_initPreviewTemplates:function(){var self=this,tags=self.previewMarkupTags,tagBef,tagAft=tags.tagAfter;$.each(self.previewContentTemplates,function(key,value){if($h.isEmpty(self.previewTemplates[key])){tagBef=tags.tagBefore2;if(key==='generic'||key==='image'){tagBef=tags.tagBefore1}if(self._isPdfRendered()&&key==='pdf'){tagBef=tagBef.replace('kv-file-content','kv-file-content kv-pdf-rendered')}self.previewTemplates[key]=tagBef+value+tagAft}})},_initPreviewCache:function(){var self=this;self.previewCache={data:{},init:function(){var content=self.initialPreview;if(content.length>0&&!$h.isArray(content)){content=content.split(self.initialPreviewDelimiter)}self.previewCache.data={content:content,config:self.initialPreviewConfig,tags:self.initialPreviewThumbTags}},count:function(skipNull){if(!self.previewCache.data||!self.previewCache.data.content){return 0}if(skipNull){var chk=self.previewCache.data.content.filter(function(n){return n!==null});return chk.length}return self.previewCache.data.content.length},get:function(i,isDisabled){var ind=$h.INIT_FLAG+i,data=self.previewCache.data,config=data.config[i],content=data.content[i],out,$tmp,cat,ftr,fname,ftype,frameClass,asData=$h.ifSet('previewAsData',config,self.initialPreviewAsData),a=config?{title:config.title||null,alt:config.alt||null}:{title:null,alt:null},parseTemplate=function(cat,dat,fname,ftype,ftr,ind,fclass,t){var fc=' file-preview-initial '+$h.SORT_CSS+(fclass?' '+fclass:''),id=self.previewInitId+'-'+ind,fileId=config&&config.fileId||id;return self._generatePreviewTemplate(cat,dat,fname,ftype,id,fileId,false,null,null,fc,ftr,ind,t,a,config&&config.zoomData||dat)};if(!content||!content.length){return''}isDisabled=isDisabled===undefined?true:isDisabled;cat=$h.ifSet('type',config,self.initialPreviewFileType||'generic');fname=$h.ifSet('filename',config,$h.ifSet('caption',config));ftype=$h.ifSet('filetype',config,cat);ftr=self.previewCache.footer(i,isDisabled,(config&&config.size||null));frameClass=$h.ifSet('frameClass',config);if(asData){out=parseTemplate(cat,content,fname,ftype,ftr,ind,frameClass)}else{out=parseTemplate('generic',content,fname,ftype,ftr,ind,frameClass,cat).setTokens({'content':data.content[i]})}if(data.tags.length&&data.tags[i]){out=$h.replaceTags(out,data.tags[i])}if(!$h.isEmpty(config)&&!$h.isEmpty(config.frameAttr)){$tmp=$h.createElement(out);$tmp.find('.file-preview-initial').attr(config.frameAttr);out=$tmp.html();$tmp.remove()}return out},clean:function(data){data.content=$h.cleanArray(data.content);data.config=$h.cleanArray(data.config);data.tags=$h.cleanArray(data.tags);self.previewCache.data=data},add:function(content,config,tags,append){var data=self.previewCache.data,index;if(!content||!content.length){return 0}index=content.length-1;if(!$h.isArray(content)){content=content.split(self.initialPreviewDelimiter)}if(append&&data.content){index=data.content.push(content[0])-1;data.config[index]=config;data.tags[index]=tags}else{data.content=content;data.config=config;data.tags=tags}self.previewCache.clean(data);return index},set:function(content,config,tags,append){var data=self.previewCache.data,i,chk;if(!content||!content.length){return}if(!$h.isArray(content)){content=content.split(self.initialPreviewDelimiter)}chk=content.filter(function(n){return n!==null});if(!chk.length){return}if(data.content===undefined){data.content=[]}if(data.config===undefined){data.config=[]}if(data.tags===undefined){data.tags=[]}if(append){for(i=0;i<content.length;i++){if(content[i]){data.content.push(content[i])}}for(i=0;i<config.length;i++){if(config[i]){data.config.push(config[i])}}for(i=0;i<tags.length;i++){if(tags[i]){data.tags.push(tags[i])}}}else{data.content=content;data.config=config;data.tags=tags}self.previewCache.clean(data)},unset:function(index){var chk=self.previewCache.count(),rev=self.reversePreviewOrder;if(!chk){return}if(chk===1){self.previewCache.data.content=[];self.previewCache.data.config=[];self.previewCache.data.tags=[];self.initialPreview=[];self.initialPreviewConfig=[];self.initialPreviewThumbTags=[];return}self.previewCache.data.content=$h.spliceArray(self.previewCache.data.content,index,rev);self.previewCache.data.config=$h.spliceArray(self.previewCache.data.config,index,rev);self.previewCache.data.tags=$h.spliceArray(self.previewCache.data.tags,index,rev);var data=$.extend(true,{},self.previewCache.data);self.previewCache.clean(data)},out:function(){var html='',caption,len=self.previewCache.count(),i,content;if(len===0){return{content:'',caption:''}}for(i=0;i<len;i++){content=self.previewCache.get(i);html=self.reversePreviewOrder?(content+html):(html+content)}caption=self._getMsgSelected(len);return{content:html,caption:caption}},footer:function(i,isDisabled,size){var data=self.previewCache.data||{};if($h.isEmpty(data.content)){return''}if($h.isEmpty(data.config)||$h.isEmpty(data.config[i])){data.config[i]={}}isDisabled=isDisabled===undefined?true:isDisabled;var config=data.config[i],caption=$h.ifSet('caption',config),a,width=$h.ifSet('width',config,'auto'),url=$h.ifSet('url',config,false),key=$h.ifSet('key',config,null),fileId=$h.ifSet('fileId',config,null),fs=self.fileActionSettings,initPreviewShowDel=self.initialPreviewShowDelete||false,downloadInitialUrl=!self.initialPreviewDownloadUrl?'':self.initialPreviewDownloadUrl+'?key='+key+(fileId?'&fileId='+fileId:''),dUrl=config.downloadUrl||downloadInitialUrl,dFil=config.filename||config.caption||'',initPreviewShowDwl=!!(dUrl),sDel=$h.ifSet('showRemove',config,initPreviewShowDel),sRot=$h.ifSet('showRotate',config,$h.ifSet('showRotate',fs,true)),sDwl=$h.ifSet('showDownload',config,$h.ifSet('showDownload',fs,initPreviewShowDwl)),sZm=$h.ifSet('showZoom',config,$h.ifSet('showZoom',fs,true)),sDrg=$h.ifSet('showDrag',config,$h.ifSet('showDrag',fs,true)),dis=(url===false)&&isDisabled;sDwl=sDwl&&config.downloadUrl!==false&&!!dUrl;a=self._renderFileActions(config,false,sDwl,sDel,sRot,sZm,sDrg,dis,url,key,true,dUrl,dFil);return self._getLayoutTemplate('footer').setTokens({'progress':self._renderThumbProgress(),'actions':a,'caption':caption,'size':self._getSize(size),'width':width,'indicator':''})}};self.previewCache.init()},_isPdfRendered:function(){var self=this,useLib=self.usePdfRenderer,flag=typeof useLib==='function'?useLib():!!useLib;return flag&&self.pdfRendererUrl},_handler:function($el,event,callback){var self=this,ns=self.namespace,ev=event.split(' ').join(ns+' ')+ns;if(!$el||!$el.length){return}$el.off(ev).on(ev,callback)},_encodeURI:function(vUrl){var self=this;return self.encodeUrl?encodeURI(vUrl):vUrl},_log:function(msg,tokens){var self=this,id=self.$element.attr('id');if(!self.showConsoleLogs){return}if(id){msg='"'+id+'": '+msg}msg='bootstrap-fileinput: '+msg;if(typeof tokens==='object'){msg=msg.setTokens(tokens)}if(window.console&&typeof window.console.log!=='undefined'){window.console.log(msg)}else{window.alert(msg)}},_validate:function(){var self=this,status=self.$element.attr('type')==='file';if(!status){self._log($h.logMessages.badInputType)}return status},_errorsExist:function(){var self=this,$err,$errList=self.$errorContainer.find('li');if($errList.length){return true}$err=$h.createElement(self.$errorContainer.html());$err.find('.kv-error-close').remove();$err.find('ul').remove();return!!$.trim($err.text()).length},_errorHandler:function(evt,caption){var self=this,err=evt.target.error,showError=function(msg){self._showError(msg.replace('{name}',caption))};if(err.code===err.NOT_FOUND_ERR){showError(self.msgFileNotFound)}else{if(err.code===err.SECURITY_ERR){showError(self.msgFileSecured)}else{if(err.code===err.NOT_READABLE_ERR){showError(self.msgFileNotReadable)}else{if(err.code===err.ABORT_ERR){showError(self.msgFilePreviewAborted)}else{showError(self.msgFilePreviewError)}}}}},_addError:function(msg){var self=this,$error=self.$errorContainer;if(msg&&$error.length){$h.setHtml($error,self.errorCloseButton+msg);self._handler($error.find('.kv-error-close'),'click',function(){setTimeout(function(){if(self.showPreview&&!self.getFrames().length){self.clear()}$error.fadeOut('slow')},self.processDelay)})}},_setValidationError:function(css){var self=this;css=(css?css+' ':'')+'has-error';self.$container.removeClass(css).addClass('has-error');$h.addCss(self.$caption,'is-invalid')},_resetErrors:function(fade){var self=this,$error=self.$errorContainer,history=self.resumableUploadOptions.retainErrorHistory;if(self.isPersistentError||(self.enableResumableUpload&&history&&!self.clearInput)){return}self.clearInput=false;self.isError=false;self.$container.removeClass('has-error');self.$caption.removeClass('is-invalid is-valid file-processing');$error.html('');if(fade){$error.fadeOut('slow')}else{$error.hide()}},_showFolderError:function(folders){var self=this,$error=self.$errorContainer,msg;if(!folders){return}if(!self.isAjaxUpload){self._clearFileInput()}msg=self.msgFoldersNotAllowed.replace('{n}',folders);self._addError(msg);self._setValidationError();$error.fadeIn(self.fadeDelay);self._raise('filefoldererror',[folders,msg])},showUserError:function(msg,params,retainErrorHistory){var self=this,fileName;if(!self.uploadInitiated){return}if(!params||!params.fileId){if(!retainErrorHistory){self.$errorContainer.html('')}}else{if(!retainErrorHistory){self.$errorContainer.find('[data-file-id="'+params.fileId+'"]').remove()}fileName=self.fileManager.getFileName(params.fileId);if(fileName){msg='<b>'+fileName+':</b> '+msg}}self._showFileError(msg,params,'fileusererror')},_showFileError:function(msg,params,event){var self=this,$error=self.$errorContainer,ev=event||'fileuploaderror',fId=params&¶ms.fileId||'',e=params&¶ms.id?'<li data-thumb-id="'+params.id+'" data-file-id="'+fId+'">'+msg+'</li>':'<li>'+msg+'</li>';if($error.find('ul').length===0){self._addError('<ul>'+e+'</ul>')}else{$error.find('ul').append(e)}$error.fadeIn(self.fadeDelay);self._raise(ev,[params,msg]);self._setValidationError('file-input-new');return true},_showError:function(msg,params,event){var self=this,$error=self.$errorContainer,ev=event||'fileerror';params=params||{};params.reader=self.reader;self._addError(msg);$error.fadeIn(self.fadeDelay);self._raise(ev,[params,msg]);if(!self.isAjaxUpload){self._clearFileInput()}self._setValidationError('file-input-new');self.$btnUpload.attr('disabled',true);return true},_noFilesError:function(params){var self=this,label=self.minFileCount>1?self.filePlural:self.fileSingle,msg=self.msgFilesTooLess.replace('{n}',self.minFileCount).replace('{files}',label),$error=self.$errorContainer;msg='<li>'+msg+'</li>';if($error.find('ul').length===0){self._addError('<ul>'+msg+'</ul>')}else{$error.find('ul').append(msg)}self.isError=true;self._updateFileDetails(0);$error.fadeIn(self.fadeDelay);self._raise('fileerror',[params,msg]);self._clearFileInput();self._setValidationError()},_parseError:function(operation,jqXHR,errorThrown,fileName){var self=this,errMsg=$.trim(errorThrown+''),textPre,errText,text;errText=jqXHR.responseJSON&&jqXHR.responseJSON.error?jqXHR.responseJSON.error.toString():'';text=errText?errText:jqXHR.responseText;if(self.cancelling&&self.msgUploadAborted){errMsg=self.msgUploadAborted}if(self.showAjaxErrorDetails&&text){if(errText){errMsg=$.trim(errText+'')}else{text=$.trim(text.replace(/\n\s*\n/g,'\n'));textPre=text.length?'<pre>'+text+'</pre>':'';errMsg+=errMsg?textPre:text}}if(!errMsg){errMsg=self.msgAjaxError.replace('{operation}',operation)}self.cancelling=false;return fileName?'<b>'+fileName+': </b>'+errMsg:errMsg},_parseFileType:function(type,name){var self=this,isValid,vType,cat,i,types=self.allowedPreviewTypes||[];if(type==='application/text-plain'){return'text'}for(i=0;i<types.length;i++){cat=types[i];isValid=self.fileTypeSettings[cat];vType=isValid(type,name)?cat:'';if(!$h.isEmpty(vType)){return vType}}return'other'},_getPreviewIcon:function(fname){var self=this,ext,out=null;if(fname&&fname.indexOf('.')>-1){ext=fname.split('.').pop();if(self.previewFileIconSettings){out=self.previewFileIconSettings[ext]||self.previewFileIconSettings[ext.toLowerCase()]||null}if(self.previewFileExtSettings){$.each(self.previewFileExtSettings,function(key,func){if(self.previewFileIconSettings[key]&&func(ext)){out=self.previewFileIconSettings[key];return}})}}return out||self.previewFileIcon},_parseFilePreviewIcon:function(content,fname){var self=this,icn=self._getPreviewIcon(fname),out=content;if(out.indexOf('{previewFileIcon}')>-1){out=out.setTokens({'previewFileIconClass':self.previewFileIconClass,'previewFileIcon':icn})}return out},_raise:function(event,params){var self=this,e=$.Event(event);if(params!==undefined){self.$element.trigger(e,params)}else{self.$element.trigger(e)}var out=e.result,isAborted=out===false;if(e.isDefaultPrevented()||isAborted){return false}if(e.type==='filebatchpreupload'&&(out||isAborted)){self.ajaxAborted=out;return false}switch(event){case'filebatchuploadcomplete':case'filebatchuploadsuccess':case'fileuploaded':case'fileclear':case'filecleared':case'filereset':case'fileerror':case'filefoldererror':case'filecustomerror':case'filesuccessremove':break;default:if(!self.ajaxAborted){self.ajaxAborted=out}break}return true},_listenFullScreen:function(isFullScreen){var self=this,$modal=self.$modal,$btnFull,$btnBord;if(!$modal||!$modal.length){return}$btnFull=$modal&&$modal.find('.btn-kv-fullscreen');$btnBord=$modal&&$modal.find('.btn-kv-borderless');if(!$btnFull.length||!$btnBord.length){return}$btnFull.removeClass('active').attr('aria-pressed','false');$btnBord.removeClass('active').attr('aria-pressed','false');if(isFullScreen){$btnFull.addClass('active').attr('aria-pressed','true')}else{$btnBord.addClass('active').attr('aria-pressed','true')}if($modal.hasClass('file-zoom-fullscreen')){self._maximizeZoomDialog()}else{if(isFullScreen){self._maximizeZoomDialog()}else{$btnBord.removeClass('active').attr('aria-pressed','false')}}},_listen:function(){var self=this,$el=self.$element,$form=self.$form,$cont=self.$container,fullScreenEv;self._handler($el,'click',function(e){self._initFileSelected();if($el.hasClass('file-no-browse')){if($el.data('zoneClicked')){$el.data('zoneClicked',false)}else{e.preventDefault()}}});self._handler($el,'change',$.proxy(self._change,self));self._handler(self.$caption,'paste',$.proxy(self.paste,self));if(self.showBrowse){self._handler(self.$btnFile,'click',$.proxy(self._browse,self));self._handler(self.$btnFile,'keypress',function(e){var keycode=e.keyCode||e.which;if(keycode===13){$el.trigger('click');self._browse(e)}})}self._handler($cont.find('.fileinput-remove:not([disabled])'),'click',$.proxy(self.clear,self));self._handler($cont.find('.fileinput-cancel'),'click',$.proxy(self.cancel,self));self._handler($cont.find('.fileinput-pause'),'click',$.proxy(self.pause,self));self._initDragDrop();self._handler($form,'reset',$.proxy(self.clear,self));if(!self.isAjaxUpload){self._handler($form,'submit',$.proxy(self._submitForm,self))}self._handler(self.$container.find('.fileinput-upload'),'click',$.proxy(self._uploadClick,self));self._handler($(window),'resize',function(){self._listenFullScreen(screen.width===window.innerWidth&&screen.height===window.innerHeight)});fullScreenEv='webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange';self._handler($(document),fullScreenEv,function(){self._listenFullScreen($h.checkFullScreen())});self.$caption.on('focus',function(){self.$captionContainer.focus()});self._autoFitContent();self._initClickable();self._refreshPreview()},_autoFitContent:function(){var width=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,self=this,config=width<400?(self.previewSettingsSmall||self.defaults.previewSettingsSmall):(self.previewSettings||self.defaults.previewSettings),sel;$.each(config,function(cat,settings){sel='.file-preview-frame .file-preview-'+cat;self.$preview.find(sel+'.kv-preview-data,'+sel+' .kv-preview-data').css(settings)})},_scanDroppedItems:function(item,files,path){path=path||'';var self=this,i,dirReader,readDir,errorHandler=function(e){self._log($h.logMessages.badDroppedFiles);self._log(e)};if(item.isFile){item.file(function(file){if(path){file.newPath=path+file.name}files.push(file)},errorHandler)}else{if(item.isDirectory){dirReader=item.createReader();readDir=function(){dirReader.readEntries(function(entries){if(entries&&entries.length>0){for(i=0;i<entries.length;i++){self._scanDroppedItems(entries[i],files,path+item.name+'/')}readDir()}return null},errorHandler)};readDir()}}},_initDragDrop:function(){var self=this,$zone=self.$dropZone;if(self.dropZoneEnabled&&self.showPreview){self._handler($zone,'dragenter dragover',$.proxy(self._zoneDragEnter,self));self._handler($zone,'dragleave',$.proxy(self._zoneDragLeave,self));self._handler($zone,'drop',$.proxy(self._zoneDrop,self));self._handler($(document),'dragenter dragover drop',self._zoneDragDropInit)}},_zoneDragDropInit:function(e){e.stopPropagation();e.preventDefault()},_zoneDragEnter:function(e){var self=this,dt=e.originalEvent.dataTransfer,hasFiles=$.inArray('Files',dt.types)>-1;self._zoneDragDropInit(e);if(self.isDisabled||!hasFiles){dt.effectAllowed='none';dt.dropEffect='none';return}dt.dropEffect='copy';if(self._raise('fileDragEnter',{'sourceEvent':e,'files':dt.types.Files})){$h.addCss(self.$dropZone,'file-highlighted')}},_zoneDragLeave:function(e){var self=this;self._zoneDragDropInit(e);if(self.isDisabled){return}if(self._raise('fileDragLeave',{'sourceEvent':e})){self.$dropZone.removeClass('file-highlighted')}},_dropFiles:function(e,files){var self=this,$el=self.$element;if(!self.isAjaxUpload){self.changeTriggered=true;$el.get(0).files=files;setTimeout(function(){self.changeTriggered=false;$el.trigger('change'+self.namespace)},self.processDelay)}else{self._change(e,files)}self.$dropZone.removeClass('file-highlighted')},_zoneDrop:function(e){var self=this,i,$el=self.$element,dt=e.originalEvent.dataTransfer,files=dt.files,items=dt.items,folders=$h.getDragDropFolders(items);e.preventDefault();if(self.isDisabled||$h.isEmpty(files)){return}if(!self._raise('fileDragDrop',{'sourceEvent':e,'files':files})){return}if(folders>0){if(!self.isAjaxUpload){self._showFolderError(folders);return}files=[];for(i=0;i<items.length;i++){var item=items[i].webkitGetAsEntry();if(item){self._scanDroppedItems(item,files)}}setTimeout(function(){self._dropFiles(e,files)},500)}else{self._dropFiles(e,files)}},_uploadClick:function(e){var self=this,$btn=self.$container.find('.fileinput-upload'),$form,isEnabled=!$btn.hasClass('disabled')&&$h.isEmpty($btn.attr('disabled'));if(e&&e.isDefaultPrevented()){return}if(!self.isAjaxUpload){if(isEnabled&&$btn.attr('type')!=='submit'){e.preventDefault();$form=$btn.closest('form');if($form.length){$form.trigger('submit')}}return}e.preventDefault();if(isEnabled){self.upload()}},_submitForm:function(){var self=this;return self._isFileSelectionValid()&&!self._abort({})},_clearPreview:function(){var self=this,$thumbs=self.showUploadedThumbs?self.getFrames(':not(.file-preview-success)'):self.getFrames();$thumbs.each(function(){var $thumb=$(this);$thumb.remove()});if(!self.getFrames().length||!self.showPreview){self._resetUpload()}self._validateDefaultPreview()},_initSortable:function(){var self=this,$el=self.$preview,settings,selector='.'+$h.SORT_CSS,$cont,$body=$('body'),$html=$('html'),rev=self.reversePreviewOrder,Sortable=window.Sortable,beginGrab,endGrab;if(!Sortable||$el.find(selector).length===0){return}$cont=$body.length?$body:($html.length?$html:self.$container);beginGrab=function(){$cont.addClass('file-grabbing')};endGrab=function(){$cont.removeClass('file-grabbing')};settings={handle:'.drag-handle-init',dataIdAttr:'data-fileid',animation:600,draggable:selector,scroll:false,forceFallback:true,onChoose:beginGrab,onStart:beginGrab,onUnchoose:endGrab,onEnd:endGrab,onSort:function(e){var oldIndex=e.oldIndex,newIndex=e.newIndex,i=0,len=self.initialPreviewConfig.length,exceedsLast=len>0&&newIndex>=len,$item=$(e.item),$first;if(exceedsLast){newIndex=len-1}self.initialPreview=$h.moveArray(self.initialPreview,oldIndex,newIndex,rev);self.initialPreviewConfig=$h.moveArray(self.initialPreviewConfig,oldIndex,newIndex,rev);self.previewCache.init();self.getFrames('.file-preview-initial').each(function(){$(this).attr('data-fileindex',$h.INIT_FLAG+i);i++});if(exceedsLast){$first=self.getFrames(':not(.file-preview-initial):first');if($first.length){$item.slideUp(function(){$item.insertBefore($first).slideDown()})}}self._raise('filesorted',{previewId:$item.attr('id'),'oldIndex':oldIndex,'newIndex':newIndex,stack:self.initialPreviewConfig})},};$.extend(true,settings,self.fileActionSettings.dragSettings);if(self.sortable){self.sortable.destroy()}self.sortable=Sortable.create($el[0],settings)},_setPreviewContent:function(content){var self=this;$h.setHtml(self.$preview,content);self._autoFitContent()},_initPreviewImageOrientations:function(){var self=this,i=0,canOrientImage=self.canOrientImage;if(!self.autoOrientImageInitial&&!canOrientImage){return}self.getFrames('.file-preview-initial').each(function(){var $thumb=$(this),$img,$zoomImg,id,config=self.initialPreviewConfig[i];if(config&&config.exif&&config.exif.Orientation){id=$thumb.attr('id');$img=$thumb.find('>.kv-file-content img');$zoomImg=self._getZoom(id,' >.kv-file-content img');if(canOrientImage){$img.css('image-orientation',(self.autoOrientImageInitial?'from-image':'none'))}else{self.setImageOrientation($img,$zoomImg,config.exif.Orientation,$thumb)}}i++})},_initPreview:function(isInit){var self=this,cap=self.initialCaption||'',out;if(!self.previewCache.count(true)){self._clearPreview();if(isInit){self._setCaption(cap)}else{self._initCaption()}return}out=self.previewCache.out();cap=isInit&&self.initialCaption?self.initialCaption:out.caption;self._setPreviewContent(out.content);self._setInitThumbAttr();self._setCaption(cap);self._initSortable();if(!$h.isEmpty(out.content)){self.$container.removeClass('file-input-new')}self._initPreviewImageOrientations()},_getZoomButton:function(type){var self=this,label=self.previewZoomButtonIcons[type],css=self.previewZoomButtonClasses[type],title=' title="'+(self.previewZoomButtonTitles[type]||'')+'" ',tag=$h.isBs(5)?'bs-':'',params=title+(type==='close'?' data-'+tag+'dismiss="modal" aria-hidden="true"':'');if(type==='fullscreen'||type==='borderless'||type==='toggleheader'){params+=' data-toggle="button" aria-pressed="false" autocomplete="off"'}return'<button type="button" class="'+css+' btn-kv-'+type+'"'+params+'>'+label+'</button>'},_getModalContent:function(){var self=this;return self._getLayoutTemplate('modal').setTokens({'rtl':self.rtl?' kv-rtl':'','zoomFrameClass':self.frameClass,'prev':self._getZoomButton('prev'),'next':self._getZoomButton('next'),'rotate':self._getZoomButton('rotate'),'toggleheader':self._getZoomButton('toggleheader'),'fullscreen':self._getZoomButton('fullscreen'),'borderless':self._getZoomButton('borderless'),'close':self._getZoomButton('close')})},_listenModalEvent:function(event){var self=this,$modal=self.$modal,getParams=function(e){return{sourceEvent:e,previewId:$modal.data('previewId'),modal:$modal}};$modal.on(event+'.bs.modal',function(e){if(e.namespace!=='bs.modal'){return}var $btnFull=$modal.find('.btn-fullscreen'),$btnBord=$modal.find('.btn-borderless');if($modal.data('fileinputPluginId')===self.$element.attr('id')){self._raise('filezoom'+event,getParams(e))}if(event==='shown'){self._handleRotation($modal,$modal.find('.file-zoom-detail'),$modal.data('angle'));$btnBord.removeClass('active').attr('aria-pressed','false');$btnFull.removeClass('active').attr('aria-pressed','false');if($modal.hasClass('file-zoom-fullscreen')){self._maximizeZoomDialog();if($h.checkFullScreen()){$btnFull.addClass('active').attr('aria-pressed','true')}else{$btnBord.addClass('active').attr('aria-pressed','true')}}}})},_initZoom:function(){var self=this,$dialog,modalMain=self._getLayoutTemplate('modalMain'),modalId='#'+$h.MODAL_ID;modalMain=self._setTabIndex('modal',modalMain);if(!self.showPreview){return}self.$modal=$(modalId);if(!self.$modal||!self.$modal.length){$dialog=$h.createElement($h.cspBuffer.stash(modalMain)).insertAfter(self.$container);self.$modal=$(modalId).insertBefore($dialog);$h.cspBuffer.apply(self.$modal);$dialog.remove()}$h.initModal(self.$modal);self.$modal.html($h.cspBuffer.stash(self._getModalContent()));$h.cspBuffer.apply(self.$modal);$.each($h.MODAL_EVENTS,function(key,event){self._listenModalEvent(event)})},_initZoomButtons:function(){var self=this,$modal=self.$modal,previewId=$modal.data('previewId')||'',$first,$last,thumbs=self.getFrames().toArray(),len=thumbs.length,$prev=$modal.find('.btn-kv-prev'),$next=$modal.find('.btn-kv-next'),$rotate=$modal.find('.btn-kv-rotate');if(thumbs.length<2){$prev.hide();$next.hide();return}else{$prev.show();$next.show()}if(!len){return}$first=$(thumbs[0]);$last=$(thumbs[len-1]);$prev.removeAttr('disabled');$next.removeAttr('disabled');if(self.reversePreviewOrder){[$prev,$next]=[$next,$prev]}if($first.length&&$first.attr('id')===previewId){$prev.attr('disabled',true)}if($last.length&&$last.attr('id')===previewId){$next.attr('disabled',true)}},_maximizeZoomDialog:function(){var self=this,$modal=self.$modal,$head=$modal.find('.modal-header:visible'),$foot=$modal.find('.modal-footer:visible'),$body=$modal.find('.kv-zoom-body'),h=$(window).height(),diff=0;$modal.addClass('file-zoom-fullscreen');if($head&&$head.length){h-=$head.outerHeight(true)}if($foot&&$foot.length){h-=$foot.outerHeight(true)}if($body&&$body.length){diff=$body.outerHeight(true)-$body.height();h-=diff}$modal.find('.kv-zoom-body').height(h)},_resizeZoomDialog:function(fullScreen){var self=this,$modal=self.$modal,$btnFull=$modal.find('.btn-kv-fullscreen'),$btnBord=$modal.find('.btn-kv-borderless');if($modal.hasClass('file-zoom-fullscreen')){$h.toggleFullScreen(false);if(!fullScreen){if(!$btnFull.hasClass('active')){$modal.removeClass('file-zoom-fullscreen');self.$modal.find('.kv-zoom-body').css('height',self.zoomModalHeight)}else{$btnFull.removeClass('active').attr('aria-pressed','false')}}else{if(!$btnFull.hasClass('active')){$modal.removeClass('file-zoom-fullscreen');self._resizeZoomDialog(true);if($btnBord.hasClass('active')){$btnBord.removeClass('active').attr('aria-pressed','false')}}}}else{if(!fullScreen){self._maximizeZoomDialog();return}$h.toggleFullScreen(true)}$modal.focus()},_setZoomContent:function($frame,navigate){var self=this,$content,tmplt,body,title,$body,$dataEl,config,previewId=$frame.attr('id'),$zoomPreview=self._getZoom(previewId),$modal=self.$modal,$tmp,desc,$desc,$btnFull=$modal.find('.btn-kv-fullscreen'),$btnBord=$modal.find('.btn-kv-borderless'),cap,size,$btnTogh=$modal.find('.btn-kv-toggleheader'),dir=navigate==='prev'?'Left':'Right',slideIn='slideIn'+dir,slideOut='slideOut'+dir,parsed,zoomData=$frame.data('zoom');if(zoomData){zoomData=decodeURIComponent(zoomData);parsed=$zoomPreview.html().replace(self.zoomPlaceholder,'').setTokens({zoomData:zoomData});$zoomPreview.html(parsed);$frame.data('zoom','');$zoomPreview.attr('data-zoom',zoomData)}tmplt=$zoomPreview.attr('data-template')||'generic';$content=$zoomPreview.find('.kv-file-content');body=$content.length?$content.html():'';cap=$frame.data('caption')||self.msgZoomModalHeading;size=$frame.data('size')||'';desc=$frame.data('description')||'';$modal.find('.kv-zoom-caption').attr('title',cap).html(cap);$modal.find('.kv-zoom-size').html(size);$desc=$modal.find('.kv-zoom-description').hide();if(desc){if(self.showDescriptionClose){desc=self._getLayoutTemplate('descriptionClose').setTokens({closeIcon:self.previewZoomButtonIcons.close})+'</button>'+desc}$desc.show().html(desc);if(self.showDescriptionClose){self._handler($modal.find('.kv-desc-hide'),'click',function(){$(this).parent().fadeOut('fast',function(){$modal.focus()})})}}$body=$modal.find('.kv-zoom-body');$modal.removeClass('kv-single-content');if(navigate){$tmp=$body.addClass('file-thumb-loading').clone().insertAfter($body);$h.setHtml($body,body).hide();$tmp.fadeOut('fast',function(){$body.fadeIn('fast',function(){$body.removeClass('file-thumb-loading')});$tmp.remove()})}else{$h.setHtml($body,body)}config=self.previewZoomSettings[tmplt];if(config){$dataEl=$body.find('.kv-preview-data');$h.addCss($dataEl,'file-zoom-detail');$.each(config,function(key,value){$dataEl.css(key,value);if(($dataEl.attr('width')&&key==='width')||($dataEl.attr('height')&&key==='height')){$dataEl.removeAttr(key)}})}$modal.data('previewId',previewId);self._handler($modal.find('.btn-kv-prev'),'click',function(){self._zoomSlideShow('prev',previewId)});self._handler($modal.find('.btn-kv-next'),'click',function(){self._zoomSlideShow('next',previewId)});self._handler($btnFull,'click',function(){self._resizeZoomDialog(true)});self._handler($btnBord,'click',function(){self._resizeZoomDialog(false)});self._handler($btnTogh,'click',function(){var $header=$modal.find('.modal-header'),$floatBar=$modal.find('.floating-buttons'),ht,$actions=$header.find('.kv-zoom-actions'),resize=function(height){var $body=self.$modal.find('.kv-zoom-body'),h=self.zoomModalHeight;if($modal.hasClass('file-zoom-fullscreen')){h=$body.outerHeight(true);if(!height){h=h-$header.outerHeight(true)}}$body.css('height',height?h+height:h)};if($header.is(':visible')){ht=$header.outerHeight(true);$header.slideUp('slow',function(){$actions.find('.btn').appendTo($floatBar);resize(ht)})}else{$floatBar.find('.btn').appendTo($actions);$header.slideDown('slow',function(){resize()})}$modal.focus()});self._handler($modal,'keydown',function(e){var key=e.which||e.keyCode,delay=self.processDelay+1,$prev=$(this).find('.btn-kv-prev'),$next=$(this).find('.btn-kv-next'),vId=$(this).data('previewId'),vPrevKey,vNextKey;[vPrevKey,vNextKey]=self.rtl?[39,37]:[37,39];$.each({prev:[$prev,vPrevKey],next:[$next,vNextKey]},function(direction,config){var $btn=config[0],vKey=config[1];if(key===vKey&&$btn.length){$modal.focus();if(!$btn.attr('disabled')){$btn.blur();setTimeout(function(){$btn.focus();self._zoomSlideShow(direction,vId);setTimeout(function(){if($btn.attr('disabled')){$modal.focus()}},delay)},delay)}}})})},_showModal:function($frame){var self=this,$modal=self.$modal,$content,css,angle;if(!$frame||!$frame.length){return}$h.initModal($modal);$h.setHtml($modal,self._getModalContent());self._setZoomContent($frame);$modal.removeClass('rotatable');$modal.data({backdrop:false,fileinputPluginId:self.$element.attr('id')});$modal.find('.kv-zoom-body').css('height',self.zoomModalHeight);$content=$frame.find('.kv-file-content > :first-child');if($content.length){css=$content.css('transform');if(css){$modal.find('.file-zoom-detail').css('transform',css)}}if($frame.hasClass('rotatable')){$modal.addClass('rotatable')}if($frame.data('angle')){$modal.data('angle',$frame.data('angle'))}angle=($frame.data('angle')||0);$modal.modal('show');self._initZoomButtons();self._initRotateZoom($frame,$content)},_zoomPreview:function($btn){var self=this,$frame;if(!$btn.length){throw'Cannot zoom to detailed preview!';}$frame=$btn.closest($h.FRAMES);self._showModal($frame)},_zoomSlideShow:function(dir,previewId){var self=this,$modal=self.$modal,$btn=$modal.find('.kv-zoom-actions .btn-kv-'+dir),$targFrame,i,$thumb,thumbsData=self.getFrames().toArray(),thumbs=[],len=thumbsData.length,out,angle,$content;if(self.reversePreviewOrder){dir=dir==='prev'?'next':'prev'}if($btn.attr('disabled')){return}for(i=0;i<len;i++){$thumb=$(thumbsData[i]);if($thumb&&$thumb.length&&$thumb.find('.kv-file-zoom:visible').length){thumbs.push(thumbsData[i])}}len=thumbs.length;for(i=0;i<len;i++){if($(thumbs[i]).attr('id')===previewId){out=dir==='prev'?i-1:i+1;break}}if(out<0||out>=len||!thumbs[out]){return}$targFrame=$(thumbs[out]);if($targFrame.length){self._setZoomContent($targFrame,dir)}self._initZoomButtons();if($targFrame.length&&$targFrame.hasClass('rotatable')){angle=$targFrame.data('angle')||0;$modal.addClass('rotatable').data('angle',angle);$content=$targFrame.find('.kv-file-content > :first-child');self._initRotateZoom($targFrame,$content)}else{$modal.removeClass('rotatable').removeData('angle')}self._raise('filezoom'+dir,{'previewId':previewId,modal:self.$modal})},_initZoomButton:function(){var self=this;self.$preview.find('.kv-file-zoom').each(function(){var $el=$(this);self._handler($el,'click',function(){self._zoomPreview($el)})})},_inputFileCount:function(){return this.$element[0].files.length},_refreshPreview:function(){var self=this,files;if((!self._inputFileCount()&&!self.isAjaxUpload)||!self.showPreview||!self.isPreviewable){return}if(self.isAjaxUpload){if(self.fileManager.count()>0){files=$.extend(true,[],self.getFileList());self.fileManager.clear();self._clearFileInput()}else{files=self.$element[0].files}}else{files=self.$element[0].files}if(files&&files.length){self.readFiles(files)}},_clearObjects:function($el){$el.find('video audio').each(function(){this.pause();$(this).remove()});$el.find('img object div').each(function(){$(this).remove()})},_clearFileInput:function(){var self=this,$el=self.$element,$srcFrm,$tmpFrm,$tmpEl;if(!self._inputFileCount()){return}$srcFrm=$el.closest('form');$tmpFrm=$(document.createElement('form'));$tmpEl=$(document.createElement('div'));$el.before($tmpEl);if($srcFrm.length){$srcFrm.after($tmpFrm)}else{$tmpEl.after($tmpFrm)}$tmpFrm.append($el).trigger('reset');$tmpEl.before($el).remove();$tmpFrm.remove()},_resetUpload:function(){var self=this;self.uploadInitiated=false;self.uploadStartTime=$h.now();self.uploadCache=[];self.$btnUpload.removeAttr('disabled');self._setProgress(0);self._hideProgress();self._resetErrors(false);self._initAjax();self.fileManager.clearImages();self._resetCanvas();if(self.overwriteInitial){self.initialPreview=[];self.initialPreviewConfig=[];self.initialPreviewThumbTags=[];self.previewCache.data={content:[],config:[],tags:[]}}},_resetCanvas:function(){var self=this;if(self.imageCanvas&&self.imageCanvasContext){self.imageCanvasContext.clearRect(0,0,self.imageCanvas.width,self.imageCanvas.height)}},_hasInitialPreview:function(){var self=this;return!self.overwriteInitial&&self.previewCache.count(true)},_resetPreview:function(){var self=this,out,cap,$div,hasSuc=self.showUploadedThumbs,hasErr=!self.removeFromPreviewOnError,includeProcessed=(hasSuc||hasErr)&&self.isDuplicateError;if(self.previewCache.count(true)){out=self.previewCache.out();if(includeProcessed){$div=$h.createElement('').insertAfter(self.$container);self.getFrames().each(function(){var $thumb=$(this);if((hasSuc&&$thumb.hasClass('file-preview-success'))||(hasErr&&$thumb.hasClass('file-preview-error'))){$div.append($thumb)}})}self._setPreviewContent(out.content);self._setInitThumbAttr();cap=self.initialCaption?self.initialCaption:out.caption;self._setCaption(cap);if(includeProcessed){$div.contents().appendTo(self.$preview);$div.remove()}}else{self._clearPreview();self._initCaption()}if(self.showPreview){self._initZoom();self._initSortable()}self.isDuplicateError=false},_clearDefaultPreview:function(){var self=this;self.$preview.find('.file-default-preview').remove()},_validateDefaultPreview:function(){var self=this;if(!self.showPreview||$h.isEmpty(self.defaultPreviewContent)){return}self._setPreviewContent('<div class="file-default-preview">'+self.defaultPreviewContent+'</div>');self.$container.removeClass('file-input-new');self._initClickable()},_resetPreviewThumbs:function(isAjax){var self=this,out;if(isAjax){self._clearPreview();self.clearFileStack();return}if(self._hasInitialPreview()){out=self.previewCache.out();self._setPreviewContent(out.content);self._setInitThumbAttr();self._setCaption(out.caption);self._initPreviewActions()}else{self._clearPreview()}},_getLayoutTemplate:function(t){var self=this,template=self.layoutTemplates[t];if($h.isEmpty(self.customLayoutTags)){return template}return $h.replaceTags(template,self.customLayoutTags)},_getPreviewTemplate:function(t){var self=this,templates=self.previewTemplates,template=templates[t]||templates.other;if($h.isEmpty(self.customPreviewTags)){return template}return $h.replaceTags(template,self.customPreviewTags)},_getOutData:function(formdata,jqXHR,responseData,filesData){var self=this;jqXHR=jqXHR||{};responseData=responseData||{};filesData=filesData||self.fileManager.list();return{formdata:formdata,files:filesData,filenames:self.filenames,filescount:self.getFilesCount(),extra:self._getExtraData(),response:responseData,reader:self.reader,jqXHR:jqXHR}},_getMsgSelected:function(n,processing){var self=this,strFiles=n===1?self.fileSingle:self.filePlural;return n>0?self.msgSelected.replace('{n}',n).replace('{files}',strFiles):(processing?self.msgProcessing:self.msgNoFilesSelected)},_getFrame:function(id,skipWarning){var self=this,$frame=$h.getFrameElement(self.$preview,id);if(self.showPreview&&!skipWarning&&!$frame.length){self._log($h.logMessages.invalidThumb,{id:id})}return $frame},_getZoom:function(id,selector){var self=this,$frame=$h.getZoomElement(self.$preview,id,selector);if(self.showPreview&&!$frame.length){self._log($h.logMessages.invalidThumb,{id:id})}return $frame},_getThumbs:function(css){css=css||'';return this.getFrames(':not(.file-preview-initial)'+css)},_getThumbId:function(fileId){var self=this;return self.previewInitId+'-'+fileId},_getExtraData:function(fileId,index){var self=this,data=self.uploadExtraData;if(typeof self.uploadExtraData==='function'){data=self.uploadExtraData(fileId,index)}return data},_initXhr:function(xhrobj,fileId){var self=this,fm=self.fileManager,func=function(event){var pct=0,total=event.total,loaded=event.loaded||event.position,stats=fm.getUploadStats(fileId,loaded,total);if(event.lengthComputable&&!self.enableResumableUpload){pct=$h.round(loaded/total*100)}if(fileId){self._setFileUploadStats(fileId,pct,stats)}else{self._setProgress(pct,null,null,self._getStats(stats))}self._raise('fileajaxprogress',[stats])};if(xhrobj.upload){if(self.progressDelay){func=$h.debounce(func,self.progressDelay)}xhrobj.upload.addEventListener('progress',func,false)}return xhrobj},_initAjaxSettings:function(){var self=this;self._ajaxSettings=$.extend(true,{},self.ajaxSettings);self._ajaxDeleteSettings=$.extend(true,{},self.ajaxDeleteSettings)},_mergeAjaxCallback:function(funcName,srcFunc,type){var self=this,settings=self._ajaxSettings,flag=self.mergeAjaxCallbacks,targFunc;if(type==='delete'){settings=self._ajaxDeleteSettings;flag=self.mergeAjaxDeleteCallbacks}targFunc=settings[funcName];if(flag&&typeof targFunc==='function'){if(flag==='before'){settings[funcName]=function(){targFunc.apply(this,arguments);srcFunc.apply(this,arguments)}}else{settings[funcName]=function(){srcFunc.apply(this,arguments);targFunc.apply(this,arguments)}}}else{settings[funcName]=srcFunc}},_ajaxSubmit:function(fnBefore,fnSuccess,fnComplete,fnError,formdata,fileId,index,vUrl){var self=this,settings,defaults,data,tm=self.taskManager;if(!self._raise('filepreajax',[formdata,fileId,index])){return}formdata.append('initialPreview',JSON.stringify(self.initialPreview));formdata.append('initialPreviewConfig',JSON.stringify(self.initialPreviewConfig));formdata.append('initialPreviewThumbTags',JSON.stringify(self.initialPreviewThumbTags));self._initAjaxSettings();self._mergeAjaxCallback('beforeSend',fnBefore);self._mergeAjaxCallback('success',fnSuccess);self._mergeAjaxCallback('complete',fnComplete);self._mergeAjaxCallback('error',fnError);vUrl=vUrl||self.uploadUrlThumb||self.uploadUrl;if(typeof vUrl==='function'){vUrl=vUrl()}data=self._getExtraData(fileId,index)||{};if(typeof data==='object'){$.each(data,function(key,value){formdata.append(key,value)})}defaults={xhr:function(){var xhrobj=$.ajaxSettings.xhr();return self._initXhr(xhrobj,fileId)},url:self._encodeURI(vUrl),type:'POST',dataType:'json',data:formdata,cache:false,processData:false,contentType:false};settings=$.extend(true,{},defaults,self._ajaxSettings);self.ajaxQueue.push(settings);tm.addTask(fileId+'-'+index,function(){var self=this.self,config,xhr;config=self.ajaxQueue.shift();xhr=$.ajax(config);self.ajaxRequests.push(xhr)}).runWithContext({self:self})},_mergeArray:function(prop,content){var self=this,arr1=$h.cleanArray(self[prop]),arr2=$h.cleanArray(content);self[prop]=arr1.concat(arr2)},_initUploadSuccess:function(out,$thumb,allFiles){var self=this,append,data,index,$div,content,config,tags,id,i;if(!self.showPreview||typeof out!=='object'||$.isEmptyObject(out)){self._resetCaption();return}if(out.initialPreview!==undefined&&out.initialPreview.length>0){self.hasInitData=true;content=out.initialPreview||[];config=out.initialPreviewConfig||[];tags=out.initialPreviewThumbTags||[];append=out.append===undefined||out.append;if(content.length>0&&!$h.isArray(content)){content=content.split(self.initialPreviewDelimiter)}if(content.length){self._mergeArray('initialPreview',content);self._mergeArray('initialPreviewConfig',config);self._mergeArray('initialPreviewThumbTags',tags)}if($thumb!==undefined){if(!allFiles){index=self.previewCache.add(content[0],config[0],tags[0],append);data=self.previewCache.get(index,false);$div=$h.createElement(data).hide().appendTo($thumb);$thumb.fadeOut('slow',function(){var $newThumb=$div.find('> .file-preview-frame');if($newThumb&&$newThumb.length){$newThumb.insertBefore($thumb).fadeIn('slow').css('display:inline-block')}self._initPreviewActions();self._clearFileInput();$thumb.remove();$div.remove();self._initSortable()})}else{id=$thumb.attr('id');i=self._getUploadCacheIndex(id);if(i!==null){self.uploadCache[i]={id:id,content:content[0],config:config[0]||[],tags:tags[0]||[],append:append}}}}else{self.previewCache.set(content,config,tags,append);self._initPreview();self._initPreviewActions()}}self._resetCaption()},_getUploadCacheIndex:function(id){var self=this,i,len=self.uploadCache.length,config;for(i=0;i<len;i++){config=self.uploadCache[i];if(config.id===id){return i}}return null},_initSuccessThumbs:function(){var self=this;if(!self.showPreview){return}setTimeout(function(){self._getThumbs($h.FRAMES+'.file-preview-success').each(function(){var $thumb=$(this),$remove=$thumb.find('.kv-file-remove');$remove.removeAttr('disabled');self._handler($remove,'click',function(){var id=$thumb.attr('id'),out=self._raise('filesuccessremove',[id,$thumb.attr('data-fileindex')]);$h.cleanMemory($thumb);if(out===false){return}self.$caption.attr('title','');$thumb.fadeOut('slow',function(){var fm=self.fileManager;$thumb.remove();if(!self.getFrames().length){self.reset()}})})})},self.processDelay)},_updateInitialPreview:function(){var self=this,u=self.uploadCache;if(self.showPreview){$.each(u,function(key,setting){self.previewCache.add(setting.content,setting.config,setting.tags,setting.append)});if(self.hasInitData){self._initPreview();self._initPreviewActions()}}},_getThumbFileId:function($thumb){var self=this;if(self.showPreview&&$thumb!==undefined){return $thumb.attr('data-fileid')}return null},_getThumbFile:function($thumb){var self=this,id=self._getThumbFileId($thumb);return id?self.fileManager.getFile(id):null},_uploadSingle:function(i,id,isBatch,deferrer){var self=this,fm=self.fileManager,count=fm.count(),formdata=new FormData(),outData,previewId=self._getThumbId(id),$thumb,chkComplete,$btnUpload,$btnDelete,hasPostData=count>0||!$.isEmptyObject(self.uploadExtraData),uploadFailed,$prog,fnBefore,errMsg,fnSuccess,fnComplete,fnError,updateUploadLog,op=self.ajaxOperations.uploadThumb,fileObj=fm.getFile(id),params={id:previewId,index:i,fileId:id},fileName=self.fileManager.getFileName(id,true),resolve=function(){if(deferrer&&deferrer.resolve){deferrer.resolve()}},reject=function(){if(deferrer&&deferrer.reject){deferrer.reject()}};if(self.enableResumableUpload){return}self.uploadInitiated=true;if(self.showPreview){$thumb=fm.getThumb(id);$prog=$thumb.find('.file-thumb-progress');$btnUpload=$thumb.find('.kv-file-upload');$btnDelete=$thumb.find('.kv-file-remove');$prog.show()}if(count===0||!hasPostData||(self.showPreview&&$btnUpload&&$btnUpload.hasClass('disabled'))||self._abort(params)){return}updateUploadLog=function(){if(!uploadFailed){fm.removeFile(id)}else{fm.errors.push(id)}fm.setProcessed(id);if(fm.isProcessed()){self.fileBatchCompleted=true;chkComplete()}};chkComplete=function(){var $initThumbs;if(!self.fileBatchCompleted){return}setTimeout(function(){var triggerReset=fm.count()===0,errCount=fm.errors.length;self._updateInitialPreview();self.unlock(triggerReset);if(triggerReset){self._clearFileInput()}$initThumbs=self.$preview.find('.file-preview-initial');if(self.uploadAsync&&$initThumbs.length){$h.addCss($initThumbs,$h.SORT_CSS);self._initSortable()}self._raise('filebatchuploadcomplete',[fm.stack,self._getExtraData()]);if(!self.retryErrorUploads||errCount===0){fm.clear()}self._setProgress(101);self.ajaxAborted=false;self.uploadInitiated=false},self.processDelay)};fnBefore=function(jqXHR){outData=self._getOutData(formdata,jqXHR);fm.initStats(id);self.fileBatchCompleted=false;if(!isBatch){self.ajaxAborted=false}if(self.showPreview){if(!$thumb.hasClass('file-preview-success')){self._setThumbStatus($thumb,'Loading');$h.addCss($thumb,'file-uploading')}$btnUpload.attr('disabled',true);$btnDelete.attr('disabled',true)}if(!isBatch){self.lock()}if(fm.errors.indexOf(id)!==-1){delete fm.errors[id]}self._raise('filepreupload',[outData,previewId,i,self._getThumbFileId($thumb)]);$.extend(true,params,outData);if(self._abort(params)){jqXHR.abort();if(!isBatch){self._setThumbStatus($thumb,'New');$thumb.removeClass('file-uploading');$btnUpload.removeAttr('disabled');$btnDelete.removeAttr('disabled')}self._setProgressCancelled()}};fnSuccess=function(data,textStatus,jqXHR){var pid=self.showPreview&&$thumb.attr('id')?$thumb.attr('id'):previewId;outData=self._getOutData(formdata,jqXHR,data);$.extend(true,params,outData);setTimeout(function(){if($h.isEmpty(data)||$h.isEmpty(data.error)){if(self.showPreview){self._setThumbStatus($thumb,'Success');$btnUpload.hide();self._initUploadSuccess(data,$thumb,isBatch);self._setProgress(101,$prog)}self._raise('fileuploaded',[outData,pid,i,self._getThumbFileId($thumb)]);if(!isBatch){self.fileManager.remove($thumb)}else{updateUploadLog();resolve()}}else{uploadFailed=true;errMsg=self._parseError(op,jqXHR,self.msgUploadError,self.fileManager.getFileName(id));self._showFileError(errMsg,params);self._setPreviewError($thumb,true);if(!self.retryErrorUploads){$btnUpload.hide()}if(isBatch){updateUploadLog();resolve()}self._setProgress(101,self._getFrame(pid).find('.file-thumb-progress'),self.msgUploadError)}},self.processDelay)};fnComplete=function(){if(self.showPreview){$btnUpload.removeAttr('disabled');$btnDelete.removeAttr('disabled');$thumb.removeClass('file-uploading')}if(!isBatch){self.unlock(false);self._clearFileInput()}else{chkComplete()}self._initSuccessThumbs()};fnError=function(jqXHR,textStatus,errorThrown){errMsg=self._parseError(op,jqXHR,errorThrown,self.fileManager.getFileName(id));uploadFailed=true;setTimeout(function(){var $prog;if(isBatch){updateUploadLog();reject()}self.fileManager.setProgress(id,100);self._setPreviewError($thumb,true);if(!self.retryErrorUploads){$btnUpload.hide()}$.extend(true,params,self._getOutData(formdata,jqXHR));self._setProgress(101,self.$progress,self.msgAjaxProgressError.replace('{operation}',op));$prog=self.showPreview&&$thumb?$thumb.find('.file-thumb-progress'):'';self._setProgress(101,$prog,self.msgUploadError);self._showFileError(errMsg,params)},self.processDelay)};self._setFileData(formdata,fileObj.file,fileName,id);self._setUploadData(formdata,{fileId:id});self._ajaxSubmit(fnBefore,fnSuccess,fnComplete,fnError,formdata,id,i)},_setFileData:function(formdata,file,fileName,fileId){var self=this,preProcess=self.preProcessUpload;if(preProcess&&typeof preProcess==='function'){formdata.append(self.uploadFileAttr,preProcess(fileId,file))}else{formdata.append(self.uploadFileAttr,file,fileName)}},_checkBatchPreupload:function(outData,jqXHR){var self=this,out=self._raise('filebatchpreupload',[outData]);if(out){return true}self._abort(outData);if(jqXHR){jqXHR.abort()}self._getThumbs().each(function(){var $thumb=$(this),$btnUpload=$thumb.find('.kv-file-upload'),$btnDelete=$thumb.find('.kv-file-remove');if($thumb.hasClass('file-preview-loading')){self._setThumbStatus($thumb,'New');$thumb.removeClass('file-uploading')}$btnUpload.removeAttr('disabled');$btnDelete.removeAttr('disabled')});self._setProgressCancelled();return false},_uploadBatch:function(){var self=this,fm=self.fileManager,total=fm.total(),params={},fnBefore,fnSuccess,fnError,fnComplete,hasPostData=total>0||!$.isEmptyObject(self.uploadExtraData),errMsg,setAllUploaded,formdata=new FormData(),op=self.ajaxOperations.uploadBatch;if(total===0||!hasPostData||self._abort(params)){return}setAllUploaded=function(){self.fileManager.clear();self._clearFileInput()};fnBefore=function(jqXHR){self.lock();fm.initStats();var outData=self._getOutData(formdata,jqXHR);self.ajaxAborted=false;if(self.showPreview){self._getThumbs().each(function(){var $thumb=$(this),$btnUpload=$thumb.find('.kv-file-upload'),$btnDelete=$thumb.find('.kv-file-remove');if(!$thumb.hasClass('file-preview-success')){self._setThumbStatus($thumb,'Loading');$h.addCss($thumb,'file-uploading')}$btnUpload.attr('disabled',true);$btnDelete.attr('disabled',true)})}self._checkBatchPreupload(outData,jqXHR)};fnSuccess=function(data,textStatus,jqXHR){var outData=self._getOutData(formdata,jqXHR,data),key=0,$thumbs=self._getThumbs(':not(.file-preview-success)'),keys=$h.isEmpty(data)||$h.isEmpty(data.errorkeys)?[]:data.errorkeys;if($h.isEmpty(data)||$h.isEmpty(data.error)){self._raise('filebatchuploadsuccess',[outData]);setAllUploaded();if(self.showPreview){$thumbs.each(function(){var $thumb=$(this);self._setThumbStatus($thumb,'Success');$thumb.removeClass('file-uploading');$thumb.find('.kv-file-upload').hide().removeAttr('disabled')});self._initUploadSuccess(data)}else{self.reset()}self._setProgress(101)}else{if(self.showPreview){$thumbs.each(function(){var $thumb=$(this);$thumb.removeClass('file-uploading');$thumb.find('.kv-file-upload').removeAttr('disabled');$thumb.find('.kv-file-remove').removeAttr('disabled');if(keys.length===0||$.inArray(key,keys)!==-1){self._setPreviewError($thumb,true);if(!self.retryErrorUploads){$thumb.find('.kv-file-upload').hide();self.fileManager.remove($thumb)}}else{$thumb.find('.kv-file-upload').hide();self._setThumbStatus($thumb,'Success');self.fileManager.remove($thumb)}if(!$thumb.hasClass('file-preview-error')||self.retryErrorUploads){key++}});self._initUploadSuccess(data)}errMsg=self._parseError(op,jqXHR,self.msgUploadError);self._showFileError(errMsg,outData,'filebatchuploaderror');self._setProgress(101,self.$progress,self.msgUploadError)}};fnComplete=function(){self.unlock();self._initSuccessThumbs();self._clearFileInput();self._raise('filebatchuploadcomplete',[self.fileManager.stack,self._getExtraData()])};fnError=function(jqXHR,textStatus,errorThrown){var outData=self._getOutData(formdata,jqXHR);errMsg=self._parseError(op,jqXHR,errorThrown);self._showFileError(errMsg,outData,'filebatchuploaderror');self.uploadFileCount=total-1;if(!self.showPreview){return}self._getThumbs().each(function(){var $thumb=$(this);$thumb.removeClass('file-uploading');if(self._getThumbFile($thumb)){self._setPreviewError($thumb)}});self._getThumbs().removeClass('file-uploading');self._getThumbs(' .kv-file-upload').removeAttr('disabled');self._getThumbs(' .kv-file-delete').removeAttr('disabled');self._setProgress(101,self.$progress,self.msgAjaxProgressError.replace('{operation}',op))};var ctr=0;$.each(self.fileManager.stack,function(key,data){if(!$h.isEmpty(data.file)){self._setFileData(formdata,data.file,(data.nameFmt||('untitled_'+ctr)),key)}ctr++});self._ajaxSubmit(fnBefore,fnSuccess,fnComplete,fnError,formdata)},_uploadExtraOnly:function(){var self=this,params={},fnBefore,fnSuccess,fnComplete,fnError,formdata=new FormData(),errMsg,op=self.ajaxOperations.uploadExtra;fnBefore=function(jqXHR){self.lock();var outData=self._getOutData(formdata,jqXHR);self._setProgress(50);params.data=outData;params.xhr=jqXHR;self._checkBatchPreupload(outData,jqXHR)};fnSuccess=function(data,textStatus,jqXHR){var outData=self._getOutData(formdata,jqXHR,data);if($h.isEmpty(data)||$h.isEmpty(data.error)){self._raise('filebatchuploadsuccess',[outData]);self._clearFileInput();self._initUploadSuccess(data);self._setProgress(101)}else{errMsg=self._parseError(op,jqXHR,self.msgUploadError);self._showFileError(errMsg,outData,'filebatchuploaderror')}};fnComplete=function(){self.unlock();self._clearFileInput();self._raise('filebatchuploadcomplete',[self.fileManager.stack,self._getExtraData()])};fnError=function(jqXHR,textStatus,errorThrown){var outData=self._getOutData(formdata,jqXHR);errMsg=self._parseError(op,jqXHR,errorThrown);params.data=outData;self._showFileError(errMsg,outData,'filebatchuploaderror');self._setProgress(101,self.$progress,self.msgAjaxProgressError.replace('{operation}',op))};self._ajaxSubmit(fnBefore,fnSuccess,fnComplete,fnError,formdata)},_deleteFileIndex:function($frame){var self=this,ind=$frame.attr('data-fileindex'),rev=self.reversePreviewOrder;if(ind.substring(0,5)===$h.INIT_FLAG){ind=parseInt(ind.replace($h.INIT_FLAG,''));self.initialPreview=$h.spliceArray(self.initialPreview,ind,rev);self.initialPreviewConfig=$h.spliceArray(self.initialPreviewConfig,ind,rev);self.initialPreviewThumbTags=$h.spliceArray(self.initialPreviewThumbTags,ind,rev);self.getFrames().each(function(){var $nFrame=$(this),nInd=$nFrame.attr('data-fileindex');if(nInd.substring(0,5)===$h.INIT_FLAG){nInd=parseInt(nInd.replace($h.INIT_FLAG,''));if(nInd>ind){nInd--;$nFrame.attr('data-fileindex',$h.INIT_FLAG+nInd)}}})}},_resetCaption:function(){var self=this;setTimeout(function(){var cap='',n,chk=self.previewCache.count(true),len=self.fileManager.count(),file,incomplete=':not(.file-preview-success):not(.file-preview-error)',cfg,hasThumb=self.showPreview&&self.getFrames(incomplete).length;if(len===0&&chk===0&&!hasThumb){self.reset()}else{n=chk+len;if(n>1){cap=self._getMsgSelected(n)}else{if(len===0){cfg=self.initialPreviewConfig[0];cap='';if(cfg){cap=cfg.caption||cfg.filename||''}if(!cap){cap=self._getMsgSelected(n)}}else{file=self.fileManager.getFirstFile();cap=file?file.nameFmt:'_'}}self._setCaption(cap)}},self.processDelay)},_handleRotation:function($el,$content,angle){var self=this,css,newCss,addCss='',scale=1,elContent=$content[0],quadrant,transform,h,w,wNew,$parent=$content.parent(),hParent,wParent,$body=$('body'),bodyExists=!!$body.length;if(bodyExists){$body.addClass('kv-overflow-hidden')}if(!$content.length||$el.hasClass('hide-rotate')){if(bodyExists){$body.removeClass('kv-overflow-hidden')}return}transform=$content.css('transform');if(transform){$content.css('transform','none')}if(transform){$content.css('transform',transform)}angle=angle||0;quadrant=angle%360;css='rotate('+angle+'deg)';newCss='rotate('+quadrant+'deg)';addCss='';if(quadrant===90||quadrant===270){w=elContent.naturalWidth||$content.outerWidth()||0;h=elContent.naturalHeight||$content.outerHeight()||0;scale=w>h&&w!=0?(h/w).toFixed(2):1;if($parent.length){hParent=$parent.height();wParent=$parent.width();wNew=Math.min(w,wParent);if(hParent>scale*wNew){scale=wNew>hParent&&wNew!=0?(hParent/wNew).toFixed(2):1}}if(scale!==1){addCss=' scale('+scale+')'}}$content.addClass('rotate-animate').css('transform',css+addCss);setTimeout(function(){$content.removeClass('rotate-animate').css('transform',newCss+addCss);if(bodyExists){$body.removeClass('kv-overflow-hidden')}$el.data('angle',quadrant)},self.fadeDelay)},_initRotateButton:function(){var self=this;self.getFrames('.rotatable .kv-file-rotate').each(function(){var $el=$(this),$frame=$el.closest($h.FRAMES),$content=$frame.find('.kv-file-content > :first-child');self._handler($el,'click',function(){var angle=($frame.data('angle')||0)+90;self._handleRotation($frame,$content,angle)})})},_initRotateZoom:function($frame,$content){var self=this,$modal=self.$modal,$rotate=$modal.find('.btn-kv-rotate'),angle=$frame.data('angle');$modal.data('angle',angle);if($rotate.length){$rotate.off('click');if($modal.hasClass('rotatable')){$rotate.on('click',function(){angle=($modal.data('angle')||0)+90;$modal.data('angle',angle);self._handleRotation($modal,$modal.find('.file-zoom-detail'),angle);self._handleRotation($frame,$content,angle);if($frame.hasClass('hide-rotate')){$frame.data('angle',angle)}})}}},_initFileActions:function(){var self=this;if(!self.showPreview){return}self._initZoomButton();self._initRotateButton();self.getFrames(' .kv-file-remove').each(function(){var $el=$(this),$frame=$el.closest($h.FRAMES),hasError,id=$frame.attr('id'),ind=$frame.attr('data-fileindex'),status,fm=self.fileManager;self._handler($el,'click',function(){status=self._raise('filepreremove',[id,ind]);if(status===false||!self._validateMinCount()){return false}hasError=$frame.hasClass('file-preview-error');$h.cleanMemory($frame);$frame.fadeOut('slow',function(){self.fileManager.remove($frame);self._clearObjects($frame);$frame.remove();if(id&&hasError){self.$errorContainer.find('li[data-thumb-id="'+id+'"]').fadeOut('fast',function(){$(this).remove();if(!self._errorsExist()){self._resetErrors()}})}self._clearFileInput();self._resetCaption();self._raise('fileremoved',[id,ind])})})});self.getFrames(' .kv-file-upload').each(function(){var $el=$(this);self._handler($el,'click',function(){var $frame=$el.closest($h.FRAMES),fileId=self._getThumbFileId($frame);self._hideProgress();if($frame.hasClass('file-preview-error')&&!self.retryErrorUploads){return}self._uploadSingle(self.fileManager.getIndex(fileId),fileId,false)})})},_initPreviewActions:function(){var self=this,$preview=self.$preview,deleteExtraData=self.deleteExtraData||{},btnRemove=$h.FRAMES+' .kv-file-remove',settings=self.fileActionSettings,origClass=settings.removeClass,errClass=settings.removeErrorClass,resetProgress=function(){var hasFiles=self.isAjaxUpload?self.previewCache.count(true):self._inputFileCount();if(!self.getFrames().length&&!hasFiles){self._setCaption('');self.reset();self.initialCaption=''}else{self._resetCaption()}};self._initZoomButton();self._initRotateButton();$preview.find(btnRemove).each(function(){var $el=$(this),vUrl=$el.data('url')||self.deleteUrl,vKey=$el.data('key'),errMsg,fnBefore,fnSuccess,fnError,op=self.ajaxOperations.deleteThumb;if($h.isEmpty(vUrl)||vKey===undefined){return}if(typeof vUrl==='function'){vUrl=vUrl()}var $frame=$el.closest($h.FRAMES),cache=self.previewCache.data,settings,params,config,fileName,extraData,index=$frame.attr('data-fileindex');index=parseInt(index.replace($h.INIT_FLAG,''));config=$h.isEmpty(cache.config)&&$h.isEmpty(cache.config[index])?null:cache.config[index];extraData=$h.isEmpty(config)||$h.isEmpty(config.extra)?deleteExtraData:config.extra;fileName=config&&(config.filename||config.caption)||'';if(typeof extraData==='function'){extraData=extraData()}params={id:$el.attr('id'),key:vKey,extra:extraData};fnBefore=function(jqXHR){self.ajaxAborted=false;self._raise('filepredelete',[vKey,jqXHR,extraData]);if(self._abort()){jqXHR.abort()}else{$el.removeClass(errClass);$h.addCss($frame,'file-uploading');$h.addCss($el,'disabled '+origClass)}};fnSuccess=function(data,textStatus,jqXHR){var n,cap;if(!$h.isEmpty(data)&&!$h.isEmpty(data.error)){params.jqXHR=jqXHR;params.response=data;errMsg=self._parseError(op,jqXHR,self.msgDeleteError,fileName);self._showFileError(errMsg,params,'filedeleteerror');$frame.removeClass('file-uploading');$el.removeClass('disabled '+origClass).addClass(errClass);resetProgress();return}$frame.removeClass('file-uploading').addClass('file-deleted');$frame.fadeOut('slow',function(){index=parseInt(($frame.attr('data-fileindex')).replace($h.INIT_FLAG,''));self.previewCache.unset(index);self._deleteFileIndex($frame);n=self.previewCache.count(true);cap=n>0?self._getMsgSelected(n):'';self._setCaption(cap);self._raise('filedeleted',[vKey,jqXHR,extraData]);self._clearObjects($frame);$frame.remove();resetProgress()})};fnError=function(jqXHR,textStatus,errorThrown){var errMsg=self._parseError(op,jqXHR,errorThrown,fileName);params.jqXHR=jqXHR;params.response={};self._showFileError(errMsg,params,'filedeleteerror');$frame.removeClass('file-uploading');$el.removeClass('disabled '+origClass).addClass(errClass);resetProgress()};self._initAjaxSettings();self._mergeAjaxCallback('beforeSend',fnBefore,'delete');self._mergeAjaxCallback('success',fnSuccess,'delete');self._mergeAjaxCallback('error',fnError,'delete');settings=$.extend(true,{},{url:self._encodeURI(vUrl),type:'POST',dataType:'json',data:$.extend(true,{},{key:vKey},extraData)},self._ajaxDeleteSettings);self._handler($el,'click',function(){if(!self._validateMinCount()){return false}self.ajaxAborted=false;self._raise('filebeforedelete',[vKey,extraData]);if(self.ajaxAborted instanceof Promise){self.ajaxAborted.then(function(result){if(!result){$.ajax(settings)}})}else{if(!self.ajaxAborted){$.ajax(settings)}}})})},_hideFileIcon:function(){var self=this;if(self.overwriteInitial){self.$captionContainer.removeClass('icon-visible')}},_showFileIcon:function(){var self=this;$h.addCss(self.$captionContainer,'icon-visible')},_getSize:function(bytes,skipTemplate,sizeUnits){var self=this,size=parseFloat(bytes),i=0,factor=self.bytesToKB,func=self.fileSizeGetter,out,sizeHuman=size,newSize;if(!$.isNumeric(bytes)||!$.isNumeric(size)){return''}if(typeof func==='function'){out=func(size)}else{if(!sizeUnits){sizeUnits=self.sizeUnits}if(size>0){while(sizeHuman>=factor){sizeHuman/=factor;++i}if(!sizeUnits[i]){sizeHuman=size;i=0}}newSize=sizeHuman.toFixed(2);if(newSize==sizeHuman){newSize=sizeHuman}out=newSize+' '+sizeUnits[i]}return skipTemplate?out:self._getLayoutTemplate('size').replace('{sizeText}',out)},_getFileType:function(ftype){var self=this;return self.mimeTypeAliases[ftype]||ftype},_generatePreviewTemplate:function(cat,data,fname,ftype,previewId,fileId,isError,size,fnameUpdated,frameClass,foot,ind,templ,attrs,zoomData){var self=this,caption=self.slug(fname),prevContent,zoomContent='',styleAttribs='',filename=fnameUpdated||fname,isIconic,ext=filename.split('.').pop().toLowerCase(),screenW=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,config,title=caption,alt=caption,typeCss='type-default',getContent,addFrameCss,footer=foot||self._renderFileFooter(cat,caption,size,'auto',isError),isRotatable,alwaysPreview=$.inArray(ext,self.alwaysPreviewFileExtensions)!==-1,forcePrevIcon=self.preferIconicPreview&&!alwaysPreview,forceZoomIcon=self.preferIconicZoomPreview&&!alwaysPreview,newCat=forcePrevIcon?'other':cat;config=screenW<400?(self.previewSettingsSmall[newCat]||self.defaults.previewSettingsSmall[newCat]):(self.previewSettings[newCat]||self.defaults.previewSettings[newCat]);if(config){$.each(config,function(key,val){styleAttribs+=key+':'+val+';'})}getContent=function(vCat,vData,zoom,frameCss,vZoomData){var id=zoom?'zoom-'+previewId:previewId,tmplt=self._getPreviewTemplate(vCat),css=(frameClass||'')+' '+frameCss,tokens;if(self.frameClass){css=self.frameClass+' '+css}if(zoom){css=css.replace(' '+$h.SORT_CSS,'')}tmplt=self._parseFilePreviewIcon(tmplt,fname);if(cat==='object'&&!ftype){$.each(self.defaults.fileTypeSettings,function(key,func){if(key==='object'||key==='other'){return}if(func(fname,ftype)){typeCss='type-'+key}})}if(!$h.isEmpty(attrs)){if(attrs.title!==undefined&&attrs.title!==null){title=attrs.title}if(attrs.alt!==undefined&&attrs.alt!==null){alt=title=attrs.alt}}tokens={'previewId':id,'caption':caption,'title':title,'alt':alt,'frameClass':css,'type':self._getFileType(ftype),'fileindex':ind,'fileid':fileId||'','filename':filename,'typeCss':typeCss,'footer':footer,'data':vData,'template':templ||cat,'style':styleAttribs?'style="'+styleAttribs+'"':'','zoomData':vZoomData?encodeURIComponent(vZoomData):''};if(zoom){tokens.zoomCache='';tokens.zoomData='{zoomData}'}return tmplt.setTokens(tokens)};ind=ind||previewId.slice(previewId.lastIndexOf('-')+1);isRotatable=self.fileActionSettings.showRotate&&$.inArray(ext,self.rotatableFileExtensions)!==-1;if(self.fileActionSettings.showZoom){addFrameCss='kv-zoom-thumb';if(isRotatable){addFrameCss+=' rotatable'+(forceZoomIcon?' hide-rotate':'')}zoomContent=getContent((forceZoomIcon?'other':cat),data,true,addFrameCss,zoomData)}zoomContent='\n'+self._getLayoutTemplate('zoomCache').replace('{zoomContent}',zoomContent);if(typeof self.sanitizeZoomCache==='function'){zoomContent=self.sanitizeZoomCache(zoomContent)}addFrameCss='kv-preview-thumb';if(isRotatable){isIconic=forcePrevIcon||self.hideThumbnailContent||!!self.previewFileIconSettings[ext];addFrameCss+=' rotatable'+(isIconic?' hide-rotate':'')}prevContent=getContent((forcePrevIcon?'other':cat),data,false,addFrameCss,zoomData);return prevContent.setTokens({zoomCache:zoomContent})},_addToPreview:function($preview,content){var self=this,$el;content=$h.cspBuffer.stash(content);$el=self.reversePreviewOrder?$preview.prepend(content):$preview.append(content);$h.cspBuffer.apply($preview);return $el},_previewDefault:function(file,isDisabled){var self=this,$preview=self.$preview;if(!self.showPreview){return}var fname=$h.getFileName(file),ftype=file?file.type:'',content,size=file.size||0,caption=self._getFileName(file,''),isError=isDisabled===true&&!self.isAjaxUpload,data=$h.createObjectURL(file),fileId=self.fileManager.getId(file),previewId=self._getThumbId(fileId);self._clearDefaultPreview();content=self._generatePreviewTemplate('other',data,fname,ftype,previewId,fileId,isError,size);self._addToPreview($preview,content);self._setThumbAttr(previewId,caption,size);if(isDisabled===true&&self.isAjaxUpload){self._setThumbStatus(self._getFrame(previewId),'Error')}},_previewFile:function(i,file,theFile,data,fileInfo){if(!this.showPreview){return}var self=this,fname=$h.getFileName(file),ftype=fileInfo.type,content,caption=fileInfo.name,cat=self._parseFileType(ftype,fname),$preview=self.$preview,fsize=file.size||0,iData=cat==='image'?theFile.target.result:data,fm=self.fileManager,fileId=fm.getId(file),previewId=self._getThumbId(fileId);content=self._generatePreviewTemplate(cat,iData,fname,ftype,previewId,fileId,false,fsize,fileInfo.filename);self._clearDefaultPreview();self._addToPreview($preview,content);var $thumb=self._getFrame(previewId);self._validateImageOrientation($thumb.find('img'),file,previewId,fileId,caption,ftype,fsize,iData);self._setThumbAttr(previewId,caption,fsize);self._initSortable()},_setThumbAttr:function(id,caption,size,description){var self=this,$frame=self._getFrame(id);if($frame.length){size=size&&size>0?self._getSize(size):'';$frame.data({'caption':caption,'size':size,'description':description||''})}},_setInitThumbAttr:function(){var self=this,data=self.previewCache.data,len=self.previewCache.count(true),config,caption,size,description,previewId;if(len===0){return}for(var i=0;i<len;i++){config=data.config[i];previewId=self.previewInitId+'-'+$h.INIT_FLAG+i;caption=$h.ifSet('caption',config,$h.ifSet('filename',config));size=$h.ifSet('size',config);description=$h.ifSet('description',config);self._setThumbAttr(previewId,caption,size,description)}},_slugDefault:function(text){return $h.isEmpty(text,true)?'':String(text).replace(/[\[\]\/\{}:;#%=\(\)\*\+\?\\\^\$\|<>&"']/g,'_')},_updateFileDetails:function(numFiles){var self=this,$el=self.$element,label,n,log,nFiles,file,name=($h.isIE(9)&&$h.findFileName($el.val()))||($el[0].files[0]&&$el[0].files[0].name);if(!name&&self.fileManager.count()>0){file=self.fileManager.getFirstFile();label=file.nameFmt}else{label=name?self.slug(name):'_'}n=self.isAjaxUpload?self.fileManager.count():numFiles;nFiles=self.previewCache.count(true)+n;log=n===1?label:self._getMsgSelected(nFiles,!self.isAjaxUpload&&!self.isError);if(self.isError){self.$previewContainer.removeClass('file-thumb-loading');self._initCapStatus();self.$previewStatus.html('');self.$captionContainer.removeClass('icon-visible')}else{self._showFileIcon()}self._setCaption(log,self.isError);self.$container.removeClass('file-input-new file-input-ajax-new');self._raise('fileselect',[numFiles,label]);if(self.previewCache.count(true)){self._initPreviewActions()}},_setThumbStatus:function($thumb,status){var self=this;if(!self.showPreview){return}var icon='indicator'+status,msg=icon+'Title',css='file-preview-'+status.toLowerCase(),$indicator=$thumb.find('.file-upload-indicator'),config=self.fileActionSettings;$thumb.removeClass('file-preview-success file-preview-error file-preview-paused file-preview-loading');if(status==='Success'){$thumb.find('.file-drag-handle').remove()}$h.setHtml($indicator,config[icon]);$indicator.attr('title',config[msg]);$thumb.addClass(css);if(status==='Error'&&!self.retryErrorUploads){$thumb.find('.kv-file-upload').attr('disabled',true)}},_setProgressCancelled:function(){var self=this;self._setProgress(101,self.$progress,self.msgCancelled)},_setProgress:function(p,$el,error,stats){var self=this;$el=$el||self.$progress;if(!$el.length){return}var pct=Math.min(p,100),out,pctLimit=self.progressUploadThreshold,t=p<=100?self.progressTemplate:self.progressCompleteTemplate,template=pct<100?self.progressTemplate:(error?(self.paused?self.progressPauseTemplate:self.progressErrorTemplate):t);if(p>=100){stats=''}if(!$h.isEmpty(template)){if(pctLimit&&pct>pctLimit&&p<=100){out=template.setTokens({'percent':pctLimit,'status':self.msgUploadThreshold})}else{out=template.setTokens({'percent':pct,'status':(p>100?self.msgUploadEnd:pct+'%')})}stats=stats||'';out=out.setTokens({stats:stats});$h.setHtml($el,out);if(error){$h.setHtml($el.find('[role="progressbar"]'),error)}}},_hasFiles:function(){var el=this.$element[0];return!!(el&&el.files&&el.files.length)},_setFileDropZoneTitle:function(){var self=this,$zone=self.$container.find('.file-drop-zone'),title=self.dropZoneTitle,strFiles;if(self.isClickable){strFiles=$h.isEmpty(self.$element.attr('multiple'))?self.fileSingle:self.filePlural;title+=self.dropZoneClickTitle.replace('{files}',strFiles)}$zone.find('.'+self.dropZoneTitleClass).remove();if(!self.showPreview||$zone.length===0||self.fileManager.count()>0||!self.dropZoneEnabled||self.previewCache.count()>0||(!self.isAjaxUpload&&self._hasFiles())){return}if($zone.find($h.FRAMES).length===0&&$h.isEmpty(self.defaultPreviewContent)){$zone.prepend('<div class="'+self.dropZoneTitleClass+'">'+title+'</div>')}self.$container.removeClass('file-input-new');$h.addCss(self.$container,'file-input-ajax-new')},_getStats:function(stats){var self=this,pendingTime,t;if(!self.showUploadStats||!stats||!stats.bitrate){return''}t=self._getLayoutTemplate('stats');pendingTime=(!stats.elapsed||!stats.bps)?self.msgCalculatingTime:self.msgPendingTime.setTokens({time:$h.getElapsed(Math.ceil(stats.pendingBytes/stats.bps))});return t.setTokens({uploadSpeed:stats.bitrate,pendingTime:pendingTime})},_setResumableProgress:function(pct,stats,$thumb){var self=this,rm=self.resumableManager,obj=$thumb?rm:self,$prog=$thumb?$thumb.find('.file-thumb-progress'):null;if(obj.lastProgress===0){obj.lastProgress=pct}if(pct<obj.lastProgress){pct=obj.lastProgress}self._setProgress(pct,$prog,null,self._getStats(stats));obj.lastProgress=pct},_toggleResumableProgress:function(template,message){var self=this,$progress=self.$progress;if($progress&&$progress.length){$h.setHtml($progress,template.setTokens({percent:101,status:message,stats:''}))}},_setFileUploadStats:function(id,pct,stats){var self=this,$prog=self.$progress;if(!self.showPreview&&(!$prog||!$prog.length)){return}var fm=self.fileManager,rm=self.resumableManager,$thumb=fm.getThumb(id),pctTot,totUpSize=0,totSize=fm.getTotalSize(),totStats=$.extend(true,{},stats);if(self.enableResumableUpload){var loaded=stats.loaded,currUplSize=rm.getUploadedSize(),currTotSize=rm.file.size,totLoaded;loaded+=currUplSize;totLoaded=fm.uploadedSize+loaded;pct=$h.round(100*loaded/currTotSize);stats.pendingBytes=currTotSize-currUplSize;self._setResumableProgress(pct,stats,$thumb);pctTot=Math.floor(100*totLoaded/totSize);totStats.pendingBytes=totSize-totLoaded;self._setResumableProgress(pctTot,totStats)}else{fm.setProgress(id,pct);$prog=$thumb&&$thumb.length?$thumb.find('.file-thumb-progress'):null;self._setProgress(pct,$prog,null,self._getStats(stats));$.each(fm.stats,function(id,cfg){totUpSize+=cfg.loaded});totStats.pendingBytes=totSize-totUpSize;pctTot=$h.round(totUpSize/totSize*100);self._setProgress(pctTot,null,null,self._getStats(totStats))}},_validateMinCount:function(){var self=this,len=self.isAjaxUpload?self.fileManager.count():self._inputFileCount();if(self.validateInitialCount&&self.minFileCount>0&&self._getFileCount(len-1)<self.minFileCount){self._noFilesError({});return false}return true},_getFileCount:function(fileCount,includeInitial){var self=this,addCount=0;if(includeInitial===undefined){includeInitial=self.validateInitialCount&&!self.overwriteInitial}if(includeInitial){addCount=self.previewCache.count(true);fileCount+=addCount}return fileCount},_getFileId:function(file){return $h.getFileId(file,this.generateFileId)},_getFileName:function(file,defaultValue){var self=this,fileName=$h.getFileName(file);return fileName?self.slug(fileName):defaultValue},_getFileNames:function(skipNull){var self=this;return self.filenames.filter(function(n){return(skipNull?n!==undefined:n!==undefined&&n!==null)})},_setPreviewError:function($thumb,keepFile){var self=this,removeFrame=self.removeFromPreviewOnError&&!self.retryErrorUploads;if(!keepFile||removeFrame){self.fileManager.remove($thumb)}if(!self.showPreview){return}if(removeFrame){$thumb.remove();return}else{self._setThumbStatus($thumb,'Error')}self._refreshUploadButton($thumb)},_refreshUploadButton:function($thumb){var self=this,$btn=$thumb.find('.kv-file-upload'),cfg=self.fileActionSettings,icon=cfg.uploadIcon,title=cfg.uploadTitle;if(!$btn.length){return}if(self.retryErrorUploads){icon=cfg.uploadRetryIcon;title=cfg.uploadRetryTitle}$btn.attr('title',title);$h.setHtml($btn,icon)},_isValidSize:function(size,type,$image,$thumb,filename,params){var self=this,msg,dim,$img,tag=size==='Small'?'min':'max',limit=self[tag+'Image'+type];if($h.isEmpty(limit)||!$image.length){return true}$img=$image[0];dim=(type==='Width')?$img.naturalWidth||$img.width:$img.naturalHeight||$img.height;if(size==='Small'?dim>=limit:dim<=limit){return true}msg=self['msgImage'+type+size]||'Image "{name}" has a size validation error (limit "{size}").';self._showFileError(msg.setTokens({'name':filename,'size':limit,'dimension':dim}),params);self._setPreviewError($thumb);self.fileManager.remove($thumb);self._clearFileInput();return false},_getExifObj:function(data){var self=this,exifObj,error=$h.logMessages.exifWarning;if(data.slice(0,23)!=='data:image/jpeg;base64,'&&data.slice(0,22)!=='data:image/jpg;base64,'){exifObj=null;return}try{exifObj=window.piexif?window.piexif.load(data):null}catch(err){exifObj=null;error=err&&err.message||''}if(!exifObj&&self.showExifErrorLog){self._log($h.logMessages.badExifParser,{details:error})}return exifObj},setImageOrientation:function($img,$zoomImg,value,$thumb){var self=this,invalidImg=!$img||!$img.length,invalidZoomImg=!$zoomImg||!$zoomImg.length,$mark,isHidden=false,$div,zoomOnly=invalidImg&&$thumb&&$thumb.attr('data-template')==='image',ev;if(invalidImg&&invalidZoomImg){return}ev='load.fileinputimageorient';if(zoomOnly){$img=$zoomImg;$zoomImg=null;$img.css(self.previewSettings.image);$div=$(document.createElement('div')).appendTo($thumb.find('.kv-file-content'));$mark=$(document.createElement('span')).insertBefore($img);$img.css('visibility','hidden').removeClass('file-zoom-detail').appendTo($div)}else{isHidden=!$img.is(':visible')}$img.off(ev).on(ev,function(){if(isHidden){self.$preview.removeClass('hide-content');$thumb.find('.kv-file-content').css('visibility','hidden')}var img=$img[0],zoomImg=$zoomImg&&$zoomImg.length?$zoomImg[0]:null,h=img.offsetHeight,w=img.offsetWidth,r=$h.getRotation(value);if(isHidden){$thumb.find('.kv-file-content').css('visibility','visible');self.$preview.addClass('hide-content')}$img.data('orientation',value);if(zoomImg){$zoomImg.data('orientation',value)}if(value<5){$h.setTransform(img,r);$h.setTransform(zoomImg,r);return}var offsetAngle=Math.atan(w/h),origFactor=Math.sqrt(Math.pow(h,2)+Math.pow(w,2)),scale=!origFactor?1:(h/Math.cos(Math.PI/2+offsetAngle))/origFactor,s=' scale('+Math.abs(scale)+')';$h.setTransform(img,r+s);$h.setTransform(zoomImg,r+s);if(zoomOnly){$img.css('visibility','visible').insertAfter($mark).addClass('file-zoom-detail');$mark.remove();$div.remove()}})},_validateImageOrientation:function($img,file,previewId,fileId,caption,ftype,fsize,iData){var self=this,exifObj=null,value,autoOrientImage=self.autoOrientImage,selector;exifObj=self._getExifObj(iData);if(self.canOrientImage){$img.css('image-orientation',(autoOrientImage?'from-image':'none'));self._validateImage(previewId,fileId,caption,ftype,fsize,iData,exifObj);return}selector=$h.getZoomSelector(previewId,' img');value=exifObj?exifObj['0th'][piexif.ImageIFD.Orientation]:null;if(!value){self._validateImage(previewId,fileId,caption,ftype,fsize,iData,exifObj);return}self.setImageOrientation($img,$(selector),value,self._getFrame(previewId));self._raise('fileimageoriented',{'$img':$img,'file':file});self._validateImage(previewId,fileId,caption,ftype,fsize,iData,exifObj)},_validateImage:function(previewId,fileId,fname,ftype,fsize,iData,exifObj){var self=this,$preview=self.$preview,params,w1,w2,$thumb=self._getFrame(previewId),i=$thumb.attr('data-fileindex'),$img=$thumb.find('img');fname=fname||'Untitled';$img.one('load',function(){if($img.data('validated')){return}$img.data('validated',true);w1=$thumb.width();w2=$preview.width();if(w1>w2){$img.css('width','100%')}params={ind:i,id:previewId,fileId:fileId};setTimeout(function(){var isValidWidth,isValidHeight;isValidWidth=self._isValidSize('Small','Width',$img,$thumb,fname,params);isValidHeight=self._isValidSize('Small','Height',$img,$thumb,fname,params);if(!self.resizeImage){isValidWidth=isValidWidth&&self._isValidSize('Large','Width',$img,$thumb,fname,params);isValidHeight=isValidHeight&&self._isValidSize('Large','Height',$img,$thumb,fname,params)}self._raise('fileimageloaded',[previewId]);$thumb.data('exif',exifObj);if(isValidWidth&&isValidHeight){self.fileManager.addImage(fileId,{ind:i,img:$img,thumb:$thumb,pid:previewId,typ:ftype,siz:fsize,validated:false,imgData:iData,exifObj:exifObj});self._validateAllImages()}},self.processDelay)}).one('error',function(){self._raise('fileimageloaderror',[previewId])})},_validateAllImages:function(){var self=this,counter={val:0},numImgs=self.fileManager.getImageCount(),fsize,minSize=self.resizeIfSizeMoreThan;if(numImgs!==self.fileManager.totalImages){return}self._raise('fileimagesloaded');if(!self.resizeImage){return}$.each(self.fileManager.loadedImages,function(id,config){if(!config.validated){fsize=config.siz;if(fsize&&fsize>minSize*self.bytesToKB){self._getResizedImage(id,config,counter,numImgs)}config.validated=true}})},_getResizedImage:function(id,config,counter,numImgs){var self=this,img=$(config.img)[0],width=img.naturalWidth,height=img.naturalHeight,blob,ratio=1,maxWidth=self.maxImageWidth||width,maxHeight=self.maxImageHeight||height,isValidImage=!!(width&&height),chkWidth,chkHeight,canvas=self.imageCanvas,dataURI,context=self.imageCanvasContext,type=config.typ,pid=config.pid,ind=config.ind,$thumb=config.thumb,throwError,msg,exifObj=config.exifObj,exifStr,file,params,evParams;throwError=function(msg,params,ev){if(self.isAjaxUpload){self._showFileError(msg,params,ev);}else{self._showError(msg,params,ev)}self._setPreviewError($thumb)};file=self.fileManager.getFile(id);params={id:pid,'index':ind,fileId:id};evParams=[id,pid,ind];if(!file||!isValidImage||(width<=maxWidth&&height<=maxHeight)){if(isValidImage&&file){self._raise('fileimageresized',evParams)}counter.val++;if(counter.val===numImgs){self._raise('fileimagesresized')}if(!isValidImage){throwError(self.msgImageResizeError,params,'fileimageresizeerror');return}}type=type||self.resizeDefaultImageType;chkWidth=width>maxWidth;chkHeight=height>maxHeight;if(self.resizePreference==='width'){ratio=chkWidth?maxWidth/width:(chkHeight?maxHeight/height:1)}else{ratio=chkHeight?maxHeight/height:(chkWidth?maxWidth/width:1)}self._resetCanvas();width*=ratio;height*=ratio;canvas.width=width;canvas.height=height;try{context.drawImage(img,0,0,width,height);dataURI=canvas.toDataURL(type,self.resizeQuality);if(exifObj){exifStr=window.piexif.dump(exifObj);dataURI=window.piexif.insert(exifStr,dataURI)}blob=$h.dataURI2Blob(dataURI);self.fileManager.setFile(id,blob);self._raise('fileimageresized',evParams);counter.val++;if(counter.val===numImgs){self._raise('fileimagesresized',[undefined,undefined])}if(!(blob instanceof Blob)){throwError(self.msgImageResizeError,params,'fileimageresizeerror');}}catch(err){counter.val++;if(counter.val===numImgs){self._raise('fileimagesresized',[undefined,undefined])}msg=self.msgImageResizeException.replace('{errors}',err.message);throwError(msg,params,'fileimageresizeexception');}},_showProgress:function(){var self=this;if(self.$progress&&self.$progress.length){self.$progress.show()}},_hideProgress:function(){var self=this;if(self.$progress&&self.$progress.length){self.$progress.hide()}},_initBrowse:function($container){var self=this,$el=self.$element;if(self.showBrowse){self.$btnFile=$container.find('.btn-file').append($el)}else{$el.appendTo($container).attr('tabindex',-1);$h.addCss($el,'file-no-browse')}},_initClickable:function(){var self=this,$zone,$tmpZone;if(!self.isClickable){return}$zone=self.$dropZone;if(!self.isAjaxUpload){$tmpZone=self.$preview.find('.file-default-preview');if($tmpZone.length){$zone=$tmpZone}}$h.addCss($zone,'clickable');$zone.attr('tabindex',-1);self._handler($zone,'click',function(e){var $tar=$(e.target);if(!self.$errorContainer.is(':visible')&&(!$tar.parents('.file-preview-thumbnails').length||$tar.parents('.file-default-preview').length)){self.$element.data('zoneClicked',true).trigger('click');$zone.blur()}})},_initCaption:function(){var self=this,cap=self.initialCaption||'';if(self.overwriteInitial||$h.isEmpty(cap)){self.$caption.val('');return false}self._setCaption(cap);return true},_setCaption:function(content,isError){var self=this,title,out,icon,n,cap,file;if(!self.$caption.length){return}self.$captionContainer.removeClass('icon-visible');if(isError){title=$('<div>'+self.msgValidationError+'</div>').text();n=self.fileManager.count();if(n){file=self.fileManager.getFirstFile();cap=n===1&&file?file.nameFmt:self._getMsgSelected(n)}else{cap=self._getMsgSelected(self.msgNo)}out=$h.isEmpty(content)?cap:content;icon='<span class="'+self.msgValidationErrorClass+'">'+self.msgValidationErrorIcon+'</span>'}else{if($h.isEmpty(content)){self.$caption.attr('title','');return}title=$('<div>'+content+'</div>').text();out=title;icon=self._getLayoutTemplate('fileIcon')}self.$captionContainer.addClass('icon-visible');self.$caption.attr('title',title).val(out);$h.setHtml(self.$captionIcon,icon)},_createContainer:function(){var self=this,attribs={'class':'file-input file-input-new'+(self.rtl?' kv-rtl':'')},$container=$h.createElement($h.cspBuffer.stash(self._renderMain()));$h.cspBuffer.apply($container);$container.insertBefore(self.$element).attr(attribs);self._initBrowse($container);if(self.theme){$container.addClass('theme-'+self.theme)}return $container},_refreshContainer:function(){var self=this,$container=self.$container,$el=self.$element;$el.insertAfter($container);$h.setHtml($container,self._renderMain());self._initBrowse($container);self._validateDisabled()},_validateDisabled:function(){var self=this;self.$caption.attr({readonly:self.isDisabled})},_setTabIndex:function(type,html){var self=this,index=self.tabIndexConfig[type];return html.setTokens({tabIndexConfig:index===undefined||index===null?'':'tabindex="'+index+'"'})},_renderMain:function(){var self=this,dropCss=self.dropZoneEnabled?' file-drop-zone':'file-drop-disabled',close=!self.showClose?'':self._getLayoutTemplate('close'),preview=!self.showPreview?'':self._getLayoutTemplate('preview').setTokens({'class':self.previewClass,'dropClass':dropCss}),css=self.isDisabled?self.captionClass+' file-caption-disabled':self.captionClass,caption=self.captionTemplate.setTokens({'class':css+' kv-fileinput-caption'});caption=self._setTabIndex('caption',caption);return self.mainTemplate.setTokens({'class':self.mainClass+(!self.showBrowse&&self.showCaption?' no-browse':''),'inputGroupClass':self.inputGroupClass,'preview':preview,'close':close,'caption':caption,'upload':self._renderButton('upload'),'remove':self._renderButton('remove'),'cancel':self._renderButton('cancel'),'pause':self._renderButton('pause'),'browse':self._renderButton('browse')})},_renderButton:function(type){var self=this,tmplt=self._getLayoutTemplate('btnDefault'),css=self[type+'Class'],title=self[type+'Title'],icon=self[type+'Icon'],label=self[type+'Label'],status=self.isDisabled?' disabled':'',btnType='button';switch(type){case'remove':if(!self.showRemove){return''}break;case'cancel':if(!self.showCancel){return''}css+=' kv-hidden';break;case'pause':if(!self.showPause){return''}css+=' kv-hidden';break;case'upload':if(!self.showUpload){return''}if(self.isAjaxUpload&&!self.isDisabled){tmplt=self._getLayoutTemplate('btnLink').replace('{href}',self.uploadUrl)}else{btnType='submit'}break;case'browse':if(!self.showBrowse){return''}tmplt=self._getLayoutTemplate('btnBrowse');break;default:return''}tmplt=self._setTabIndex(type,tmplt);css+=type==='browse'?' btn-file':' fileinput-'+type+' fileinput-'+type+'-button';if(!$h.isEmpty(label)){label=' <span class="'+self.buttonLabelClass+'">'+label+'</span>'}return tmplt.setTokens({'type':btnType,'css':css,'title':title,'status':status,'icon':icon,'label':label})},_renderThumbProgress:function(){var self=this;return'<div class="file-thumb-progress kv-hidden">'+self.progressInfoTemplate.setTokens({percent:101,status:self.msgUploadBegin,stats:''})+'</div>'},_renderFileFooter:function(cat,caption,size,width,isError){var self=this,config=self.fileActionSettings,rem=config.showRemove,drg=config.showDrag,upl=config.showUpload,rot=config.showRotate,zoom=config.showZoom,out,params,template=self._getLayoutTemplate('footer'),tInd=self._getLayoutTemplate('indicator'),ind=isError?config.indicatorError:config.indicatorNew,title=isError?config.indicatorErrorTitle:config.indicatorNewTitle,indicator=tInd.setTokens({'indicator':ind,'indicatorTitle':title});size=self._getSize(size);params={type:cat,caption:caption,size:size,width:width,progress:'',indicator:indicator};if(self.isAjaxUpload){params.progress=self._renderThumbProgress();params.actions=self._renderFileActions(params,upl,false,rem,rot,zoom,drg,false,false,false)}else{params.actions=self._renderFileActions(params,false,false,false,false,zoom,drg,false,false,false)}out=template.setTokens(params);out=$h.replaceTags(out,self.previewThumbTags);return out},_renderFileActions:function(cfg,showUpl,showDwn,showDel,showRot,showZoom,showDrag,disabled,url,key,isInit,dUrl,dFile){var self=this;if(!cfg.type&&isInit){cfg.type='image'}if(self.enableResumableUpload){showUpl=false}else{if(typeof showUpl==='function'){showUpl=showUpl(cfg)}}if(typeof showDwn==='function'){showDwn=showDwn(cfg)}if(typeof showDel==='function'){showDel=showDel(cfg)}if(typeof showZoom==='function'){showZoom=showZoom(cfg)}if(typeof showDrag==='function'){showDrag=showDrag(cfg)}if(typeof showRot==='function'){showRot=showRot(cfg)}if(!showUpl&&!showDwn&&!showDel&&!showRot&&!showZoom&&!showDrag){return''}var vUrl=url===false?'':' data-url="'+url+'"',btnZoom='',btnDrag='',btnRotate='',css,vKey=key===false?'':' data-key="'+key+'"',btnDelete='',btnUpload='',btnDownload='',template=self._getLayoutTemplate('actions'),config=self.fileActionSettings,otherButtons=self.otherActionButtons.setTokens({'dataKey':vKey,'key':key}),removeClass=disabled?config.removeClass+' disabled':config.removeClass;if(showDel){btnDelete=self._getLayoutTemplate('actionDelete').setTokens({'removeClass':removeClass,'removeIcon':config.removeIcon,'removeTitle':config.removeTitle,'dataUrl':vUrl,'dataKey':vKey,'key':key})}if(showRot){btnRotate=self._getLayoutTemplate('actionRotate').setTokens({'rotateClass':config.rotateClass,'rotateIcon':config.rotateIcon,'rotateTitle':config.rotateTitle})}if(showUpl){btnUpload=self._getLayoutTemplate('actionUpload').setTokens({'uploadClass':config.uploadClass,'uploadIcon':config.uploadIcon,'uploadTitle':config.uploadTitle})}if(showDwn){btnDownload=self._getLayoutTemplate('actionDownload').setTokens({'downloadClass':config.downloadClass,'downloadIcon':config.downloadIcon,'downloadTitle':config.downloadTitle,'downloadUrl':dUrl||self.initialPreviewDownloadUrl});btnDownload=btnDownload.setTokens({'filename':dFile,'key':key})}if(showZoom){btnZoom=self._getLayoutTemplate('actionZoom').setTokens({'zoomClass':config.zoomClass,'zoomIcon':config.zoomIcon,'zoomTitle':config.zoomTitle})}if(showDrag&&isInit){css='drag-handle-init '+config.dragClass;btnDrag=self._getLayoutTemplate('actionDrag').setTokens({'dragClass':css,'dragTitle':config.dragTitle,'dragIcon':config.dragIcon})}return template.setTokens({'delete':btnDelete,'upload':btnUpload,'download':btnDownload,'rotate':btnRotate,'zoom':btnZoom,'drag':btnDrag,'other':otherButtons})},_browse:function(e){var self=this;if(e&&e.isDefaultPrevented()||!self._raise('filebrowse')){return}if(self.isError&&!self.isAjaxUpload){self.clear()}if(self.focusCaptionOnBrowse){self.$captionContainer.focus()}},_change:function(e){var self=this;$(document.body).off('focusin.fileinput focusout.fileinput');if(self.changeTriggered){self._toggleLoading('hide');return}self._toggleLoading('show');var $el=self.$element,isDragDrop=arguments.length>1,isAjaxUpload=self.isAjaxUpload,tfiles,files=isDragDrop?arguments[1]:$el[0].files,ctr=self.fileManager.count(),total,initCount,len,isSingleUpl=$h.isEmpty($el.attr('multiple')),maxCount=!isAjaxUpload&&isSingleUpl?1:self.maxFileCount,maxTotCount=self.maxTotalFileCount,inclAll=maxTotCount>0&&maxTotCount>maxCount,flagSingle=(isSingleUpl&&ctr>0),throwError=function(mesg,file,previewId,index){var p1=$.extend(true,{},self._getOutData(null,{},{},files),{id:previewId,index:index}),p2={id:previewId,index:index,file:file,files:files};self.isPersistentError=true;self._toggleLoading('hide');return isAjaxUpload?self._showFileError(mesg,p1):self._showError(mesg,p2)},maxCountCheck=function(n,m,all){var msg=all?self.msgTotalFilesTooMany:self.msgFilesTooMany;msg=msg.replace('{m}',m).replace('{n}',n);self.isError=throwError(msg,null,null,null);self.$captionContainer.removeClass('icon-visible');self._setCaption('',true);self.$container.removeClass('file-input-new file-input-ajax-new')};self.reader=null;self._resetUpload();self._hideFileIcon();if(self.dropZoneEnabled){self.$container.find('.file-drop-zone .'+self.dropZoneTitleClass).remove()}if(!isAjaxUpload){if(e.target&&e.target.files===undefined){files=e.target.value?[{name:e.target.value.replace(/^.+\\/,'')}]:[]}else{files=e.target.files||{}}}tfiles=files;if($h.isEmpty(tfiles)||tfiles.length===0){if(!isAjaxUpload){self.clear()}self._raise('fileselectnone');return}self._resetErrors();len=tfiles.length;initCount=isAjaxUpload?(self.fileManager.count()+len):len;total=self._getFileCount(initCount,inclAll?false:undefined);if(maxCount>0&&total>maxCount){if(!self.autoReplace||len>maxCount){maxCountCheck((self.autoReplace&&len>maxCount?len:total),maxCount);return}if(total>maxCount){self._resetPreviewThumbs(isAjaxUpload)}}else{if(inclAll){total=self._getFileCount(initCount,true);if(maxTotCount>0&&total>maxTotCount){if(!self.autoReplace||len>maxCount){maxCountCheck((self.autoReplace&&len>maxTotCount?len:total),maxTotCount,true);return}if(total>maxCount){self._resetPreviewThumbs(isAjaxUpload)}}}if(!isAjaxUpload||flagSingle){self._resetPreviewThumbs(false);if(flagSingle){self.clearFileStack()}}else{if(isAjaxUpload&&ctr===0&&(!self.previewCache.count(true)||self.overwriteInitial)){self._resetPreviewThumbs(true)}}}if(self.autoReplace){self._getThumbs().each(function(){var $thumb=$(this);if($thumb.hasClass('file-preview-success')||$thumb.hasClass('file-preview-error')){$thumb.remove()}})}self.readFiles(tfiles);self._toggleLoading('hide')},_abort:function(params){var self=this,data;if(self.ajaxAborted&&typeof self.ajaxAborted==='object'&&self.ajaxAborted.message!==undefined){data=$.extend(true,{},self._getOutData(null),params);data.abortData=self.ajaxAborted.data||{};data.abortMessage=self.ajaxAborted.message;self._setProgress(101,self.$progress,self.msgCancelled);self._showFileError(self.ajaxAborted.message,data,'filecustomerror');self.cancel();self.unlock();return true}return!!self.ajaxAborted},_resetFileStack:function(){var self=this,i=0;self._getThumbs().each(function(){var $thumb=$(this),ind=$thumb.attr('data-fileindex'),pid=$thumb.attr('id');if(ind==='-1'||ind===-1){return}if(!self._getThumbFile($thumb)){$thumb.attr({'data-fileindex':i});i++}else{$thumb.attr({'data-fileindex':'-1'})}self._getZoom(pid).attr({'data-fileindex':$thumb.attr('data-fileindex')})})},_isFileSelectionValid:function(cnt){var self=this;cnt=cnt||0;if(self.required&&!self.getFilesCount()){self.$errorContainer.html('');self._showFileError(self.msgFileRequired);return false}if(self.minFileCount>0&&self._getFileCount(cnt)<self.minFileCount){self._noFilesError({});return false}return true},_canPreview:function(file){var self=this;if(!file||!self.showPreview||!self.$preview||!self.$preview.length){return false}var name=file.name||'',type=file.type||'',size=(file.size||0)/self.bytesToKB,cat=self._parseFileType(type,name),allowedTypes,allowedMimes,allowedExts,skipPreview,types=self.allowedPreviewTypes,mimes=self.allowedPreviewMimeTypes,exts=self.allowedPreviewExtensions||[],dTypes=self.disabledPreviewTypes,dMimes=self.disabledPreviewMimeTypes,dExts=self.disabledPreviewExtensions||[],maxSize=self.maxFilePreviewSize&&parseFloat(self.maxFilePreviewSize)||0,expAllExt=new RegExp('\\.('+exts.join('|')+')$','i'),expDisExt=new RegExp('\\.('+dExts.join('|')+')$','i');allowedTypes=!types||types.indexOf(cat)!==-1;allowedMimes=!mimes||mimes.indexOf(type)!==-1;allowedExts=!exts.length||$h.compare(name,expAllExt);skipPreview=(dTypes&&dTypes.indexOf(cat)!==-1)||(dMimes&&dMimes.indexOf(type)!==-1)||(dExts.length&&$h.compare(name,expDisExt))||(maxSize&&!isNaN(maxSize)&&size>maxSize);return!skipPreview&&(allowedTypes||allowedMimes||allowedExts)},addToStack:function(file,id){var self=this;self.stackIsUpdating=true;self.fileManager.add(file,id);self._refreshPreview();self.stackIsUpdating=false},clearFileStack:function(){var self=this;self.fileManager.clear();self._initResumableUpload();if(self.enableResumableUpload){if(self.showPause===null){self.showPause=true}if(self.showCancel===null){self.showCancel=false}}else{self.showPause=false;if(self.showCancel===null){self.showCancel=true}}return self.$element},getFileStack:function(){return this.fileManager.stack},getFileList:function(){return this.fileManager.list()},getFilesSize:function(){return this.fileManager.getTotalSize()},getFilesCount:function(includeInitial){var self=this,len=self.isAjaxUpload?self.fileManager.count():self._inputFileCount();if(includeInitial){len+=self.previewCache.count(true)}return self._getFileCount(len)},_initCapStatus:function(status){var self=this,$cap=self.$caption;$cap.removeClass('is-valid file-processing');if(!status){return}if(status==='processing'){$cap.addClass('file-processing')}else{$cap.addClass('is-valid')}},_toggleLoading:function(type){var self=this;self.$previewStatus.html(type==='hide'?'':self.msgProcessing);self.$container.removeClass('file-thumb-loading');self._initCapStatus(type==='hide'?'':'processing');if(type!=='hide'){if(self.dropZoneEnabled){self.$container.find('.file-drop-zone .'+self.dropZoneTitleClass).remove()}self.$container.addClass('file-thumb-loading')}},_initFileSelected:function(){var self=this,$el=self.$element,$body=$(document.body),ev='focusin.fileinput focusout.fileinput';if($body.length){$body.off(ev).on('focusout.fileinput',function(){self._toggleLoading('show')}).on('focusin.fileinput',function(){setTimeout(function(){if(!$el.val()){self._setFileDropZoneTitle()}$body.off(ev);self._toggleLoading('hide')},2500)})}else{self._toggleLoading('hide')}},readFiles:function(files){this.reader=new FileReader();var self=this,reader=self.reader,$container=self.$previewContainer,$status=self.$previewStatus,msgLoading=self.msgLoading,msgProgress=self.msgProgress,previewInitId=self.previewInitId,numFiles=files.length,settings=self.fileTypeSettings,readFile,fileTypes=self.allowedFileTypes,typLen=fileTypes?fileTypes.length:0,fileExt=self.allowedFileExtensions,strExt=$h.isEmpty(fileExt)?'':fileExt.join(', '),throwError=function(msg,file,previewId,index,fileId){var $thumb,p1=$.extend(true,{},self._getOutData(null,{},{},files),{id:previewId,index:index,fileId:fileId}),p2={id:previewId,index:index,fileId:fileId,file:file,files:files};self._previewDefault(file,true);$thumb=self._getFrame(previewId,true);self._toggleLoading('hide');if(self.isAjaxUpload){setTimeout(function(){readFile(index+1)},self.processDelay)}else{self.unlock();numFiles=0}if(self.removeFromPreviewOnError&&$thumb.length){$thumb.remove()}else{self._initFileActions();$thumb.find('.kv-file-upload').remove()}self.isPersistentError=true;self.isError=self.isAjaxUpload?self._showFileError(msg,p1):self._showError(msg,p2);self._updateFileDetails(numFiles)};self.fileManager.clearImages();$.each(files,function(key,file){var func=self.fileTypeSettings.image;if(func&&func(file.type)){self.fileManager.totalImages++}});readFile=function(i){var $error=self.$errorContainer,errors,fm=self.fileManager;if(i>=numFiles){self.unlock();if(self.duplicateErrors.length){errors='<li>'+self.duplicateErrors.join('</li><li>')+'</li>';if($error.find('ul').length===0){$h.setHtml($error,self.errorCloseButton+'<ul>'+errors+'</ul>')}else{$error.find('ul').append(errors)}$error.fadeIn(self.fadeDelay);self._handler($error.find('.kv-error-close'),'click',function(){$error.fadeOut(self.fadeDelay)});self.duplicateErrors=[]}if(self.isAjaxUpload){self._raise('filebatchselected',[fm.stack]);if(fm.count()===0&&!self.isError){self.reset()}}else{self._raise('filebatchselected',[files])}$container.removeClass('file-thumb-loading');self._initCapStatus('valid');$status.html('');return}self.lock(true);var file=files[i],id,previewId,fileProcessed,fSize=(file&&file.size||0),sizeHuman=self._getSize(fSize,true),j,msg,fnImage=settings.image,chk,typ,typ1,typ2,caption,fileSize=fSize/self.bytesToKB,fileExtExpr='',previewData,fileCount=0,strTypes='',fileId,canLoad,fileReaderAborted=false,func,knownTypes=0,isImage,processFileLoaded,initFileData;initFileData=function(dataSource){dataSource=dataSource||file;id=fileId=self._getFileId(file);previewId=previewInitId+'-'+id;previewData=$h.createObjectURL(dataSource);caption=self._getFileName(file,'')};processFileLoaded=function(){var isImageResized=!!fm.loadedImages[id],msg=msgProgress.setTokens({'index':i+1,'files':numFiles,'percent':50,'name':caption});setTimeout(function(){$status.html(msg);self._updateFileDetails(numFiles);if(self.getFilesCount(true)>0&&self.getFrames(':visible')){self.$dropZone.find('.'+self.dropZoneTitleClass).remove()}readFile(i+1)},self.processDelay);if(self._raise('fileloaded',[file,previewId,id,i,reader])&&self.isAjaxUpload){if(!isImageResized){fm.add(file)}}else{if(isImageResized){fm.removeFile(id)}}};if(!file){return}initFileData();if(typLen>0){for(j=0;j<typLen;j++){typ1=fileTypes[j];typ2=self.msgFileTypes[typ1]||typ1;strTypes+=j===0?typ2:', '+typ2}}if(caption===false){readFile(i+1);return}if(caption.length===0){msg=self.msgInvalidFileName.replace('{name}',$h.htmlEncode($h.getFileName(file),'[unknown]'));throwError(msg,file,previewId,i,fileId);return}if(!$h.isEmpty(fileExt)){fileExtExpr=new RegExp('\\.('+fileExt.join('|')+')$','i')}if(self.isAjaxUpload&&fm.exists(fileId)||self._getFrame(previewId,true).length){var p2={id:previewId,index:i,fileId:fileId,file:file,files:files};msg=self.msgDuplicateFile.setTokens({name:caption,size:sizeHuman});if(self.isAjaxUpload){if(!self.stackIsUpdating){self.duplicateErrors.push(msg);self.isDuplicateError=true;self._raise('fileduplicateerror',[file,fileId,caption,sizeHuman,previewId,i])}readFile(i+1);self._updateFileDetails(numFiles)}else{self._showError(msg,p2);self.unlock();numFiles=0;self._clearFileInput();self.reset();self._updateFileDetails(numFiles)}return}if(self.maxFileSize>0&&fileSize>self.maxFileSize){msg=self.msgSizeTooLarge.setTokens({'name':caption,'size':sizeHuman,'maxSize':self._getSize(self.maxFileSize*self.bytesToKB,true)});throwError(msg,file,previewId,i,fileId);return}if(self.minFileSize!==null&&fileSize<=$h.getNum(self.minFileSize)){msg=self.msgSizeTooSmall.setTokens({'name':caption,'size':sizeHuman,'minSize':self._getSize(self.minFileSize*self.bytesToKB,true)});throwError(msg,file,previewId,i,fileId);return}if(!$h.isEmpty(fileTypes)&&$h.isArray(fileTypes)){for(j=0;j<fileTypes.length;j+=1){typ=fileTypes[j];func=settings[typ];fileCount+=!func||(typeof func!=='function')?0:(func(file.type,$h.getFileName(file))?1:0)}if(fileCount===0){msg=self.msgInvalidFileType.setTokens({name:caption,types:strTypes});throwError(msg,file,previewId,i,fileId);return}}if(fileCount===0&&!$h.isEmpty(fileExt)&&$h.isArray(fileExt)&&!$h.isEmpty(fileExtExpr)){chk=$h.compare(caption,fileExtExpr);fileCount+=$h.isEmpty(chk)?0:chk.length;if(fileCount===0){msg=self.msgInvalidFileExtension.setTokens({name:caption,extensions:strExt});throwError(msg,file,previewId,i,fileId);return}}if(!self._canPreview(file)){canLoad=self._raise('filebeforeload',[file,i,reader]);if(self.isAjaxUpload&&canLoad){fm.add(file)}if(self.showPreview&&canLoad){$container.addClass('file-thumb-loading');self._initCapStatus('processing');self._previewDefault(file);self._initFileActions()}setTimeout(function(){if(canLoad){self._updateFileDetails(numFiles)}readFile(i+1);self._raise('fileloaded',[file,previewId,id,i])},10);return}isImage=fnImage(file.type,caption);$status.html(msgLoading.replace('{index}',i+1).replace('{files}',numFiles));$container.addClass('file-thumb-loading');self._initCapStatus('processing');reader.onerror=function(evt){self._errorHandler(evt,caption)};reader.onload=function(theFile){var hex,fileInfo,fileData,byte,bytes=[],contents,mime,processPreview=function(fType,ext){if($h.isEmpty(fType)){contents=$h.arrayBuffer2String(reader.result);fType=$h.isSvg(contents)?'image/svg+xml':$h.getMimeType(hex,contents,file.type)}fileInfo={'name':caption,'type':fType||''};if(ext&&typeof File!=="undefined"){try{var fName=fileInfo.filename=caption+'.'+ext;fileProcessed=new File([file],fName,{type:fileInfo.type});initFileData(fileProcessed)}catch(err){}}isImage=fnImage(fType,'');if(isImage){var newReader=new FileReader();newReader.onerror=function(theFileNew){self._errorHandler(theFileNew,caption)};newReader.onload=function(theFileNew){if(self.isAjaxUpload&&!self._raise('filebeforeload',[file,i,reader])){fileReaderAborted=true;self._resetCaption();reader.abort();$status.html('');$container.removeClass('file-thumb-loading');self._initCapStatus('valid');self.enable();return}self._previewFile(i,file,theFileNew,previewData,fileInfo);self._initFileActions();processFileLoaded()};newReader.readAsDataURL(file);return}if(self.isAjaxUpload&&!self._raise('filebeforeload',[file,i,reader])){fileReaderAborted=true;self._resetCaption();reader.abort();$status.html('');$container.removeClass('file-thumb-loading');self._initCapStatus('valid');self.enable();return}self._previewFile(i,file,theFile,previewData,fileInfo);self._initFileActions();processFileLoaded()};mime=file.type;fileInfo={'name':caption,'type':mime};$.each(settings,function(k,f){if(k!=='object'&&k!=='other'&&typeof f==='function'&&f(mime,caption)){knownTypes++}});if(typeof FileTypeParser!=="undefined"){fileData=new Uint8Array(theFile.target.result);new FileTypeParser().parse(fileData).then(function(result){processPreview(result&&result.mime||mime,result&&result.ext||'')})}else{if(knownTypes===0){fileData=new Uint8Array(theFile.target.result);for(j=0;j<fileData.length;j++){byte=fileData[j].toString(16);bytes.push(byte)}hex=bytes.join('').toLowerCase().substring(0,8);mime=$h.getMimeType(hex,'','')}processPreview(mime)}};reader.onprogress=function(data){if(data.lengthComputable){var fact=(data.loaded/data.total)*100,progress=Math.ceil(fact);msg=msgProgress.setTokens({'index':i+1,'files':numFiles,'percent':progress,'name':caption});setTimeout(function(){if(!fileReaderAborted){$status.html(msg)}},self.processDelay)}};reader.readAsArrayBuffer(file)};readFile(0);self._updateFileDetails(numFiles)},lock:function(selectMode){var self=this,$container=self.$container;self._resetErrors();self.disable();if(!selectMode&&self.showCancel){$container.find('.fileinput-cancel').show()}if(!selectMode&&self.showPause){$container.find('.fileinput-pause').show()}self._initCapStatus('processing');self._raise('filelock',[self.fileManager.stack,self._getExtraData()]);return self.$element},unlock:function(reset){var self=this,$container=self.$container;if(reset===undefined){reset=true}self.enable();$container.removeClass('is-locked');if(self.showCancel){$container.find('.fileinput-cancel').hide()}if(self.showPause){$container.find('.fileinput-pause').hide()}if(reset){self._resetFileStack()}self._initCapStatus();self._raise('fileunlock',[self.fileManager.stack,self._getExtraData()]);return self.$element},resume:function(){var self=this,fm=self.fileManager,flag=false,rm=self.resumableManager;fm.bpsLog=[];fm.bps=0;if(!self.enableResumableUpload){return self.$element}if(self.paused){self._toggleResumableProgress(self.progressPauseTemplate,self.msgUploadResume)}else{flag=true}self.paused=false;if(flag){self._toggleResumableProgress(self.progressInfoTemplate,self.msgUploadBegin)}setTimeout(function(){rm.upload()},self.processDelay);return self.$element},paste:function(e){var self=this,ev=e.originalEvent,files=ev.clipboardData&&ev.clipboardData.files||null;if(files){self._dropFiles(e,files)}return self.$element},pause:function(){var self=this,rm=self.resumableManager,xhr=self.ajaxRequests,len=xhr.length,i,pct=rm.getProgress(),actions=self.fileActionSettings,tm=self.taskManager,pool=tm.getPool(rm.id);if(!self.enableResumableUpload){return self.$element}else{if(pool){pool.cancel()}}self._raise('fileuploadpaused',[self.fileManager,rm]);if(len>0){for(i=0;i<len;i+=1){self.paused=true;xhr[i].abort()}}if(self.showPreview){self._getThumbs().each(function(){var $thumb=$(this),t=self._getLayoutTemplate('stats'),stats,$indicator=$thumb.find('.file-upload-indicator');$thumb.removeClass('file-uploading');if($indicator.attr('title')===actions.indicatorLoadingTitle){self._setThumbStatus($thumb,'Paused');stats=t.setTokens({pendingTime:self.msgPaused,uploadSpeed:''});self.paused=true;self._setProgress(pct,$thumb.find('.file-thumb-progress'),pct+'%',stats)}if(!self._getThumbFile($thumb)){$thumb.find('.kv-file-remove').removeClass('disabled').removeAttr('disabled')}})}self._setProgress(101,self.$progress,self.msgPaused);return self.$element},cancel:function(){var self=this,xhr=self.ajaxRequests,rm=self.resumableManager,tm=self.taskManager,pool=rm?tm.getPool(rm.id):undefined,len=xhr.length,i;if(self.enableResumableUpload&&pool){pool.cancel().done(function(){self._setProgressCancelled()});rm.reset();self._raise('fileuploadcancelled',[self.fileManager,rm])}else{if(self.ajaxPool){self.ajaxPool.cancel()}self._raise('fileuploadcancelled',[self.fileManager])}self._initAjax();if(len>0){for(i=0;i<len;i+=1){self.cancelling=true;xhr[i].abort()}}self._getThumbs().each(function(){var $thumb=$(this),$prog=$thumb.find('.file-thumb-progress');$thumb.removeClass('file-uploading');self._setProgress(0,$prog);$prog.hide();if(!self._getThumbFile($thumb)){$thumb.find('.kv-file-upload').removeClass('disabled').removeAttr('disabled');$thumb.find('.kv-file-remove').removeClass('disabled').removeAttr('disabled')}self.unlock()});setTimeout(function(){self._setProgressCancelled()},self.processDelay);return self.$element},clear:function(){var self=this,cap;if(!self._raise('fileclear')){return}self.clearInput=true;self.$btnUpload.removeAttr('disabled');self._getThumbs().find('video,audio,img').each(function(){$h.cleanMemory($(this))});self._clearFileInput();self._resetUpload();self.clearFileStack();self.isDuplicateError=false;self.isPersistentError=false;self._resetErrors(true);if(self._hasInitialPreview()){self._showFileIcon();self._resetPreview();self._initPreviewActions();self.$container.removeClass('file-input-new')}else{self._getThumbs().each(function(){self._clearObjects($(this))});if(self.isAjaxUpload){self.previewCache.data={}}self.$preview.html('');cap=(!self.overwriteInitial&&self.initialCaption.length>0)?self.initialCaption:'';self.$caption.attr('title','').val(cap);$h.addCss(self.$container,'file-input-new');self._validateDefaultPreview()}if(self.$container.find($h.FRAMES).length===0){if(!self._initCaption()){self.$captionContainer.removeClass('icon-visible')}}self._hideFileIcon();if(self.focusCaptionOnClear){self.$captionContainer.focus()}self._setFileDropZoneTitle();self._raise('filecleared');return self.$element},reset:function(){var self=this;if(!self._raise('filereset')){return}self.lastProgress=0;self._resetPreview();self.$container.find('.fileinput-filename').text('');$h.addCss(self.$container,'file-input-new');if(self.getFrames().length){self.$container.removeClass('file-input-new')}self.clearFileStack();self._setFileDropZoneTitle();return self.$element},disable:function(){var self=this,$container=self.$container;self.isDisabled=true;self._raise('filedisabled');self.$element.attr('disabled','disabled');$container.addClass('is-locked');$h.addCss($container.find('.btn-file'),'disabled');$container.find('.kv-fileinput-caption').addClass('file-caption-disabled');$container.find('.fileinput-remove, .fileinput-upload, .file-preview-frame button').attr('disabled',true);self._initDragDrop();return self.$element},enable:function(){var self=this,$container=self.$container;self.isDisabled=false;self._raise('fileenabled');self.$element.removeAttr('disabled');$container.removeClass('is-locked');$container.find('.kv-fileinput-caption').removeClass('file-caption-disabled');$container.find('.fileinput-remove, .fileinput-upload, .file-preview-frame button').removeAttr('disabled');$container.find('.btn-file').removeClass('disabled');self._initDragDrop();return self.$element},upload:function(){var self=this,fm=self.fileManager,totLen=fm.count(),i,outData,tm=self.taskManager,hasExtraData=!$.isEmptyObject(self._getExtraData());fm.bpsLog=[];fm.bps=0;if(!self.isAjaxUpload||self.isDisabled||!self._isFileSelectionValid(totLen)){return}self.lastProgress=0;self._resetUpload();if(totLen===0&&!hasExtraData){self._showFileError(self.msgUploadEmpty);return}self.cancelling=false;self.uploadInitiated=true;self._showProgress();self.lock();if(totLen===0&&hasExtraData){self._setProgress(2);self._uploadExtraOnly();return}if(self.enableResumableUpload){return self.resume()}if(self.uploadAsync||self.enableResumableUpload){outData=self._getOutData(null);if(!self._checkBatchPreupload(outData)){return}self.fileBatchCompleted=false;self.uploadCache=[];$.each(self.getFileStack(),function(id){var previewId=self._getThumbId(id);self.uploadCache.push({id:previewId,content:null,config:null,tags:null,append:true})});self.$preview.find('.file-preview-initial').removeClass($h.SORT_CSS);self._initSortable()}self._setProgress(2);self.hasInitData=false;if(self.uploadAsync){i=0;var pool=self.ajaxPool=tm.addPool($h.uniqId());$.each(self.getFileStack(),function(id){pool.addTask(id+i,function(deferrer){self._uploadSingle(i,id,true,deferrer)});i++});pool.run(self.maxAjaxThreads).done(function(){self._log('Async upload batch completed successfully.');self._raise('filebatchuploadsuccess',[fm.stack,self._getExtraData()])}).fail(function(){self._log('Async upload batch completed with errors.');self._raise('filebatchuploaderror',[fm.stack,self._getExtraData()])});return}self._uploadBatch();return self.$element},destroy:function(){var self=this,$form=self.$form,$cont=self.$container,$el=self.$element,ns=self.namespace;$(document).off(ns);$(window).off(ns);if($form&&$form.length){$form.off(ns)}if(self.isAjaxUpload){self._clearFileInput()}self._cleanup();self._initPreviewCache();$el.insertBefore($cont).off(ns).removeData();$cont.off().remove();return $el},refresh:function(options){var self=this,$el=self.$element;if(typeof options!=='object'||$h.isEmpty(options)){options=self.options}else{options=$.extend(true,{},self.options,options)}self._init(options,true);self._listen();return $el},zoom:function(frameId){var self=this,$frame=self._getFrame(frameId);self._showModal($frame)},getExif:function(frameId){var self=this,$frame=self._getFrame(frameId);return $frame&&$frame.data('exif')||null},getFrames:function(cssFilter){var self=this,$frames;cssFilter=cssFilter||'';$frames=self.$preview.find($h.FRAMES+cssFilter);if(self.reversePreviewOrder){$frames=$($frames.get().reverse())}return $frames},getPreview:function(){var self=this;return{content:self.initialPreview,config:self.initialPreviewConfig,tags:self.initialPreviewThumbTags}}};$.fn.fileinput=function(option){if(!$h.hasFileAPISupport()&&!$h.isIE(9)){return}var args=Array.apply(null,arguments),retvals=[];args.shift();this.each(function(){var self=$(this),data=self.data('fileinput'),options=typeof option==='object'&&option,theme=options.theme||self.data('theme'),l={},t={},lang=options.language||self.data('language')||$.fn.fileinput.defaults.language||'en',opt;if(!data){if(theme){t=$.fn.fileinputThemes[theme]||{}}if(lang!=='en'&&!$h.isEmpty($.fn.fileinputLocales[lang])){l=$.fn.fileinputLocales[lang]||{}}opt=$.extend(true,{},$.fn.fileinput.defaults,t,$.fn.fileinputLocales.en,l,options,self.data());data=new FileInput(this,opt);self.data('fileinput',data)}if(typeof option==='string'){retvals.push(data[option].apply(data,args))}});switch(retvals.length){case 0:return this;case 1:return retvals[0];default:return retvals}};var IFRAME_ATTRIBS='class="kv-preview-data file-preview-pdf" src="{renderer}?file={data}" {style}',defBtnCss1='btn btn-sm btn-kv '+$h.defaultButtonCss(),defBtnCss2='btn '+$h.defaultButtonCss();$.fn.fileinput.defaults={language:'zh',bytesToKB:1024,showCaption:true,showBrowse:true,showPreview:true,showRemove:true,showUpload:true,showUploadStats:true,showCancel:null,showPause:null,showClose:true,showUploadedThumbs:true,showConsoleLogs:false,browseOnZoneClick:false,autoReplace:false,showDescriptionClose:true,autoOrientImage:function(){var ua=window.navigator.userAgent,webkit=!!ua.match(/WebKit/i),iOS=!!ua.match(/iP(od|ad|hone)/i),iOSSafari=iOS&&webkit&&!ua.match(/CriOS/i);return!iOSSafari},autoOrientImageInitial:true,showExifErrorLog:false,required:false,rtl:false,hideThumbnailContent:false,encodeUrl:true,focusCaptionOnBrowse:true,focusCaptionOnClear:true,generateFileId:null,previewClass:'',captionClass:'',frameClass:'krajee-default',mainClass:'',inputGroupClass:'',mainTemplate:null,fileSizeGetter:null,initialCaption:'',initialPreview:[],initialPreviewDelimiter:'*$$*',initialPreviewAsData:false,initialPreviewFileType:'image',initialPreviewConfig:[],initialPreviewThumbTags:[],previewThumbTags:{},initialPreviewShowDelete:true,initialPreviewDownloadUrl:'',removeFromPreviewOnError:false,deleteUrl:'',deleteExtraData:{},overwriteInitial:true,sanitizeZoomCache:function(content){var $container=$h.createElement(content);$container.find('input,textarea,select,datalist,form,.file-thumbnail-footer').remove();return $container.html()},previewZoomButtonIcons:{prev:'<i class="glyphicon glyphicon-triangle-left"></i>',next:'<i class="glyphicon glyphicon-triangle-right"></i>',toggleheader:'<i class="glyphicon glyphicon-resize-vertical"></i>',fullscreen:'<i class="glyphicon glyphicon-fullscreen"></i>',borderless:'<i class="glyphicon glyphicon-resize-full"></i>',close:'<i class="glyphicon glyphicon-remove"></i>'},previewZoomButtonClasses:{prev:'btn btn-default btn-outline-secondary btn-navigate',next:'btn btn-default btn-outline-secondary btn-navigate',rotate:defBtnCss1,toggleheader:defBtnCss1,fullscreen:defBtnCss1,borderless:defBtnCss1,close:defBtnCss1},previewTemplates:{},previewContentTemplates:{},preferIconicPreview:false,preferIconicZoomPreview:false,alwaysPreviewFileExtensions:[],rotatableFileExtensions:['jpg','jpeg','png','gif'],allowedFileTypes:null,allowedFileExtensions:null,allowedPreviewTypes:undefined,allowedPreviewMimeTypes:null,allowedPreviewExtensions:null,disabledPreviewTypes:undefined,disabledPreviewExtensions:['msi','exe','com','zip','rar','app','vb','scr'],disabledPreviewMimeTypes:null,defaultPreviewContent:null,customLayoutTags:{},customPreviewTags:{},previewFileIcon:'<i class="bi-file-earmark-fill"></i>',previewFileIconClass:'file-other-icon',previewFileIconSettings:{},previewFileExtSettings:{},buttonLabelClass:'hidden-xs',browseIcon:'<i class="bi-folder2-open"></i> ',browseClass:'btn btn-primary',removeIcon:'<i class="bi-trash"></i>',removeClass:defBtnCss2,cancelIcon:'<i class="bi-slash-circle"></i>',cancelClass:defBtnCss2,pauseIcon:'<i class="bi-pause-fill"></i>',pauseClass:defBtnCss2,uploadIcon:'<i class="bi-upload"></i>',uploadClass:defBtnCss2,uploadUrl:null,uploadUrlThumb:null,uploadAsync:true,uploadParamNames:{chunkCount:'chunkCount',chunkIndex:'chunkIndex',chunkSize:'chunkSize',chunkSizeStart:'chunkSizeStart',chunksUploaded:'chunksUploaded',fileBlob:'fileBlob',fileId:'fileId',fileName:'fileName',fileRelativePath:'fileRelativePath',fileSize:'fileSize',retryCount:'retryCount'},maxAjaxThreads:5,fadeDelay:800,processDelay:100,bitrateUpdateDelay:500,queueDelay:10,progressDelay:0,enableResumableUpload:false,resumableUploadOptions:{fallback:null,testUrl:null,chunkSize:2048,maxThreads:4,maxRetries:3,showErrorLog:true,retainErrorHistory:false,skipErrorsAndProceed:false},uploadExtraData:{},zoomModalHeight:485,minImageWidth:null,minImageHeight:null,maxImageWidth:null,maxImageHeight:null,resizeImage:false,resizePreference:'width',resizeQuality:0.92,resizeDefaultImageType:'image/jpeg',resizeIfSizeMoreThan:0,minFileSize:-1,maxFileSize:0,maxFilePreviewSize:25600,minFileCount:0,maxFileCount:0,maxTotalFileCount:0,validateInitialCount:false,msgValidationErrorClass:'text-danger',msgValidationErrorIcon:'<i class="glyphicon glyphicon-exclamation-sign"></i> ',msgErrorClass:'file-error-message',progressThumbClass:'progress-bar progress-bar-striped active progress-bar-animated',progressClass:'progress-bar bg-success progress-bar-success progress-bar-striped active progress-bar-animated',progressInfoClass:'progress-bar bg-info progress-bar-info progress-bar-striped active progress-bar-animated',progressCompleteClass:'progress-bar bg-success progress-bar-success',progressPauseClass:'progress-bar bg-primary progress-bar-primary progress-bar-striped active progress-bar-animated',progressErrorClass:'progress-bar bg-danger progress-bar-danger',progressUploadThreshold:99,previewFileType:'image',elCaptionContainer:null,elCaptionText:null,elPreviewContainer:null,elPreviewImage:null,elPreviewStatus:null,elErrorContainer:null,errorCloseButton:undefined,slugCallback:null,dropZoneEnabled:true,dropZoneTitleClass:'file-drop-zone-title',fileActionSettings:{},otherActionButtons:'',textEncoding:'UTF-8',preProcessUpload:null,ajaxSettings:{},ajaxDeleteSettings:{},showAjaxErrorDetails:true,mergeAjaxCallbacks:false,mergeAjaxDeleteCallbacks:false,retryErrorUploads:true,reversePreviewOrder:false,usePdfRenderer:function(){var isIE11=!!window.MSInputMethodContext&&!!document.documentMode;return!!navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/i)||isIE11},pdfRendererUrl:'',pdfRendererTemplate:'<iframe '+IFRAME_ATTRIBS+'></iframe>',tabIndexConfig:{browse:500,remove:500,upload:500,cancel:null,pause:null,modal:-1}};$.fn.fileinputLocales.en={sizeUnits:['B','KB','MB','GB','TB','PB','EB','ZB','YB'],bitRateUnits:['B/s','KB/s','MB/s','GB/s','TB/s','PB/s','EB/s','ZB/s','YB/s'],fileSingle:'file',filePlural:'files',browseLabel:'Browse …',removeLabel:'Remove',removeTitle:'Clear all unprocessed files',cancelLabel:'Cancel',cancelTitle:'Abort ongoing upload',pauseLabel:'Pause',pauseTitle:'Pause ongoing upload',uploadLabel:'Upload',uploadTitle:'Upload selected files',msgNo:'No',msgNoFilesSelected:'No files selected',msgCancelled:'Cancelled',msgPaused:'Paused',msgPlaceholder:'Select {files} ...',msgZoomModalHeading:'Detailed Preview',msgFileRequired:'You must select a file to upload.',msgSizeTooSmall:'File "{name}" (<b>{size}</b>) is too small and must be larger than <b>{minSize}</b>.',msgSizeTooLarge:'File "{name}" (<b>{size}</b>) exceeds maximum allowed upload size of <b>{maxSize}</b>.',msgFilesTooLess:'You must select at least <b>{n}</b> {files} to upload.',msgFilesTooMany:'Number of files selected for upload <b>({n})</b> exceeds maximum allowed limit of <b>{m}</b>.',msgTotalFilesTooMany:'You can upload a maximum of <b>{m}</b> files (<b>{n}</b> files detected).',msgFileNotFound:'File "{name}" not found!',msgFileSecured:'Security restrictions prevent reading the file "{name}".',msgFileNotReadable:'File "{name}" is not readable.',msgFilePreviewAborted:'File preview aborted for "{name}".',msgFilePreviewError:'An error occurred while reading the file "{name}".',msgInvalidFileName:'Invalid or unsupported characters in file name "{name}".',msgInvalidFileType:'Invalid type for file "{name}". Only "{types}" files are supported.',msgInvalidFileExtension:'Invalid extension for file "{name}". Only "{extensions}" files are supported.',msgFileTypes:{'image':'image','html':'HTML','text':'text','video':'video','audio':'audio','flash':'flash','pdf':'PDF','object':'object'},msgUploadAborted:'The file upload was aborted',msgUploadThreshold:'Processing …',msgUploadBegin:'Initializing …',msgUploadEnd:'Done',msgUploadResume:'Resuming upload …',msgUploadEmpty:'No valid data available for upload.',msgUploadError:'Upload Error',msgDeleteError:'Delete Error',msgProgressError:'Error',msgValidationError:'Validation Error',msgLoading:'Loading file {index} of {files} …',msgProgress:'Loading file {index} of {files} - {name} - {percent}% completed.',msgSelected:'{n} {files} selected',msgProcessing:'Processing ...',msgFoldersNotAllowed:'Drag & drop files only! {n} folder(s) dropped were skipped.',msgImageWidthSmall:'Width of image file "{name}" must be at least <b>{size} px</b> (detected <b>{dimension} px</b>).',msgImageHeightSmall:'Height of image file "{name}" must be at least <b>{size} px</b> (detected <b>{dimension} px</b>).',msgImageWidthLarge:'Width of image file "{name}" cannot exceed <b>{size} px</b> (detected <b>{dimension} px</b>).',msgImageHeightLarge:'Height of image file "{name}" cannot exceed <b>{size} px</b> (detected <b>{dimension} px</b>).',msgImageResizeError:'Could not get the image dimensions to resize.',msgImageResizeException:'Error while resizing the image.<pre>{errors}</pre>',msgAjaxError:'Something went wrong with the {operation} operation. Please try again later!',msgAjaxProgressError:'{operation} failed',msgDuplicateFile:'File "{name}" of same size "{size}" has already been selected earlier. Skipping duplicate selection.',msgResumableUploadRetriesExceeded:'Upload aborted beyond <b>{max}</b> retries for file <b>{file}</b>! Error Details: <pre>{error}</pre>',msgPendingTime:'{time} remaining',msgCalculatingTime:'calculating time remaining',ajaxOperations:{deleteThumb:'file delete',uploadThumb:'file upload',uploadBatch:'batch file upload',uploadExtra:'form data upload'},dropZoneTitle:'Drag & drop files here …',dropZoneClickTitle:'<br>(or click to select {files})',previewZoomButtonTitles:{prev:'View previous file',next:'View next file',rotate:'Rotate 90 deg. clockwise',toggleheader:'Toggle header',fullscreen:'Toggle full screen',borderless:'Toggle borderless mode',close:'Close detailed preview'}};$.fn.fileinputLocales.zh={sizeUnits:['B','KB','MB','GB','TB','PB','EB','ZB','YB'],bitRateUnits:['B/s','KB/s','MB/s','GB/s','TB/s','PB/s','EB/s','ZB/s','YB/s'],fileSingle:'文件',filePlural:'个文件',browseLabel:'选择 …',removeLabel:'移除',removeTitle:'清除选中文件',cancelLabel:'取消',cancelTitle:'取消进行中的上传',pauseLabel:'暂停',pauseTitle:'暂停上传',uploadLabel:'上传',uploadTitle:'上传选中文件',msgNo:'没有',msgNoFilesSelected:'未选择文件',msgPaused:'已暂停',msgCancelled:'取消',msgPlaceholder:'选择 {files} ...',msgZoomModalHeading:'详细预览',msgFileRequired:'必须选择一个文件上传.',msgSizeTooSmall:'文件 "{name}" (<b>{size}</b>) 必须大于限定大小 <b>{minSize}</b>.',msgSizeTooLarge:'文件 "{name}" (<b>{size}</b>) 超过了允许大小 <b>{maxSize}</b>.',msgFilesTooLess:'你必须选择最少 <b>{n}</b> {files} 来上传. ',msgFilesTooMany:'选择的上传文件个数 <b>({n})</b> 超出最大文件的限制个数 <b>{m}</b>.',msgTotalFilesTooMany:'你最多可以上传 <b>{m}</b> 个文件 (当前有<b>{n}</b> 个文件).',msgFileNotFound:'文件 "{name}" 未找到!',msgFileSecured:'安全限制,为了防止读取文件 "{name}".',msgFileNotReadable:'文件 "{name}" 不可读.',msgFilePreviewAborted:'取消 "{name}" 的预览.',msgFilePreviewError:'读取 "{name}" 时出现了一个错误.',msgInvalidFileName:'文件名 "{name}" 包含非法字符.',msgInvalidFileType:'不正确的类型 "{name}". 只支持 "{types}" 类型的文件.',msgInvalidFileExtension:'不正确的文件扩展名 "{name}". 只支持 "{extensions}" 的文件扩展名.',msgFileTypes:{'image':'image','html':'HTML','text':'text','video':'video','audio':'audio','flash':'flash','pdf':'PDF','object':'object'},msgUploadAborted:'该文件上传被中止',msgUploadThreshold:'处理中 …',msgUploadBegin:'正在初始化 …',msgUploadEnd:'完成',msgUploadResume:'继续上传 …',msgUploadEmpty:'无效的文件上传.',msgUploadError:'上传出错',msgDeleteError:'删除出错',msgProgressError:'上传出错',msgValidationError:'验证错误',msgLoading:'加载第 {index} 文件 共 {files} …',msgProgress:'加载第 {index} 文件 共 {files} - {name} - {percent}% 完成.',msgSelected:'{n} {files} 选中',msgProcessing:'处理中 ...',msgFoldersNotAllowed:'只支持拖拽文件! 跳过 {n} 拖拽的文件夹.',msgImageWidthSmall:'图像文件的"{name}"的宽度必须是至少{size}像素.',msgImageHeightSmall:'图像文件的"{name}"的高度必须至少为{size}像素.',msgImageWidthLarge:'图像文件"{name}"的宽度不能超过{size}像素.',msgImageHeightLarge:'图像文件"{name}"的高度不能超过{size}像素.',msgImageResizeError:'无法获取的图像尺寸调整。',msgImageResizeException:'调整图像大小时发生错误。<pre>{errors}</pre>',msgAjaxError:'{operation} 发生错误. 请重试!',msgAjaxProgressError:'{operation} 失败',msgDuplicateFile:'文件 "{name}",大小 "{size}" 已经被选中.忽略相同的文件.',msgResumableUploadRetriesExceeded:'文件 <b>{file}</b> 上传失败超过 <b>{max}</b> 次重试 ! 错误详情: <pre>{error}</pre>',msgPendingTime:'{time} 剩余',msgCalculatingTime:'计算剩余时间',ajaxOperations:{deleteThumb:'删除文件',uploadThumb:'上传文件',uploadBatch:'批量上传',uploadExtra:'表单数据上传'},dropZoneTitle:'拖拽文件到这里 …<br>支持多文件同时上传',dropZoneClickTitle:'<br>(或点击{files}按钮选择文件)',fileActionSettings:{removeTitle:'删除文件',uploadTitle:'上传文件',downloadTitle:'下载文件',uploadRetryTitle:'重试',rotateTitle:'顺时针旋转90度',zoomTitle:'查看详情',dragTitle:'移动 / 重置',indicatorNewTitle:'没有上传',indicatorSuccessTitle:'上传',indicatorErrorTitle:'上传错误',indicatorPausedTitle:'上传已暂停',indicatorLoadingTitle:'上传 …'},previewZoomButtonTitles:{prev:'预览上一个文件',next:'预览下一个文件',rotate:'顺时针旋转90度',toggleheader:'缩放',fullscreen:'全屏',borderless:'无边界模式',close:'关闭当前预览'}};$.fn.fileinput.Constructor=FileInput;$(document).ready(function(){var $input=$('input.file[type=file]');if($input.length){$input.fileinput()}})})); |
New file |
| | |
| | | /*! |
| | | * Bootstrap-select v1.13.18 (https://developer.snapappointments.com/bootstrap-select) |
| | | * |
| | | * Copyright 2012-2020 SnapAppointments, LLC |
| | | * Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE) |
| | | */ |
| | | |
| | | @-webkit-keyframes bs-notify-fadeOut { |
| | | 0% { |
| | | opacity: 0.9; |
| | | } |
| | | 100% { |
| | | opacity: 0; |
| | | } |
| | | } |
| | | @-o-keyframes bs-notify-fadeOut { |
| | | 0% { |
| | | opacity: 0.9; |
| | | } |
| | | 100% { |
| | | opacity: 0; |
| | | } |
| | | } |
| | | @keyframes bs-notify-fadeOut { |
| | | 0% { |
| | | opacity: 0.9; |
| | | } |
| | | 100% { |
| | | opacity: 0; |
| | | } |
| | | } |
| | | select.bs-select-hidden, |
| | | .bootstrap-select > select.bs-select-hidden, |
| | | select.selectpicker { |
| | | display: none !important; |
| | | } |
| | | .bootstrap-select { |
| | | width: 220px \0; |
| | | /*IE9 and below*/ |
| | | vertical-align: middle; |
| | | } |
| | | .bootstrap-select > .dropdown-toggle { |
| | | position: relative; |
| | | width: 100%; |
| | | text-align: right; |
| | | white-space: nowrap; |
| | | display: -webkit-inline-box; |
| | | display: -webkit-inline-flex; |
| | | display: -ms-inline-flexbox; |
| | | display: inline-flex; |
| | | -webkit-box-align: center; |
| | | -webkit-align-items: center; |
| | | -ms-flex-align: center; |
| | | align-items: center; |
| | | -webkit-box-pack: justify; |
| | | -webkit-justify-content: space-between; |
| | | -ms-flex-pack: justify; |
| | | justify-content: space-between; |
| | | } |
| | | .bootstrap-select > .dropdown-toggle:after { |
| | | margin-top: -1px; |
| | | } |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder:hover, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder:focus, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder:active { |
| | | color: #999; |
| | | } |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-primary, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-secondary, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-success, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-danger, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-info, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-dark, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-primary:hover, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-secondary:hover, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-success:hover, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-danger:hover, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-info:hover, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-dark:hover, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-primary:focus, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-secondary:focus, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-success:focus, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-danger:focus, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-info:focus, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-dark:focus, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-primary:active, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-secondary:active, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-success:active, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-danger:active, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-info:active, |
| | | .bootstrap-select > .dropdown-toggle.bs-placeholder.btn-dark:active { |
| | | color: rgba(255, 255, 255, 0.5); |
| | | } |
| | | .bootstrap-select > select { |
| | | position: absolute !important; |
| | | bottom: 0; |
| | | left: 50%; |
| | | display: block !important; |
| | | width: 0.5px !important; |
| | | height: 100% !important; |
| | | padding: 0 !important; |
| | | opacity: 0 !important; |
| | | border: none; |
| | | z-index: 0 !important; |
| | | } |
| | | .bootstrap-select > select.mobile-device { |
| | | top: 0; |
| | | left: 0; |
| | | display: block !important; |
| | | width: 100% !important; |
| | | z-index: 2 !important; |
| | | } |
| | | .has-error .bootstrap-select .dropdown-toggle, |
| | | .error .bootstrap-select .dropdown-toggle, |
| | | .bootstrap-select.is-invalid .dropdown-toggle, |
| | | .was-validated .bootstrap-select select:invalid + .dropdown-toggle { |
| | | border-color: #b94a48; |
| | | } |
| | | .bootstrap-select.is-valid .dropdown-toggle, |
| | | .was-validated .bootstrap-select select:valid + .dropdown-toggle { |
| | | border-color: #28a745; |
| | | } |
| | | .bootstrap-select.fit-width { |
| | | width: auto !important; |
| | | } |
| | | .bootstrap-select:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) { |
| | | width: 220px; |
| | | } |
| | | .bootstrap-select > select.mobile-device:focus + .dropdown-toggle, |
| | | .bootstrap-select .dropdown-toggle:focus { |
| | | outline: thin dotted #333333 !important; |
| | | outline: 5px auto -webkit-focus-ring-color !important; |
| | | outline-offset: -2px; |
| | | } |
| | | .bootstrap-select.form-control { |
| | | margin-bottom: 0; |
| | | padding: 0; |
| | | border: none; |
| | | height: auto; |
| | | } |
| | | :not(.input-group) > .bootstrap-select.form-control:not([class*="col-"]) { |
| | | width: 100%; |
| | | } |
| | | .bootstrap-select.form-control.input-group-btn { |
| | | float: none; |
| | | z-index: auto; |
| | | } |
| | | .form-inline .bootstrap-select, |
| | | .form-inline .bootstrap-select.form-control:not([class*="col-"]) { |
| | | width: auto; |
| | | } |
| | | .bootstrap-select:not(.input-group-btn), |
| | | .bootstrap-select[class*="col-"] { |
| | | float: none; |
| | | display: inline-block; |
| | | margin-left: 0; |
| | | } |
| | | .bootstrap-select.dropdown-menu-right, |
| | | .bootstrap-select[class*="col-"].dropdown-menu-right, |
| | | .row .bootstrap-select[class*="col-"].dropdown-menu-right { |
| | | float: right; |
| | | } |
| | | .form-inline .bootstrap-select, |
| | | .form-horizontal .bootstrap-select, |
| | | .form-group .bootstrap-select { |
| | | margin-bottom: 0; |
| | | } |
| | | .form-group-lg .bootstrap-select.form-control, |
| | | .form-group-sm .bootstrap-select.form-control { |
| | | padding: 0; |
| | | } |
| | | .form-group-lg .bootstrap-select.form-control .dropdown-toggle, |
| | | .form-group-sm .bootstrap-select.form-control .dropdown-toggle { |
| | | height: 100%; |
| | | font-size: inherit; |
| | | line-height: inherit; |
| | | border-radius: inherit; |
| | | } |
| | | .bootstrap-select.form-control-sm .dropdown-toggle, |
| | | .bootstrap-select.form-control-lg .dropdown-toggle { |
| | | font-size: inherit; |
| | | line-height: inherit; |
| | | border-radius: inherit; |
| | | } |
| | | .bootstrap-select.form-control-sm .dropdown-toggle { |
| | | padding: 0.25rem 0.5rem; |
| | | } |
| | | .bootstrap-select.form-control-lg .dropdown-toggle { |
| | | padding: 0.5rem 1rem; |
| | | } |
| | | .form-inline .bootstrap-select .form-control { |
| | | width: 100%; |
| | | } |
| | | .bootstrap-select.disabled, |
| | | .bootstrap-select > .disabled { |
| | | cursor: not-allowed; |
| | | } |
| | | .bootstrap-select.disabled:focus, |
| | | .bootstrap-select > .disabled:focus { |
| | | outline: none !important; |
| | | } |
| | | .bootstrap-select.bs-container { |
| | | position: absolute; |
| | | top: 0; |
| | | left: 0; |
| | | height: 0 !important; |
| | | padding: 0 !important; |
| | | } |
| | | .bootstrap-select.bs-container .dropdown-menu { |
| | | z-index: 1060; |
| | | } |
| | | .bootstrap-select .dropdown-toggle .filter-option { |
| | | position: static; |
| | | top: 0; |
| | | left: 0; |
| | | float: left; |
| | | height: 100%; |
| | | width: 100%; |
| | | text-align: left; |
| | | overflow: hidden; |
| | | -webkit-box-flex: 0; |
| | | -webkit-flex: 0 1 auto; |
| | | -ms-flex: 0 1 auto; |
| | | flex: 0 1 auto; |
| | | } |
| | | .bs3.bootstrap-select .dropdown-toggle .filter-option { |
| | | padding-right: inherit; |
| | | } |
| | | .input-group .bs3-has-addon.bootstrap-select .dropdown-toggle .filter-option { |
| | | position: absolute; |
| | | padding-top: inherit; |
| | | padding-bottom: inherit; |
| | | padding-left: inherit; |
| | | float: none; |
| | | } |
| | | .input-group .bs3-has-addon.bootstrap-select .dropdown-toggle .filter-option .filter-option-inner { |
| | | padding-right: inherit; |
| | | } |
| | | .bootstrap-select .dropdown-toggle .filter-option-inner-inner { |
| | | overflow: hidden; |
| | | } |
| | | .bootstrap-select .dropdown-toggle .filter-expand { |
| | | width: 0 !important; |
| | | float: left; |
| | | opacity: 0 !important; |
| | | overflow: hidden; |
| | | } |
| | | .bootstrap-select .dropdown-toggle .caret { |
| | | position: absolute; |
| | | top: 50%; |
| | | right: 12px; |
| | | margin-top: -2px; |
| | | vertical-align: middle; |
| | | } |
| | | .input-group .bootstrap-select.form-control .dropdown-toggle { |
| | | border-radius: inherit; |
| | | } |
| | | .bootstrap-select[class*="col-"] .dropdown-toggle { |
| | | width: 100%; |
| | | } |
| | | .bootstrap-select .dropdown-menu { |
| | | min-width: 100%; |
| | | -webkit-box-sizing: border-box; |
| | | -moz-box-sizing: border-box; |
| | | box-sizing: border-box; |
| | | } |
| | | .bootstrap-select .dropdown-menu > .inner:focus { |
| | | outline: none !important; |
| | | } |
| | | .bootstrap-select .dropdown-menu.inner { |
| | | position: static; |
| | | float: none; |
| | | border: 0; |
| | | padding: 0; |
| | | margin: 0; |
| | | border-radius: 0; |
| | | -webkit-box-shadow: none; |
| | | box-shadow: none; |
| | | } |
| | | .bootstrap-select .dropdown-menu li { |
| | | position: relative; |
| | | } |
| | | .bootstrap-select .dropdown-menu li.active small { |
| | | color: rgba(255, 255, 255, 0.5) !important; |
| | | } |
| | | .bootstrap-select .dropdown-menu li.disabled a { |
| | | cursor: not-allowed; |
| | | } |
| | | .bootstrap-select .dropdown-menu li a { |
| | | cursor: pointer; |
| | | -webkit-user-select: none; |
| | | -moz-user-select: none; |
| | | -ms-user-select: none; |
| | | user-select: none; |
| | | } |
| | | .bootstrap-select .dropdown-menu li a.opt { |
| | | position: relative; |
| | | padding-left: 2.25em; |
| | | } |
| | | .bootstrap-select .dropdown-menu li a span.check-mark { |
| | | display: none; |
| | | } |
| | | .bootstrap-select .dropdown-menu li a span.text { |
| | | display: inline-block; |
| | | } |
| | | .bootstrap-select .dropdown-menu li small { |
| | | padding-left: 0.5em; |
| | | } |
| | | .bootstrap-select .dropdown-menu .notify { |
| | | position: absolute; |
| | | bottom: 5px; |
| | | width: 96%; |
| | | margin: 0 2%; |
| | | min-height: 26px; |
| | | padding: 3px 5px; |
| | | background: #f5f5f5; |
| | | border: 1px solid #e3e3e3; |
| | | -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); |
| | | box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); |
| | | pointer-events: none; |
| | | opacity: 0.9; |
| | | -webkit-box-sizing: border-box; |
| | | -moz-box-sizing: border-box; |
| | | box-sizing: border-box; |
| | | } |
| | | .bootstrap-select .dropdown-menu .notify.fadeOut { |
| | | -webkit-animation: 300ms linear 750ms forwards bs-notify-fadeOut; |
| | | -o-animation: 300ms linear 750ms forwards bs-notify-fadeOut; |
| | | animation: 300ms linear 750ms forwards bs-notify-fadeOut; |
| | | } |
| | | .bootstrap-select .no-results { |
| | | padding: 3px; |
| | | background: #f5f5f5; |
| | | margin: 0 5px; |
| | | white-space: nowrap; |
| | | } |
| | | .bootstrap-select.fit-width .dropdown-toggle .filter-option { |
| | | position: static; |
| | | display: inline; |
| | | padding: 0; |
| | | } |
| | | .bootstrap-select.fit-width .dropdown-toggle .filter-option-inner, |
| | | .bootstrap-select.fit-width .dropdown-toggle .filter-option-inner-inner { |
| | | display: inline; |
| | | } |
| | | .bootstrap-select.fit-width .dropdown-toggle .bs-caret:before { |
| | | content: '\00a0'; |
| | | } |
| | | .bootstrap-select.fit-width .dropdown-toggle .caret { |
| | | position: static; |
| | | top: auto; |
| | | margin-top: -1px; |
| | | } |
| | | .bootstrap-select.show-tick .dropdown-menu .selected span.check-mark { |
| | | position: absolute; |
| | | display: inline-block; |
| | | right: 15px; |
| | | top: 5px; |
| | | } |
| | | .bootstrap-select.show-tick .dropdown-menu li a span.text { |
| | | margin-right: 34px; |
| | | } |
| | | .bootstrap-select .bs-ok-default:after { |
| | | content: ''; |
| | | display: block; |
| | | width: 0.5em; |
| | | height: 1em; |
| | | border-style: solid; |
| | | border-width: 0 0.26em 0.26em 0; |
| | | -webkit-transform-style: preserve-3d; |
| | | transform-style: preserve-3d; |
| | | -webkit-transform: rotate(45deg); |
| | | -ms-transform: rotate(45deg); |
| | | -o-transform: rotate(45deg); |
| | | transform: rotate(45deg); |
| | | } |
| | | .bootstrap-select.show-menu-arrow.open > .dropdown-toggle, |
| | | .bootstrap-select.show-menu-arrow.show > .dropdown-toggle { |
| | | z-index: 1061; |
| | | } |
| | | .bootstrap-select.show-menu-arrow .dropdown-toggle .filter-option:before { |
| | | content: ''; |
| | | border-left: 7px solid transparent; |
| | | border-right: 7px solid transparent; |
| | | border-bottom: 7px solid rgba(204, 204, 204, 0.2); |
| | | position: absolute; |
| | | bottom: -4px; |
| | | left: 9px; |
| | | display: none; |
| | | } |
| | | .bootstrap-select.show-menu-arrow .dropdown-toggle .filter-option:after { |
| | | content: ''; |
| | | border-left: 6px solid transparent; |
| | | border-right: 6px solid transparent; |
| | | border-bottom: 6px solid white; |
| | | position: absolute; |
| | | bottom: -4px; |
| | | left: 10px; |
| | | display: none; |
| | | } |
| | | .bootstrap-select.show-menu-arrow.dropup .dropdown-toggle .filter-option:before { |
| | | bottom: auto; |
| | | top: -4px; |
| | | border-top: 7px solid rgba(204, 204, 204, 0.2); |
| | | border-bottom: 0; |
| | | } |
| | | .bootstrap-select.show-menu-arrow.dropup .dropdown-toggle .filter-option:after { |
| | | bottom: auto; |
| | | top: -4px; |
| | | border-top: 6px solid white; |
| | | border-bottom: 0; |
| | | } |
| | | .bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle .filter-option:before { |
| | | right: 12px; |
| | | left: auto; |
| | | } |
| | | .bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle .filter-option:after { |
| | | right: 13px; |
| | | left: auto; |
| | | } |
| | | .bootstrap-select.show-menu-arrow.open > .dropdown-toggle .filter-option:before, |
| | | .bootstrap-select.show-menu-arrow.show > .dropdown-toggle .filter-option:before, |
| | | .bootstrap-select.show-menu-arrow.open > .dropdown-toggle .filter-option:after, |
| | | .bootstrap-select.show-menu-arrow.show > .dropdown-toggle .filter-option:after { |
| | | display: block; |
| | | } |
| | | .bs-searchbox, |
| | | .bs-actionsbox, |
| | | .bs-donebutton { |
| | | padding: 4px 8px; |
| | | } |
| | | .bs-actionsbox { |
| | | width: 100%; |
| | | -webkit-box-sizing: border-box; |
| | | -moz-box-sizing: border-box; |
| | | box-sizing: border-box; |
| | | } |
| | | .bs-actionsbox .btn-group button { |
| | | width: 50%; |
| | | } |
| | | .bs-donebutton { |
| | | float: left; |
| | | width: 100%; |
| | | -webkit-box-sizing: border-box; |
| | | -moz-box-sizing: border-box; |
| | | box-sizing: border-box; |
| | | } |
| | | .bs-donebutton .btn-group button { |
| | | width: 100%; |
| | | } |
| | | .bs-searchbox + .bs-actionsbox { |
| | | padding: 0 8px 4px; |
| | | } |
| | | .bs-searchbox .form-control { |
| | | margin-bottom: 0; |
| | | width: 100%; |
| | | float: none; |
| | | } |
New file |
| | |
| | | /*! |
| | | * Bootstrap-select v1.13.18 (https://developer.snapappointments.com/bootstrap-select) |
| | | * |
| | | * Copyright 2012-2020 SnapAppointments, LLC |
| | | * Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE) |
| | | */ |
| | | |
| | | (function (root, factory) { |
| | | if (root === undefined && window !== undefined) root = window; |
| | | if (typeof define === 'function' && define.amd) { |
| | | // AMD. Register as an anonymous module unless amdModuleId is set |
| | | define(["jquery"], function (a0) { |
| | | return (factory(a0)); |
| | | }); |
| | | } else if (typeof module === 'object' && module.exports) { |
| | | // Node. Does not work with strict CommonJS, but |
| | | // only CommonJS-like environments that support module.exports, |
| | | // like Node. |
| | | module.exports = factory(require("jquery")); |
| | | } else { |
| | | factory(root["jQuery"]); |
| | | } |
| | | }(this, function (jQuery) { |
| | | |
| | | (function ($) { |
| | | 'use strict'; |
| | | |
| | | var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']; |
| | | |
| | | var uriAttrs = [ |
| | | 'background', |
| | | 'cite', |
| | | 'href', |
| | | 'itemtype', |
| | | 'longdesc', |
| | | 'poster', |
| | | 'src', |
| | | 'xlink:href' |
| | | ]; |
| | | |
| | | var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; |
| | | |
| | | var DefaultWhitelist = { |
| | | // Global attributes allowed on any supplied element below. |
| | | '*': ['class', 'dir', 'id', 'lang', 'role', 'tabindex', 'style', ARIA_ATTRIBUTE_PATTERN], |
| | | a: ['target', 'href', 'title', 'rel'], |
| | | area: [], |
| | | b: [], |
| | | br: [], |
| | | col: [], |
| | | code: [], |
| | | div: [], |
| | | em: [], |
| | | hr: [], |
| | | h1: [], |
| | | h2: [], |
| | | h3: [], |
| | | h4: [], |
| | | h5: [], |
| | | h6: [], |
| | | i: [], |
| | | img: ['src', 'alt', 'title', 'width', 'height'], |
| | | li: [], |
| | | ol: [], |
| | | p: [], |
| | | pre: [], |
| | | s: [], |
| | | small: [], |
| | | span: [], |
| | | sub: [], |
| | | sup: [], |
| | | strong: [], |
| | | u: [], |
| | | ul: [] |
| | | } |
| | | |
| | | /** |
| | | * A pattern that recognizes a commonly useful subset of URLs that are safe. |
| | | * |
| | | * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts |
| | | */ |
| | | var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi; |
| | | |
| | | /** |
| | | * A pattern that matches safe data URLs. Only matches image, video and audio types. |
| | | * |
| | | * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts |
| | | */ |
| | | var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i; |
| | | |
| | | function allowedAttribute (attr, allowedAttributeList) { |
| | | var attrName = attr.nodeName.toLowerCase() |
| | | |
| | | if ($.inArray(attrName, allowedAttributeList) !== -1) { |
| | | if ($.inArray(attrName, uriAttrs) !== -1) { |
| | | return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)) |
| | | } |
| | | |
| | | return true |
| | | } |
| | | |
| | | var regExp = $(allowedAttributeList).filter(function (index, value) { |
| | | return value instanceof RegExp |
| | | }) |
| | | |
| | | // Check if a regular expression validates the attribute. |
| | | for (var i = 0, l = regExp.length; i < l; i++) { |
| | | if (attrName.match(regExp[i])) { |
| | | return true |
| | | } |
| | | } |
| | | |
| | | return false |
| | | } |
| | | |
| | | function sanitizeHtml (unsafeElements, whiteList, sanitizeFn) { |
| | | if (sanitizeFn && typeof sanitizeFn === 'function') { |
| | | return sanitizeFn(unsafeElements); |
| | | } |
| | | |
| | | var whitelistKeys = Object.keys(whiteList); |
| | | |
| | | for (var i = 0, len = unsafeElements.length; i < len; i++) { |
| | | var elements = unsafeElements[i].querySelectorAll('*'); |
| | | |
| | | for (var j = 0, len2 = elements.length; j < len2; j++) { |
| | | var el = elements[j]; |
| | | var elName = el.nodeName.toLowerCase(); |
| | | |
| | | if (whitelistKeys.indexOf(elName) === -1) { |
| | | el.parentNode.removeChild(el); |
| | | |
| | | continue; |
| | | } |
| | | |
| | | var attributeList = [].slice.call(el.attributes); |
| | | var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []); |
| | | |
| | | for (var k = 0, len3 = attributeList.length; k < len3; k++) { |
| | | var attr = attributeList[k]; |
| | | |
| | | if (!allowedAttribute(attr, whitelistedAttributes)) { |
| | | el.removeAttribute(attr.nodeName); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // Polyfill for browsers with no classList support |
| | | // Remove in v2 |
| | | if (!('classList' in document.createElement('_'))) { |
| | | (function (view) { |
| | | if (!('Element' in view)) return; |
| | | |
| | | var classListProp = 'classList', |
| | | protoProp = 'prototype', |
| | | elemCtrProto = view.Element[protoProp], |
| | | objCtr = Object, |
| | | classListGetter = function () { |
| | | var $elem = $(this); |
| | | |
| | | return { |
| | | add: function (classes) { |
| | | classes = Array.prototype.slice.call(arguments).join(' '); |
| | | return $elem.addClass(classes); |
| | | }, |
| | | remove: function (classes) { |
| | | classes = Array.prototype.slice.call(arguments).join(' '); |
| | | return $elem.removeClass(classes); |
| | | }, |
| | | toggle: function (classes, force) { |
| | | return $elem.toggleClass(classes, force); |
| | | }, |
| | | contains: function (classes) { |
| | | return $elem.hasClass(classes); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | if (objCtr.defineProperty) { |
| | | var classListPropDesc = { |
| | | get: classListGetter, |
| | | enumerable: true, |
| | | configurable: true |
| | | }; |
| | | try { |
| | | objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc); |
| | | } catch (ex) { // IE 8 doesn't support enumerable:true |
| | | // adding undefined to fight this issue https://github.com/eligrey/classList.js/issues/36 |
| | | // modernie IE8-MSW7 machine has IE8 8.0.6001.18702 and is affected |
| | | if (ex.number === undefined || ex.number === -0x7FF5EC54) { |
| | | classListPropDesc.enumerable = false; |
| | | objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc); |
| | | } |
| | | } |
| | | } else if (objCtr[protoProp].__defineGetter__) { |
| | | elemCtrProto.__defineGetter__(classListProp, classListGetter); |
| | | } |
| | | }(window)); |
| | | } |
| | | |
| | | var testElement = document.createElement('_'); |
| | | |
| | | testElement.classList.add('c1', 'c2'); |
| | | |
| | | if (!testElement.classList.contains('c2')) { |
| | | var _add = DOMTokenList.prototype.add, |
| | | _remove = DOMTokenList.prototype.remove; |
| | | |
| | | DOMTokenList.prototype.add = function () { |
| | | Array.prototype.forEach.call(arguments, _add.bind(this)); |
| | | } |
| | | |
| | | DOMTokenList.prototype.remove = function () { |
| | | Array.prototype.forEach.call(arguments, _remove.bind(this)); |
| | | } |
| | | } |
| | | |
| | | testElement.classList.toggle('c3', false); |
| | | |
| | | // Polyfill for IE 10 and Firefox <24, where classList.toggle does not |
| | | // support the second argument. |
| | | if (testElement.classList.contains('c3')) { |
| | | var _toggle = DOMTokenList.prototype.toggle; |
| | | |
| | | DOMTokenList.prototype.toggle = function (token, force) { |
| | | if (1 in arguments && !this.contains(token) === !force) { |
| | | return force; |
| | | } else { |
| | | return _toggle.call(this, token); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | testElement = null; |
| | | |
| | | // shallow array comparison |
| | | function isEqual (array1, array2) { |
| | | return array1.length === array2.length && array1.every(function (element, index) { |
| | | return element === array2[index]; |
| | | }); |
| | | }; |
| | | |
| | | // <editor-fold desc="Shims"> |
| | | if (!String.prototype.startsWith) { |
| | | (function () { |
| | | 'use strict'; // needed to support `apply`/`call` with `undefined`/`null` |
| | | var defineProperty = (function () { |
| | | // IE 8 only supports `Object.defineProperty` on DOM elements |
| | | try { |
| | | var object = {}; |
| | | var $defineProperty = Object.defineProperty; |
| | | var result = $defineProperty(object, object, object) && $defineProperty; |
| | | } catch (error) { |
| | | } |
| | | return result; |
| | | }()); |
| | | var toString = {}.toString; |
| | | var startsWith = function (search) { |
| | | if (this == null) { |
| | | throw new TypeError(); |
| | | } |
| | | var string = String(this); |
| | | if (search && toString.call(search) == '[object RegExp]') { |
| | | throw new TypeError(); |
| | | } |
| | | var stringLength = string.length; |
| | | var searchString = String(search); |
| | | var searchLength = searchString.length; |
| | | var position = arguments.length > 1 ? arguments[1] : undefined; |
| | | // `ToInteger` |
| | | var pos = position ? Number(position) : 0; |
| | | if (pos != pos) { // better `isNaN` |
| | | pos = 0; |
| | | } |
| | | var start = Math.min(Math.max(pos, 0), stringLength); |
| | | // Avoid the `indexOf` call if no match is possible |
| | | if (searchLength + start > stringLength) { |
| | | return false; |
| | | } |
| | | var index = -1; |
| | | while (++index < searchLength) { |
| | | if (string.charCodeAt(start + index) != searchString.charCodeAt(index)) { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | }; |
| | | if (defineProperty) { |
| | | defineProperty(String.prototype, 'startsWith', { |
| | | 'value': startsWith, |
| | | 'configurable': true, |
| | | 'writable': true |
| | | }); |
| | | } else { |
| | | String.prototype.startsWith = startsWith; |
| | | } |
| | | }()); |
| | | } |
| | | |
| | | if (!Object.keys) { |
| | | Object.keys = function ( |
| | | o, // object |
| | | k, // key |
| | | r // result array |
| | | ) { |
| | | // initialize object and result |
| | | r = []; |
| | | // iterate over object keys |
| | | for (k in o) { |
| | | // fill result array with non-prototypical keys |
| | | r.hasOwnProperty.call(o, k) && r.push(k); |
| | | } |
| | | // return result |
| | | return r; |
| | | }; |
| | | } |
| | | |
| | | if (HTMLSelectElement && !HTMLSelectElement.prototype.hasOwnProperty('selectedOptions')) { |
| | | Object.defineProperty(HTMLSelectElement.prototype, 'selectedOptions', { |
| | | get: function () { |
| | | return this.querySelectorAll(':checked'); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function getSelectedOptions (select, ignoreDisabled) { |
| | | var selectedOptions = select.selectedOptions, |
| | | options = [], |
| | | opt; |
| | | |
| | | if (ignoreDisabled) { |
| | | for (var i = 0, len = selectedOptions.length; i < len; i++) { |
| | | opt = selectedOptions[i]; |
| | | |
| | | if (!(opt.disabled || opt.parentNode.tagName === 'OPTGROUP' && opt.parentNode.disabled)) { |
| | | options.push(opt); |
| | | } |
| | | } |
| | | |
| | | return options; |
| | | } |
| | | |
| | | return selectedOptions; |
| | | } |
| | | |
| | | // much faster than $.val() |
| | | function getSelectValues (select, selectedOptions) { |
| | | var value = [], |
| | | options = selectedOptions || select.selectedOptions, |
| | | opt; |
| | | |
| | | for (var i = 0, len = options.length; i < len; i++) { |
| | | opt = options[i]; |
| | | |
| | | if (!(opt.disabled || opt.parentNode.tagName === 'OPTGROUP' && opt.parentNode.disabled)) { |
| | | value.push(opt.value); |
| | | } |
| | | } |
| | | |
| | | if (!select.multiple) { |
| | | return !value.length ? null : value[0]; |
| | | } |
| | | |
| | | return value; |
| | | } |
| | | |
| | | // set data-selected on select element if the value has been programmatically selected |
| | | // prior to initialization of bootstrap-select |
| | | // * consider removing or replacing an alternative method * |
| | | var valHooks = { |
| | | useDefault: false, |
| | | _set: $.valHooks.select.set |
| | | }; |
| | | |
| | | $.valHooks.select.set = function (elem, value) { |
| | | if (value && !valHooks.useDefault) $(elem).data('selected', true); |
| | | |
| | | return valHooks._set.apply(this, arguments); |
| | | }; |
| | | |
| | | var changedArguments = null; |
| | | |
| | | var EventIsSupported = (function () { |
| | | try { |
| | | new Event('change'); |
| | | return true; |
| | | } catch (e) { |
| | | return false; |
| | | } |
| | | })(); |
| | | |
| | | $.fn.triggerNative = function (eventName) { |
| | | var el = this[0], |
| | | event; |
| | | |
| | | if (el.dispatchEvent) { // for modern browsers & IE9+ |
| | | if (EventIsSupported) { |
| | | // For modern browsers |
| | | event = new Event(eventName, { |
| | | bubbles: true |
| | | }); |
| | | } else { |
| | | // For IE since it doesn't support Event constructor |
| | | event = document.createEvent('Event'); |
| | | event.initEvent(eventName, true, false); |
| | | } |
| | | |
| | | el.dispatchEvent(event); |
| | | } else if (el.fireEvent) { // for IE8 |
| | | event = document.createEventObject(); |
| | | event.eventType = eventName; |
| | | el.fireEvent('on' + eventName, event); |
| | | } else { |
| | | // fall back to jQuery.trigger |
| | | this.trigger(eventName); |
| | | } |
| | | }; |
| | | // </editor-fold> |
| | | |
| | | function stringSearch (li, searchString, method, normalize) { |
| | | var stringTypes = [ |
| | | 'display', |
| | | 'subtext', |
| | | 'tokens' |
| | | ], |
| | | searchSuccess = false; |
| | | |
| | | for (var i = 0; i < stringTypes.length; i++) { |
| | | var stringType = stringTypes[i], |
| | | string = li[stringType]; |
| | | |
| | | if (string) { |
| | | string = string.toString(); |
| | | |
| | | // Strip HTML tags. This isn't perfect, but it's much faster than any other method |
| | | if (stringType === 'display') { |
| | | string = string.replace(/<[^>]+>/g, ''); |
| | | } |
| | | |
| | | if (normalize) string = normalizeToBase(string); |
| | | string = string.toUpperCase(); |
| | | |
| | | if (method === 'contains') { |
| | | searchSuccess = string.indexOf(searchString) >= 0; |
| | | } else { |
| | | searchSuccess = string.startsWith(searchString); |
| | | } |
| | | |
| | | if (searchSuccess) break; |
| | | } |
| | | } |
| | | |
| | | return searchSuccess; |
| | | } |
| | | |
| | | function toInteger (value) { |
| | | return parseInt(value, 10) || 0; |
| | | } |
| | | |
| | | // Borrowed from Lodash (_.deburr) |
| | | /** Used to map Latin Unicode letters to basic Latin letters. */ |
| | | var deburredLetters = { |
| | | // Latin-1 Supplement block. |
| | | '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', |
| | | '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', |
| | | '\xc7': 'C', '\xe7': 'c', |
| | | '\xd0': 'D', '\xf0': 'd', |
| | | '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', |
| | | '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', |
| | | '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', |
| | | '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', |
| | | '\xd1': 'N', '\xf1': 'n', |
| | | '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', |
| | | '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', |
| | | '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', |
| | | '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', |
| | | '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', |
| | | '\xc6': 'Ae', '\xe6': 'ae', |
| | | '\xde': 'Th', '\xfe': 'th', |
| | | '\xdf': 'ss', |
| | | // Latin Extended-A block. |
| | | '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', |
| | | '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', |
| | | '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', |
| | | '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', |
| | | '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', |
| | | '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', |
| | | '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', |
| | | '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', |
| | | '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', |
| | | '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', |
| | | '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', |
| | | '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', |
| | | '\u0134': 'J', '\u0135': 'j', |
| | | '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', |
| | | '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', |
| | | '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', |
| | | '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', |
| | | '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', |
| | | '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', |
| | | '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', |
| | | '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', |
| | | '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', |
| | | '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', |
| | | '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', |
| | | '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', |
| | | '\u0163': 't', '\u0165': 't', '\u0167': 't', |
| | | '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', |
| | | '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', |
| | | '\u0174': 'W', '\u0175': 'w', |
| | | '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', |
| | | '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', |
| | | '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', |
| | | '\u0132': 'IJ', '\u0133': 'ij', |
| | | '\u0152': 'Oe', '\u0153': 'oe', |
| | | '\u0149': "'n", '\u017f': 's' |
| | | }; |
| | | |
| | | /** Used to match Latin Unicode letters (excluding mathematical operators). */ |
| | | var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; |
| | | |
| | | /** Used to compose unicode character classes. */ |
| | | var rsComboMarksRange = '\\u0300-\\u036f', |
| | | reComboHalfMarksRange = '\\ufe20-\\ufe2f', |
| | | rsComboSymbolsRange = '\\u20d0-\\u20ff', |
| | | rsComboMarksExtendedRange = '\\u1ab0-\\u1aff', |
| | | rsComboMarksSupplementRange = '\\u1dc0-\\u1dff', |
| | | rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange + rsComboMarksExtendedRange + rsComboMarksSupplementRange; |
| | | |
| | | /** Used to compose unicode capture groups. */ |
| | | var rsCombo = '[' + rsComboRange + ']'; |
| | | |
| | | /** |
| | | * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and |
| | | * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). |
| | | */ |
| | | var reComboMark = RegExp(rsCombo, 'g'); |
| | | |
| | | function deburrLetter (key) { |
| | | return deburredLetters[key]; |
| | | }; |
| | | |
| | | function normalizeToBase (string) { |
| | | string = string.toString(); |
| | | return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); |
| | | } |
| | | |
| | | // List of HTML entities for escaping. |
| | | var escapeMap = { |
| | | '&': '&', |
| | | '<': '<', |
| | | '>': '>', |
| | | '"': '"', |
| | | "'": ''', |
| | | '`': '`' |
| | | }; |
| | | |
| | | // Functions for escaping and unescaping strings to/from HTML interpolation. |
| | | var createEscaper = function (map) { |
| | | var escaper = function (match) { |
| | | return map[match]; |
| | | }; |
| | | // Regexes for identifying a key that needs to be escaped. |
| | | var source = '(?:' + Object.keys(map).join('|') + ')'; |
| | | var testRegexp = RegExp(source); |
| | | var replaceRegexp = RegExp(source, 'g'); |
| | | return function (string) { |
| | | string = string == null ? '' : '' + string; |
| | | return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string; |
| | | }; |
| | | }; |
| | | |
| | | var htmlEscape = createEscaper(escapeMap); |
| | | |
| | | /** |
| | | * ------------------------------------------------------------------------ |
| | | * Constants |
| | | * ------------------------------------------------------------------------ |
| | | */ |
| | | |
| | | var keyCodeMap = { |
| | | 32: ' ', |
| | | 48: '0', |
| | | 49: '1', |
| | | 50: '2', |
| | | 51: '3', |
| | | 52: '4', |
| | | 53: '5', |
| | | 54: '6', |
| | | 55: '7', |
| | | 56: '8', |
| | | 57: '9', |
| | | 59: ';', |
| | | 65: 'A', |
| | | 66: 'B', |
| | | 67: 'C', |
| | | 68: 'D', |
| | | 69: 'E', |
| | | 70: 'F', |
| | | 71: 'G', |
| | | 72: 'H', |
| | | 73: 'I', |
| | | 74: 'J', |
| | | 75: 'K', |
| | | 76: 'L', |
| | | 77: 'M', |
| | | 78: 'N', |
| | | 79: 'O', |
| | | 80: 'P', |
| | | 81: 'Q', |
| | | 82: 'R', |
| | | 83: 'S', |
| | | 84: 'T', |
| | | 85: 'U', |
| | | 86: 'V', |
| | | 87: 'W', |
| | | 88: 'X', |
| | | 89: 'Y', |
| | | 90: 'Z', |
| | | 96: '0', |
| | | 97: '1', |
| | | 98: '2', |
| | | 99: '3', |
| | | 100: '4', |
| | | 101: '5', |
| | | 102: '6', |
| | | 103: '7', |
| | | 104: '8', |
| | | 105: '9' |
| | | }; |
| | | |
| | | var keyCodes = { |
| | | ESCAPE: 27, // KeyboardEvent.which value for Escape (Esc) key |
| | | ENTER: 13, // KeyboardEvent.which value for Enter key |
| | | SPACE: 32, // KeyboardEvent.which value for space key |
| | | TAB: 9, // KeyboardEvent.which value for tab key |
| | | ARROW_UP: 38, // KeyboardEvent.which value for up arrow key |
| | | ARROW_DOWN: 40 // KeyboardEvent.which value for down arrow key |
| | | } |
| | | |
| | | var version = { |
| | | success: false, |
| | | major: '3' |
| | | }; |
| | | |
| | | try { |
| | | version.full = ($.fn.dropdown.Constructor.VERSION || '').split(' ')[0].split('.'); |
| | | version.major = version.full[0]; |
| | | version.success = true; |
| | | } catch (err) { |
| | | // do nothing |
| | | } |
| | | |
| | | var selectId = 0; |
| | | |
| | | var EVENT_KEY = '.bs.select'; |
| | | |
| | | var classNames = { |
| | | DISABLED: 'disabled', |
| | | DIVIDER: 'divider', |
| | | SHOW: 'open', |
| | | DROPUP: 'dropup', |
| | | MENU: 'dropdown-menu', |
| | | MENURIGHT: 'dropdown-menu-right', |
| | | MENULEFT: 'dropdown-menu-left', |
| | | // to-do: replace with more advanced template/customization options |
| | | BUTTONCLASS: 'btn-default', |
| | | POPOVERHEADER: 'popover-title', |
| | | ICONBASE: 'glyphicon', |
| | | TICKICON: 'glyphicon-ok' |
| | | } |
| | | |
| | | var Selector = { |
| | | MENU: '.' + classNames.MENU |
| | | } |
| | | |
| | | var elementTemplates = { |
| | | div: document.createElement('div'), |
| | | span: document.createElement('span'), |
| | | i: document.createElement('i'), |
| | | subtext: document.createElement('small'), |
| | | a: document.createElement('a'), |
| | | li: document.createElement('li'), |
| | | whitespace: document.createTextNode('\u00A0'), |
| | | fragment: document.createDocumentFragment() |
| | | } |
| | | |
| | | elementTemplates.noResults = elementTemplates.li.cloneNode(false); |
| | | elementTemplates.noResults.className = 'no-results'; |
| | | |
| | | elementTemplates.a.setAttribute('role', 'option'); |
| | | elementTemplates.a.className = 'dropdown-item'; |
| | | |
| | | elementTemplates.subtext.className = 'text-muted'; |
| | | |
| | | elementTemplates.text = elementTemplates.span.cloneNode(false); |
| | | elementTemplates.text.className = 'text'; |
| | | |
| | | elementTemplates.checkMark = elementTemplates.span.cloneNode(false); |
| | | |
| | | var REGEXP_ARROW = new RegExp(keyCodes.ARROW_UP + '|' + keyCodes.ARROW_DOWN); |
| | | var REGEXP_TAB_OR_ESCAPE = new RegExp('^' + keyCodes.TAB + '$|' + keyCodes.ESCAPE); |
| | | |
| | | var generateOption = { |
| | | li: function (content, classes, optgroup) { |
| | | var li = elementTemplates.li.cloneNode(false); |
| | | |
| | | if (content) { |
| | | if (content.nodeType === 1 || content.nodeType === 11) { |
| | | li.appendChild(content); |
| | | } else { |
| | | li.innerHTML = content; |
| | | } |
| | | } |
| | | |
| | | if (typeof classes !== 'undefined' && classes !== '') li.className = classes; |
| | | if (typeof optgroup !== 'undefined' && optgroup !== null) li.classList.add('optgroup-' + optgroup); |
| | | |
| | | return li; |
| | | }, |
| | | |
| | | a: function (text, classes, inline) { |
| | | var a = elementTemplates.a.cloneNode(true); |
| | | |
| | | if (text) { |
| | | if (text.nodeType === 11) { |
| | | a.appendChild(text); |
| | | } else { |
| | | a.insertAdjacentHTML('beforeend', text); |
| | | } |
| | | } |
| | | |
| | | if (typeof classes !== 'undefined' && classes !== '') a.classList.add.apply(a.classList, classes.split(/\s+/)); |
| | | if (inline) a.setAttribute('style', inline); |
| | | |
| | | return a; |
| | | }, |
| | | |
| | | text: function (options, useFragment) { |
| | | var textElement = elementTemplates.text.cloneNode(false), |
| | | subtextElement, |
| | | iconElement; |
| | | |
| | | if (options.content) { |
| | | textElement.innerHTML = options.content; |
| | | } else { |
| | | textElement.textContent = options.text; |
| | | |
| | | if (options.icon) { |
| | | var whitespace = elementTemplates.whitespace.cloneNode(false); |
| | | |
| | | // need to use <i> for icons in the button to prevent a breaking change |
| | | // note: switch to span in next major release |
| | | iconElement = (useFragment === true ? elementTemplates.i : elementTemplates.span).cloneNode(false); |
| | | iconElement.className = this.options.iconBase + ' ' + options.icon; |
| | | |
| | | elementTemplates.fragment.appendChild(iconElement); |
| | | elementTemplates.fragment.appendChild(whitespace); |
| | | } |
| | | |
| | | if (options.subtext) { |
| | | subtextElement = elementTemplates.subtext.cloneNode(false); |
| | | subtextElement.textContent = options.subtext; |
| | | textElement.appendChild(subtextElement); |
| | | } |
| | | } |
| | | |
| | | if (useFragment === true) { |
| | | while (textElement.childNodes.length > 0) { |
| | | elementTemplates.fragment.appendChild(textElement.childNodes[0]); |
| | | } |
| | | } else { |
| | | elementTemplates.fragment.appendChild(textElement); |
| | | } |
| | | |
| | | return elementTemplates.fragment; |
| | | }, |
| | | |
| | | label: function (options) { |
| | | var textElement = elementTemplates.text.cloneNode(false), |
| | | subtextElement, |
| | | iconElement; |
| | | |
| | | textElement.innerHTML = options.display; |
| | | |
| | | if (options.icon) { |
| | | var whitespace = elementTemplates.whitespace.cloneNode(false); |
| | | |
| | | iconElement = elementTemplates.span.cloneNode(false); |
| | | iconElement.className = this.options.iconBase + ' ' + options.icon; |
| | | |
| | | elementTemplates.fragment.appendChild(iconElement); |
| | | elementTemplates.fragment.appendChild(whitespace); |
| | | } |
| | | |
| | | if (options.subtext) { |
| | | subtextElement = elementTemplates.subtext.cloneNode(false); |
| | | subtextElement.textContent = options.subtext; |
| | | textElement.appendChild(subtextElement); |
| | | } |
| | | |
| | | elementTemplates.fragment.appendChild(textElement); |
| | | |
| | | return elementTemplates.fragment; |
| | | } |
| | | } |
| | | |
| | | function showNoResults (searchMatch, searchValue) { |
| | | if (!searchMatch.length) { |
| | | elementTemplates.noResults.innerHTML = this.options.noneResultsText.replace('{0}', '"' + htmlEscape(searchValue) + '"'); |
| | | this.$menuInner[0].firstChild.appendChild(elementTemplates.noResults); |
| | | } |
| | | } |
| | | |
| | | var Selectpicker = function (element, options) { |
| | | var that = this; |
| | | |
| | | // bootstrap-select has been initialized - revert valHooks.select.set back to its original function |
| | | if (!valHooks.useDefault) { |
| | | $.valHooks.select.set = valHooks._set; |
| | | valHooks.useDefault = true; |
| | | } |
| | | |
| | | this.$element = $(element); |
| | | this.$newElement = null; |
| | | this.$button = null; |
| | | this.$menu = null; |
| | | this.options = options; |
| | | this.selectpicker = { |
| | | main: {}, |
| | | search: {}, |
| | | current: {}, // current changes if a search is in progress |
| | | view: {}, |
| | | isSearching: false, |
| | | keydown: { |
| | | keyHistory: '', |
| | | resetKeyHistory: { |
| | | start: function () { |
| | | return setTimeout(function () { |
| | | that.selectpicker.keydown.keyHistory = ''; |
| | | }, 800); |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | |
| | | this.sizeInfo = {}; |
| | | |
| | | // If we have no title yet, try to pull it from the html title attribute (jQuery doesnt' pick it up as it's not a |
| | | // data-attribute) |
| | | if (this.options.title === null) { |
| | | this.options.title = this.$element.attr('title'); |
| | | } |
| | | |
| | | // Format window padding |
| | | var winPad = this.options.windowPadding; |
| | | if (typeof winPad === 'number') { |
| | | this.options.windowPadding = [winPad, winPad, winPad, winPad]; |
| | | } |
| | | |
| | | // Expose public methods |
| | | this.val = Selectpicker.prototype.val; |
| | | this.render = Selectpicker.prototype.render; |
| | | this.refresh = Selectpicker.prototype.refresh; |
| | | this.setStyle = Selectpicker.prototype.setStyle; |
| | | this.selectAll = Selectpicker.prototype.selectAll; |
| | | this.deselectAll = Selectpicker.prototype.deselectAll; |
| | | this.destroy = Selectpicker.prototype.destroy; |
| | | this.remove = Selectpicker.prototype.remove; |
| | | this.show = Selectpicker.prototype.show; |
| | | this.hide = Selectpicker.prototype.hide; |
| | | |
| | | this.init(); |
| | | }; |
| | | |
| | | Selectpicker.VERSION = '1.13.18'; |
| | | |
| | | // part of this is duplicated in i18n/defaults-en_US.js. Make sure to update both. |
| | | Selectpicker.DEFAULTS = { |
| | | noneSelectedText: 'Nothing selected', |
| | | noneResultsText: 'No results matched {0}', |
| | | countSelectedText: function (numSelected, numTotal) { |
| | | return (numSelected == 1) ? '{0} item selected' : '{0} items selected'; |
| | | }, |
| | | maxOptionsText: function (numAll, numGroup) { |
| | | return [ |
| | | (numAll == 1) ? 'Limit reached ({n} item max)' : 'Limit reached ({n} items max)', |
| | | (numGroup == 1) ? 'Group limit reached ({n} item max)' : 'Group limit reached ({n} items max)' |
| | | ]; |
| | | }, |
| | | selectAllText: 'Select All', |
| | | deselectAllText: 'Deselect All', |
| | | doneButton: false, |
| | | doneButtonText: 'Close', |
| | | multipleSeparator: ', ', |
| | | styleBase: 'btn', |
| | | style: classNames.BUTTONCLASS, |
| | | size: 'auto', |
| | | title: null, |
| | | selectedTextFormat: 'values', |
| | | width: false, |
| | | container: false, |
| | | hideDisabled: false, |
| | | showSubtext: false, |
| | | showIcon: true, |
| | | showContent: true, |
| | | dropupAuto: true, |
| | | header: false, |
| | | liveSearch: false, |
| | | liveSearchPlaceholder: null, |
| | | liveSearchNormalize: false, |
| | | liveSearchStyle: 'contains', |
| | | actionsBox: false, |
| | | iconBase: classNames.ICONBASE, |
| | | tickIcon: classNames.TICKICON, |
| | | showTick: false, |
| | | template: { |
| | | caret: '<span class="caret"></span>' |
| | | }, |
| | | maxOptions: false, |
| | | mobile: false, |
| | | selectOnTab: false, |
| | | dropdownAlignRight: false, |
| | | windowPadding: 0, |
| | | virtualScroll: 600, |
| | | display: false, |
| | | sanitize: true, |
| | | sanitizeFn: null, |
| | | whiteList: DefaultWhitelist |
| | | }; |
| | | |
| | | Selectpicker.prototype = { |
| | | |
| | | constructor: Selectpicker, |
| | | |
| | | init: function () { |
| | | var that = this, |
| | | id = this.$element.attr('id'), |
| | | element = this.$element[0], |
| | | form = element.form; |
| | | |
| | | selectId++; |
| | | this.selectId = 'bs-select-' + selectId; |
| | | |
| | | element.classList.add('bs-select-hidden'); |
| | | |
| | | this.multiple = this.$element.prop('multiple'); |
| | | this.autofocus = this.$element.prop('autofocus'); |
| | | |
| | | if (element.classList.contains('show-tick')) { |
| | | this.options.showTick = true; |
| | | } |
| | | |
| | | this.$newElement = this.createDropdown(); |
| | | this.buildData(); |
| | | this.$element |
| | | .after(this.$newElement) |
| | | .prependTo(this.$newElement); |
| | | |
| | | // ensure select is associated with form element if it got unlinked after moving it inside newElement |
| | | if (form && element.form === null) { |
| | | if (!form.id) form.id = 'form-' + this.selectId; |
| | | element.setAttribute('form', form.id); |
| | | } |
| | | |
| | | this.$button = this.$newElement.children('button'); |
| | | this.$menu = this.$newElement.children(Selector.MENU); |
| | | this.$menuInner = this.$menu.children('.inner'); |
| | | this.$searchbox = this.$menu.find('input'); |
| | | |
| | | element.classList.remove('bs-select-hidden'); |
| | | |
| | | if (this.options.dropdownAlignRight === true) this.$menu[0].classList.add(classNames.MENURIGHT); |
| | | |
| | | if (typeof id !== 'undefined') { |
| | | this.$button.attr('data-id', id); |
| | | } |
| | | |
| | | this.checkDisabled(); |
| | | this.clickListener(); |
| | | |
| | | if (this.options.liveSearch) { |
| | | this.liveSearchListener(); |
| | | this.focusedParent = this.$searchbox[0]; |
| | | } else { |
| | | this.focusedParent = this.$menuInner[0]; |
| | | } |
| | | |
| | | this.setStyle(); |
| | | this.render(); |
| | | this.setWidth(); |
| | | if (this.options.container) { |
| | | this.selectPosition(); |
| | | } else { |
| | | this.$element.on('hide' + EVENT_KEY, function () { |
| | | if (that.isVirtual()) { |
| | | // empty menu on close |
| | | var menuInner = that.$menuInner[0], |
| | | emptyMenu = menuInner.firstChild.cloneNode(false); |
| | | |
| | | // replace the existing UL with an empty one - this is faster than $.empty() or innerHTML = '' |
| | | menuInner.replaceChild(emptyMenu, menuInner.firstChild); |
| | | menuInner.scrollTop = 0; |
| | | } |
| | | }); |
| | | } |
| | | this.$menu.data('this', this); |
| | | this.$newElement.data('this', this); |
| | | if (this.options.mobile) this.mobile(); |
| | | |
| | | this.$newElement.on({ |
| | | 'hide.bs.dropdown': function (e) { |
| | | that.$element.trigger('hide' + EVENT_KEY, e); |
| | | }, |
| | | 'hidden.bs.dropdown': function (e) { |
| | | that.$element.trigger('hidden' + EVENT_KEY, e); |
| | | }, |
| | | 'show.bs.dropdown': function (e) { |
| | | that.$element.trigger('show' + EVENT_KEY, e); |
| | | }, |
| | | 'shown.bs.dropdown': function (e) { |
| | | that.$element.trigger('shown' + EVENT_KEY, e); |
| | | } |
| | | }); |
| | | |
| | | if (element.hasAttribute('required')) { |
| | | this.$element.on('invalid' + EVENT_KEY, function () { |
| | | that.$button[0].classList.add('bs-invalid'); |
| | | |
| | | that.$element |
| | | .on('shown' + EVENT_KEY + '.invalid', function () { |
| | | that.$element |
| | | .val(that.$element.val()) // set the value to hide the validation message in Chrome when menu is opened |
| | | .off('shown' + EVENT_KEY + '.invalid'); |
| | | }) |
| | | .on('rendered' + EVENT_KEY, function () { |
| | | // if select is no longer invalid, remove the bs-invalid class |
| | | if (this.validity.valid) that.$button[0].classList.remove('bs-invalid'); |
| | | that.$element.off('rendered' + EVENT_KEY); |
| | | }); |
| | | |
| | | that.$button.on('blur' + EVENT_KEY, function () { |
| | | that.$element.trigger('focus').trigger('blur'); |
| | | that.$button.off('blur' + EVENT_KEY); |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | setTimeout(function () { |
| | | that.buildList(); |
| | | that.$element.trigger('loaded' + EVENT_KEY); |
| | | }); |
| | | }, |
| | | |
| | | createDropdown: function () { |
| | | // Options |
| | | // If we are multiple or showTick option is set, then add the show-tick class |
| | | var showTick = (this.multiple || this.options.showTick) ? ' show-tick' : '', |
| | | multiselectable = this.multiple ? ' aria-multiselectable="true"' : '', |
| | | inputGroup = '', |
| | | autofocus = this.autofocus ? ' autofocus' : ''; |
| | | |
| | | if (version.major < 4 && this.$element.parent().hasClass('input-group')) { |
| | | inputGroup = ' input-group-btn'; |
| | | } |
| | | |
| | | // Elements |
| | | var drop, |
| | | header = '', |
| | | searchbox = '', |
| | | actionsbox = '', |
| | | donebutton = ''; |
| | | |
| | | if (this.options.header) { |
| | | header = |
| | | '<div class="' + classNames.POPOVERHEADER + '">' + |
| | | '<button type="button" class="close" aria-hidden="true">×</button>' + |
| | | this.options.header + |
| | | '</div>'; |
| | | } |
| | | |
| | | if (this.options.liveSearch) { |
| | | searchbox = |
| | | '<div class="bs-searchbox">' + |
| | | '<input type="search" class="form-control" autocomplete="off"' + |
| | | ( |
| | | this.options.liveSearchPlaceholder === null ? '' |
| | | : |
| | | ' placeholder="' + htmlEscape(this.options.liveSearchPlaceholder) + '"' |
| | | ) + |
| | | ' role="combobox" aria-label="Search" aria-controls="' + this.selectId + '" aria-autocomplete="list">' + |
| | | '</div>'; |
| | | } |
| | | |
| | | if (this.multiple && this.options.actionsBox) { |
| | | actionsbox = |
| | | '<div class="bs-actionsbox">' + |
| | | '<div class="btn-group btn-group-sm btn-block">' + |
| | | '<button type="button" class="actions-btn bs-select-all btn ' + classNames.BUTTONCLASS + '">' + |
| | | this.options.selectAllText + |
| | | '</button>' + |
| | | '<button type="button" class="actions-btn bs-deselect-all btn ' + classNames.BUTTONCLASS + '">' + |
| | | this.options.deselectAllText + |
| | | '</button>' + |
| | | '</div>' + |
| | | '</div>'; |
| | | } |
| | | |
| | | if (this.multiple && this.options.doneButton) { |
| | | donebutton = |
| | | '<div class="bs-donebutton">' + |
| | | '<div class="btn-group btn-block">' + |
| | | '<button type="button" class="btn btn-sm ' + classNames.BUTTONCLASS + '">' + |
| | | this.options.doneButtonText + |
| | | '</button>' + |
| | | '</div>' + |
| | | '</div>'; |
| | | } |
| | | |
| | | drop = |
| | | '<div class="dropdown bootstrap-select' + showTick + inputGroup + '">' + |
| | | '<button type="button" tabindex="-1" class="' + this.options.styleBase + ' dropdown-toggle" ' + (this.options.display === 'static' ? 'data-display="static"' : '') + 'data-toggle="dropdown"' + autofocus + ' role="combobox" aria-owns="' + this.selectId + '" aria-haspopup="listbox" aria-expanded="false">' + |
| | | '<div class="filter-option">' + |
| | | '<div class="filter-option-inner">' + |
| | | '<div class="filter-option-inner-inner"></div>' + |
| | | '</div> ' + |
| | | '</div>' + |
| | | ( |
| | | version.major === '4' ? '' |
| | | : |
| | | '<span class="bs-caret">' + |
| | | this.options.template.caret + |
| | | '</span>' |
| | | ) + |
| | | '</button>' + |
| | | '<div class="' + classNames.MENU + ' ' + (version.major === '4' ? '' : classNames.SHOW) + '">' + |
| | | header + |
| | | searchbox + |
| | | actionsbox + |
| | | '<div class="inner ' + classNames.SHOW + '" role="listbox" id="' + this.selectId + '" tabindex="-1" ' + multiselectable + '>' + |
| | | '<ul class="' + classNames.MENU + ' inner ' + (version.major === '4' ? classNames.SHOW : '') + '" role="presentation">' + |
| | | '</ul>' + |
| | | '</div>' + |
| | | donebutton + |
| | | '</div>' + |
| | | '</div>'; |
| | | |
| | | return $(drop); |
| | | }, |
| | | |
| | | setPositionData: function () { |
| | | this.selectpicker.view.canHighlight = []; |
| | | this.selectpicker.view.size = 0; |
| | | this.selectpicker.view.firstHighlightIndex = false; |
| | | |
| | | for (var i = 0; i < this.selectpicker.current.data.length; i++) { |
| | | var li = this.selectpicker.current.data[i], |
| | | canHighlight = true; |
| | | |
| | | if (li.type === 'divider') { |
| | | canHighlight = false; |
| | | li.height = this.sizeInfo.dividerHeight; |
| | | } else if (li.type === 'optgroup-label') { |
| | | canHighlight = false; |
| | | li.height = this.sizeInfo.dropdownHeaderHeight; |
| | | } else { |
| | | li.height = this.sizeInfo.liHeight; |
| | | } |
| | | |
| | | if (li.disabled) canHighlight = false; |
| | | |
| | | this.selectpicker.view.canHighlight.push(canHighlight); |
| | | |
| | | if (canHighlight) { |
| | | this.selectpicker.view.size++; |
| | | li.posinset = this.selectpicker.view.size; |
| | | if (this.selectpicker.view.firstHighlightIndex === false) this.selectpicker.view.firstHighlightIndex = i; |
| | | } |
| | | |
| | | li.position = (i === 0 ? 0 : this.selectpicker.current.data[i - 1].position) + li.height; |
| | | } |
| | | }, |
| | | |
| | | isVirtual: function () { |
| | | return (this.options.virtualScroll !== false) && (this.selectpicker.main.elements.length >= this.options.virtualScroll) || this.options.virtualScroll === true; |
| | | }, |
| | | |
| | | createView: function (isSearching, setSize, refresh) { |
| | | var that = this, |
| | | scrollTop = 0, |
| | | active = [], |
| | | selected, |
| | | prevActive; |
| | | |
| | | this.selectpicker.isSearching = isSearching; |
| | | this.selectpicker.current = isSearching ? this.selectpicker.search : this.selectpicker.main; |
| | | |
| | | this.setPositionData(); |
| | | |
| | | if (setSize) { |
| | | if (refresh) { |
| | | scrollTop = this.$menuInner[0].scrollTop; |
| | | } else if (!that.multiple) { |
| | | var element = that.$element[0], |
| | | selectedIndex = (element.options[element.selectedIndex] || {}).liIndex; |
| | | |
| | | if (typeof selectedIndex === 'number' && that.options.size !== false) { |
| | | var selectedData = that.selectpicker.main.data[selectedIndex], |
| | | position = selectedData && selectedData.position; |
| | | |
| | | if (position) { |
| | | scrollTop = position - ((that.sizeInfo.menuInnerHeight + that.sizeInfo.liHeight) / 2); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | scroll(scrollTop, true); |
| | | |
| | | this.$menuInner.off('scroll.createView').on('scroll.createView', function (e, updateValue) { |
| | | if (!that.noScroll) scroll(this.scrollTop, updateValue); |
| | | that.noScroll = false; |
| | | }); |
| | | |
| | | function scroll (scrollTop, init) { |
| | | var size = that.selectpicker.current.elements.length, |
| | | chunks = [], |
| | | chunkSize, |
| | | chunkCount, |
| | | firstChunk, |
| | | lastChunk, |
| | | currentChunk, |
| | | prevPositions, |
| | | positionIsDifferent, |
| | | previousElements, |
| | | menuIsDifferent = true, |
| | | isVirtual = that.isVirtual(); |
| | | |
| | | that.selectpicker.view.scrollTop = scrollTop; |
| | | |
| | | chunkSize = Math.ceil(that.sizeInfo.menuInnerHeight / that.sizeInfo.liHeight * 1.5); // number of options in a chunk |
| | | chunkCount = Math.round(size / chunkSize) || 1; // number of chunks |
| | | |
| | | for (var i = 0; i < chunkCount; i++) { |
| | | var endOfChunk = (i + 1) * chunkSize; |
| | | |
| | | if (i === chunkCount - 1) { |
| | | endOfChunk = size; |
| | | } |
| | | |
| | | chunks[i] = [ |
| | | (i) * chunkSize + (!i ? 0 : 1), |
| | | endOfChunk |
| | | ]; |
| | | |
| | | if (!size) break; |
| | | |
| | | if (currentChunk === undefined && scrollTop - 1 <= that.selectpicker.current.data[endOfChunk - 1].position - that.sizeInfo.menuInnerHeight) { |
| | | currentChunk = i; |
| | | } |
| | | } |
| | | |
| | | if (currentChunk === undefined) currentChunk = 0; |
| | | |
| | | prevPositions = [that.selectpicker.view.position0, that.selectpicker.view.position1]; |
| | | |
| | | // always display previous, current, and next chunks |
| | | firstChunk = Math.max(0, currentChunk - 1); |
| | | lastChunk = Math.min(chunkCount - 1, currentChunk + 1); |
| | | |
| | | that.selectpicker.view.position0 = isVirtual === false ? 0 : (Math.max(0, chunks[firstChunk][0]) || 0); |
| | | that.selectpicker.view.position1 = isVirtual === false ? size : (Math.min(size, chunks[lastChunk][1]) || 0); |
| | | |
| | | positionIsDifferent = prevPositions[0] !== that.selectpicker.view.position0 || prevPositions[1] !== that.selectpicker.view.position1; |
| | | |
| | | if (that.activeIndex !== undefined) { |
| | | prevActive = that.selectpicker.main.elements[that.prevActiveIndex]; |
| | | active = that.selectpicker.main.elements[that.activeIndex]; |
| | | selected = that.selectpicker.main.elements[that.selectedIndex]; |
| | | |
| | | if (init) { |
| | | if (that.activeIndex !== that.selectedIndex) { |
| | | that.defocusItem(active); |
| | | } |
| | | that.activeIndex = undefined; |
| | | } |
| | | |
| | | if (that.activeIndex && that.activeIndex !== that.selectedIndex) { |
| | | that.defocusItem(selected); |
| | | } |
| | | } |
| | | |
| | | if (that.prevActiveIndex !== undefined && that.prevActiveIndex !== that.activeIndex && that.prevActiveIndex !== that.selectedIndex) { |
| | | that.defocusItem(prevActive); |
| | | } |
| | | |
| | | if (init || positionIsDifferent) { |
| | | previousElements = that.selectpicker.view.visibleElements ? that.selectpicker.view.visibleElements.slice() : []; |
| | | |
| | | if (isVirtual === false) { |
| | | that.selectpicker.view.visibleElements = that.selectpicker.current.elements; |
| | | } else { |
| | | that.selectpicker.view.visibleElements = that.selectpicker.current.elements.slice(that.selectpicker.view.position0, that.selectpicker.view.position1); |
| | | } |
| | | |
| | | that.setOptionStatus(); |
| | | |
| | | // if searching, check to make sure the list has actually been updated before updating DOM |
| | | // this prevents unnecessary repaints |
| | | if (isSearching || (isVirtual === false && init)) menuIsDifferent = !isEqual(previousElements, that.selectpicker.view.visibleElements); |
| | | |
| | | // if virtual scroll is disabled and not searching, |
| | | // menu should never need to be updated more than once |
| | | if ((init || isVirtual === true) && menuIsDifferent) { |
| | | var menuInner = that.$menuInner[0], |
| | | menuFragment = document.createDocumentFragment(), |
| | | emptyMenu = menuInner.firstChild.cloneNode(false), |
| | | marginTop, |
| | | marginBottom, |
| | | elements = that.selectpicker.view.visibleElements, |
| | | toSanitize = []; |
| | | |
| | | // replace the existing UL with an empty one - this is faster than $.empty() |
| | | menuInner.replaceChild(emptyMenu, menuInner.firstChild); |
| | | |
| | | for (var i = 0, visibleElementsLen = elements.length; i < visibleElementsLen; i++) { |
| | | var element = elements[i], |
| | | elText, |
| | | elementData; |
| | | |
| | | if (that.options.sanitize) { |
| | | elText = element.lastChild; |
| | | |
| | | if (elText) { |
| | | elementData = that.selectpicker.current.data[i + that.selectpicker.view.position0]; |
| | | |
| | | if (elementData && elementData.content && !elementData.sanitized) { |
| | | toSanitize.push(elText); |
| | | elementData.sanitized = true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | menuFragment.appendChild(element); |
| | | } |
| | | |
| | | if (that.options.sanitize && toSanitize.length) { |
| | | sanitizeHtml(toSanitize, that.options.whiteList, that.options.sanitizeFn); |
| | | } |
| | | |
| | | if (isVirtual === true) { |
| | | marginTop = (that.selectpicker.view.position0 === 0 ? 0 : that.selectpicker.current.data[that.selectpicker.view.position0 - 1].position); |
| | | marginBottom = (that.selectpicker.view.position1 > size - 1 ? 0 : that.selectpicker.current.data[size - 1].position - that.selectpicker.current.data[that.selectpicker.view.position1 - 1].position); |
| | | |
| | | menuInner.firstChild.style.marginTop = marginTop + 'px'; |
| | | menuInner.firstChild.style.marginBottom = marginBottom + 'px'; |
| | | } else { |
| | | menuInner.firstChild.style.marginTop = 0; |
| | | menuInner.firstChild.style.marginBottom = 0; |
| | | } |
| | | |
| | | menuInner.firstChild.appendChild(menuFragment); |
| | | |
| | | // if an option is encountered that is wider than the current menu width, update the menu width accordingly |
| | | // switch to ResizeObserver with increased browser support |
| | | if (isVirtual === true && that.sizeInfo.hasScrollBar) { |
| | | var menuInnerInnerWidth = menuInner.firstChild.offsetWidth; |
| | | |
| | | if (init && menuInnerInnerWidth < that.sizeInfo.menuInnerInnerWidth && that.sizeInfo.totalMenuWidth > that.sizeInfo.selectWidth) { |
| | | menuInner.firstChild.style.minWidth = that.sizeInfo.menuInnerInnerWidth + 'px'; |
| | | } else if (menuInnerInnerWidth > that.sizeInfo.menuInnerInnerWidth) { |
| | | // set to 0 to get actual width of menu |
| | | that.$menu[0].style.minWidth = 0; |
| | | |
| | | var actualMenuWidth = menuInner.firstChild.offsetWidth; |
| | | |
| | | if (actualMenuWidth > that.sizeInfo.menuInnerInnerWidth) { |
| | | that.sizeInfo.menuInnerInnerWidth = actualMenuWidth; |
| | | menuInner.firstChild.style.minWidth = that.sizeInfo.menuInnerInnerWidth + 'px'; |
| | | } |
| | | |
| | | // reset to default CSS styling |
| | | that.$menu[0].style.minWidth = ''; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | that.prevActiveIndex = that.activeIndex; |
| | | |
| | | if (!that.options.liveSearch) { |
| | | that.$menuInner.trigger('focus'); |
| | | } else if (isSearching && init) { |
| | | var index = 0, |
| | | newActive; |
| | | |
| | | if (!that.selectpicker.view.canHighlight[index]) { |
| | | index = 1 + that.selectpicker.view.canHighlight.slice(1).indexOf(true); |
| | | } |
| | | |
| | | newActive = that.selectpicker.view.visibleElements[index]; |
| | | |
| | | that.defocusItem(that.selectpicker.view.currentActive); |
| | | |
| | | that.activeIndex = (that.selectpicker.current.data[index] || {}).index; |
| | | |
| | | that.focusItem(newActive); |
| | | } |
| | | } |
| | | |
| | | $(window) |
| | | .off('resize' + EVENT_KEY + '.' + this.selectId + '.createView') |
| | | .on('resize' + EVENT_KEY + '.' + this.selectId + '.createView', function () { |
| | | var isActive = that.$newElement.hasClass(classNames.SHOW); |
| | | |
| | | if (isActive) scroll(that.$menuInner[0].scrollTop); |
| | | }); |
| | | }, |
| | | |
| | | focusItem: function (li, liData, noStyle) { |
| | | if (li) { |
| | | liData = liData || this.selectpicker.main.data[this.activeIndex]; |
| | | var a = li.firstChild; |
| | | |
| | | if (a) { |
| | | a.setAttribute('aria-setsize', this.selectpicker.view.size); |
| | | a.setAttribute('aria-posinset', liData.posinset); |
| | | |
| | | if (noStyle !== true) { |
| | | this.focusedParent.setAttribute('aria-activedescendant', a.id); |
| | | li.classList.add('active'); |
| | | a.classList.add('active'); |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | |
| | | defocusItem: function (li) { |
| | | if (li) { |
| | | li.classList.remove('active'); |
| | | if (li.firstChild) li.firstChild.classList.remove('active'); |
| | | } |
| | | }, |
| | | |
| | | setPlaceholder: function () { |
| | | var that = this, |
| | | updateIndex = false; |
| | | |
| | | if (this.options.title && !this.multiple) { |
| | | if (!this.selectpicker.view.titleOption) this.selectpicker.view.titleOption = document.createElement('option'); |
| | | |
| | | // this option doesn't create a new <li> element, but does add a new option at the start, |
| | | // so startIndex should increase to prevent having to check every option for the bs-title-option class |
| | | updateIndex = true; |
| | | |
| | | var element = this.$element[0], |
| | | selectTitleOption = false, |
| | | titleNotAppended = !this.selectpicker.view.titleOption.parentNode, |
| | | selectedIndex = element.selectedIndex, |
| | | selectedOption = element.options[selectedIndex], |
| | | navigation = window.performance && window.performance.getEntriesByType('navigation'), |
| | | // Safari doesn't support getEntriesByType('navigation') - fall back to performance.navigation |
| | | isNotBackForward = (navigation && navigation.length) ? navigation[0].type !== 'back_forward' : window.performance.navigation.type !== 2; |
| | | |
| | | if (titleNotAppended) { |
| | | // Use native JS to prepend option (faster) |
| | | this.selectpicker.view.titleOption.className = 'bs-title-option'; |
| | | this.selectpicker.view.titleOption.value = ''; |
| | | |
| | | // Check if selected or data-selected attribute is already set on an option. If not, select the titleOption option. |
| | | // the selected item may have been changed by user or programmatically before the bootstrap select plugin runs, |
| | | // if so, the select will have the data-selected attribute |
| | | selectTitleOption = !selectedOption || (selectedIndex === 0 && selectedOption.defaultSelected === false && this.$element.data('selected') === undefined); |
| | | } |
| | | |
| | | if (titleNotAppended || this.selectpicker.view.titleOption.index !== 0) { |
| | | element.insertBefore(this.selectpicker.view.titleOption, element.firstChild); |
| | | } |
| | | |
| | | // Set selected *after* appending to select, |
| | | // otherwise the option doesn't get selected in IE |
| | | // set using selectedIndex, as setting the selected attr to true here doesn't work in IE11 |
| | | if (selectTitleOption && isNotBackForward) { |
| | | element.selectedIndex = 0; |
| | | } else if (document.readyState !== 'complete') { |
| | | // if navigation type is back_forward, there's a chance the select will have its value set by BFCache |
| | | // wait for that value to be set, then run render again |
| | | window.addEventListener('pageshow', function () { |
| | | if (that.selectpicker.view.displayedValue !== element.value) that.render(); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | return updateIndex; |
| | | }, |
| | | |
| | | buildData: function () { |
| | | var optionSelector = ':not([hidden]):not([data-hidden="true"])', |
| | | mainData = [], |
| | | optID = 0, |
| | | startIndex = this.setPlaceholder() ? 1 : 0; // append the titleOption if necessary and skip the first option in the loop |
| | | |
| | | if (this.options.hideDisabled) optionSelector += ':not(:disabled)'; |
| | | |
| | | var selectOptions = this.$element[0].querySelectorAll('select > *' + optionSelector); |
| | | |
| | | function addDivider (config) { |
| | | var previousData = mainData[mainData.length - 1]; |
| | | |
| | | // ensure optgroup doesn't create back-to-back dividers |
| | | if ( |
| | | previousData && |
| | | previousData.type === 'divider' && |
| | | (previousData.optID || config.optID) |
| | | ) { |
| | | return; |
| | | } |
| | | |
| | | config = config || {}; |
| | | config.type = 'divider'; |
| | | |
| | | mainData.push(config); |
| | | } |
| | | |
| | | function addOption (option, config) { |
| | | config = config || {}; |
| | | |
| | | config.divider = option.getAttribute('data-divider') === 'true'; |
| | | |
| | | if (config.divider) { |
| | | addDivider({ |
| | | optID: config.optID |
| | | }); |
| | | } else { |
| | | var liIndex = mainData.length, |
| | | cssText = option.style.cssText, |
| | | inlineStyle = cssText ? htmlEscape(cssText) : '', |
| | | optionClass = (option.className || '') + (config.optgroupClass || ''); |
| | | |
| | | if (config.optID) optionClass = 'opt ' + optionClass; |
| | | |
| | | config.optionClass = optionClass.trim(); |
| | | config.inlineStyle = inlineStyle; |
| | | config.text = option.textContent; |
| | | |
| | | config.content = option.getAttribute('data-content'); |
| | | config.tokens = option.getAttribute('data-tokens'); |
| | | config.subtext = option.getAttribute('data-subtext'); |
| | | config.icon = option.getAttribute('data-icon'); |
| | | |
| | | option.liIndex = liIndex; |
| | | |
| | | config.display = config.content || config.text; |
| | | config.type = 'option'; |
| | | config.index = liIndex; |
| | | config.option = option; |
| | | config.selected = !!option.selected; |
| | | config.disabled = config.disabled || !!option.disabled; |
| | | |
| | | mainData.push(config); |
| | | } |
| | | } |
| | | |
| | | function addOptgroup (index, selectOptions) { |
| | | var optgroup = selectOptions[index], |
| | | // skip placeholder option |
| | | previous = index - 1 < startIndex ? false : selectOptions[index - 1], |
| | | next = selectOptions[index + 1], |
| | | options = optgroup.querySelectorAll('option' + optionSelector); |
| | | |
| | | if (!options.length) return; |
| | | |
| | | var config = { |
| | | display: htmlEscape(optgroup.label), |
| | | subtext: optgroup.getAttribute('data-subtext'), |
| | | icon: optgroup.getAttribute('data-icon'), |
| | | type: 'optgroup-label', |
| | | optgroupClass: ' ' + (optgroup.className || '') |
| | | }, |
| | | headerIndex, |
| | | lastIndex; |
| | | |
| | | optID++; |
| | | |
| | | if (previous) { |
| | | addDivider({ optID: optID }); |
| | | } |
| | | |
| | | config.optID = optID; |
| | | |
| | | mainData.push(config); |
| | | |
| | | for (var j = 0, len = options.length; j < len; j++) { |
| | | var option = options[j]; |
| | | |
| | | if (j === 0) { |
| | | headerIndex = mainData.length - 1; |
| | | lastIndex = headerIndex + len; |
| | | } |
| | | |
| | | addOption(option, { |
| | | headerIndex: headerIndex, |
| | | lastIndex: lastIndex, |
| | | optID: config.optID, |
| | | optgroupClass: config.optgroupClass, |
| | | disabled: optgroup.disabled |
| | | }); |
| | | } |
| | | |
| | | if (next) { |
| | | addDivider({ optID: optID }); |
| | | } |
| | | } |
| | | |
| | | for (var len = selectOptions.length, i = startIndex; i < len; i++) { |
| | | var item = selectOptions[i]; |
| | | |
| | | if (item.tagName !== 'OPTGROUP') { |
| | | addOption(item, {}); |
| | | } else { |
| | | addOptgroup(i, selectOptions); |
| | | } |
| | | } |
| | | |
| | | this.selectpicker.main.data = this.selectpicker.current.data = mainData; |
| | | }, |
| | | |
| | | buildList: function () { |
| | | var that = this, |
| | | selectData = this.selectpicker.main.data, |
| | | mainElements = [], |
| | | widestOptionLength = 0; |
| | | |
| | | if ((that.options.showTick || that.multiple) && !elementTemplates.checkMark.parentNode) { |
| | | elementTemplates.checkMark.className = this.options.iconBase + ' ' + that.options.tickIcon + ' check-mark'; |
| | | elementTemplates.a.appendChild(elementTemplates.checkMark); |
| | | } |
| | | |
| | | function buildElement (item) { |
| | | var liElement, |
| | | combinedLength = 0; |
| | | |
| | | switch (item.type) { |
| | | case 'divider': |
| | | liElement = generateOption.li( |
| | | false, |
| | | classNames.DIVIDER, |
| | | (item.optID ? item.optID + 'div' : undefined) |
| | | ); |
| | | |
| | | break; |
| | | |
| | | case 'option': |
| | | liElement = generateOption.li( |
| | | generateOption.a( |
| | | generateOption.text.call(that, item), |
| | | item.optionClass, |
| | | item.inlineStyle |
| | | ), |
| | | '', |
| | | item.optID |
| | | ); |
| | | |
| | | if (liElement.firstChild) { |
| | | liElement.firstChild.id = that.selectId + '-' + item.index; |
| | | } |
| | | |
| | | break; |
| | | |
| | | case 'optgroup-label': |
| | | liElement = generateOption.li( |
| | | generateOption.label.call(that, item), |
| | | 'dropdown-header' + item.optgroupClass, |
| | | item.optID |
| | | ); |
| | | |
| | | break; |
| | | } |
| | | |
| | | item.element = liElement; |
| | | mainElements.push(liElement); |
| | | |
| | | // count the number of characters in the option - not perfect, but should work in most cases |
| | | if (item.display) combinedLength += item.display.length; |
| | | if (item.subtext) combinedLength += item.subtext.length; |
| | | // if there is an icon, ensure this option's width is checked |
| | | if (item.icon) combinedLength += 1; |
| | | |
| | | if (combinedLength > widestOptionLength) { |
| | | widestOptionLength = combinedLength; |
| | | |
| | | // guess which option is the widest |
| | | // use this when calculating menu width |
| | | // not perfect, but it's fast, and the width will be updating accordingly when scrolling |
| | | that.selectpicker.view.widestOption = mainElements[mainElements.length - 1]; |
| | | } |
| | | } |
| | | |
| | | for (var len = selectData.length, i = 0; i < len; i++) { |
| | | var item = selectData[i]; |
| | | |
| | | buildElement(item); |
| | | } |
| | | |
| | | this.selectpicker.main.elements = this.selectpicker.current.elements = mainElements; |
| | | }, |
| | | |
| | | findLis: function () { |
| | | return this.$menuInner.find('.inner > li'); |
| | | }, |
| | | |
| | | render: function () { |
| | | var that = this, |
| | | element = this.$element[0], |
| | | // ensure titleOption is appended and selected (if necessary) before getting selectedOptions |
| | | placeholderSelected = this.setPlaceholder() && element.selectedIndex === 0, |
| | | selectedOptions = getSelectedOptions(element, this.options.hideDisabled), |
| | | selectedCount = selectedOptions.length, |
| | | button = this.$button[0], |
| | | buttonInner = button.querySelector('.filter-option-inner-inner'), |
| | | multipleSeparator = document.createTextNode(this.options.multipleSeparator), |
| | | titleFragment = elementTemplates.fragment.cloneNode(false), |
| | | showCount, |
| | | countMax, |
| | | hasContent = false; |
| | | |
| | | button.classList.toggle('bs-placeholder', that.multiple ? !selectedCount : !getSelectValues(element, selectedOptions)); |
| | | |
| | | if (!that.multiple && selectedOptions.length === 1) { |
| | | that.selectpicker.view.displayedValue = getSelectValues(element, selectedOptions); |
| | | } |
| | | |
| | | if (this.options.selectedTextFormat === 'static') { |
| | | titleFragment = generateOption.text.call(this, { text: this.options.title }, true); |
| | | } else { |
| | | showCount = this.multiple && this.options.selectedTextFormat.indexOf('count') !== -1 && selectedCount > 1; |
| | | |
| | | // determine if the number of selected options will be shown (showCount === true) |
| | | if (showCount) { |
| | | countMax = this.options.selectedTextFormat.split('>'); |
| | | showCount = (countMax.length > 1 && selectedCount > countMax[1]) || (countMax.length === 1 && selectedCount >= 2); |
| | | } |
| | | |
| | | // only loop through all selected options if the count won't be shown |
| | | if (showCount === false) { |
| | | if (!placeholderSelected) { |
| | | for (var selectedIndex = 0; selectedIndex < selectedCount; selectedIndex++) { |
| | | if (selectedIndex < 50) { |
| | | var option = selectedOptions[selectedIndex], |
| | | thisData = this.selectpicker.main.data[option.liIndex], |
| | | titleOptions = {}; |
| | | |
| | | if (this.multiple && selectedIndex > 0) { |
| | | titleFragment.appendChild(multipleSeparator.cloneNode(false)); |
| | | } |
| | | |
| | | if (option.title) { |
| | | titleOptions.text = option.title; |
| | | } else if (thisData) { |
| | | if (thisData.content && that.options.showContent) { |
| | | titleOptions.content = thisData.content.toString(); |
| | | hasContent = true; |
| | | } else { |
| | | if (that.options.showIcon) { |
| | | titleOptions.icon = thisData.icon; |
| | | } |
| | | if (that.options.showSubtext && !that.multiple && thisData.subtext) titleOptions.subtext = ' ' + thisData.subtext; |
| | | titleOptions.text = option.textContent.trim(); |
| | | } |
| | | } |
| | | |
| | | titleFragment.appendChild(generateOption.text.call(this, titleOptions, true)); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | // add ellipsis |
| | | if (selectedCount > 49) { |
| | | titleFragment.appendChild(document.createTextNode('...')); |
| | | } |
| | | } |
| | | } else { |
| | | var optionSelector = ':not([hidden]):not([data-hidden="true"]):not([data-divider="true"])'; |
| | | if (this.options.hideDisabled) optionSelector += ':not(:disabled)'; |
| | | |
| | | // If this is a multiselect, and selectedTextFormat is count, then show 1 of 2 selected, etc. |
| | | var totalCount = this.$element[0].querySelectorAll('select > option' + optionSelector + ', optgroup' + optionSelector + ' option' + optionSelector).length, |
| | | tr8nText = (typeof this.options.countSelectedText === 'function') ? this.options.countSelectedText(selectedCount, totalCount) : this.options.countSelectedText; |
| | | |
| | | titleFragment = generateOption.text.call(this, { |
| | | text: tr8nText.replace('{0}', selectedCount.toString()).replace('{1}', totalCount.toString()) |
| | | }, true); |
| | | } |
| | | } |
| | | |
| | | if (this.options.title == undefined) { |
| | | // use .attr to ensure undefined is returned if title attribute is not set |
| | | this.options.title = this.$element.attr('title'); |
| | | } |
| | | |
| | | // If the select doesn't have a title, then use the default, or if nothing is set at all, use noneSelectedText |
| | | if (!titleFragment.childNodes.length) { |
| | | titleFragment = generateOption.text.call(this, { |
| | | text: typeof this.options.title !== 'undefined' ? this.options.title : this.options.noneSelectedText |
| | | }, true); |
| | | } |
| | | |
| | | // strip all HTML tags and trim the result, then unescape any escaped tags |
| | | button.title = titleFragment.textContent.replace(/<[^>]*>?/g, '').trim(); |
| | | |
| | | if (this.options.sanitize && hasContent) { |
| | | sanitizeHtml([titleFragment], that.options.whiteList, that.options.sanitizeFn); |
| | | } |
| | | |
| | | buttonInner.innerHTML = ''; |
| | | buttonInner.appendChild(titleFragment); |
| | | |
| | | if (version.major < 4 && this.$newElement[0].classList.contains('bs3-has-addon')) { |
| | | var filterExpand = button.querySelector('.filter-expand'), |
| | | clone = buttonInner.cloneNode(true); |
| | | |
| | | clone.className = 'filter-expand'; |
| | | |
| | | if (filterExpand) { |
| | | button.replaceChild(clone, filterExpand); |
| | | } else { |
| | | button.appendChild(clone); |
| | | } |
| | | } |
| | | |
| | | this.$element.trigger('rendered' + EVENT_KEY); |
| | | }, |
| | | |
| | | /** |
| | | * @param [style] |
| | | * @param [status] |
| | | */ |
| | | setStyle: function (newStyle, status) { |
| | | var button = this.$button[0], |
| | | newElement = this.$newElement[0], |
| | | style = this.options.style.trim(), |
| | | buttonClass; |
| | | |
| | | if (this.$element.attr('class')) { |
| | | this.$newElement.addClass(this.$element.attr('class').replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi, '')); |
| | | } |
| | | |
| | | if (version.major < 4) { |
| | | newElement.classList.add('bs3'); |
| | | |
| | | if (newElement.parentNode.classList && newElement.parentNode.classList.contains('input-group') && |
| | | (newElement.previousElementSibling || newElement.nextElementSibling) && |
| | | (newElement.previousElementSibling || newElement.nextElementSibling).classList.contains('input-group-addon') |
| | | ) { |
| | | newElement.classList.add('bs3-has-addon'); |
| | | } |
| | | } |
| | | |
| | | if (newStyle) { |
| | | buttonClass = newStyle.trim(); |
| | | } else { |
| | | buttonClass = style; |
| | | } |
| | | |
| | | if (status == 'add') { |
| | | if (buttonClass) button.classList.add.apply(button.classList, buttonClass.split(' ')); |
| | | } else if (status == 'remove') { |
| | | if (buttonClass) button.classList.remove.apply(button.classList, buttonClass.split(' ')); |
| | | } else { |
| | | if (style) button.classList.remove.apply(button.classList, style.split(' ')); |
| | | if (buttonClass) button.classList.add.apply(button.classList, buttonClass.split(' ')); |
| | | } |
| | | }, |
| | | |
| | | liHeight: function (refresh) { |
| | | if (!refresh && (this.options.size === false || Object.keys(this.sizeInfo).length)) return; |
| | | |
| | | var newElement = elementTemplates.div.cloneNode(false), |
| | | menu = elementTemplates.div.cloneNode(false), |
| | | menuInner = elementTemplates.div.cloneNode(false), |
| | | menuInnerInner = document.createElement('ul'), |
| | | divider = elementTemplates.li.cloneNode(false), |
| | | dropdownHeader = elementTemplates.li.cloneNode(false), |
| | | li, |
| | | a = elementTemplates.a.cloneNode(false), |
| | | text = elementTemplates.span.cloneNode(false), |
| | | header = this.options.header && this.$menu.find('.' + classNames.POPOVERHEADER).length > 0 ? this.$menu.find('.' + classNames.POPOVERHEADER)[0].cloneNode(true) : null, |
| | | search = this.options.liveSearch ? elementTemplates.div.cloneNode(false) : null, |
| | | actions = this.options.actionsBox && this.multiple && this.$menu.find('.bs-actionsbox').length > 0 ? this.$menu.find('.bs-actionsbox')[0].cloneNode(true) : null, |
| | | doneButton = this.options.doneButton && this.multiple && this.$menu.find('.bs-donebutton').length > 0 ? this.$menu.find('.bs-donebutton')[0].cloneNode(true) : null, |
| | | firstOption = this.$element.find('option')[0]; |
| | | |
| | | this.sizeInfo.selectWidth = this.$newElement[0].offsetWidth; |
| | | |
| | | text.className = 'text'; |
| | | a.className = 'dropdown-item ' + (firstOption ? firstOption.className : ''); |
| | | newElement.className = this.$menu[0].parentNode.className + ' ' + classNames.SHOW; |
| | | newElement.style.width = 0; // ensure button width doesn't affect natural width of menu when calculating |
| | | if (this.options.width === 'auto') menu.style.minWidth = 0; |
| | | menu.className = classNames.MENU + ' ' + classNames.SHOW; |
| | | menuInner.className = 'inner ' + classNames.SHOW; |
| | | menuInnerInner.className = classNames.MENU + ' inner ' + (version.major === '4' ? classNames.SHOW : ''); |
| | | divider.className = classNames.DIVIDER; |
| | | dropdownHeader.className = 'dropdown-header'; |
| | | |
| | | text.appendChild(document.createTextNode('\u200b')); |
| | | |
| | | if (this.selectpicker.current.data.length) { |
| | | for (var i = 0; i < this.selectpicker.current.data.length; i++) { |
| | | var data = this.selectpicker.current.data[i]; |
| | | if (data.type === 'option') { |
| | | li = data.element; |
| | | break; |
| | | } |
| | | } |
| | | } else { |
| | | li = elementTemplates.li.cloneNode(false); |
| | | a.appendChild(text); |
| | | li.appendChild(a); |
| | | } |
| | | |
| | | dropdownHeader.appendChild(text.cloneNode(true)); |
| | | |
| | | if (this.selectpicker.view.widestOption) { |
| | | menuInnerInner.appendChild(this.selectpicker.view.widestOption.cloneNode(true)); |
| | | } |
| | | |
| | | menuInnerInner.appendChild(li); |
| | | menuInnerInner.appendChild(divider); |
| | | menuInnerInner.appendChild(dropdownHeader); |
| | | if (header) menu.appendChild(header); |
| | | if (search) { |
| | | var input = document.createElement('input'); |
| | | search.className = 'bs-searchbox'; |
| | | input.className = 'form-control'; |
| | | search.appendChild(input); |
| | | menu.appendChild(search); |
| | | } |
| | | if (actions) menu.appendChild(actions); |
| | | menuInner.appendChild(menuInnerInner); |
| | | menu.appendChild(menuInner); |
| | | if (doneButton) menu.appendChild(doneButton); |
| | | newElement.appendChild(menu); |
| | | |
| | | document.body.appendChild(newElement); |
| | | |
| | | var liHeight = li.offsetHeight, |
| | | dropdownHeaderHeight = dropdownHeader ? dropdownHeader.offsetHeight : 0, |
| | | headerHeight = header ? header.offsetHeight : 0, |
| | | searchHeight = search ? search.offsetHeight : 0, |
| | | actionsHeight = actions ? actions.offsetHeight : 0, |
| | | doneButtonHeight = doneButton ? doneButton.offsetHeight : 0, |
| | | dividerHeight = $(divider).outerHeight(true), |
| | | // fall back to jQuery if getComputedStyle is not supported |
| | | menuStyle = window.getComputedStyle ? window.getComputedStyle(menu) : false, |
| | | menuWidth = menu.offsetWidth, |
| | | $menu = menuStyle ? null : $(menu), |
| | | menuPadding = { |
| | | vert: toInteger(menuStyle ? menuStyle.paddingTop : $menu.css('paddingTop')) + |
| | | toInteger(menuStyle ? menuStyle.paddingBottom : $menu.css('paddingBottom')) + |
| | | toInteger(menuStyle ? menuStyle.borderTopWidth : $menu.css('borderTopWidth')) + |
| | | toInteger(menuStyle ? menuStyle.borderBottomWidth : $menu.css('borderBottomWidth')), |
| | | horiz: toInteger(menuStyle ? menuStyle.paddingLeft : $menu.css('paddingLeft')) + |
| | | toInteger(menuStyle ? menuStyle.paddingRight : $menu.css('paddingRight')) + |
| | | toInteger(menuStyle ? menuStyle.borderLeftWidth : $menu.css('borderLeftWidth')) + |
| | | toInteger(menuStyle ? menuStyle.borderRightWidth : $menu.css('borderRightWidth')) |
| | | }, |
| | | menuExtras = { |
| | | vert: menuPadding.vert + |
| | | toInteger(menuStyle ? menuStyle.marginTop : $menu.css('marginTop')) + |
| | | toInteger(menuStyle ? menuStyle.marginBottom : $menu.css('marginBottom')) + 2, |
| | | horiz: menuPadding.horiz + |
| | | toInteger(menuStyle ? menuStyle.marginLeft : $menu.css('marginLeft')) + |
| | | toInteger(menuStyle ? menuStyle.marginRight : $menu.css('marginRight')) + 2 |
| | | }, |
| | | scrollBarWidth; |
| | | |
| | | menuInner.style.overflowY = 'scroll'; |
| | | |
| | | scrollBarWidth = menu.offsetWidth - menuWidth; |
| | | |
| | | document.body.removeChild(newElement); |
| | | |
| | | this.sizeInfo.liHeight = liHeight; |
| | | this.sizeInfo.dropdownHeaderHeight = dropdownHeaderHeight; |
| | | this.sizeInfo.headerHeight = headerHeight; |
| | | this.sizeInfo.searchHeight = searchHeight; |
| | | this.sizeInfo.actionsHeight = actionsHeight; |
| | | this.sizeInfo.doneButtonHeight = doneButtonHeight; |
| | | this.sizeInfo.dividerHeight = dividerHeight; |
| | | this.sizeInfo.menuPadding = menuPadding; |
| | | this.sizeInfo.menuExtras = menuExtras; |
| | | this.sizeInfo.menuWidth = menuWidth; |
| | | this.sizeInfo.menuInnerInnerWidth = menuWidth - menuPadding.horiz; |
| | | this.sizeInfo.totalMenuWidth = this.sizeInfo.menuWidth; |
| | | this.sizeInfo.scrollBarWidth = scrollBarWidth; |
| | | this.sizeInfo.selectHeight = this.$newElement[0].offsetHeight; |
| | | |
| | | this.setPositionData(); |
| | | }, |
| | | |
| | | getSelectPosition: function () { |
| | | var that = this, |
| | | $window = $(window), |
| | | pos = that.$newElement.offset(), |
| | | $container = $(that.options.container), |
| | | containerPos; |
| | | |
| | | if (that.options.container && $container.length && !$container.is('body')) { |
| | | containerPos = $container.offset(); |
| | | containerPos.top += parseInt($container.css('borderTopWidth')); |
| | | containerPos.left += parseInt($container.css('borderLeftWidth')); |
| | | } else { |
| | | containerPos = { top: 0, left: 0 }; |
| | | } |
| | | |
| | | var winPad = that.options.windowPadding; |
| | | |
| | | this.sizeInfo.selectOffsetTop = pos.top - containerPos.top - $window.scrollTop(); |
| | | this.sizeInfo.selectOffsetBot = $window.height() - this.sizeInfo.selectOffsetTop - this.sizeInfo.selectHeight - containerPos.top - winPad[2]; |
| | | this.sizeInfo.selectOffsetLeft = pos.left - containerPos.left - $window.scrollLeft(); |
| | | this.sizeInfo.selectOffsetRight = $window.width() - this.sizeInfo.selectOffsetLeft - this.sizeInfo.selectWidth - containerPos.left - winPad[1]; |
| | | this.sizeInfo.selectOffsetTop -= winPad[0]; |
| | | this.sizeInfo.selectOffsetLeft -= winPad[3]; |
| | | }, |
| | | |
| | | setMenuSize: function (isAuto) { |
| | | this.getSelectPosition(); |
| | | |
| | | var selectWidth = this.sizeInfo.selectWidth, |
| | | liHeight = this.sizeInfo.liHeight, |
| | | headerHeight = this.sizeInfo.headerHeight, |
| | | searchHeight = this.sizeInfo.searchHeight, |
| | | actionsHeight = this.sizeInfo.actionsHeight, |
| | | doneButtonHeight = this.sizeInfo.doneButtonHeight, |
| | | divHeight = this.sizeInfo.dividerHeight, |
| | | menuPadding = this.sizeInfo.menuPadding, |
| | | menuInnerHeight, |
| | | menuHeight, |
| | | divLength = 0, |
| | | minHeight, |
| | | _minHeight, |
| | | maxHeight, |
| | | menuInnerMinHeight, |
| | | estimate, |
| | | isDropup; |
| | | |
| | | if (this.options.dropupAuto) { |
| | | // Get the estimated height of the menu without scrollbars. |
| | | // This is useful for smaller menus, where there might be plenty of room |
| | | // below the button without setting dropup, but we can't know |
| | | // the exact height of the menu until createView is called later |
| | | estimate = liHeight * this.selectpicker.current.elements.length + menuPadding.vert; |
| | | |
| | | isDropup = this.sizeInfo.selectOffsetTop - this.sizeInfo.selectOffsetBot > this.sizeInfo.menuExtras.vert && estimate + this.sizeInfo.menuExtras.vert + 50 > this.sizeInfo.selectOffsetBot; |
| | | |
| | | // ensure dropup doesn't change while searching (so menu doesn't bounce back and forth) |
| | | if (this.selectpicker.isSearching === true) { |
| | | isDropup = this.selectpicker.dropup; |
| | | } |
| | | |
| | | this.$newElement.toggleClass(classNames.DROPUP, isDropup); |
| | | this.selectpicker.dropup = isDropup; |
| | | } |
| | | |
| | | if (this.options.size === 'auto') { |
| | | _minHeight = this.selectpicker.current.elements.length > 3 ? this.sizeInfo.liHeight * 3 + this.sizeInfo.menuExtras.vert - 2 : 0; |
| | | menuHeight = this.sizeInfo.selectOffsetBot - this.sizeInfo.menuExtras.vert; |
| | | minHeight = _minHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight; |
| | | menuInnerMinHeight = Math.max(_minHeight - menuPadding.vert, 0); |
| | | |
| | | if (this.$newElement.hasClass(classNames.DROPUP)) { |
| | | menuHeight = this.sizeInfo.selectOffsetTop - this.sizeInfo.menuExtras.vert; |
| | | } |
| | | |
| | | maxHeight = menuHeight; |
| | | menuInnerHeight = menuHeight - headerHeight - searchHeight - actionsHeight - doneButtonHeight - menuPadding.vert; |
| | | } else if (this.options.size && this.options.size != 'auto' && this.selectpicker.current.elements.length > this.options.size) { |
| | | for (var i = 0; i < this.options.size; i++) { |
| | | if (this.selectpicker.current.data[i].type === 'divider') divLength++; |
| | | } |
| | | |
| | | menuHeight = liHeight * this.options.size + divLength * divHeight + menuPadding.vert; |
| | | menuInnerHeight = menuHeight - menuPadding.vert; |
| | | maxHeight = menuHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight; |
| | | minHeight = menuInnerMinHeight = ''; |
| | | } |
| | | |
| | | this.$menu.css({ |
| | | 'max-height': maxHeight + 'px', |
| | | 'overflow': 'hidden', |
| | | 'min-height': minHeight + 'px' |
| | | }); |
| | | |
| | | this.$menuInner.css({ |
| | | 'max-height': menuInnerHeight + 'px', |
| | | 'overflow-y': 'auto', |
| | | 'min-height': menuInnerMinHeight + 'px' |
| | | }); |
| | | |
| | | // ensure menuInnerHeight is always a positive number to prevent issues calculating chunkSize in createView |
| | | this.sizeInfo.menuInnerHeight = Math.max(menuInnerHeight, 1); |
| | | |
| | | if (this.selectpicker.current.data.length && this.selectpicker.current.data[this.selectpicker.current.data.length - 1].position > this.sizeInfo.menuInnerHeight) { |
| | | this.sizeInfo.hasScrollBar = true; |
| | | this.sizeInfo.totalMenuWidth = this.sizeInfo.menuWidth + this.sizeInfo.scrollBarWidth; |
| | | } |
| | | |
| | | if (this.options.dropdownAlignRight === 'auto') { |
| | | this.$menu.toggleClass(classNames.MENURIGHT, this.sizeInfo.selectOffsetLeft > this.sizeInfo.selectOffsetRight && this.sizeInfo.selectOffsetRight < (this.sizeInfo.totalMenuWidth - selectWidth)); |
| | | } |
| | | |
| | | if (this.dropdown && this.dropdown._popper) this.dropdown._popper.update(); |
| | | }, |
| | | |
| | | setSize: function (refresh) { |
| | | this.liHeight(refresh); |
| | | |
| | | if (this.options.header) this.$menu.css('padding-top', 0); |
| | | |
| | | if (this.options.size !== false) { |
| | | var that = this, |
| | | $window = $(window); |
| | | |
| | | this.setMenuSize(); |
| | | |
| | | if (this.options.liveSearch) { |
| | | this.$searchbox |
| | | .off('input.setMenuSize propertychange.setMenuSize') |
| | | .on('input.setMenuSize propertychange.setMenuSize', function () { |
| | | return that.setMenuSize(); |
| | | }); |
| | | } |
| | | |
| | | if (this.options.size === 'auto') { |
| | | $window |
| | | .off('resize' + EVENT_KEY + '.' + this.selectId + '.setMenuSize' + ' scroll' + EVENT_KEY + '.' + this.selectId + '.setMenuSize') |
| | | .on('resize' + EVENT_KEY + '.' + this.selectId + '.setMenuSize' + ' scroll' + EVENT_KEY + '.' + this.selectId + '.setMenuSize', function () { |
| | | return that.setMenuSize(); |
| | | }); |
| | | } else if (this.options.size && this.options.size != 'auto' && this.selectpicker.current.elements.length > this.options.size) { |
| | | $window.off('resize' + EVENT_KEY + '.' + this.selectId + '.setMenuSize' + ' scroll' + EVENT_KEY + '.' + this.selectId + '.setMenuSize'); |
| | | } |
| | | } |
| | | |
| | | this.createView(false, true, refresh); |
| | | }, |
| | | |
| | | setWidth: function () { |
| | | var that = this; |
| | | |
| | | if (this.options.width === 'auto') { |
| | | requestAnimationFrame(function () { |
| | | that.$menu.css('min-width', '0'); |
| | | |
| | | that.$element.on('loaded' + EVENT_KEY, function () { |
| | | that.liHeight(); |
| | | that.setMenuSize(); |
| | | |
| | | // Get correct width if element is hidden |
| | | var $selectClone = that.$newElement.clone().appendTo('body'), |
| | | btnWidth = $selectClone.css('width', 'auto').children('button').outerWidth(); |
| | | |
| | | $selectClone.remove(); |
| | | |
| | | // Set width to whatever's larger, button title or longest option |
| | | that.sizeInfo.selectWidth = Math.max(that.sizeInfo.totalMenuWidth, btnWidth); |
| | | that.$newElement.css('width', that.sizeInfo.selectWidth + 'px'); |
| | | }); |
| | | }); |
| | | } else if (this.options.width === 'fit') { |
| | | // Remove inline min-width so width can be changed from 'auto' |
| | | this.$menu.css('min-width', ''); |
| | | this.$newElement.css('width', '').addClass('fit-width'); |
| | | } else if (this.options.width) { |
| | | // Remove inline min-width so width can be changed from 'auto' |
| | | this.$menu.css('min-width', ''); |
| | | this.$newElement.css('width', this.options.width); |
| | | } else { |
| | | // Remove inline min-width/width so width can be changed |
| | | this.$menu.css('min-width', ''); |
| | | this.$newElement.css('width', ''); |
| | | } |
| | | // Remove fit-width class if width is changed programmatically |
| | | if (this.$newElement.hasClass('fit-width') && this.options.width !== 'fit') { |
| | | this.$newElement[0].classList.remove('fit-width'); |
| | | } |
| | | }, |
| | | |
| | | selectPosition: function () { |
| | | this.$bsContainer = $('<div class="bs-container" />'); |
| | | |
| | | var that = this, |
| | | $container = $(this.options.container), |
| | | pos, |
| | | containerPos, |
| | | actualHeight, |
| | | getPlacement = function ($element) { |
| | | var containerPosition = {}, |
| | | // fall back to dropdown's default display setting if display is not manually set |
| | | display = that.options.display || ( |
| | | // Bootstrap 3 doesn't have $.fn.dropdown.Constructor.Default |
| | | $.fn.dropdown.Constructor.Default ? $.fn.dropdown.Constructor.Default.display |
| | | : false |
| | | ); |
| | | |
| | | that.$bsContainer.addClass($element.attr('class').replace(/form-control|fit-width/gi, '')).toggleClass(classNames.DROPUP, $element.hasClass(classNames.DROPUP)); |
| | | pos = $element.offset(); |
| | | |
| | | if (!$container.is('body')) { |
| | | containerPos = $container.offset(); |
| | | containerPos.top += parseInt($container.css('borderTopWidth')) - $container.scrollTop(); |
| | | containerPos.left += parseInt($container.css('borderLeftWidth')) - $container.scrollLeft(); |
| | | } else { |
| | | containerPos = { top: 0, left: 0 }; |
| | | } |
| | | |
| | | actualHeight = $element.hasClass(classNames.DROPUP) ? 0 : $element[0].offsetHeight; |
| | | |
| | | // Bootstrap 4+ uses Popper for menu positioning |
| | | if (version.major < 4 || display === 'static') { |
| | | containerPosition.top = pos.top - containerPos.top + actualHeight; |
| | | containerPosition.left = pos.left - containerPos.left; |
| | | } |
| | | |
| | | containerPosition.width = $element[0].offsetWidth; |
| | | |
| | | that.$bsContainer.css(containerPosition); |
| | | }; |
| | | |
| | | this.$button.on('click.bs.dropdown.data-api', function () { |
| | | if (that.isDisabled()) { |
| | | return; |
| | | } |
| | | |
| | | getPlacement(that.$newElement); |
| | | |
| | | that.$bsContainer |
| | | .appendTo(that.options.container) |
| | | .toggleClass(classNames.SHOW, !that.$button.hasClass(classNames.SHOW)) |
| | | .append(that.$menu); |
| | | }); |
| | | |
| | | $(window) |
| | | .off('resize' + EVENT_KEY + '.' + this.selectId + ' scroll' + EVENT_KEY + '.' + this.selectId) |
| | | .on('resize' + EVENT_KEY + '.' + this.selectId + ' scroll' + EVENT_KEY + '.' + this.selectId, function () { |
| | | var isActive = that.$newElement.hasClass(classNames.SHOW); |
| | | |
| | | if (isActive) getPlacement(that.$newElement); |
| | | }); |
| | | |
| | | this.$element.on('hide' + EVENT_KEY, function () { |
| | | that.$menu.data('height', that.$menu.height()); |
| | | that.$bsContainer.detach(); |
| | | }); |
| | | }, |
| | | |
| | | setOptionStatus: function (selectedOnly) { |
| | | var that = this; |
| | | |
| | | that.noScroll = false; |
| | | |
| | | if (that.selectpicker.view.visibleElements && that.selectpicker.view.visibleElements.length) { |
| | | for (var i = 0; i < that.selectpicker.view.visibleElements.length; i++) { |
| | | var liData = that.selectpicker.current.data[i + that.selectpicker.view.position0], |
| | | option = liData.option; |
| | | |
| | | if (option) { |
| | | if (selectedOnly !== true) { |
| | | that.setDisabled( |
| | | liData.index, |
| | | liData.disabled |
| | | ); |
| | | } |
| | | |
| | | that.setSelected( |
| | | liData.index, |
| | | option.selected |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * @param {number} index - the index of the option that is being changed |
| | | * @param {boolean} selected - true if the option is being selected, false if being deselected |
| | | */ |
| | | setSelected: function (index, selected) { |
| | | var li = this.selectpicker.main.elements[index], |
| | | liData = this.selectpicker.main.data[index], |
| | | activeIndexIsSet = this.activeIndex !== undefined, |
| | | thisIsActive = this.activeIndex === index, |
| | | prevActive, |
| | | a, |
| | | // if current option is already active |
| | | // OR |
| | | // if the current option is being selected, it's NOT multiple, and |
| | | // activeIndex is undefined: |
| | | // - when the menu is first being opened, OR |
| | | // - after a search has been performed, OR |
| | | // - when retainActive is false when selecting a new option (i.e. index of the newly selected option is not the same as the current activeIndex) |
| | | keepActive = thisIsActive || (selected && !this.multiple && !activeIndexIsSet); |
| | | |
| | | liData.selected = selected; |
| | | |
| | | a = li.firstChild; |
| | | |
| | | if (selected) { |
| | | this.selectedIndex = index; |
| | | } |
| | | |
| | | li.classList.toggle('selected', selected); |
| | | |
| | | if (keepActive) { |
| | | this.focusItem(li, liData); |
| | | this.selectpicker.view.currentActive = li; |
| | | this.activeIndex = index; |
| | | } else { |
| | | this.defocusItem(li); |
| | | } |
| | | |
| | | if (a) { |
| | | a.classList.toggle('selected', selected); |
| | | |
| | | if (selected) { |
| | | a.setAttribute('aria-selected', true); |
| | | } else { |
| | | if (this.multiple) { |
| | | a.setAttribute('aria-selected', false); |
| | | } else { |
| | | a.removeAttribute('aria-selected'); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!keepActive && !activeIndexIsSet && selected && this.prevActiveIndex !== undefined) { |
| | | prevActive = this.selectpicker.main.elements[this.prevActiveIndex]; |
| | | |
| | | this.defocusItem(prevActive); |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * @param {number} index - the index of the option that is being disabled |
| | | * @param {boolean} disabled - true if the option is being disabled, false if being enabled |
| | | */ |
| | | setDisabled: function (index, disabled) { |
| | | var li = this.selectpicker.main.elements[index], |
| | | a; |
| | | |
| | | this.selectpicker.main.data[index].disabled = disabled; |
| | | |
| | | a = li.firstChild; |
| | | |
| | | li.classList.toggle(classNames.DISABLED, disabled); |
| | | |
| | | if (a) { |
| | | if (version.major === '4') a.classList.toggle(classNames.DISABLED, disabled); |
| | | |
| | | if (disabled) { |
| | | a.setAttribute('aria-disabled', disabled); |
| | | a.setAttribute('tabindex', -1); |
| | | } else { |
| | | a.removeAttribute('aria-disabled'); |
| | | a.setAttribute('tabindex', 0); |
| | | } |
| | | } |
| | | }, |
| | | |
| | | isDisabled: function () { |
| | | return this.$element[0].disabled; |
| | | }, |
| | | |
| | | checkDisabled: function () { |
| | | if (this.isDisabled()) { |
| | | this.$newElement[0].classList.add(classNames.DISABLED); |
| | | this.$button.addClass(classNames.DISABLED).attr('aria-disabled', true); |
| | | } else { |
| | | if (this.$button[0].classList.contains(classNames.DISABLED)) { |
| | | this.$newElement[0].classList.remove(classNames.DISABLED); |
| | | this.$button.removeClass(classNames.DISABLED).attr('aria-disabled', false); |
| | | } |
| | | } |
| | | }, |
| | | |
| | | clickListener: function () { |
| | | var that = this, |
| | | $document = $(document); |
| | | |
| | | $document.data('spaceSelect', false); |
| | | |
| | | this.$button.on('keyup', function (e) { |
| | | if (/(32)/.test(e.keyCode.toString(10)) && $document.data('spaceSelect')) { |
| | | e.preventDefault(); |
| | | $document.data('spaceSelect', false); |
| | | } |
| | | }); |
| | | |
| | | this.$newElement.on('show.bs.dropdown', function () { |
| | | if (version.major > 3 && !that.dropdown) { |
| | | that.dropdown = that.$button.data('bs.dropdown'); |
| | | that.dropdown._menu = that.$menu[0]; |
| | | } |
| | | }); |
| | | |
| | | this.$button.on('click.bs.dropdown.data-api', function () { |
| | | if (!that.$newElement.hasClass(classNames.SHOW)) { |
| | | that.setSize(); |
| | | } |
| | | }); |
| | | |
| | | function setFocus () { |
| | | if (that.options.liveSearch) { |
| | | that.$searchbox.trigger('focus'); |
| | | } else { |
| | | that.$menuInner.trigger('focus'); |
| | | } |
| | | } |
| | | |
| | | function checkPopperExists () { |
| | | if (that.dropdown && that.dropdown._popper && that.dropdown._popper.state.isCreated) { |
| | | setFocus(); |
| | | } else { |
| | | requestAnimationFrame(checkPopperExists); |
| | | } |
| | | } |
| | | |
| | | this.$element.on('shown' + EVENT_KEY, function () { |
| | | if (that.$menuInner[0].scrollTop !== that.selectpicker.view.scrollTop) { |
| | | that.$menuInner[0].scrollTop = that.selectpicker.view.scrollTop; |
| | | } |
| | | |
| | | if (version.major > 3) { |
| | | requestAnimationFrame(checkPopperExists); |
| | | } else { |
| | | setFocus(); |
| | | } |
| | | }); |
| | | |
| | | // ensure posinset and setsize are correct before selecting an option via a click |
| | | this.$menuInner.on('mouseenter', 'li a', function (e) { |
| | | var hoverLi = this.parentElement, |
| | | position0 = that.isVirtual() ? that.selectpicker.view.position0 : 0, |
| | | index = Array.prototype.indexOf.call(hoverLi.parentElement.children, hoverLi), |
| | | hoverData = that.selectpicker.current.data[index + position0]; |
| | | |
| | | that.focusItem(hoverLi, hoverData, true); |
| | | }); |
| | | |
| | | this.$menuInner.on('click', 'li a', function (e, retainActive) { |
| | | var $this = $(this), |
| | | element = that.$element[0], |
| | | position0 = that.isVirtual() ? that.selectpicker.view.position0 : 0, |
| | | clickedData = that.selectpicker.current.data[$this.parent().index() + position0], |
| | | clickedIndex = clickedData.index, |
| | | prevValue = getSelectValues(element), |
| | | prevIndex = element.selectedIndex, |
| | | prevOption = element.options[prevIndex], |
| | | triggerChange = true; |
| | | |
| | | // Don't close on multi choice menu |
| | | if (that.multiple && that.options.maxOptions !== 1) { |
| | | e.stopPropagation(); |
| | | } |
| | | |
| | | e.preventDefault(); |
| | | |
| | | // Don't run if the select is disabled |
| | | if (!that.isDisabled() && !$this.parent().hasClass(classNames.DISABLED)) { |
| | | var option = clickedData.option, |
| | | $option = $(option), |
| | | state = option.selected, |
| | | $optgroup = $option.parent('optgroup'), |
| | | $optgroupOptions = $optgroup.find('option'), |
| | | maxOptions = that.options.maxOptions, |
| | | maxOptionsGrp = $optgroup.data('maxOptions') || false; |
| | | |
| | | if (clickedIndex === that.activeIndex) retainActive = true; |
| | | |
| | | if (!retainActive) { |
| | | that.prevActiveIndex = that.activeIndex; |
| | | that.activeIndex = undefined; |
| | | } |
| | | |
| | | if (!that.multiple) { // Deselect all others if not multi select box |
| | | if (prevOption) prevOption.selected = false; |
| | | option.selected = true; |
| | | that.setSelected(clickedIndex, true); |
| | | } else { // Toggle the one we have chosen if we are multi select. |
| | | option.selected = !state; |
| | | |
| | | that.setSelected(clickedIndex, !state); |
| | | that.focusedParent.focus(); |
| | | |
| | | if (maxOptions !== false || maxOptionsGrp !== false) { |
| | | var maxReached = maxOptions < getSelectedOptions(element).length, |
| | | maxReachedGrp = maxOptionsGrp < $optgroup.find('option:selected').length; |
| | | |
| | | if ((maxOptions && maxReached) || (maxOptionsGrp && maxReachedGrp)) { |
| | | if (maxOptions && maxOptions == 1) { |
| | | element.selectedIndex = -1; |
| | | option.selected = true; |
| | | that.setOptionStatus(true); |
| | | } else if (maxOptionsGrp && maxOptionsGrp == 1) { |
| | | for (var i = 0; i < $optgroupOptions.length; i++) { |
| | | var _option = $optgroupOptions[i]; |
| | | _option.selected = false; |
| | | that.setSelected(_option.liIndex, false); |
| | | } |
| | | |
| | | option.selected = true; |
| | | that.setSelected(clickedIndex, true); |
| | | } else { |
| | | var maxOptionsText = typeof that.options.maxOptionsText === 'string' ? [that.options.maxOptionsText, that.options.maxOptionsText] : that.options.maxOptionsText, |
| | | maxOptionsArr = typeof maxOptionsText === 'function' ? maxOptionsText(maxOptions, maxOptionsGrp) : maxOptionsText, |
| | | maxTxt = maxOptionsArr[0].replace('{n}', maxOptions), |
| | | maxTxtGrp = maxOptionsArr[1].replace('{n}', maxOptionsGrp), |
| | | $notify = $('<div class="notify"></div>'); |
| | | // If {var} is set in array, replace it |
| | | /** @deprecated */ |
| | | if (maxOptionsArr[2]) { |
| | | maxTxt = maxTxt.replace('{var}', maxOptionsArr[2][maxOptions > 1 ? 0 : 1]); |
| | | maxTxtGrp = maxTxtGrp.replace('{var}', maxOptionsArr[2][maxOptionsGrp > 1 ? 0 : 1]); |
| | | } |
| | | |
| | | option.selected = false; |
| | | |
| | | that.$menu.append($notify); |
| | | |
| | | if (maxOptions && maxReached) { |
| | | $notify.append($('<div>' + maxTxt + '</div>')); |
| | | triggerChange = false; |
| | | that.$element.trigger('maxReached' + EVENT_KEY); |
| | | } |
| | | |
| | | if (maxOptionsGrp && maxReachedGrp) { |
| | | $notify.append($('<div>' + maxTxtGrp + '</div>')); |
| | | triggerChange = false; |
| | | that.$element.trigger('maxReachedGrp' + EVENT_KEY); |
| | | } |
| | | |
| | | setTimeout(function () { |
| | | that.setSelected(clickedIndex, false); |
| | | }, 10); |
| | | |
| | | $notify[0].classList.add('fadeOut'); |
| | | |
| | | setTimeout(function () { |
| | | $notify.remove(); |
| | | }, 1050); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!that.multiple || (that.multiple && that.options.maxOptions === 1)) { |
| | | that.$button.trigger('focus'); |
| | | } else if (that.options.liveSearch) { |
| | | that.$searchbox.trigger('focus'); |
| | | } |
| | | |
| | | // Trigger select 'change' |
| | | if (triggerChange) { |
| | | if (that.multiple || prevIndex !== element.selectedIndex) { |
| | | // $option.prop('selected') is current option state (selected/unselected). prevValue is the value of the select prior to being changed. |
| | | changedArguments = [option.index, $option.prop('selected'), prevValue]; |
| | | that.$element |
| | | .triggerNative('change'); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | this.$menu.on('click', 'li.' + classNames.DISABLED + ' a, .' + classNames.POPOVERHEADER + ', .' + classNames.POPOVERHEADER + ' :not(.close)', function (e) { |
| | | if (e.currentTarget == this) { |
| | | e.preventDefault(); |
| | | e.stopPropagation(); |
| | | if (that.options.liveSearch && !$(e.target).hasClass('close')) { |
| | | that.$searchbox.trigger('focus'); |
| | | } else { |
| | | that.$button.trigger('focus'); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | this.$menuInner.on('click', '.divider, .dropdown-header', function (e) { |
| | | e.preventDefault(); |
| | | e.stopPropagation(); |
| | | if (that.options.liveSearch) { |
| | | that.$searchbox.trigger('focus'); |
| | | } else { |
| | | that.$button.trigger('focus'); |
| | | } |
| | | }); |
| | | |
| | | this.$menu.on('click', '.' + classNames.POPOVERHEADER + ' .close', function () { |
| | | that.$button.trigger('click'); |
| | | }); |
| | | |
| | | this.$searchbox.on('click', function (e) { |
| | | e.stopPropagation(); |
| | | }); |
| | | |
| | | this.$menu.on('click', '.actions-btn', function (e) { |
| | | if (that.options.liveSearch) { |
| | | that.$searchbox.trigger('focus'); |
| | | } else { |
| | | that.$button.trigger('focus'); |
| | | } |
| | | |
| | | e.preventDefault(); |
| | | e.stopPropagation(); |
| | | |
| | | if ($(this).hasClass('bs-select-all')) { |
| | | that.selectAll(); |
| | | } else { |
| | | that.deselectAll(); |
| | | } |
| | | }); |
| | | |
| | | this.$button |
| | | .on('focus' + EVENT_KEY, function (e) { |
| | | var tabindex = that.$element[0].getAttribute('tabindex'); |
| | | |
| | | // only change when button is actually focused |
| | | if (tabindex !== undefined && e.originalEvent && e.originalEvent.isTrusted) { |
| | | // apply select element's tabindex to ensure correct order is followed when tabbing to the next element |
| | | this.setAttribute('tabindex', tabindex); |
| | | // set element's tabindex to -1 to allow for reverse tabbing |
| | | that.$element[0].setAttribute('tabindex', -1); |
| | | that.selectpicker.view.tabindex = tabindex; |
| | | } |
| | | }) |
| | | .on('blur' + EVENT_KEY, function (e) { |
| | | // revert everything to original tabindex |
| | | if (that.selectpicker.view.tabindex !== undefined && e.originalEvent && e.originalEvent.isTrusted) { |
| | | that.$element[0].setAttribute('tabindex', that.selectpicker.view.tabindex); |
| | | this.setAttribute('tabindex', -1); |
| | | that.selectpicker.view.tabindex = undefined; |
| | | } |
| | | }); |
| | | |
| | | this.$element |
| | | .on('change' + EVENT_KEY, function () { |
| | | that.render(); |
| | | that.$element.trigger('changed' + EVENT_KEY, changedArguments); |
| | | changedArguments = null; |
| | | }) |
| | | .on('focus' + EVENT_KEY, function () { |
| | | if (!that.options.mobile) that.$button[0].focus(); |
| | | }); |
| | | }, |
| | | |
| | | liveSearchListener: function () { |
| | | var that = this; |
| | | |
| | | this.$button.on('click.bs.dropdown.data-api', function () { |
| | | if (!!that.$searchbox.val()) { |
| | | that.$searchbox.val(''); |
| | | that.selectpicker.search.previousValue = undefined; |
| | | } |
| | | }); |
| | | |
| | | this.$searchbox.on('click.bs.dropdown.data-api focus.bs.dropdown.data-api touchend.bs.dropdown.data-api', function (e) { |
| | | e.stopPropagation(); |
| | | }); |
| | | |
| | | this.$searchbox.on('input propertychange', function () { |
| | | var searchValue = that.$searchbox[0].value; |
| | | |
| | | that.selectpicker.search.elements = []; |
| | | that.selectpicker.search.data = []; |
| | | |
| | | if (searchValue) { |
| | | var i, |
| | | searchMatch = [], |
| | | q = searchValue.toUpperCase(), |
| | | cache = {}, |
| | | cacheArr = [], |
| | | searchStyle = that._searchStyle(), |
| | | normalizeSearch = that.options.liveSearchNormalize; |
| | | |
| | | if (normalizeSearch) q = normalizeToBase(q); |
| | | |
| | | for (var i = 0; i < that.selectpicker.main.data.length; i++) { |
| | | var li = that.selectpicker.main.data[i]; |
| | | |
| | | if (!cache[i]) { |
| | | cache[i] = stringSearch(li, q, searchStyle, normalizeSearch); |
| | | } |
| | | |
| | | if (cache[i] && li.headerIndex !== undefined && cacheArr.indexOf(li.headerIndex) === -1) { |
| | | if (li.headerIndex > 0) { |
| | | cache[li.headerIndex - 1] = true; |
| | | cacheArr.push(li.headerIndex - 1); |
| | | } |
| | | |
| | | cache[li.headerIndex] = true; |
| | | cacheArr.push(li.headerIndex); |
| | | |
| | | cache[li.lastIndex + 1] = true; |
| | | } |
| | | |
| | | if (cache[i] && li.type !== 'optgroup-label') cacheArr.push(i); |
| | | } |
| | | |
| | | for (var i = 0, cacheLen = cacheArr.length; i < cacheLen; i++) { |
| | | var index = cacheArr[i], |
| | | prevIndex = cacheArr[i - 1], |
| | | li = that.selectpicker.main.data[index], |
| | | liPrev = that.selectpicker.main.data[prevIndex]; |
| | | |
| | | if (li.type !== 'divider' || (li.type === 'divider' && liPrev && liPrev.type !== 'divider' && cacheLen - 1 !== i)) { |
| | | that.selectpicker.search.data.push(li); |
| | | searchMatch.push(that.selectpicker.main.elements[index]); |
| | | } |
| | | } |
| | | |
| | | that.activeIndex = undefined; |
| | | that.noScroll = true; |
| | | that.$menuInner.scrollTop(0); |
| | | that.selectpicker.search.elements = searchMatch; |
| | | that.createView(true); |
| | | showNoResults.call(that, searchMatch, searchValue); |
| | | } else if (that.selectpicker.search.previousValue) { // for IE11 (#2402) |
| | | that.$menuInner.scrollTop(0); |
| | | that.createView(false); |
| | | } |
| | | |
| | | that.selectpicker.search.previousValue = searchValue; |
| | | }); |
| | | }, |
| | | |
| | | _searchStyle: function () { |
| | | return this.options.liveSearchStyle || 'contains'; |
| | | }, |
| | | |
| | | val: function (value) { |
| | | var element = this.$element[0]; |
| | | |
| | | if (typeof value !== 'undefined') { |
| | | var prevValue = getSelectValues(element); |
| | | |
| | | changedArguments = [null, null, prevValue]; |
| | | |
| | | this.$element |
| | | .val(value) |
| | | .trigger('changed' + EVENT_KEY, changedArguments); |
| | | |
| | | if (this.$newElement.hasClass(classNames.SHOW)) { |
| | | if (this.multiple) { |
| | | this.setOptionStatus(true); |
| | | } else { |
| | | var liSelectedIndex = (element.options[element.selectedIndex] || {}).liIndex; |
| | | |
| | | if (typeof liSelectedIndex === 'number') { |
| | | this.setSelected(this.selectedIndex, false); |
| | | this.setSelected(liSelectedIndex, true); |
| | | } |
| | | } |
| | | } |
| | | |
| | | this.render(); |
| | | |
| | | changedArguments = null; |
| | | |
| | | return this.$element; |
| | | } else { |
| | | return this.$element.val(); |
| | | } |
| | | }, |
| | | |
| | | changeAll: function (status) { |
| | | if (!this.multiple) return; |
| | | if (typeof status === 'undefined') status = true; |
| | | |
| | | var element = this.$element[0], |
| | | previousSelected = 0, |
| | | currentSelected = 0, |
| | | prevValue = getSelectValues(element); |
| | | |
| | | element.classList.add('bs-select-hidden'); |
| | | |
| | | for (var i = 0, data = this.selectpicker.current.data, len = data.length; i < len; i++) { |
| | | var liData = data[i], |
| | | option = liData.option; |
| | | |
| | | if (option && !liData.disabled && liData.type !== 'divider') { |
| | | if (liData.selected) previousSelected++; |
| | | option.selected = status; |
| | | if (status === true) currentSelected++; |
| | | } |
| | | } |
| | | |
| | | element.classList.remove('bs-select-hidden'); |
| | | |
| | | if (previousSelected === currentSelected) return; |
| | | |
| | | this.setOptionStatus(); |
| | | |
| | | changedArguments = [null, null, prevValue]; |
| | | |
| | | this.$element |
| | | .triggerNative('change'); |
| | | }, |
| | | |
| | | selectAll: function () { |
| | | return this.changeAll(true); |
| | | }, |
| | | |
| | | deselectAll: function () { |
| | | return this.changeAll(false); |
| | | }, |
| | | |
| | | toggle: function (e) { |
| | | e = e || window.event; |
| | | |
| | | if (e) e.stopPropagation(); |
| | | |
| | | this.$button.trigger('click.bs.dropdown.data-api'); |
| | | }, |
| | | |
| | | keydown: function (e) { |
| | | var $this = $(this), |
| | | isToggle = $this.hasClass('dropdown-toggle'), |
| | | $parent = isToggle ? $this.closest('.dropdown') : $this.closest(Selector.MENU), |
| | | that = $parent.data('this'), |
| | | $items = that.findLis(), |
| | | index, |
| | | isActive, |
| | | liActive, |
| | | activeLi, |
| | | offset, |
| | | updateScroll = false, |
| | | downOnTab = e.which === keyCodes.TAB && !isToggle && !that.options.selectOnTab, |
| | | isArrowKey = REGEXP_ARROW.test(e.which) || downOnTab, |
| | | scrollTop = that.$menuInner[0].scrollTop, |
| | | isVirtual = that.isVirtual(), |
| | | position0 = isVirtual === true ? that.selectpicker.view.position0 : 0; |
| | | |
| | | // do nothing if a function key is pressed |
| | | if (e.which >= 112 && e.which <= 123) return; |
| | | |
| | | isActive = that.$newElement.hasClass(classNames.SHOW); |
| | | |
| | | if ( |
| | | !isActive && |
| | | ( |
| | | isArrowKey || |
| | | (e.which >= 48 && e.which <= 57) || |
| | | (e.which >= 96 && e.which <= 105) || |
| | | (e.which >= 65 && e.which <= 90) |
| | | ) |
| | | ) { |
| | | that.$button.trigger('click.bs.dropdown.data-api'); |
| | | |
| | | if (that.options.liveSearch) { |
| | | that.$searchbox.trigger('focus'); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if (e.which === keyCodes.ESCAPE && isActive) { |
| | | e.preventDefault(); |
| | | that.$button.trigger('click.bs.dropdown.data-api').trigger('focus'); |
| | | } |
| | | |
| | | if (isArrowKey) { // if up or down |
| | | if (!$items.length) return; |
| | | |
| | | liActive = that.selectpicker.main.elements[that.activeIndex]; |
| | | index = liActive ? Array.prototype.indexOf.call(liActive.parentElement.children, liActive) : -1; |
| | | |
| | | if (index !== -1) { |
| | | that.defocusItem(liActive); |
| | | } |
| | | |
| | | if (e.which === keyCodes.ARROW_UP) { // up |
| | | if (index !== -1) index--; |
| | | if (index + position0 < 0) index += $items.length; |
| | | |
| | | if (!that.selectpicker.view.canHighlight[index + position0]) { |
| | | index = that.selectpicker.view.canHighlight.slice(0, index + position0).lastIndexOf(true) - position0; |
| | | if (index === -1) index = $items.length - 1; |
| | | } |
| | | } else if (e.which === keyCodes.ARROW_DOWN || downOnTab) { // down |
| | | index++; |
| | | if (index + position0 >= that.selectpicker.view.canHighlight.length) index = that.selectpicker.view.firstHighlightIndex; |
| | | |
| | | if (!that.selectpicker.view.canHighlight[index + position0]) { |
| | | index = index + 1 + that.selectpicker.view.canHighlight.slice(index + position0 + 1).indexOf(true); |
| | | } |
| | | } |
| | | |
| | | e.preventDefault(); |
| | | |
| | | var liActiveIndex = position0 + index; |
| | | |
| | | if (e.which === keyCodes.ARROW_UP) { // up |
| | | // scroll to bottom and highlight last option |
| | | if (position0 === 0 && index === $items.length - 1) { |
| | | that.$menuInner[0].scrollTop = that.$menuInner[0].scrollHeight; |
| | | |
| | | liActiveIndex = that.selectpicker.current.elements.length - 1; |
| | | } else { |
| | | activeLi = that.selectpicker.current.data[liActiveIndex]; |
| | | offset = activeLi.position - activeLi.height; |
| | | |
| | | updateScroll = offset < scrollTop; |
| | | } |
| | | } else if (e.which === keyCodes.ARROW_DOWN || downOnTab) { // down |
| | | // scroll to top and highlight first option |
| | | if (index === that.selectpicker.view.firstHighlightIndex) { |
| | | that.$menuInner[0].scrollTop = 0; |
| | | |
| | | liActiveIndex = that.selectpicker.view.firstHighlightIndex; |
| | | } else { |
| | | activeLi = that.selectpicker.current.data[liActiveIndex]; |
| | | offset = activeLi.position - that.sizeInfo.menuInnerHeight; |
| | | |
| | | updateScroll = offset > scrollTop; |
| | | } |
| | | } |
| | | |
| | | liActive = that.selectpicker.current.elements[liActiveIndex]; |
| | | |
| | | that.activeIndex = that.selectpicker.current.data[liActiveIndex].index; |
| | | |
| | | that.focusItem(liActive); |
| | | |
| | | that.selectpicker.view.currentActive = liActive; |
| | | |
| | | if (updateScroll) that.$menuInner[0].scrollTop = offset; |
| | | |
| | | if (that.options.liveSearch) { |
| | | that.$searchbox.trigger('focus'); |
| | | } else { |
| | | $this.trigger('focus'); |
| | | } |
| | | } else if ( |
| | | (!$this.is('input') && !REGEXP_TAB_OR_ESCAPE.test(e.which)) || |
| | | (e.which === keyCodes.SPACE && that.selectpicker.keydown.keyHistory) |
| | | ) { |
| | | var searchMatch, |
| | | matches = [], |
| | | keyHistory; |
| | | |
| | | e.preventDefault(); |
| | | |
| | | that.selectpicker.keydown.keyHistory += keyCodeMap[e.which]; |
| | | |
| | | if (that.selectpicker.keydown.resetKeyHistory.cancel) clearTimeout(that.selectpicker.keydown.resetKeyHistory.cancel); |
| | | that.selectpicker.keydown.resetKeyHistory.cancel = that.selectpicker.keydown.resetKeyHistory.start(); |
| | | |
| | | keyHistory = that.selectpicker.keydown.keyHistory; |
| | | |
| | | // if all letters are the same, set keyHistory to just the first character when searching |
| | | if (/^(.)\1+$/.test(keyHistory)) { |
| | | keyHistory = keyHistory.charAt(0); |
| | | } |
| | | |
| | | // find matches |
| | | for (var i = 0; i < that.selectpicker.current.data.length; i++) { |
| | | var li = that.selectpicker.current.data[i], |
| | | hasMatch; |
| | | |
| | | hasMatch = stringSearch(li, keyHistory, 'startsWith', true); |
| | | |
| | | if (hasMatch && that.selectpicker.view.canHighlight[i]) { |
| | | matches.push(li.index); |
| | | } |
| | | } |
| | | |
| | | if (matches.length) { |
| | | var matchIndex = 0; |
| | | |
| | | $items.removeClass('active').find('a').removeClass('active'); |
| | | |
| | | // either only one key has been pressed or they are all the same key |
| | | if (keyHistory.length === 1) { |
| | | matchIndex = matches.indexOf(that.activeIndex); |
| | | |
| | | if (matchIndex === -1 || matchIndex === matches.length - 1) { |
| | | matchIndex = 0; |
| | | } else { |
| | | matchIndex++; |
| | | } |
| | | } |
| | | |
| | | searchMatch = matches[matchIndex]; |
| | | |
| | | activeLi = that.selectpicker.main.data[searchMatch]; |
| | | |
| | | if (scrollTop - activeLi.position > 0) { |
| | | offset = activeLi.position - activeLi.height; |
| | | updateScroll = true; |
| | | } else { |
| | | offset = activeLi.position - that.sizeInfo.menuInnerHeight; |
| | | // if the option is already visible at the current scroll position, just keep it the same |
| | | updateScroll = activeLi.position > scrollTop + that.sizeInfo.menuInnerHeight; |
| | | } |
| | | |
| | | liActive = that.selectpicker.main.elements[searchMatch]; |
| | | |
| | | that.activeIndex = matches[matchIndex]; |
| | | |
| | | that.focusItem(liActive); |
| | | |
| | | if (liActive) liActive.firstChild.focus(); |
| | | |
| | | if (updateScroll) that.$menuInner[0].scrollTop = offset; |
| | | |
| | | $this.trigger('focus'); |
| | | } |
| | | } |
| | | |
| | | // Select focused option if "Enter", "Spacebar" or "Tab" (when selectOnTab is true) are pressed inside the menu. |
| | | if ( |
| | | isActive && |
| | | ( |
| | | (e.which === keyCodes.SPACE && !that.selectpicker.keydown.keyHistory) || |
| | | e.which === keyCodes.ENTER || |
| | | (e.which === keyCodes.TAB && that.options.selectOnTab) |
| | | ) |
| | | ) { |
| | | if (e.which !== keyCodes.SPACE) e.preventDefault(); |
| | | |
| | | if (!that.options.liveSearch || e.which !== keyCodes.SPACE) { |
| | | that.$menuInner.find('.active a').trigger('click', true); // retain active class |
| | | $this.trigger('focus'); |
| | | |
| | | if (!that.options.liveSearch) { |
| | | // Prevent screen from scrolling if the user hits the spacebar |
| | | e.preventDefault(); |
| | | // Fixes spacebar selection of dropdown items in FF & IE |
| | | $(document).data('spaceSelect', true); |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | |
| | | mobile: function () { |
| | | // ensure mobile is set to true if mobile function is called after init |
| | | this.options.mobile = true; |
| | | this.$element[0].classList.add('mobile-device'); |
| | | }, |
| | | |
| | | refresh: function () { |
| | | // update options if data attributes have been changed |
| | | var config = $.extend({}, this.options, this.$element.data()); |
| | | this.options = config; |
| | | |
| | | this.checkDisabled(); |
| | | this.buildData(); |
| | | this.setStyle(); |
| | | this.render(); |
| | | this.buildList(); |
| | | this.setWidth(); |
| | | |
| | | this.setSize(true); |
| | | |
| | | this.$element.trigger('refreshed' + EVENT_KEY); |
| | | }, |
| | | |
| | | hide: function () { |
| | | this.$newElement.hide(); |
| | | }, |
| | | |
| | | show: function () { |
| | | this.$newElement.show(); |
| | | }, |
| | | |
| | | remove: function () { |
| | | this.$newElement.remove(); |
| | | this.$element.remove(); |
| | | }, |
| | | |
| | | destroy: function () { |
| | | this.$newElement.before(this.$element).remove(); |
| | | |
| | | if (this.$bsContainer) { |
| | | this.$bsContainer.remove(); |
| | | } else { |
| | | this.$menu.remove(); |
| | | } |
| | | |
| | | if (this.selectpicker.view.titleOption && this.selectpicker.view.titleOption.parentNode) { |
| | | this.selectpicker.view.titleOption.parentNode.removeChild(this.selectpicker.view.titleOption); |
| | | } |
| | | |
| | | this.$element |
| | | .off(EVENT_KEY) |
| | | .removeData('selectpicker') |
| | | .removeClass('bs-select-hidden selectpicker'); |
| | | |
| | | $(window).off(EVENT_KEY + '.' + this.selectId); |
| | | } |
| | | }; |
| | | |
| | | // SELECTPICKER PLUGIN DEFINITION |
| | | // ============================== |
| | | function Plugin (option) { |
| | | // get the args of the outer function.. |
| | | var args = arguments; |
| | | // The arguments of the function are explicitly re-defined from the argument list, because the shift causes them |
| | | // to get lost/corrupted in android 2.3 and IE9 #715 #775 |
| | | var _option = option; |
| | | |
| | | [].shift.apply(args); |
| | | |
| | | // if the version was not set successfully |
| | | if (!version.success) { |
| | | // try to retreive it again |
| | | try { |
| | | version.full = ($.fn.dropdown.Constructor.VERSION || '').split(' ')[0].split('.'); |
| | | } catch (err) { |
| | | // fall back to use BootstrapVersion if set |
| | | if (Selectpicker.BootstrapVersion) { |
| | | version.full = Selectpicker.BootstrapVersion.split(' ')[0].split('.'); |
| | | } else { |
| | | version.full = [version.major, '0', '0']; |
| | | |
| | | console.warn( |
| | | 'There was an issue retrieving Bootstrap\'s version. ' + |
| | | 'Ensure Bootstrap is being loaded before bootstrap-select and there is no namespace collision. ' + |
| | | 'If loading Bootstrap asynchronously, the version may need to be manually specified via $.fn.selectpicker.Constructor.BootstrapVersion.', |
| | | err |
| | | ); |
| | | } |
| | | } |
| | | |
| | | version.major = version.full[0]; |
| | | version.success = true; |
| | | } |
| | | |
| | | if (version.major === '4') { |
| | | // some defaults need to be changed if using Bootstrap 4 |
| | | // check to see if they have already been manually changed before forcing them to update |
| | | var toUpdate = []; |
| | | |
| | | if (Selectpicker.DEFAULTS.style === classNames.BUTTONCLASS) toUpdate.push({ name: 'style', className: 'BUTTONCLASS' }); |
| | | if (Selectpicker.DEFAULTS.iconBase === classNames.ICONBASE) toUpdate.push({ name: 'iconBase', className: 'ICONBASE' }); |
| | | if (Selectpicker.DEFAULTS.tickIcon === classNames.TICKICON) toUpdate.push({ name: 'tickIcon', className: 'TICKICON' }); |
| | | |
| | | classNames.DIVIDER = 'dropdown-divider'; |
| | | classNames.SHOW = 'show'; |
| | | classNames.BUTTONCLASS = 'btn-light'; |
| | | classNames.POPOVERHEADER = 'popover-header'; |
| | | classNames.ICONBASE = ''; |
| | | classNames.TICKICON = 'bs-ok-default'; |
| | | |
| | | for (var i = 0; i < toUpdate.length; i++) { |
| | | var option = toUpdate[i]; |
| | | Selectpicker.DEFAULTS[option.name] = classNames[option.className]; |
| | | } |
| | | } |
| | | |
| | | var value; |
| | | var chain = this.each(function () { |
| | | var $this = $(this); |
| | | if ($this.is('select')) { |
| | | var data = $this.data('selectpicker'), |
| | | options = typeof _option == 'object' && _option; |
| | | |
| | | if (!data) { |
| | | var dataAttributes = $this.data(); |
| | | |
| | | for (var dataAttr in dataAttributes) { |
| | | if (Object.prototype.hasOwnProperty.call(dataAttributes, dataAttr) && $.inArray(dataAttr, DISALLOWED_ATTRIBUTES) !== -1) { |
| | | delete dataAttributes[dataAttr]; |
| | | } |
| | | } |
| | | |
| | | var config = $.extend({}, Selectpicker.DEFAULTS, $.fn.selectpicker.defaults || {}, dataAttributes, options); |
| | | config.template = $.extend({}, Selectpicker.DEFAULTS.template, ($.fn.selectpicker.defaults ? $.fn.selectpicker.defaults.template : {}), dataAttributes.template, options.template); |
| | | $this.data('selectpicker', (data = new Selectpicker(this, config))); |
| | | } else if (options) { |
| | | for (var i in options) { |
| | | if (Object.prototype.hasOwnProperty.call(options, i)) { |
| | | data.options[i] = options[i]; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (typeof _option == 'string') { |
| | | if (data[_option] instanceof Function) { |
| | | value = data[_option].apply(data, args); |
| | | } else { |
| | | value = data.options[_option]; |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | if (typeof value !== 'undefined') { |
| | | // noinspection JSUnusedAssignment |
| | | return value; |
| | | } else { |
| | | return chain; |
| | | } |
| | | } |
| | | |
| | | var old = $.fn.selectpicker; |
| | | $.fn.selectpicker = Plugin; |
| | | $.fn.selectpicker.Constructor = Selectpicker; |
| | | |
| | | // SELECTPICKER NO CONFLICT |
| | | // ======================== |
| | | $.fn.selectpicker.noConflict = function () { |
| | | $.fn.selectpicker = old; |
| | | return this; |
| | | }; |
| | | |
| | | // get Bootstrap's keydown event handler for either Bootstrap 4 or Bootstrap 3 |
| | | function keydownHandler () { |
| | | if ($.fn.dropdown) { |
| | | // wait to define until function is called in case Bootstrap isn't loaded yet |
| | | var bootstrapKeydown = $.fn.dropdown.Constructor._dataApiKeydownHandler || $.fn.dropdown.Constructor.prototype.keydown; |
| | | return bootstrapKeydown.apply(this, arguments); |
| | | } |
| | | } |
| | | |
| | | $(document) |
| | | .off('keydown.bs.dropdown.data-api') |
| | | .on('keydown.bs.dropdown.data-api', ':not(.bootstrap-select) > [data-toggle="dropdown"]', keydownHandler) |
| | | .on('keydown.bs.dropdown.data-api', ':not(.bootstrap-select) > .dropdown-menu', keydownHandler) |
| | | .on('keydown' + EVENT_KEY, '.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input', Selectpicker.prototype.keydown) |
| | | .on('focusin.modal', '.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input', function (e) { |
| | | e.stopPropagation(); |
| | | }); |
| | | |
| | | // SELECTPICKER DATA-API |
| | | // ===================== |
| | | $(window).on('load' + EVENT_KEY + '.data-api', function () { |
| | | $('.selectpicker').each(function () { |
| | | var $selectpicker = $(this); |
| | | Plugin.call($selectpicker, $selectpicker.data()); |
| | | }) |
| | | }); |
| | | })(jQuery); |
| | | |
| | | |
| | | })); |
New file |
| | |
| | | /*! |
| | | * Bootstrap-select v1.13.18 (https://developer.snapappointments.com/bootstrap-select) |
| | | * |
| | | * Copyright 2012-2020 SnapAppointments, LLC |
| | | * Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE) |
| | | */@-webkit-keyframes bs-notify-fadeOut{0%{opacity:.9}100%{opacity:0}}@-o-keyframes bs-notify-fadeOut{0%{opacity:.9}100%{opacity:0}}@keyframes bs-notify-fadeOut{0%{opacity:.9}100%{opacity:0}}.bootstrap-select>select.bs-select-hidden,select.bs-select-hidden,select.selectpicker{display:none!important}.bootstrap-select{width:220px\0;vertical-align:middle}.bootstrap-select>.dropdown-toggle{position:relative;width:100%;text-align:right;white-space:nowrap;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between}.bootstrap-select>.dropdown-toggle:after{margin-top:-1px}.bootstrap-select>.dropdown-toggle.bs-placeholder,.bootstrap-select>.dropdown-toggle.bs-placeholder:active,.bootstrap-select>.dropdown-toggle.bs-placeholder:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder:hover{color:#999}.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-danger,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-danger:active,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-danger:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-danger:hover,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-dark,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-dark:active,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-dark:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-dark:hover,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-info,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-info:active,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-info:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-info:hover,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-primary,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-primary:active,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-primary:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-primary:hover,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-secondary,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-secondary:active,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-secondary:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-secondary:hover,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-success,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-success:active,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-success:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-success:hover{color:rgba(255,255,255,.5)}.bootstrap-select>select{position:absolute!important;bottom:0;left:50%;display:block!important;width:.5px!important;height:100%!important;padding:0!important;opacity:0!important;border:none;z-index:0!important}.bootstrap-select>select.mobile-device{top:0;left:0;display:block!important;width:100%!important;z-index:2!important}.bootstrap-select.is-invalid .dropdown-toggle,.error .bootstrap-select .dropdown-toggle,.has-error .bootstrap-select .dropdown-toggle,.was-validated .bootstrap-select select:invalid+.dropdown-toggle{border-color:#b94a48}.bootstrap-select.is-valid .dropdown-toggle,.was-validated .bootstrap-select select:valid+.dropdown-toggle{border-color:#28a745}.bootstrap-select.fit-width{width:auto!important}.bootstrap-select:not([class*=col-]):not([class*=form-control]):not(.input-group-btn){width:220px}.bootstrap-select .dropdown-toggle:focus,.bootstrap-select>select.mobile-device:focus+.dropdown-toggle{outline:thin dotted #333!important;outline:5px auto -webkit-focus-ring-color!important;outline-offset:-2px}.bootstrap-select.form-control{margin-bottom:0;padding:0;border:none;height:auto}:not(.input-group)>.bootstrap-select.form-control:not([class*=col-]){width:100%}.bootstrap-select.form-control.input-group-btn{float:none;z-index:auto}.form-inline .bootstrap-select,.form-inline .bootstrap-select.form-control:not([class*=col-]){width:auto}.bootstrap-select:not(.input-group-btn),.bootstrap-select[class*=col-]{float:none;display:inline-block;margin-left:0}.bootstrap-select.dropdown-menu-right,.bootstrap-select[class*=col-].dropdown-menu-right,.row .bootstrap-select[class*=col-].dropdown-menu-right{float:right}.form-group .bootstrap-select,.form-horizontal .bootstrap-select,.form-inline .bootstrap-select{margin-bottom:0}.form-group-lg .bootstrap-select.form-control,.form-group-sm .bootstrap-select.form-control{padding:0}.form-group-lg .bootstrap-select.form-control .dropdown-toggle,.form-group-sm .bootstrap-select.form-control .dropdown-toggle{height:100%;font-size:inherit;line-height:inherit;border-radius:inherit}.bootstrap-select.form-control-lg .dropdown-toggle,.bootstrap-select.form-control-sm .dropdown-toggle{font-size:inherit;line-height:inherit;border-radius:inherit}.bootstrap-select.form-control-sm .dropdown-toggle{padding:.25rem .5rem}.bootstrap-select.form-control-lg .dropdown-toggle{padding:.5rem 1rem}.form-inline .bootstrap-select .form-control{width:100%}.bootstrap-select.disabled,.bootstrap-select>.disabled{cursor:not-allowed}.bootstrap-select.disabled:focus,.bootstrap-select>.disabled:focus{outline:0!important}.bootstrap-select.bs-container{position:absolute;top:0;left:0;height:0!important;padding:0!important}.bootstrap-select.bs-container .dropdown-menu{z-index:1060}.bootstrap-select .dropdown-toggle .filter-option{position:static;top:0;left:0;float:left;height:100%;width:100%;text-align:left;overflow:hidden;-webkit-box-flex:0;-webkit-flex:0 1 auto;-ms-flex:0 1 auto;flex:0 1 auto}.bs3.bootstrap-select .dropdown-toggle .filter-option{padding-right:inherit}.input-group .bs3-has-addon.bootstrap-select .dropdown-toggle .filter-option{position:absolute;padding-top:inherit;padding-bottom:inherit;padding-left:inherit;float:none}.input-group .bs3-has-addon.bootstrap-select .dropdown-toggle .filter-option .filter-option-inner{padding-right:inherit}.bootstrap-select .dropdown-toggle .filter-option-inner-inner{overflow:hidden}.bootstrap-select .dropdown-toggle .filter-expand{width:0!important;float:left;opacity:0!important;overflow:hidden}.bootstrap-select .dropdown-toggle .caret{position:absolute;top:50%;right:12px;margin-top:-2px;vertical-align:middle}.input-group .bootstrap-select.form-control .dropdown-toggle{border-radius:inherit}.bootstrap-select[class*=col-] .dropdown-toggle{width:100%}.bootstrap-select .dropdown-menu{min-width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.bootstrap-select .dropdown-menu>.inner:focus{outline:0!important}.bootstrap-select .dropdown-menu.inner{position:static;float:none;border:0;padding:0;margin:0;border-radius:0;-webkit-box-shadow:none;box-shadow:none}.bootstrap-select .dropdown-menu li{position:relative}.bootstrap-select .dropdown-menu li.active small{color:rgba(255,255,255,.5)!important}.bootstrap-select .dropdown-menu li.disabled a{cursor:not-allowed}.bootstrap-select .dropdown-menu li a{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.bootstrap-select .dropdown-menu li a.opt{position:relative;padding-left:2.25em}.bootstrap-select .dropdown-menu li a span.check-mark{display:none}.bootstrap-select .dropdown-menu li a span.text{display:inline-block}.bootstrap-select .dropdown-menu li small{padding-left:.5em}.bootstrap-select .dropdown-menu .notify{position:absolute;bottom:5px;width:96%;margin:0 2%;min-height:26px;padding:3px 5px;background:#f5f5f5;border:1px solid #e3e3e3;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05);pointer-events:none;opacity:.9;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.bootstrap-select .dropdown-menu .notify.fadeOut{-webkit-animation:.3s linear 750ms forwards bs-notify-fadeOut;-o-animation:.3s linear 750ms forwards bs-notify-fadeOut;animation:.3s linear 750ms forwards bs-notify-fadeOut}.bootstrap-select .no-results{padding:3px;background:#f5f5f5;margin:0 5px;white-space:nowrap}.bootstrap-select.fit-width .dropdown-toggle .filter-option{position:static;display:inline;padding:0}.bootstrap-select.fit-width .dropdown-toggle .filter-option-inner,.bootstrap-select.fit-width .dropdown-toggle .filter-option-inner-inner{display:inline}.bootstrap-select.fit-width .dropdown-toggle .bs-caret:before{content:'\00a0'}.bootstrap-select.fit-width .dropdown-toggle .caret{position:static;top:auto;margin-top:-1px}.bootstrap-select.show-tick .dropdown-menu .selected span.check-mark{position:absolute;display:inline-block;right:15px;top:5px}.bootstrap-select.show-tick .dropdown-menu li a span.text{margin-right:34px}.bootstrap-select .bs-ok-default:after{content:'';display:block;width:.5em;height:1em;border-style:solid;border-width:0 .26em .26em 0;-webkit-transform-style:preserve-3d;transform-style:preserve-3d;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}.bootstrap-select.show-menu-arrow.open>.dropdown-toggle,.bootstrap-select.show-menu-arrow.show>.dropdown-toggle{z-index:1061}.bootstrap-select.show-menu-arrow .dropdown-toggle .filter-option:before{content:'';border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid rgba(204,204,204,.2);position:absolute;bottom:-4px;left:9px;display:none}.bootstrap-select.show-menu-arrow .dropdown-toggle .filter-option:after{content:'';border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #fff;position:absolute;bottom:-4px;left:10px;display:none}.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle .filter-option:before{bottom:auto;top:-4px;border-top:7px solid rgba(204,204,204,.2);border-bottom:0}.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle .filter-option:after{bottom:auto;top:-4px;border-top:6px solid #fff;border-bottom:0}.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle .filter-option:before{right:12px;left:auto}.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle .filter-option:after{right:13px;left:auto}.bootstrap-select.show-menu-arrow.open>.dropdown-toggle .filter-option:after,.bootstrap-select.show-menu-arrow.open>.dropdown-toggle .filter-option:before,.bootstrap-select.show-menu-arrow.show>.dropdown-toggle .filter-option:after,.bootstrap-select.show-menu-arrow.show>.dropdown-toggle .filter-option:before{display:block}.bs-actionsbox,.bs-donebutton,.bs-searchbox{padding:4px 8px}.bs-actionsbox{width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.bs-actionsbox .btn-group button{width:50%}.bs-donebutton{float:left;width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.bs-donebutton .btn-group button{width:100%}.bs-searchbox+.bs-actionsbox{padding:0 8px 4px}.bs-searchbox .form-control{margin-bottom:0;width:100%;float:none} |
New file |
| | |
| | | /*! |
| | | * Bootstrap-select v1.13.18 (https://developer.snapappointments.com/bootstrap-select) |
| | | * |
| | | * Copyright 2012-2020 SnapAppointments, LLC |
| | | * Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE) |
| | | */ |
| | | |
| | | !function(e,t){void 0===e&&void 0!==window&&(e=window),"function"==typeof define&&define.amd?define(["jquery"],function(e){return t(e)}):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(e.jQuery)}(this,function(e){!function(P){"use strict";var d=["sanitize","whiteList","sanitizeFn"],r=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],e={"*":["class","dir","id","lang","role","tabindex","style",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},l=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,a=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;function v(e,t){var i=e.nodeName.toLowerCase();if(-1!==P.inArray(i,t))return-1===P.inArray(i,r)||Boolean(e.nodeValue.match(l)||e.nodeValue.match(a));for(var s=P(t).filter(function(e,t){return t instanceof RegExp}),n=0,o=s.length;n<o;n++)if(i.match(s[n]))return!0;return!1}function W(e,t,i){if(i&&"function"==typeof i)return i(e);for(var s=Object.keys(t),n=0,o=e.length;n<o;n++)for(var r=e[n].querySelectorAll("*"),l=0,a=r.length;l<a;l++){var c=r[l],d=c.nodeName.toLowerCase();if(-1!==s.indexOf(d))for(var h=[].slice.call(c.attributes),p=[].concat(t["*"]||[],t[d]||[]),u=0,f=h.length;u<f;u++){var m=h[u];v(m,p)||c.removeAttribute(m.nodeName)}else c.parentNode.removeChild(c)}}"classList"in document.createElement("_")||function(e){if("Element"in e){var t="classList",i="prototype",s=e.Element[i],n=Object,o=function(){var i=P(this);return{add:function(e){return e=Array.prototype.slice.call(arguments).join(" "),i.addClass(e)},remove:function(e){return e=Array.prototype.slice.call(arguments).join(" "),i.removeClass(e)},toggle:function(e,t){return i.toggleClass(e,t)},contains:function(e){return i.hasClass(e)}}};if(n.defineProperty){var r={get:o,enumerable:!0,configurable:!0};try{n.defineProperty(s,t,r)}catch(e){void 0!==e.number&&-2146823252!==e.number||(r.enumerable=!1,n.defineProperty(s,t,r))}}else n[i].__defineGetter__&&s.__defineGetter__(t,o)}}(window);var t,c,i=document.createElement("_");if(i.classList.add("c1","c2"),!i.classList.contains("c2")){var s=DOMTokenList.prototype.add,n=DOMTokenList.prototype.remove;DOMTokenList.prototype.add=function(){Array.prototype.forEach.call(arguments,s.bind(this))},DOMTokenList.prototype.remove=function(){Array.prototype.forEach.call(arguments,n.bind(this))}}if(i.classList.toggle("c3",!1),i.classList.contains("c3")){var o=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(e,t){return 1 in arguments&&!this.contains(e)==!t?t:o.call(this,e)}}function h(e){if(null==this)throw new TypeError;var t=String(this);if(e&&"[object RegExp]"==c.call(e))throw new TypeError;var i=t.length,s=String(e),n=s.length,o=1<arguments.length?arguments[1]:void 0,r=o?Number(o):0;r!=r&&(r=0);var l=Math.min(Math.max(r,0),i);if(i<n+l)return!1;for(var a=-1;++a<n;)if(t.charCodeAt(l+a)!=s.charCodeAt(a))return!1;return!0}function O(e,t){var i,s=e.selectedOptions,n=[];if(t){for(var o=0,r=s.length;o<r;o++)(i=s[o]).disabled||"OPTGROUP"===i.parentNode.tagName&&i.parentNode.disabled||n.push(i);return n}return s}function z(e,t){for(var i,s=[],n=t||e.selectedOptions,o=0,r=n.length;o<r;o++)(i=n[o]).disabled||"OPTGROUP"===i.parentNode.tagName&&i.parentNode.disabled||s.push(i.value);return e.multiple?s:s.length?s[0]:null}i=null,String.prototype.startsWith||(t=function(){try{var e={},t=Object.defineProperty,i=t(e,e,e)&&t}catch(e){}return i}(),c={}.toString,t?t(String.prototype,"startsWith",{value:h,configurable:!0,writable:!0}):String.prototype.startsWith=h),Object.keys||(Object.keys=function(e,t,i){for(t in i=[],e)i.hasOwnProperty.call(e,t)&&i.push(t);return i}),HTMLSelectElement&&!HTMLSelectElement.prototype.hasOwnProperty("selectedOptions")&&Object.defineProperty(HTMLSelectElement.prototype,"selectedOptions",{get:function(){return this.querySelectorAll(":checked")}});var p={useDefault:!1,_set:P.valHooks.select.set};P.valHooks.select.set=function(e,t){return t&&!p.useDefault&&P(e).data("selected",!0),p._set.apply(this,arguments)};var T=null,u=function(){try{return new Event("change"),!0}catch(e){return!1}}();function k(e,t,i,s){for(var n=["display","subtext","tokens"],o=!1,r=0;r<n.length;r++){var l=n[r],a=e[l];if(a&&(a=a.toString(),"display"===l&&(a=a.replace(/<[^>]+>/g,"")),s&&(a=w(a)),a=a.toUpperCase(),o="contains"===i?0<=a.indexOf(t):a.startsWith(t)))break}return o}function N(e){return parseInt(e,10)||0}P.fn.triggerNative=function(e){var t,i=this[0];i.dispatchEvent?(u?t=new Event(e,{bubbles:!0}):(t=document.createEvent("Event")).initEvent(e,!0,!1),i.dispatchEvent(t)):i.fireEvent?((t=document.createEventObject()).eventType=e,i.fireEvent("on"+e,t)):this.trigger(e)};var f={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"},m=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,g=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]","g");function b(e){return f[e]}function w(e){return(e=e.toString())&&e.replace(m,b).replace(g,"")}var I,x,y,$,S=(I={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},x="(?:"+Object.keys(I).join("|")+")",y=RegExp(x),$=RegExp(x,"g"),function(e){return e=null==e?"":""+e,y.test(e)?e.replace($,E):e});function E(e){return I[e]}var C={32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"},A=27,L=13,D=32,H=9,B=38,R=40,M={success:!1,major:"3"};try{M.full=(P.fn.dropdown.Constructor.VERSION||"").split(" ")[0].split("."),M.major=M.full[0],M.success=!0}catch(e){}var U=0,j=".bs.select",V={DISABLED:"disabled",DIVIDER:"divider",SHOW:"open",DROPUP:"dropup",MENU:"dropdown-menu",MENURIGHT:"dropdown-menu-right",MENULEFT:"dropdown-menu-left",BUTTONCLASS:"btn-default",POPOVERHEADER:"popover-title",ICONBASE:"glyphicon",TICKICON:"glyphicon-ok"},F={MENU:"."+V.MENU},_={div:document.createElement("div"),span:document.createElement("span"),i:document.createElement("i"),subtext:document.createElement("small"),a:document.createElement("a"),li:document.createElement("li"),whitespace:document.createTextNode("\xa0"),fragment:document.createDocumentFragment()};_.noResults=_.li.cloneNode(!1),_.noResults.className="no-results",_.a.setAttribute("role","option"),_.a.className="dropdown-item",_.subtext.className="text-muted",_.text=_.span.cloneNode(!1),_.text.className="text",_.checkMark=_.span.cloneNode(!1);var G=new RegExp(B+"|"+R),q=new RegExp("^"+H+"$|"+A),K={li:function(e,t,i){var s=_.li.cloneNode(!1);return e&&(1===e.nodeType||11===e.nodeType?s.appendChild(e):s.innerHTML=e),void 0!==t&&""!==t&&(s.className=t),null!=i&&s.classList.add("optgroup-"+i),s},a:function(e,t,i){var s=_.a.cloneNode(!0);return e&&(11===e.nodeType?s.appendChild(e):s.insertAdjacentHTML("beforeend",e)),void 0!==t&&""!==t&&s.classList.add.apply(s.classList,t.split(/\s+/)),i&&s.setAttribute("style",i),s},text:function(e,t){var i,s,n=_.text.cloneNode(!1);if(e.content)n.innerHTML=e.content;else{if(n.textContent=e.text,e.icon){var o=_.whitespace.cloneNode(!1);(s=(!0===t?_.i:_.span).cloneNode(!1)).className=this.options.iconBase+" "+e.icon,_.fragment.appendChild(s),_.fragment.appendChild(o)}e.subtext&&((i=_.subtext.cloneNode(!1)).textContent=e.subtext,n.appendChild(i))}if(!0===t)for(;0<n.childNodes.length;)_.fragment.appendChild(n.childNodes[0]);else _.fragment.appendChild(n);return _.fragment},label:function(e){var t,i,s=_.text.cloneNode(!1);if(s.innerHTML=e.display,e.icon){var n=_.whitespace.cloneNode(!1);(i=_.span.cloneNode(!1)).className=this.options.iconBase+" "+e.icon,_.fragment.appendChild(i),_.fragment.appendChild(n)}return e.subtext&&((t=_.subtext.cloneNode(!1)).textContent=e.subtext,s.appendChild(t)),_.fragment.appendChild(s),_.fragment}};var Y=function(e,t){var i=this;p.useDefault||(P.valHooks.select.set=p._set,p.useDefault=!0),this.$element=P(e),this.$newElement=null,this.$button=null,this.$menu=null,this.options=t,this.selectpicker={main:{},search:{},current:{},view:{},isSearching:!1,keydown:{keyHistory:"",resetKeyHistory:{start:function(){return setTimeout(function(){i.selectpicker.keydown.keyHistory=""},800)}}}},this.sizeInfo={},null===this.options.title&&(this.options.title=this.$element.attr("title"));var s=this.options.windowPadding;"number"==typeof s&&(this.options.windowPadding=[s,s,s,s]),this.val=Y.prototype.val,this.render=Y.prototype.render,this.refresh=Y.prototype.refresh,this.setStyle=Y.prototype.setStyle,this.selectAll=Y.prototype.selectAll,this.deselectAll=Y.prototype.deselectAll,this.destroy=Y.prototype.destroy,this.remove=Y.prototype.remove,this.show=Y.prototype.show,this.hide=Y.prototype.hide,this.init()};function Z(e){var l,a=arguments,c=e;if([].shift.apply(a),!M.success){try{M.full=(P.fn.dropdown.Constructor.VERSION||"").split(" ")[0].split(".")}catch(e){Y.BootstrapVersion?M.full=Y.BootstrapVersion.split(" ")[0].split("."):(M.full=[M.major,"0","0"],console.warn("There was an issue retrieving Bootstrap's version. Ensure Bootstrap is being loaded before bootstrap-select and there is no namespace collision. If loading Bootstrap asynchronously, the version may need to be manually specified via $.fn.selectpicker.Constructor.BootstrapVersion.",e))}M.major=M.full[0],M.success=!0}if("4"===M.major){var t=[];Y.DEFAULTS.style===V.BUTTONCLASS&&t.push({name:"style",className:"BUTTONCLASS"}),Y.DEFAULTS.iconBase===V.ICONBASE&&t.push({name:"iconBase",className:"ICONBASE"}),Y.DEFAULTS.tickIcon===V.TICKICON&&t.push({name:"tickIcon",className:"TICKICON"}),V.DIVIDER="dropdown-divider",V.SHOW="show",V.BUTTONCLASS="btn-light",V.POPOVERHEADER="popover-header",V.ICONBASE="",V.TICKICON="bs-ok-default";for(var i=0;i<t.length;i++){e=t[i];Y.DEFAULTS[e.name]=V[e.className]}}var s=this.each(function(){var e=P(this);if(e.is("select")){var t=e.data("selectpicker"),i="object"==typeof c&&c;if(t){if(i)for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(t.options[s]=i[s])}else{var n=e.data();for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&-1!==P.inArray(o,d)&&delete n[o];var r=P.extend({},Y.DEFAULTS,P.fn.selectpicker.defaults||{},n,i);r.template=P.extend({},Y.DEFAULTS.template,P.fn.selectpicker.defaults?P.fn.selectpicker.defaults.template:{},n.template,i.template),e.data("selectpicker",t=new Y(this,r))}"string"==typeof c&&(l=t[c]instanceof Function?t[c].apply(t,a):t.options[c])}});return void 0!==l?l:s}Y.VERSION="1.13.18",Y.DEFAULTS={noneSelectedText:"Nothing selected",noneResultsText:"No results matched {0}",countSelectedText:function(e,t){return 1==e?"{0} item selected":"{0} items selected"},maxOptionsText:function(e,t){return[1==e?"Limit reached ({n} item max)":"Limit reached ({n} items max)",1==t?"Group limit reached ({n} item max)":"Group limit reached ({n} items max)"]},selectAllText:"Select All",deselectAllText:"Deselect All",doneButton:!1,doneButtonText:"Close",multipleSeparator:", ",styleBase:"btn",style:V.BUTTONCLASS,size:"auto",title:null,selectedTextFormat:"values",width:!1,container:!1,hideDisabled:!1,showSubtext:!1,showIcon:!0,showContent:!0,dropupAuto:!0,header:!1,liveSearch:!1,liveSearchPlaceholder:null,liveSearchNormalize:!1,liveSearchStyle:"contains",actionsBox:!1,iconBase:V.ICONBASE,tickIcon:V.TICKICON,showTick:!1,template:{caret:'<span class="caret"></span>'},maxOptions:!1,mobile:!1,selectOnTab:!1,dropdownAlignRight:!1,windowPadding:0,virtualScroll:600,display:!1,sanitize:!0,sanitizeFn:null,whiteList:e},Y.prototype={constructor:Y,init:function(){var i=this,e=this.$element.attr("id"),t=this.$element[0],s=t.form;U++,this.selectId="bs-select-"+U,t.classList.add("bs-select-hidden"),this.multiple=this.$element.prop("multiple"),this.autofocus=this.$element.prop("autofocus"),t.classList.contains("show-tick")&&(this.options.showTick=!0),this.$newElement=this.createDropdown(),this.buildData(),this.$element.after(this.$newElement).prependTo(this.$newElement),s&&null===t.form&&(s.id||(s.id="form-"+this.selectId),t.setAttribute("form",s.id)),this.$button=this.$newElement.children("button"),this.$menu=this.$newElement.children(F.MENU),this.$menuInner=this.$menu.children(".inner"),this.$searchbox=this.$menu.find("input"),t.classList.remove("bs-select-hidden"),!0===this.options.dropdownAlignRight&&this.$menu[0].classList.add(V.MENURIGHT),void 0!==e&&this.$button.attr("data-id",e),this.checkDisabled(),this.clickListener(),this.options.liveSearch?(this.liveSearchListener(),this.focusedParent=this.$searchbox[0]):this.focusedParent=this.$menuInner[0],this.setStyle(),this.render(),this.setWidth(),this.options.container?this.selectPosition():this.$element.on("hide"+j,function(){if(i.isVirtual()){var e=i.$menuInner[0],t=e.firstChild.cloneNode(!1);e.replaceChild(t,e.firstChild),e.scrollTop=0}}),this.$menu.data("this",this),this.$newElement.data("this",this),this.options.mobile&&this.mobile(),this.$newElement.on({"hide.bs.dropdown":function(e){i.$element.trigger("hide"+j,e)},"hidden.bs.dropdown":function(e){i.$element.trigger("hidden"+j,e)},"show.bs.dropdown":function(e){i.$element.trigger("show"+j,e)},"shown.bs.dropdown":function(e){i.$element.trigger("shown"+j,e)}}),t.hasAttribute("required")&&this.$element.on("invalid"+j,function(){i.$button[0].classList.add("bs-invalid"),i.$element.on("shown"+j+".invalid",function(){i.$element.val(i.$element.val()).off("shown"+j+".invalid")}).on("rendered"+j,function(){this.validity.valid&&i.$button[0].classList.remove("bs-invalid"),i.$element.off("rendered"+j)}),i.$button.on("blur"+j,function(){i.$element.trigger("focus").trigger("blur"),i.$button.off("blur"+j)})}),setTimeout(function(){i.buildList(),i.$element.trigger("loaded"+j)})},createDropdown:function(){var e=this.multiple||this.options.showTick?" show-tick":"",t=this.multiple?' aria-multiselectable="true"':"",i="",s=this.autofocus?" autofocus":"";M.major<4&&this.$element.parent().hasClass("input-group")&&(i=" input-group-btn");var n,o="",r="",l="",a="";return this.options.header&&(o='<div class="'+V.POPOVERHEADER+'"><button type="button" class="close" aria-hidden="true">×</button>'+this.options.header+"</div>"),this.options.liveSearch&&(r='<div class="bs-searchbox"><input type="search" class="form-control" autocomplete="off"'+(null===this.options.liveSearchPlaceholder?"":' placeholder="'+S(this.options.liveSearchPlaceholder)+'"')+' role="combobox" aria-label="Search" aria-controls="'+this.selectId+'" aria-autocomplete="list"></div>'),this.multiple&&this.options.actionsBox&&(l='<div class="bs-actionsbox"><div class="btn-group btn-group-sm btn-block"><button type="button" class="actions-btn bs-select-all btn '+V.BUTTONCLASS+'">'+this.options.selectAllText+'</button><button type="button" class="actions-btn bs-deselect-all btn '+V.BUTTONCLASS+'">'+this.options.deselectAllText+"</button></div></div>"),this.multiple&&this.options.doneButton&&(a='<div class="bs-donebutton"><div class="btn-group btn-block"><button type="button" class="btn btn-sm '+V.BUTTONCLASS+'">'+this.options.doneButtonText+"</button></div></div>"),n='<div class="dropdown bootstrap-select'+e+i+'"><button type="button" tabindex="-1" class="'+this.options.styleBase+' dropdown-toggle" '+("static"===this.options.display?'data-display="static"':"")+'data-toggle="dropdown"'+s+' role="combobox" aria-owns="'+this.selectId+'" aria-haspopup="listbox" aria-expanded="false"><div class="filter-option"><div class="filter-option-inner"><div class="filter-option-inner-inner"></div></div> </div>'+("4"===M.major?"":'<span class="bs-caret">'+this.options.template.caret+"</span>")+'</button><div class="'+V.MENU+" "+("4"===M.major?"":V.SHOW)+'">'+o+r+l+'<div class="inner '+V.SHOW+'" role="listbox" id="'+this.selectId+'" tabindex="-1" '+t+'><ul class="'+V.MENU+" inner "+("4"===M.major?V.SHOW:"")+'" role="presentation"></ul></div>'+a+"</div></div>",P(n)},setPositionData:function(){this.selectpicker.view.canHighlight=[],this.selectpicker.view.size=0,this.selectpicker.view.firstHighlightIndex=!1;for(var e=0;e<this.selectpicker.current.data.length;e++){var t=this.selectpicker.current.data[e],i=!0;"divider"===t.type?(i=!1,t.height=this.sizeInfo.dividerHeight):"optgroup-label"===t.type?(i=!1,t.height=this.sizeInfo.dropdownHeaderHeight):t.height=this.sizeInfo.liHeight,t.disabled&&(i=!1),this.selectpicker.view.canHighlight.push(i),i&&(this.selectpicker.view.size++,t.posinset=this.selectpicker.view.size,!1===this.selectpicker.view.firstHighlightIndex&&(this.selectpicker.view.firstHighlightIndex=e)),t.position=(0===e?0:this.selectpicker.current.data[e-1].position)+t.height}},isVirtual:function(){return!1!==this.options.virtualScroll&&this.selectpicker.main.elements.length>=this.options.virtualScroll||!0===this.options.virtualScroll},createView:function(N,e,t){var A,L,D=this,i=0,H=[];if(this.selectpicker.isSearching=N,this.selectpicker.current=N?this.selectpicker.search:this.selectpicker.main,this.setPositionData(),e)if(t)i=this.$menuInner[0].scrollTop;else if(!D.multiple){var s=D.$element[0],n=(s.options[s.selectedIndex]||{}).liIndex;if("number"==typeof n&&!1!==D.options.size){var o=D.selectpicker.main.data[n],r=o&&o.position;r&&(i=r-(D.sizeInfo.menuInnerHeight+D.sizeInfo.liHeight)/2)}}function l(e,t){var i,s,n,o,r,l,a,c,d=D.selectpicker.current.elements.length,h=[],p=!0,u=D.isVirtual();D.selectpicker.view.scrollTop=e,i=Math.ceil(D.sizeInfo.menuInnerHeight/D.sizeInfo.liHeight*1.5),s=Math.round(d/i)||1;for(var f=0;f<s;f++){var m=(f+1)*i;if(f===s-1&&(m=d),h[f]=[f*i+(f?1:0),m],!d)break;void 0===r&&e-1<=D.selectpicker.current.data[m-1].position-D.sizeInfo.menuInnerHeight&&(r=f)}if(void 0===r&&(r=0),l=[D.selectpicker.view.position0,D.selectpicker.view.position1],n=Math.max(0,r-1),o=Math.min(s-1,r+1),D.selectpicker.view.position0=!1===u?0:Math.max(0,h[n][0])||0,D.selectpicker.view.position1=!1===u?d:Math.min(d,h[o][1])||0,a=l[0]!==D.selectpicker.view.position0||l[1]!==D.selectpicker.view.position1,void 0!==D.activeIndex&&(L=D.selectpicker.main.elements[D.prevActiveIndex],H=D.selectpicker.main.elements[D.activeIndex],A=D.selectpicker.main.elements[D.selectedIndex],t&&(D.activeIndex!==D.selectedIndex&&D.defocusItem(H),D.activeIndex=void 0),D.activeIndex&&D.activeIndex!==D.selectedIndex&&D.defocusItem(A)),void 0!==D.prevActiveIndex&&D.prevActiveIndex!==D.activeIndex&&D.prevActiveIndex!==D.selectedIndex&&D.defocusItem(L),(t||a)&&(c=D.selectpicker.view.visibleElements?D.selectpicker.view.visibleElements.slice():[],D.selectpicker.view.visibleElements=!1===u?D.selectpicker.current.elements:D.selectpicker.current.elements.slice(D.selectpicker.view.position0,D.selectpicker.view.position1),D.setOptionStatus(),(N||!1===u&&t)&&(p=!function(e,i){return e.length===i.length&&e.every(function(e,t){return e===i[t]})}(c,D.selectpicker.view.visibleElements)),(t||!0===u)&&p)){var v,g,b=D.$menuInner[0],w=document.createDocumentFragment(),I=b.firstChild.cloneNode(!1),x=D.selectpicker.view.visibleElements,k=[];b.replaceChild(I,b.firstChild);f=0;for(var y=x.length;f<y;f++){var $,S,E=x[f];D.options.sanitize&&($=E.lastChild)&&(S=D.selectpicker.current.data[f+D.selectpicker.view.position0])&&S.content&&!S.sanitized&&(k.push($),S.sanitized=!0),w.appendChild(E)}if(D.options.sanitize&&k.length&&W(k,D.options.whiteList,D.options.sanitizeFn),!0===u?(v=0===D.selectpicker.view.position0?0:D.selectpicker.current.data[D.selectpicker.view.position0-1].position,g=D.selectpicker.view.position1>d-1?0:D.selectpicker.current.data[d-1].position-D.selectpicker.current.data[D.selectpicker.view.position1-1].position,b.firstChild.style.marginTop=v+"px",b.firstChild.style.marginBottom=g+"px"):(b.firstChild.style.marginTop=0,b.firstChild.style.marginBottom=0),b.firstChild.appendChild(w),!0===u&&D.sizeInfo.hasScrollBar){var C=b.firstChild.offsetWidth;if(t&&C<D.sizeInfo.menuInnerInnerWidth&&D.sizeInfo.totalMenuWidth>D.sizeInfo.selectWidth)b.firstChild.style.minWidth=D.sizeInfo.menuInnerInnerWidth+"px";else if(C>D.sizeInfo.menuInnerInnerWidth){D.$menu[0].style.minWidth=0;var O=b.firstChild.offsetWidth;O>D.sizeInfo.menuInnerInnerWidth&&(D.sizeInfo.menuInnerInnerWidth=O,b.firstChild.style.minWidth=D.sizeInfo.menuInnerInnerWidth+"px"),D.$menu[0].style.minWidth=""}}}if(D.prevActiveIndex=D.activeIndex,D.options.liveSearch){if(N&&t){var z,T=0;D.selectpicker.view.canHighlight[T]||(T=1+D.selectpicker.view.canHighlight.slice(1).indexOf(!0)),z=D.selectpicker.view.visibleElements[T],D.defocusItem(D.selectpicker.view.currentActive),D.activeIndex=(D.selectpicker.current.data[T]||{}).index,D.focusItem(z)}}else D.$menuInner.trigger("focus")}l(i,!0),this.$menuInner.off("scroll.createView").on("scroll.createView",function(e,t){D.noScroll||l(this.scrollTop,t),D.noScroll=!1}),P(window).off("resize"+j+"."+this.selectId+".createView").on("resize"+j+"."+this.selectId+".createView",function(){D.$newElement.hasClass(V.SHOW)&&l(D.$menuInner[0].scrollTop)})},focusItem:function(e,t,i){if(e){t=t||this.selectpicker.main.data[this.activeIndex];var s=e.firstChild;s&&(s.setAttribute("aria-setsize",this.selectpicker.view.size),s.setAttribute("aria-posinset",t.posinset),!0!==i&&(this.focusedParent.setAttribute("aria-activedescendant",s.id),e.classList.add("active"),s.classList.add("active")))}},defocusItem:function(e){e&&(e.classList.remove("active"),e.firstChild&&e.firstChild.classList.remove("active"))},setPlaceholder:function(){var e=this,t=!1;if(this.options.title&&!this.multiple){this.selectpicker.view.titleOption||(this.selectpicker.view.titleOption=document.createElement("option")),t=!0;var i=this.$element[0],s=!1,n=!this.selectpicker.view.titleOption.parentNode,o=i.selectedIndex,r=i.options[o],l=window.performance&&window.performance.getEntriesByType("navigation"),a=l&&l.length?"back_forward"!==l[0].type:2!==window.performance.navigation.type;n&&(this.selectpicker.view.titleOption.className="bs-title-option",this.selectpicker.view.titleOption.value="",s=!r||0===o&&!1===r.defaultSelected&&void 0===this.$element.data("selected")),!n&&0===this.selectpicker.view.titleOption.index||i.insertBefore(this.selectpicker.view.titleOption,i.firstChild),s&&a?i.selectedIndex=0:"complete"!==document.readyState&&window.addEventListener("pageshow",function(){e.selectpicker.view.displayedValue!==i.value&&e.render()})}return t},buildData:function(){var p=':not([hidden]):not([data-hidden="true"])',u=[],f=0,m=this.setPlaceholder()?1:0;this.options.hideDisabled&&(p+=":not(:disabled)");var e=this.$element[0].querySelectorAll("select > *"+p);function v(e){var t=u[u.length-1];t&&"divider"===t.type&&(t.optID||e.optID)||((e=e||{}).type="divider",u.push(e))}function g(e,t){if((t=t||{}).divider="true"===e.getAttribute("data-divider"),t.divider)v({optID:t.optID});else{var i=u.length,s=e.style.cssText,n=s?S(s):"",o=(e.className||"")+(t.optgroupClass||"");t.optID&&(o="opt "+o),t.optionClass=o.trim(),t.inlineStyle=n,t.text=e.textContent,t.content=e.getAttribute("data-content"),t.tokens=e.getAttribute("data-tokens"),t.subtext=e.getAttribute("data-subtext"),t.icon=e.getAttribute("data-icon"),e.liIndex=i,t.display=t.content||t.text,t.type="option",t.index=i,t.option=e,t.selected=!!e.selected,t.disabled=t.disabled||!!e.disabled,u.push(t)}}function t(e,t){var i=t[e],s=!(e-1<m)&&t[e-1],n=t[e+1],o=i.querySelectorAll("option"+p);if(o.length){var r,l,a={display:S(i.label),subtext:i.getAttribute("data-subtext"),icon:i.getAttribute("data-icon"),type:"optgroup-label",optgroupClass:" "+(i.className||"")};f++,s&&v({optID:f}),a.optID=f,u.push(a);for(var c=0,d=o.length;c<d;c++){var h=o[c];0===c&&(l=(r=u.length-1)+d),g(h,{headerIndex:r,lastIndex:l,optID:a.optID,optgroupClass:a.optgroupClass,disabled:i.disabled})}n&&v({optID:f})}}for(var i=e.length,s=m;s<i;s++){var n=e[s];"OPTGROUP"!==n.tagName?g(n,{}):t(s,e)}this.selectpicker.main.data=this.selectpicker.current.data=u},buildList:function(){var s=this,e=this.selectpicker.main.data,n=[],o=0;function t(e){var t,i=0;switch(e.type){case"divider":t=K.li(!1,V.DIVIDER,e.optID?e.optID+"div":void 0);break;case"option":(t=K.li(K.a(K.text.call(s,e),e.optionClass,e.inlineStyle),"",e.optID)).firstChild&&(t.firstChild.id=s.selectId+"-"+e.index);break;case"optgroup-label":t=K.li(K.label.call(s,e),"dropdown-header"+e.optgroupClass,e.optID)}e.element=t,n.push(t),e.display&&(i+=e.display.length),e.subtext&&(i+=e.subtext.length),e.icon&&(i+=1),o<i&&(o=i,s.selectpicker.view.widestOption=n[n.length-1])}!s.options.showTick&&!s.multiple||_.checkMark.parentNode||(_.checkMark.className=this.options.iconBase+" "+s.options.tickIcon+" check-mark",_.a.appendChild(_.checkMark));for(var i=e.length,r=0;r<i;r++){t(e[r])}this.selectpicker.main.elements=this.selectpicker.current.elements=n},findLis:function(){return this.$menuInner.find(".inner > li")},render:function(){var e,t=this,i=this.$element[0],s=this.setPlaceholder()&&0===i.selectedIndex,n=O(i,this.options.hideDisabled),o=n.length,r=this.$button[0],l=r.querySelector(".filter-option-inner-inner"),a=document.createTextNode(this.options.multipleSeparator),c=_.fragment.cloneNode(!1),d=!1;if(r.classList.toggle("bs-placeholder",t.multiple?!o:!z(i,n)),t.multiple||1!==n.length||(t.selectpicker.view.displayedValue=z(i,n)),"static"===this.options.selectedTextFormat)c=K.text.call(this,{text:this.options.title},!0);else if(!1===(this.multiple&&-1!==this.options.selectedTextFormat.indexOf("count")&&1<o&&(1<(e=this.options.selectedTextFormat.split(">")).length&&o>e[1]||1===e.length&&2<=o))){if(!s){for(var h=0;h<o&&h<50;h++){var p=n[h],u=this.selectpicker.main.data[p.liIndex],f={};this.multiple&&0<h&&c.appendChild(a.cloneNode(!1)),p.title?f.text=p.title:u&&(u.content&&t.options.showContent?(f.content=u.content.toString(),d=!0):(t.options.showIcon&&(f.icon=u.icon),t.options.showSubtext&&!t.multiple&&u.subtext&&(f.subtext=" "+u.subtext),f.text=p.textContent.trim())),c.appendChild(K.text.call(this,f,!0))}49<o&&c.appendChild(document.createTextNode("..."))}}else{var m=':not([hidden]):not([data-hidden="true"]):not([data-divider="true"])';this.options.hideDisabled&&(m+=":not(:disabled)");var v=this.$element[0].querySelectorAll("select > option"+m+", optgroup"+m+" option"+m).length,g="function"==typeof this.options.countSelectedText?this.options.countSelectedText(o,v):this.options.countSelectedText;c=K.text.call(this,{text:g.replace("{0}",o.toString()).replace("{1}",v.toString())},!0)}if(null==this.options.title&&(this.options.title=this.$element.attr("title")),c.childNodes.length||(c=K.text.call(this,{text:void 0!==this.options.title?this.options.title:this.options.noneSelectedText},!0)),r.title=c.textContent.replace(/<[^>]*>?/g,"").trim(),this.options.sanitize&&d&&W([c],t.options.whiteList,t.options.sanitizeFn),l.innerHTML="",l.appendChild(c),M.major<4&&this.$newElement[0].classList.contains("bs3-has-addon")){var b=r.querySelector(".filter-expand"),w=l.cloneNode(!0);w.className="filter-expand",b?r.replaceChild(w,b):r.appendChild(w)}this.$element.trigger("rendered"+j)},setStyle:function(e,t){var i,s=this.$button[0],n=this.$newElement[0],o=this.options.style.trim();this.$element.attr("class")&&this.$newElement.addClass(this.$element.attr("class").replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi,"")),M.major<4&&(n.classList.add("bs3"),n.parentNode.classList&&n.parentNode.classList.contains("input-group")&&(n.previousElementSibling||n.nextElementSibling)&&(n.previousElementSibling||n.nextElementSibling).classList.contains("input-group-addon")&&n.classList.add("bs3-has-addon")),i=e?e.trim():o,"add"==t?i&&s.classList.add.apply(s.classList,i.split(" ")):"remove"==t?i&&s.classList.remove.apply(s.classList,i.split(" ")):(o&&s.classList.remove.apply(s.classList,o.split(" ")),i&&s.classList.add.apply(s.classList,i.split(" ")))},liHeight:function(e){if(e||!1!==this.options.size&&!Object.keys(this.sizeInfo).length){var t,i=_.div.cloneNode(!1),s=_.div.cloneNode(!1),n=_.div.cloneNode(!1),o=document.createElement("ul"),r=_.li.cloneNode(!1),l=_.li.cloneNode(!1),a=_.a.cloneNode(!1),c=_.span.cloneNode(!1),d=this.options.header&&0<this.$menu.find("."+V.POPOVERHEADER).length?this.$menu.find("."+V.POPOVERHEADER)[0].cloneNode(!0):null,h=this.options.liveSearch?_.div.cloneNode(!1):null,p=this.options.actionsBox&&this.multiple&&0<this.$menu.find(".bs-actionsbox").length?this.$menu.find(".bs-actionsbox")[0].cloneNode(!0):null,u=this.options.doneButton&&this.multiple&&0<this.$menu.find(".bs-donebutton").length?this.$menu.find(".bs-donebutton")[0].cloneNode(!0):null,f=this.$element.find("option")[0];if(this.sizeInfo.selectWidth=this.$newElement[0].offsetWidth,c.className="text",a.className="dropdown-item "+(f?f.className:""),i.className=this.$menu[0].parentNode.className+" "+V.SHOW,i.style.width=0,"auto"===this.options.width&&(s.style.minWidth=0),s.className=V.MENU+" "+V.SHOW,n.className="inner "+V.SHOW,o.className=V.MENU+" inner "+("4"===M.major?V.SHOW:""),r.className=V.DIVIDER,l.className="dropdown-header",c.appendChild(document.createTextNode("\u200b")),this.selectpicker.current.data.length)for(var m=0;m<this.selectpicker.current.data.length;m++){var v=this.selectpicker.current.data[m];if("option"===v.type){t=v.element;break}}else t=_.li.cloneNode(!1),a.appendChild(c),t.appendChild(a);if(l.appendChild(c.cloneNode(!0)),this.selectpicker.view.widestOption&&o.appendChild(this.selectpicker.view.widestOption.cloneNode(!0)),o.appendChild(t),o.appendChild(r),o.appendChild(l),d&&s.appendChild(d),h){var g=document.createElement("input");h.className="bs-searchbox",g.className="form-control",h.appendChild(g),s.appendChild(h)}p&&s.appendChild(p),n.appendChild(o),s.appendChild(n),u&&s.appendChild(u),i.appendChild(s),document.body.appendChild(i);var b,w=t.offsetHeight,I=l?l.offsetHeight:0,x=d?d.offsetHeight:0,k=h?h.offsetHeight:0,y=p?p.offsetHeight:0,$=u?u.offsetHeight:0,S=P(r).outerHeight(!0),E=!!window.getComputedStyle&&window.getComputedStyle(s),C=s.offsetWidth,O=E?null:P(s),z={vert:N(E?E.paddingTop:O.css("paddingTop"))+N(E?E.paddingBottom:O.css("paddingBottom"))+N(E?E.borderTopWidth:O.css("borderTopWidth"))+N(E?E.borderBottomWidth:O.css("borderBottomWidth")),horiz:N(E?E.paddingLeft:O.css("paddingLeft"))+N(E?E.paddingRight:O.css("paddingRight"))+N(E?E.borderLeftWidth:O.css("borderLeftWidth"))+N(E?E.borderRightWidth:O.css("borderRightWidth"))},T={vert:z.vert+N(E?E.marginTop:O.css("marginTop"))+N(E?E.marginBottom:O.css("marginBottom"))+2,horiz:z.horiz+N(E?E.marginLeft:O.css("marginLeft"))+N(E?E.marginRight:O.css("marginRight"))+2};n.style.overflowY="scroll",b=s.offsetWidth-C,document.body.removeChild(i),this.sizeInfo.liHeight=w,this.sizeInfo.dropdownHeaderHeight=I,this.sizeInfo.headerHeight=x,this.sizeInfo.searchHeight=k,this.sizeInfo.actionsHeight=y,this.sizeInfo.doneButtonHeight=$,this.sizeInfo.dividerHeight=S,this.sizeInfo.menuPadding=z,this.sizeInfo.menuExtras=T,this.sizeInfo.menuWidth=C,this.sizeInfo.menuInnerInnerWidth=C-z.horiz,this.sizeInfo.totalMenuWidth=this.sizeInfo.menuWidth,this.sizeInfo.scrollBarWidth=b,this.sizeInfo.selectHeight=this.$newElement[0].offsetHeight,this.setPositionData()}},getSelectPosition:function(){var e,t=P(window),i=this.$newElement.offset(),s=P(this.options.container);this.options.container&&s.length&&!s.is("body")?((e=s.offset()).top+=parseInt(s.css("borderTopWidth")),e.left+=parseInt(s.css("borderLeftWidth"))):e={top:0,left:0};var n=this.options.windowPadding;this.sizeInfo.selectOffsetTop=i.top-e.top-t.scrollTop(),this.sizeInfo.selectOffsetBot=t.height()-this.sizeInfo.selectOffsetTop-this.sizeInfo.selectHeight-e.top-n[2],this.sizeInfo.selectOffsetLeft=i.left-e.left-t.scrollLeft(),this.sizeInfo.selectOffsetRight=t.width()-this.sizeInfo.selectOffsetLeft-this.sizeInfo.selectWidth-e.left-n[1],this.sizeInfo.selectOffsetTop-=n[0],this.sizeInfo.selectOffsetLeft-=n[3]},setMenuSize:function(e){this.getSelectPosition();var t,i,s,n,o,r,l,a,c=this.sizeInfo.selectWidth,d=this.sizeInfo.liHeight,h=this.sizeInfo.headerHeight,p=this.sizeInfo.searchHeight,u=this.sizeInfo.actionsHeight,f=this.sizeInfo.doneButtonHeight,m=this.sizeInfo.dividerHeight,v=this.sizeInfo.menuPadding,g=0;if(this.options.dropupAuto&&(l=d*this.selectpicker.current.elements.length+v.vert,a=this.sizeInfo.selectOffsetTop-this.sizeInfo.selectOffsetBot>this.sizeInfo.menuExtras.vert&&l+this.sizeInfo.menuExtras.vert+50>this.sizeInfo.selectOffsetBot,!0===this.selectpicker.isSearching&&(a=this.selectpicker.dropup),this.$newElement.toggleClass(V.DROPUP,a),this.selectpicker.dropup=a),"auto"===this.options.size)n=3<this.selectpicker.current.elements.length?3*this.sizeInfo.liHeight+this.sizeInfo.menuExtras.vert-2:0,i=this.sizeInfo.selectOffsetBot-this.sizeInfo.menuExtras.vert,s=n+h+p+u+f,r=Math.max(n-v.vert,0),this.$newElement.hasClass(V.DROPUP)&&(i=this.sizeInfo.selectOffsetTop-this.sizeInfo.menuExtras.vert),t=(o=i)-h-p-u-f-v.vert;else if(this.options.size&&"auto"!=this.options.size&&this.selectpicker.current.elements.length>this.options.size){for(var b=0;b<this.options.size;b++)"divider"===this.selectpicker.current.data[b].type&&g++;t=(i=d*this.options.size+g*m+v.vert)-v.vert,o=i+h+p+u+f,s=r=""}this.$menu.css({"max-height":o+"px",overflow:"hidden","min-height":s+"px"}),this.$menuInner.css({"max-height":t+"px","overflow-y":"auto","min-height":r+"px"}),this.sizeInfo.menuInnerHeight=Math.max(t,1),this.selectpicker.current.data.length&&this.selectpicker.current.data[this.selectpicker.current.data.length-1].position>this.sizeInfo.menuInnerHeight&&(this.sizeInfo.hasScrollBar=!0,this.sizeInfo.totalMenuWidth=this.sizeInfo.menuWidth+this.sizeInfo.scrollBarWidth),"auto"===this.options.dropdownAlignRight&&this.$menu.toggleClass(V.MENURIGHT,this.sizeInfo.selectOffsetLeft>this.sizeInfo.selectOffsetRight&&this.sizeInfo.selectOffsetRight<this.sizeInfo.totalMenuWidth-c),this.dropdown&&this.dropdown._popper&&this.dropdown._popper.update()},setSize:function(e){if(this.liHeight(e),this.options.header&&this.$menu.css("padding-top",0),!1!==this.options.size){var t=this,i=P(window);this.setMenuSize(),this.options.liveSearch&&this.$searchbox.off("input.setMenuSize propertychange.setMenuSize").on("input.setMenuSize propertychange.setMenuSize",function(){return t.setMenuSize()}),"auto"===this.options.size?i.off("resize"+j+"."+this.selectId+".setMenuSize scroll"+j+"."+this.selectId+".setMenuSize").on("resize"+j+"."+this.selectId+".setMenuSize scroll"+j+"."+this.selectId+".setMenuSize",function(){return t.setMenuSize()}):this.options.size&&"auto"!=this.options.size&&this.selectpicker.current.elements.length>this.options.size&&i.off("resize"+j+"."+this.selectId+".setMenuSize scroll"+j+"."+this.selectId+".setMenuSize")}this.createView(!1,!0,e)},setWidth:function(){var i=this;"auto"===this.options.width?requestAnimationFrame(function(){i.$menu.css("min-width","0"),i.$element.on("loaded"+j,function(){i.liHeight(),i.setMenuSize();var e=i.$newElement.clone().appendTo("body"),t=e.css("width","auto").children("button").outerWidth();e.remove(),i.sizeInfo.selectWidth=Math.max(i.sizeInfo.totalMenuWidth,t),i.$newElement.css("width",i.sizeInfo.selectWidth+"px")})}):"fit"===this.options.width?(this.$menu.css("min-width",""),this.$newElement.css("width","").addClass("fit-width")):this.options.width?(this.$menu.css("min-width",""),this.$newElement.css("width",this.options.width)):(this.$menu.css("min-width",""),this.$newElement.css("width","")),this.$newElement.hasClass("fit-width")&&"fit"!==this.options.width&&this.$newElement[0].classList.remove("fit-width")},selectPosition:function(){this.$bsContainer=P('<div class="bs-container" />');function e(e){var t={},i=r.options.display||!!P.fn.dropdown.Constructor.Default&&P.fn.dropdown.Constructor.Default.display;r.$bsContainer.addClass(e.attr("class").replace(/form-control|fit-width/gi,"")).toggleClass(V.DROPUP,e.hasClass(V.DROPUP)),s=e.offset(),l.is("body")?n={top:0,left:0}:((n=l.offset()).top+=parseInt(l.css("borderTopWidth"))-l.scrollTop(),n.left+=parseInt(l.css("borderLeftWidth"))-l.scrollLeft()),o=e.hasClass(V.DROPUP)?0:e[0].offsetHeight,(M.major<4||"static"===i)&&(t.top=s.top-n.top+o,t.left=s.left-n.left),t.width=e[0].offsetWidth,r.$bsContainer.css(t)}var s,n,o,r=this,l=P(this.options.container);this.$button.on("click.bs.dropdown.data-api",function(){r.isDisabled()||(e(r.$newElement),r.$bsContainer.appendTo(r.options.container).toggleClass(V.SHOW,!r.$button.hasClass(V.SHOW)).append(r.$menu))}),P(window).off("resize"+j+"."+this.selectId+" scroll"+j+"."+this.selectId).on("resize"+j+"."+this.selectId+" scroll"+j+"."+this.selectId,function(){r.$newElement.hasClass(V.SHOW)&&e(r.$newElement)}),this.$element.on("hide"+j,function(){r.$menu.data("height",r.$menu.height()),r.$bsContainer.detach()})},setOptionStatus:function(e){var t=this;if(t.noScroll=!1,t.selectpicker.view.visibleElements&&t.selectpicker.view.visibleElements.length)for(var i=0;i<t.selectpicker.view.visibleElements.length;i++){var s=t.selectpicker.current.data[i+t.selectpicker.view.position0],n=s.option;n&&(!0!==e&&t.setDisabled(s.index,s.disabled),t.setSelected(s.index,n.selected))}},setSelected:function(e,t){var i,s,n=this.selectpicker.main.elements[e],o=this.selectpicker.main.data[e],r=void 0!==this.activeIndex,l=this.activeIndex===e||t&&!this.multiple&&!r;o.selected=t,s=n.firstChild,t&&(this.selectedIndex=e),n.classList.toggle("selected",t),l?(this.focusItem(n,o),this.selectpicker.view.currentActive=n,this.activeIndex=e):this.defocusItem(n),s&&(s.classList.toggle("selected",t),t?s.setAttribute("aria-selected",!0):this.multiple?s.setAttribute("aria-selected",!1):s.removeAttribute("aria-selected")),l||r||!t||void 0===this.prevActiveIndex||(i=this.selectpicker.main.elements[this.prevActiveIndex],this.defocusItem(i))},setDisabled:function(e,t){var i,s=this.selectpicker.main.elements[e];this.selectpicker.main.data[e].disabled=t,i=s.firstChild,s.classList.toggle(V.DISABLED,t),i&&("4"===M.major&&i.classList.toggle(V.DISABLED,t),t?(i.setAttribute("aria-disabled",t),i.setAttribute("tabindex",-1)):(i.removeAttribute("aria-disabled"),i.setAttribute("tabindex",0)))},isDisabled:function(){return this.$element[0].disabled},checkDisabled:function(){this.isDisabled()?(this.$newElement[0].classList.add(V.DISABLED),this.$button.addClass(V.DISABLED).attr("aria-disabled",!0)):this.$button[0].classList.contains(V.DISABLED)&&(this.$newElement[0].classList.remove(V.DISABLED),this.$button.removeClass(V.DISABLED).attr("aria-disabled",!1))},clickListener:function(){var C=this,t=P(document);function e(){C.options.liveSearch?C.$searchbox.trigger("focus"):C.$menuInner.trigger("focus")}function i(){C.dropdown&&C.dropdown._popper&&C.dropdown._popper.state.isCreated?e():requestAnimationFrame(i)}t.data("spaceSelect",!1),this.$button.on("keyup",function(e){/(32)/.test(e.keyCode.toString(10))&&t.data("spaceSelect")&&(e.preventDefault(),t.data("spaceSelect",!1))}),this.$newElement.on("show.bs.dropdown",function(){3<M.major&&!C.dropdown&&(C.dropdown=C.$button.data("bs.dropdown"),C.dropdown._menu=C.$menu[0])}),this.$button.on("click.bs.dropdown.data-api",function(){C.$newElement.hasClass(V.SHOW)||C.setSize()}),this.$element.on("shown"+j,function(){C.$menuInner[0].scrollTop!==C.selectpicker.view.scrollTop&&(C.$menuInner[0].scrollTop=C.selectpicker.view.scrollTop),3<M.major?requestAnimationFrame(i):e()}),this.$menuInner.on("mouseenter","li a",function(e){var t=this.parentElement,i=C.isVirtual()?C.selectpicker.view.position0:0,s=Array.prototype.indexOf.call(t.parentElement.children,t),n=C.selectpicker.current.data[s+i];C.focusItem(t,n,!0)}),this.$menuInner.on("click","li a",function(e,t){var i=P(this),s=C.$element[0],n=C.isVirtual()?C.selectpicker.view.position0:0,o=C.selectpicker.current.data[i.parent().index()+n],r=o.index,l=z(s),a=s.selectedIndex,c=s.options[a],d=!0;if(C.multiple&&1!==C.options.maxOptions&&e.stopPropagation(),e.preventDefault(),!C.isDisabled()&&!i.parent().hasClass(V.DISABLED)){var h=o.option,p=P(h),u=h.selected,f=p.parent("optgroup"),m=f.find("option"),v=C.options.maxOptions,g=f.data("maxOptions")||!1;if(r===C.activeIndex&&(t=!0),t||(C.prevActiveIndex=C.activeIndex,C.activeIndex=void 0),C.multiple){if(h.selected=!u,C.setSelected(r,!u),C.focusedParent.focus(),!1!==v||!1!==g){var b=v<O(s).length,w=g<f.find("option:selected").length;if(v&&b||g&&w)if(v&&1==v)s.selectedIndex=-1,h.selected=!0,C.setOptionStatus(!0);else if(g&&1==g){for(var I=0;I<m.length;I++){var x=m[I];x.selected=!1,C.setSelected(x.liIndex,!1)}h.selected=!0,C.setSelected(r,!0)}else{var k="string"==typeof C.options.maxOptionsText?[C.options.maxOptionsText,C.options.maxOptionsText]:C.options.maxOptionsText,y="function"==typeof k?k(v,g):k,$=y[0].replace("{n}",v),S=y[1].replace("{n}",g),E=P('<div class="notify"></div>');y[2]&&($=$.replace("{var}",y[2][1<v?0:1]),S=S.replace("{var}",y[2][1<g?0:1])),h.selected=!1,C.$menu.append(E),v&&b&&(E.append(P("<div>"+$+"</div>")),d=!1,C.$element.trigger("maxReached"+j)),g&&w&&(E.append(P("<div>"+S+"</div>")),d=!1,C.$element.trigger("maxReachedGrp"+j)),setTimeout(function(){C.setSelected(r,!1)},10),E[0].classList.add("fadeOut"),setTimeout(function(){E.remove()},1050)}}}else c&&(c.selected=!1),h.selected=!0,C.setSelected(r,!0);!C.multiple||C.multiple&&1===C.options.maxOptions?C.$button.trigger("focus"):C.options.liveSearch&&C.$searchbox.trigger("focus"),d&&(!C.multiple&&a===s.selectedIndex||(T=[h.index,p.prop("selected"),l],C.$element.triggerNative("change")))}}),this.$menu.on("click","li."+V.DISABLED+" a, ."+V.POPOVERHEADER+", ."+V.POPOVERHEADER+" :not(.close)",function(e){e.currentTarget==this&&(e.preventDefault(),e.stopPropagation(),C.options.liveSearch&&!P(e.target).hasClass("close")?C.$searchbox.trigger("focus"):C.$button.trigger("focus"))}),this.$menuInner.on("click",".divider, .dropdown-header",function(e){e.preventDefault(),e.stopPropagation(),C.options.liveSearch?C.$searchbox.trigger("focus"):C.$button.trigger("focus")}),this.$menu.on("click","."+V.POPOVERHEADER+" .close",function(){C.$button.trigger("click")}),this.$searchbox.on("click",function(e){e.stopPropagation()}),this.$menu.on("click",".actions-btn",function(e){C.options.liveSearch?C.$searchbox.trigger("focus"):C.$button.trigger("focus"),e.preventDefault(),e.stopPropagation(),P(this).hasClass("bs-select-all")?C.selectAll():C.deselectAll()}),this.$button.on("focus"+j,function(e){var t=C.$element[0].getAttribute("tabindex");void 0!==t&&e.originalEvent&&e.originalEvent.isTrusted&&(this.setAttribute("tabindex",t),C.$element[0].setAttribute("tabindex",-1),C.selectpicker.view.tabindex=t)}).on("blur"+j,function(e){void 0!==C.selectpicker.view.tabindex&&e.originalEvent&&e.originalEvent.isTrusted&&(C.$element[0].setAttribute("tabindex",C.selectpicker.view.tabindex),this.setAttribute("tabindex",-1),C.selectpicker.view.tabindex=void 0)}),this.$element.on("change"+j,function(){C.render(),C.$element.trigger("changed"+j,T),T=null}).on("focus"+j,function(){C.options.mobile||C.$button[0].focus()})},liveSearchListener:function(){var u=this;this.$button.on("click.bs.dropdown.data-api",function(){u.$searchbox.val()&&(u.$searchbox.val(""),u.selectpicker.search.previousValue=void 0)}),this.$searchbox.on("click.bs.dropdown.data-api focus.bs.dropdown.data-api touchend.bs.dropdown.data-api",function(e){e.stopPropagation()}),this.$searchbox.on("input propertychange",function(){var e=u.$searchbox[0].value;if(u.selectpicker.search.elements=[],u.selectpicker.search.data=[],e){var t=[],i=e.toUpperCase(),s={},n=[],o=u._searchStyle(),r=u.options.liveSearchNormalize;r&&(i=w(i));for(var l=0;l<u.selectpicker.main.data.length;l++){var a=u.selectpicker.main.data[l];s[l]||(s[l]=k(a,i,o,r)),s[l]&&void 0!==a.headerIndex&&-1===n.indexOf(a.headerIndex)&&(0<a.headerIndex&&(s[a.headerIndex-1]=!0,n.push(a.headerIndex-1)),s[a.headerIndex]=!0,n.push(a.headerIndex),s[a.lastIndex+1]=!0),s[l]&&"optgroup-label"!==a.type&&n.push(l)}l=0;for(var c=n.length;l<c;l++){var d=n[l],h=n[l-1],p=(a=u.selectpicker.main.data[d],u.selectpicker.main.data[h]);("divider"!==a.type||"divider"===a.type&&p&&"divider"!==p.type&&c-1!==l)&&(u.selectpicker.search.data.push(a),t.push(u.selectpicker.main.elements[d]))}u.activeIndex=void 0,u.noScroll=!0,u.$menuInner.scrollTop(0),u.selectpicker.search.elements=t,u.createView(!0),function(e,t){e.length||(_.noResults.innerHTML=this.options.noneResultsText.replace("{0}",'"'+S(t)+'"'),this.$menuInner[0].firstChild.appendChild(_.noResults))}.call(u,t,e)}else u.selectpicker.search.previousValue&&(u.$menuInner.scrollTop(0),u.createView(!1));u.selectpicker.search.previousValue=e})},_searchStyle:function(){return this.options.liveSearchStyle||"contains"},val:function(e){var t=this.$element[0];if(void 0===e)return this.$element.val();var i=z(t);if(T=[null,null,i],this.$element.val(e).trigger("changed"+j,T),this.$newElement.hasClass(V.SHOW))if(this.multiple)this.setOptionStatus(!0);else{var s=(t.options[t.selectedIndex]||{}).liIndex;"number"==typeof s&&(this.setSelected(this.selectedIndex,!1),this.setSelected(s,!0))}return this.render(),T=null,this.$element},changeAll:function(e){if(this.multiple){void 0===e&&(e=!0);var t=this.$element[0],i=0,s=0,n=z(t);t.classList.add("bs-select-hidden");for(var o=0,r=this.selectpicker.current.data,l=r.length;o<l;o++){var a=r[o],c=a.option;c&&!a.disabled&&"divider"!==a.type&&(a.selected&&i++,!0===(c.selected=e)&&s++)}t.classList.remove("bs-select-hidden"),i!==s&&(this.setOptionStatus(),T=[null,null,n],this.$element.triggerNative("change"))}},selectAll:function(){return this.changeAll(!0)},deselectAll:function(){return this.changeAll(!1)},toggle:function(e){(e=e||window.event)&&e.stopPropagation(),this.$button.trigger("click.bs.dropdown.data-api")},keydown:function(e){var t,i,s,n,o,r=P(this),l=r.hasClass("dropdown-toggle"),a=(l?r.closest(".dropdown"):r.closest(F.MENU)).data("this"),c=a.findLis(),d=!1,h=e.which===H&&!l&&!a.options.selectOnTab,p=G.test(e.which)||h,u=a.$menuInner[0].scrollTop,f=!0===a.isVirtual()?a.selectpicker.view.position0:0;if(!(112<=e.which&&e.which<=123))if(!(i=a.$newElement.hasClass(V.SHOW))&&(p||48<=e.which&&e.which<=57||96<=e.which&&e.which<=105||65<=e.which&&e.which<=90)&&(a.$button.trigger("click.bs.dropdown.data-api"),a.options.liveSearch))a.$searchbox.trigger("focus");else{if(e.which===A&&i&&(e.preventDefault(),a.$button.trigger("click.bs.dropdown.data-api").trigger("focus")),p){if(!c.length)return;-1!==(t=(s=a.selectpicker.main.elements[a.activeIndex])?Array.prototype.indexOf.call(s.parentElement.children,s):-1)&&a.defocusItem(s),e.which===B?(-1!==t&&t--,t+f<0&&(t+=c.length),a.selectpicker.view.canHighlight[t+f]||-1===(t=a.selectpicker.view.canHighlight.slice(0,t+f).lastIndexOf(!0)-f)&&(t=c.length-1)):e.which!==R&&!h||(++t+f>=a.selectpicker.view.canHighlight.length&&(t=a.selectpicker.view.firstHighlightIndex),a.selectpicker.view.canHighlight[t+f]||(t=t+1+a.selectpicker.view.canHighlight.slice(t+f+1).indexOf(!0))),e.preventDefault();var m=f+t;e.which===B?0===f&&t===c.length-1?(a.$menuInner[0].scrollTop=a.$menuInner[0].scrollHeight,m=a.selectpicker.current.elements.length-1):d=(o=(n=a.selectpicker.current.data[m]).position-n.height)<u:e.which!==R&&!h||(t===a.selectpicker.view.firstHighlightIndex?(a.$menuInner[0].scrollTop=0,m=a.selectpicker.view.firstHighlightIndex):d=u<(o=(n=a.selectpicker.current.data[m]).position-a.sizeInfo.menuInnerHeight)),s=a.selectpicker.current.elements[m],a.activeIndex=a.selectpicker.current.data[m].index,a.focusItem(s),a.selectpicker.view.currentActive=s,d&&(a.$menuInner[0].scrollTop=o),a.options.liveSearch?a.$searchbox.trigger("focus"):r.trigger("focus")}else if(!r.is("input")&&!q.test(e.which)||e.which===D&&a.selectpicker.keydown.keyHistory){var v,g,b=[];e.preventDefault(),a.selectpicker.keydown.keyHistory+=C[e.which],a.selectpicker.keydown.resetKeyHistory.cancel&&clearTimeout(a.selectpicker.keydown.resetKeyHistory.cancel),a.selectpicker.keydown.resetKeyHistory.cancel=a.selectpicker.keydown.resetKeyHistory.start(),g=a.selectpicker.keydown.keyHistory,/^(.)\1+$/.test(g)&&(g=g.charAt(0));for(var w=0;w<a.selectpicker.current.data.length;w++){var I=a.selectpicker.current.data[w];k(I,g,"startsWith",!0)&&a.selectpicker.view.canHighlight[w]&&b.push(I.index)}if(b.length){var x=0;c.removeClass("active").find("a").removeClass("active"),1===g.length&&(-1===(x=b.indexOf(a.activeIndex))||x===b.length-1?x=0:x++),v=b[x],d=0<u-(n=a.selectpicker.main.data[v]).position?(o=n.position-n.height,!0):(o=n.position-a.sizeInfo.menuInnerHeight,n.position>u+a.sizeInfo.menuInnerHeight),s=a.selectpicker.main.elements[v],a.activeIndex=b[x],a.focusItem(s),s&&s.firstChild.focus(),d&&(a.$menuInner[0].scrollTop=o),r.trigger("focus")}}i&&(e.which===D&&!a.selectpicker.keydown.keyHistory||e.which===L||e.which===H&&a.options.selectOnTab)&&(e.which!==D&&e.preventDefault(),a.options.liveSearch&&e.which===D||(a.$menuInner.find(".active a").trigger("click",!0),r.trigger("focus"),a.options.liveSearch||(e.preventDefault(),P(document).data("spaceSelect",!0))))}},mobile:function(){this.options.mobile=!0,this.$element[0].classList.add("mobile-device")},refresh:function(){var e=P.extend({},this.options,this.$element.data());this.options=e,this.checkDisabled(),this.buildData(),this.setStyle(),this.render(),this.buildList(),this.setWidth(),this.setSize(!0),this.$element.trigger("refreshed"+j)},hide:function(){this.$newElement.hide()},show:function(){this.$newElement.show()},remove:function(){this.$newElement.remove(),this.$element.remove()},destroy:function(){this.$newElement.before(this.$element).remove(),this.$bsContainer?this.$bsContainer.remove():this.$menu.remove(),this.selectpicker.view.titleOption&&this.selectpicker.view.titleOption.parentNode&&this.selectpicker.view.titleOption.parentNode.removeChild(this.selectpicker.view.titleOption),this.$element.off(j).removeData("selectpicker").removeClass("bs-select-hidden selectpicker"),P(window).off(j+"."+this.selectId)}};var J=P.fn.selectpicker;function Q(){if(P.fn.dropdown)return(P.fn.dropdown.Constructor._dataApiKeydownHandler||P.fn.dropdown.Constructor.prototype.keydown).apply(this,arguments)}P.fn.selectpicker=Z,P.fn.selectpicker.Constructor=Y,P.fn.selectpicker.noConflict=function(){return P.fn.selectpicker=J,this},P(document).off("keydown.bs.dropdown.data-api").on("keydown.bs.dropdown.data-api",':not(.bootstrap-select) > [data-toggle="dropdown"]',Q).on("keydown.bs.dropdown.data-api",":not(.bootstrap-select) > .dropdown-menu",Q).on("keydown"+j,'.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input',Y.prototype.keydown).on("focusin.modal",'.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input',function(e){e.stopPropagation()}),P(window).on("load"+j+".data-api",function(){P(".selectpicker").each(function(){var e=P(this);Z.call(e,e.data())})})}(e)}); |
New file |
| | |
| | | /** |
| | | * @author zhixin wen <wenzhixin2010@gmail.com> |
| | | * version: 1.19.1 |
| | | * https://github.com/wenzhixin/bootstrap-table/ |
| | | */ |
| | | .bootstrap-table .fixed-table-toolbar::after{content:"";display:block;clear:both}.bootstrap-table .fixed-table-toolbar .bs-bars,.bootstrap-table .fixed-table-toolbar .columns,.bootstrap-table .fixed-table-toolbar .search{position:relative;margin-top:10px;margin-bottom:10px}.bootstrap-table .fixed-table-toolbar .columns .btn-group>.btn-group{display:inline-block;margin-left:-1px!important}.bootstrap-table .fixed-table-toolbar .columns .btn-group>.btn-group>.btn{border-radius:0}.bootstrap-table .fixed-table-toolbar .columns .btn-group>.btn-group:first-child>.btn{border-top-left-radius:4px;border-bottom-left-radius:4px}.bootstrap-table .fixed-table-toolbar .columns .btn-group>.btn-group:last-child>.btn{border-top-right-radius:4px;border-bottom-right-radius:4px}.bootstrap-table .fixed-table-toolbar .columns .dropdown-menu{text-align:left;max-height:300px;overflow:auto;-ms-overflow-style:scrollbar;z-index:1001}.bootstrap-table .fixed-table-toolbar .columns label{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.428571429}.bootstrap-table .fixed-table-toolbar .columns-left{margin-right:5px}.bootstrap-table .fixed-table-toolbar .columns-right{margin-left:5px}.bootstrap-table .fixed-table-toolbar .pull-right .dropdown-menu{right:0;left:auto}.bootstrap-table .fixed-table-container{position:relative;clear:both}.bootstrap-table .fixed-table-container .table{width:100%;margin-bottom:0!important}.bootstrap-table .fixed-table-container .table td,.bootstrap-table .fixed-table-container .table th{vertical-align:middle;box-sizing:border-box}.bootstrap-table .fixed-table-container .table thead th{vertical-align:bottom;padding:0;margin:0}.bootstrap-table .fixed-table-container .table thead th:focus{outline:0 solid transparent}.bootstrap-table .fixed-table-container .table thead th.detail{width:30px}.bootstrap-table .fixed-table-container .table thead th .th-inner{padding:.75rem;vertical-align:bottom;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.bootstrap-table .fixed-table-container .table thead th .sortable{cursor:pointer;background-position:right;background-repeat:no-repeat;padding-right:30px!important}.bootstrap-table .fixed-table-container .table thead th .both{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAQAAADYWf5HAAAAkElEQVQoz7X QMQ5AQBCF4dWQSJxC5wwax1Cq1e7BAdxD5SL+Tq/QCM1oNiJidwox0355mXnG/DrEtIQ6azioNZQxI0ykPhTQIwhCR+BmBYtlK7kLJYwWCcJA9M4qdrZrd8pPjZWPtOqdRQy320YSV17OatFC4euts6z39GYMKRPCTKY9UnPQ6P+GtMRfGtPnBCiqhAeJPmkqAAAAAElFTkSuQmCC")}.bootstrap-table .fixed-table-container .table thead th .asc{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg==")}.bootstrap-table .fixed-table-container .table thead th .desc{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZUlEQVQ4y2NgGAWjYBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJzcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII= ")}.bootstrap-table .fixed-table-container .table tbody tr.selected td{background-color:rgba(0,0,0,.075)}.bootstrap-table .fixed-table-container .table tbody tr.no-records-found td{text-align:center}.bootstrap-table .fixed-table-container .table tbody tr .card-view{display:flex}.bootstrap-table .fixed-table-container .table tbody tr .card-view .card-view-title{font-weight:700;display:inline-block;min-width:30%;width:auto!important;text-align:left!important}.bootstrap-table .fixed-table-container .table tbody tr .card-view .card-view-value{width:100%!important}.bootstrap-table .fixed-table-container .table .bs-checkbox{text-align:center}.bootstrap-table .fixed-table-container .table .bs-checkbox label{margin-bottom:0}.bootstrap-table .fixed-table-container .table .bs-checkbox label input[type=checkbox],.bootstrap-table .fixed-table-container .table .bs-checkbox label input[type=radio]{margin:0 auto!important}.bootstrap-table .fixed-table-container .table.table-sm .th-inner{padding:.3rem}.bootstrap-table .fixed-table-container.fixed-height:not(.has-footer){border-bottom:1px solid #dee2e6}.bootstrap-table .fixed-table-container.fixed-height.has-card-view{border-top:1px solid #dee2e6;border-bottom:1px solid #dee2e6}.bootstrap-table .fixed-table-container.fixed-height .fixed-table-border{border-left:1px solid #dee2e6;border-right:1px solid #dee2e6}.bootstrap-table .fixed-table-container.fixed-height .table thead th{border-bottom:1px solid #dee2e6}.bootstrap-table .fixed-table-container.fixed-height .table-dark thead th{border-bottom:1px solid #32383e}.bootstrap-table .fixed-table-container .fixed-table-header{overflow:hidden}.bootstrap-table .fixed-table-container .fixed-table-body{overflow-x:auto;overflow-y:auto;height:100%}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading{align-items:center;background:#fff;display:flex;justify-content:center;position:absolute;bottom:0;width:100%;max-width:100%;z-index:1000;transition:visibility 0s,opacity .15s ease-in-out;opacity:0;visibility:hidden}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.open{visibility:visible;opacity:1}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap{align-items:baseline;display:flex;justify-content:center}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .loading-text{margin-right:6px}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap{align-items:center;display:flex;justify-content:center}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-dot,.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::after,.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::before{content:"";animation-duration:1.5s;animation-iteration-count:infinite;animation-name:LOADING;background:#212529;border-radius:50%;display:block;height:5px;margin:0 4px;opacity:0;width:5px}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-dot{animation-delay:.3s}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::after{animation-delay:.6s}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark{background:#212529}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-dot,.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-wrap::after,.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-wrap::before{background:#fff}.bootstrap-table .fixed-table-container .fixed-table-footer{overflow:hidden}.bootstrap-table .fixed-table-pagination::after{content:"";display:block;clear:both}.bootstrap-table .fixed-table-pagination>.pagination,.bootstrap-table .fixed-table-pagination>.pagination-detail{margin-top:10px;margin-bottom:10px}.bootstrap-table .fixed-table-pagination>.pagination-detail .pagination-info{line-height:34px;margin-right:5px}.bootstrap-table .fixed-table-pagination>.pagination-detail .page-list{display:inline-block}.bootstrap-table .fixed-table-pagination>.pagination-detail .page-list .btn-group{position:relative;display:inline-block;vertical-align:middle}.bootstrap-table .fixed-table-pagination>.pagination-detail .page-list .btn-group .dropdown-menu{margin-bottom:0}.bootstrap-table .fixed-table-pagination>.pagination ul.pagination{margin:0}.bootstrap-table .fixed-table-pagination>.pagination ul.pagination li.page-intermediate a{color:#c8c8c8}.bootstrap-table .fixed-table-pagination>.pagination ul.pagination li.page-intermediate a::before{content:'\2B05'}.bootstrap-table .fixed-table-pagination>.pagination ul.pagination li.page-intermediate a::after{content:'\27A1'}.bootstrap-table .fixed-table-pagination>.pagination ul.pagination li.disabled a{pointer-events:none;cursor:default}.bootstrap-table.fullscreen{position:fixed;top:0;left:0;z-index:1050;width:100%!important;background:#fff;height:calc(100vh);overflow-y:scroll}.bootstrap-table.bootstrap4 .pagination-lg .page-link,.bootstrap-table.bootstrap5 .pagination-lg .page-link{padding:.5rem 1rem}.bootstrap-table.bootstrap5 .float-left{float:left}.bootstrap-table.bootstrap5 .float-right{float:right}div.fixed-table-scroll-inner{width:100%;height:200px}div.fixed-table-scroll-outer{top:0;left:0;visibility:hidden;width:200px;height:150px;overflow:hidden}@keyframes LOADING{0%{opacity:0}50%{opacity:1}to{opacity:0}} |
New file |
| | |
| | | /** |
| | | * @author zhixin wen |
| | | * version: 1.22.6 |
| | | * https://github.com/wenzhixin/bootstrap-table/ |
| | | */ |
| | | !function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e(require("jquery")):"function"===typeof define&&define.amd?define(["jquery"],e):(t="undefined"!==typeof globalThis?globalThis:t||self,t.BootstrapTable=e(t.jQuery))}(this,function(t){"use strict";function e(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var a,i,n,o,s=[],l=!0,c=!1;try{if(n=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(a=n.call(r)).done)&&(s.push(a.value),s.length!==e);l=!0);}catch(t){c=!0,i=t}finally{try{if(!l&&null!=r["return"]&&(o=r["return"](),Object(o)!==o))return}finally{if(c)throw i}}return s}}function r(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var a=r.call(t,e||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function a(t){var e=r(t,"string");return"symbol"==typeof e?e:e+""}function i(t){"@babel/helpers - typeof";return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||false;i.configurable=true;if("value"in i)i.writable=true;Object.defineProperty(t,a(i.key),i)}}function s(t,e,r){if(e)o(t.prototype,e);if(r)o(t,r);Object.defineProperty(t,"prototype",{writable:false});return t}function l(t,r){return u(t)||e(t,r)||v(t,r)||g()}function c(t){return f(t)||h(t)||v(t)||p()}function f(t){if(Array.isArray(t))return d(t)}function u(t){if(Array.isArray(t))return t}function h(t){if("undefined"!==typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function v(t,e){if(!t)return;if("string"===typeof t)return d(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor)r=t.constructor.name;if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d(t,e)}function d(t,e){if(null==e||e>t.length)e=t.length;for(var r=0,a=new Array(e);r<e;r++)a[r]=t[r];return a}function p(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function g(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function b(t,e){var r="undefined"!==typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=v(t))||e&&t&&"number"===typeof t.length){if(r)t=r;var a=0;var i=function(){};return{s:i,n:function(){if(a>=t.length)return{done:true};return{done:false,value:t[a++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n=true,o=false,s;return{s:function(){r=r.call(t)},n:function(){var t=r.next();n=t.done;return t},e:function(t){o=true;s=t},f:function(){try{if(!n&&null!=r["return"])r["return"]()}finally{if(o)throw s}}}}var m="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{};var y=function(t){return t&&t.Math===Math&&t};var w=y("object"==typeof globalThis&&globalThis)||y("object"==typeof window&&window)||y("object"==typeof self&&self)||y("object"==typeof m&&m)||y("object"==typeof m&&m)||function(){return this}()||Function("return this")();var S={};var x=function(t){try{return!!t()}catch(e){return true}};var O=x;var k=!O(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]});var P=x;var C=!P(function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")});var T=C;var I=Function.prototype.call;var A=T?I.bind(I):function(){return I.apply(I,arguments)};var $={};var R={}.propertyIsEnumerable;var E=Object.getOwnPropertyDescriptor;var j=E&&!R.call({1:2},1);$.f=j?function ky(t){var e=E(this,t);return!!e&&e.enumerable}:R;var _=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}};var N=C;var F=Function.prototype;var D=F.call;var V=N&&F.bind.bind(D,D);var B=N?V:function(t){return function(){return D.apply(t,arguments)}};var L=B;var H=L({}.toString);var M=L("".slice);var U=function(t){return M(H(t),8,-1)};var z=B;var q=x;var G=U;var W=Object;var K=z("".split);var Y=q(function(){return!W("z").propertyIsEnumerable(0)})?function(t){return"String"===G(t)?K(t,""):W(t)}:W;var J=function(t){return null===t||void 0===t};var X=J;var Q=TypeError;var Z=function(t){if(X(t))throw new Q("Can't call method on "+t);return t};var tt=Y;var et=Z;var rt=function(t){return tt(et(t))};var at="object"==typeof document&&document.all;var it="undefined"==typeof at&&void 0!==at?function(t){return"function"==typeof t||t===at}:function(t){return"function"==typeof t};var nt=it;var ot=function(t){return"object"==typeof t?null!==t:nt(t)};var st=w;var lt=it;var ct=function(t){return lt(t)?t:void 0};var ft=function(t,e){return arguments.length<2?ct(st[t]):st[t]&&st[t][e]};var ut=B;var ht=ut({}.isPrototypeOf);var vt="undefined"!=typeof navigator&&String(navigator.userAgent)||"";var dt=w;var pt=vt;var gt=dt.process;var bt=dt.Deno;var mt=gt&>.versions||bt&&bt.version;var yt=mt&&mt.v8;var wt,St;if(yt){wt=yt.split(".");St=wt[0]>0&&wt[0]<4?1:+(wt[0]+wt[1])}if(!St&&pt){wt=pt.match(/Edge\/(\d+)/);if(!wt||wt[1]>=74){wt=pt.match(/Chrome\/(\d+)/);if(wt)St=+wt[1]}}var xt=St;var Ot=xt;var kt=x;var Pt=w;var Ct=Pt.String;var Tt=!!Object.getOwnPropertySymbols&&!kt(function(){var t=Symbol("symbol detection");return!Ct(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Ot&&Ot<41});var It=Tt;var At=It&&!Symbol.sham&&"symbol"==typeof Symbol.iterator;var $t=ft;var Rt=it;var Et=ht;var jt=At;var _t=Object;var Nt=jt?function(t){return"symbol"==typeof t}:function(t){var e=$t("Symbol");return Rt(e)&&Et(e.prototype,_t(t))};var Ft=String;var Dt=function(t){try{return Ft(t)}catch(e){return"Object"}};var Vt=it;var Bt=Dt;var Lt=TypeError;var Ht=function(t){if(Vt(t))return t;throw new Lt(Bt(t)+" is not a function")};var Mt=Ht;var Ut=J;var zt=function(t,e){var r=t[e];return Ut(r)?void 0:Mt(r)};var qt=A;var Gt=it;var Wt=ot;var Kt=TypeError;var Yt=function(t,e){var r,a;if("string"===e&&Gt(r=t.toString)&&!Wt(a=qt(r,t)))return a;if(Gt(r=t.valueOf)&&!Wt(a=qt(r,t)))return a;if("string"!==e&&Gt(r=t.toString)&&!Wt(a=qt(r,t)))return a;throw new Kt("Can't convert object to primitive value")};var Jt={exports:{}};var Xt=false;var Qt=w;var Zt=Object.defineProperty;var te=function(t,e){try{Zt(Qt,t,{value:e,configurable:true,writable:true})}catch(r){Qt[t]=e}return e};var ee=w;var re=te;var ae="__core-js_shared__";var ie=Jt.exports=ee[ae]||re(ae,{});(ie.versions||(ie.versions=[])).push({version:"3.36.1",mode:"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.36.1/LICENSE",source:"https://github.com/zloirock/core-js"});var ne=Jt.exports;var oe=ne;var se=function(t,e){return oe[t]||(oe[t]=e||{})};var le=Z;var ce=Object;var fe=function(t){return ce(le(t))};var ue=B;var he=fe;var ve=ue({}.hasOwnProperty);var de=Object.hasOwn||function Py(t,e){return ve(he(t),e)};var pe=B;var ge=0;var be=Math.random();var me=pe(1..toString);var ye=function(t){return"Symbol("+(void 0===t?"":t)+")_"+me(++ge+be,36)};var we=w;var Se=se;var xe=de;var Oe=ye;var ke=Tt;var Pe=At;var Ce=we.Symbol;var Te=Se("wks");var Ie=Pe?Ce["for"]||Ce:Ce&&Ce.withoutSetter||Oe;var Ae=function(t){if(!xe(Te,t))Te[t]=ke&&xe(Ce,t)?Ce[t]:Ie("Symbol."+t);return Te[t]};var $e=A;var Re=ot;var Ee=Nt;var je=zt;var _e=Yt;var Ne=Ae;var Fe=TypeError;var De=Ne("toPrimitive");var Ve=function(t,e){if(!Re(t)||Ee(t))return t;var r=je(t,De);var a;if(r){if(void 0===e)e="default";a=$e(r,t,e);if(!Re(a)||Ee(a))return a;throw new Fe("Can't convert object to primitive value")}if(void 0===e)e="number";return _e(t,e)};var Be=Ve;var Le=Nt;var He=function(t){var e=Be(t,"string");return Le(e)?e:e+""};var Me=w;var Ue=ot;var ze=Me.document;var qe=Ue(ze)&&Ue(ze.createElement);var Ge=function(t){return qe?ze.createElement(t):{}};var We=k;var Ke=x;var Ye=Ge;var Je=!We&&!Ke(function(){return 7!==Object.defineProperty(Ye("div"),"a",{get:function(){return 7}}).a});var Xe=k;var Qe=A;var Ze=$;var tr=_;var er=rt;var rr=He;var ar=de;var ir=Je;var nr=Object.getOwnPropertyDescriptor;S.f=Xe?nr:function Cy(t,e){t=er(t);e=rr(e);if(ir)try{return nr(t,e)}catch(r){}if(ar(t,e))return tr(!Qe(Ze.f,t,e),t[e])};var or={};var sr=k;var lr=x;var cr=sr&&lr(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:false}).prototype});var fr=ot;var ur=String;var hr=TypeError;var vr=function(t){if(fr(t))return t;throw new hr(ur(t)+" is not an object")};var dr=k;var pr=Je;var gr=cr;var br=vr;var mr=He;var yr=TypeError;var wr=Object.defineProperty;var Sr=Object.getOwnPropertyDescriptor;var xr="enumerable";var Or="configurable";var kr="writable";or.f=dr?gr?function Ty(t,e,r){br(t);e=mr(e);br(r);if("function"===typeof t&&"prototype"===e&&"value"in r&&kr in r&&!r[kr]){var a=Sr(t,e);if(a&&a[kr]){t[e]=r.value;r={configurable:Or in r?r[Or]:a[Or],enumerable:xr in r?r[xr]:a[xr],writable:false}}}return wr(t,e,r)}:wr:function Iy(t,e,r){br(t);e=mr(e);br(r);if(pr)try{return wr(t,e,r)}catch(a){}if("get"in r||"set"in r)throw new yr("Accessors not supported");if("value"in r)t[e]=r.value;return t};var Pr=k;var Cr=or;var Tr=_;var Ir=Pr?function(t,e,r){return Cr.f(t,e,Tr(1,r))}:function(t,e,r){t[e]=r;return t};var Ar={exports:{}};var $r=k;var Rr=de;var Er=Function.prototype;var jr=$r&&Object.getOwnPropertyDescriptor;var _r=Rr(Er,"name");var Nr=_r&&"something"===function Ay(){}.name;var Fr=_r&&(!$r||$r&&jr(Er,"name").configurable);var Dr={EXISTS:_r,PROPER:Nr,CONFIGURABLE:Fr};var Vr=B;var Br=it;var Lr=ne;var Hr=Vr(Function.toString);if(!Br(Lr.inspectSource))Lr.inspectSource=function(t){return Hr(t)};var Mr=Lr.inspectSource;var Ur=w;var zr=it;var qr=Ur.WeakMap;var Gr=zr(qr)&&/native code/.test(String(qr));var Wr=se;var Kr=ye;var Yr=Wr("keys");var Jr=function(t){return Yr[t]||(Yr[t]=Kr(t))};var Xr={};var Qr=Gr;var Zr=w;var ta=ot;var ea=Ir;var ra=de;var aa=ne;var ia=Jr;var na=Xr;var oa="Object already initialized";var sa=Zr.TypeError;var la=Zr.WeakMap;var ca,fa,ua;var ha=function(t){return ua(t)?fa(t):ca(t,{})};var va=function(t){return function(e){var r;if(!ta(e)||(r=fa(e)).type!==t)throw new sa("Incompatible receiver, "+t+" required");return r}};if(Qr||aa.state){var da=aa.state||(aa.state=new la);da.get=da.get;da.has=da.has;da.set=da.set;ca=function(t,e){if(da.has(t))throw new sa(oa);e.facade=t;da.set(t,e);return e};fa=function(t){return da.get(t)||{}};ua=function(t){return da.has(t)}}else{var pa=ia("state");na[pa]=true;ca=function(t,e){if(ra(t,pa))throw new sa(oa);e.facade=t;ea(t,pa,e);return e};fa=function(t){return ra(t,pa)?t[pa]:{}};ua=function(t){return ra(t,pa)}}var ga={set:ca,get:fa,has:ua,enforce:ha,getterFor:va};var ba=B;var ma=x;var ya=it;var wa=de;var Sa=k;var xa=Dr.CONFIGURABLE;var Oa=Mr;var ka=ga;var Pa=ka.enforce;var Ca=ka.get;var Ta=String;var Ia=Object.defineProperty;var Aa=ba("".slice);var $a=ba("".replace);var Ra=ba([].join);var Ea=Sa&&!ma(function(){return 8!==Ia(function(){},"length",{value:8}).length});var ja=String(String).split("String");var _a=Ar.exports=function(t,e,r){if("Symbol("===Aa(Ta(e),0,7))e="["+$a(Ta(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]";if(r&&r.getter)e="get "+e;if(r&&r.setter)e="set "+e;if(!wa(t,"name")||xa&&t.name!==e)if(Sa)Ia(t,"name",{value:e,configurable:true});else t.name=e;if(Ea&&r&&wa(r,"arity")&&t.length!==r.arity)Ia(t,"length",{value:r.arity});try{if(r&&wa(r,"constructor")&&r.constructor){if(Sa)Ia(t,"prototype",{writable:false})}else if(t.prototype)t.prototype=void 0}catch(a){}var i=Pa(t);if(!wa(i,"source"))i.source=Ra(ja,"string"==typeof e?e:"");return t};Function.prototype.toString=_a(function $y(){return ya(this)&&Ca(this).source||Oa(this)},"toString");var Na=Ar.exports;var Fa=it;var Da=or;var Va=Na;var Ba=te;var La=function(t,e,r,a){if(!a)a={};var i=a.enumerable;var n=void 0!==a.name?a.name:e;if(Fa(r))Va(r,n,a);if(a.global)if(i)t[e]=r;else Ba(e,r);else{try{if(!a.unsafe)delete t[e];else if(t[e])i=true}catch(o){}if(i)t[e]=r;else Da.f(t,e,{value:r,enumerable:false,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return t};var Ha={};var Ma=Math.ceil;var Ua=Math.floor;var za=Math.trunc||function Ry(t){var e=+t;return(e>0?Ua:Ma)(e)};var qa=za;var Ga=function(t){var e=+t;return e!==e||0===e?0:qa(e)};var Wa=Ga;var Ka=Math.max;var Ya=Math.min;var Ja=function(t,e){var r=Wa(t);return r<0?Ka(r+e,0):Ya(r,e)};var Xa=Ga;var Qa=Math.min;var Za=function(t){var e=Xa(t);return e>0?Qa(e,9007199254740991):0};var ti=Za;var ei=function(t){return ti(t.length)};var ri=rt;var ai=Ja;var ii=ei;var ni=function(t){return function(e,r,a){var i=ri(e);var n=ii(i);if(0===n)return!t&&-1;var o=ai(a,n);var s;if(t&&r!==r)while(n>o){s=i[o++];if(s!==s)return true}else for(;n>o;o++)if((t||o in i)&&i[o]===r)return t||o||0;return!t&&-1}};var oi={includes:ni(true),indexOf:ni(false)};var si=B;var li=de;var ci=rt;var fi=oi.indexOf;var ui=Xr;var hi=si([].push);var vi=function(t,e){var r=ci(t);var a=0;var i=[];var n;for(n in r)!li(ui,n)&&li(r,n)&&hi(i,n);while(e.length>a)if(li(r,n=e[a++]))~fi(i,n)||hi(i,n);return i};var di=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"];var pi=vi;var gi=di;var bi=gi.concat("length","prototype");Ha.f=Object.getOwnPropertyNames||function Ey(t){return pi(t,bi)};var mi={};mi.f=Object.getOwnPropertySymbols;var yi=ft;var wi=B;var Si=Ha;var xi=mi;var Oi=vr;var ki=wi([].concat);var Pi=yi("Reflect","ownKeys")||function jy(t){var e=Si.f(Oi(t));var r=xi.f;return r?ki(e,r(t)):e};var Ci=de;var Ti=Pi;var Ii=S;var Ai=or;var $i=function(t,e,r){var a=Ti(e);var i=Ai.f;var n=Ii.f;for(var o=0;o<a.length;o++){var s=a[o];if(!Ci(t,s)&&!(r&&Ci(r,s)))i(t,s,n(e,s))}};var Ri=x;var Ei=it;var ji=/#|\.prototype\./;var _i=function(t,e){var r=Fi[Ni(t)];return r===Vi?true:r===Di?false:Ei(e)?Ri(e):!!e};var Ni=_i.normalize=function(t){return String(t).replace(ji,".").toLowerCase()};var Fi=_i.data={};var Di=_i.NATIVE="N";var Vi=_i.POLYFILL="P";var Bi=_i;var Li=w;var Hi=S.f;var Mi=Ir;var Ui=La;var zi=te;var qi=$i;var Gi=Bi;var Wi=function(t,e){var r=t.target;var a=t.global;var i=t.stat;var n,o,s,l,c,f;if(a)o=Li;else if(i)o=Li[r]||zi(r,{});else o=Li[r]&&Li[r].prototype;if(o)for(s in e){c=e[s];if(t.dontCallGetSet){f=Hi(o,s);l=f&&f.value}else l=o[s];n=Gi(a?s:r+(i?".":"#")+s,t.forced);if(!n&&void 0!==l){if(typeof c==typeof l)continue;qi(c,l)}if(t.sham||l&&l.sham)Mi(c,"sham",true);Ui(o,s,c,t)}};var Ki=U;var Yi=Array.isArray||function _y(t){return"Array"===Ki(t)};var Ji=TypeError;var Xi=9007199254740991;var Qi=function(t){if(t>Xi)throw Ji("Maximum allowed index exceeded");return t};var Zi=k;var tn=or;var en=_;var rn=function(t,e,r){if(Zi)tn.f(t,e,en(0,r));else t[e]=r};var an=Ae;var nn=an("toStringTag");var on={};on[nn]="z";var sn="[object z]"===String(on);var ln=sn;var cn=it;var fn=U;var un=Ae;var hn=un("toStringTag");var vn=Object;var dn="Arguments"===fn(function(){return arguments}());var pn=function(t,e){try{return t[e]}catch(r){}};var gn=ln?fn:function(t){var e,r,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=pn(e=vn(t),hn))?r:dn?fn(e):"Object"===(a=fn(e))&&cn(e.callee)?"Arguments":a};var bn=B;var mn=x;var yn=it;var wn=gn;var Sn=ft;var xn=Mr;var On=function(){};var kn=Sn("Reflect","construct");var Pn=/^\s*(?:class|function)\b/;var Cn=bn(Pn.exec);var Tn=!Pn.test(On);var In=function Ny(t){if(!yn(t))return false;try{kn(On,[],t);return true}catch(e){return false}};var An=function Fy(t){if(!yn(t))return false;switch(wn(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return false}try{return Tn||!!Cn(Pn,xn(t))}catch(e){return true}};An.sham=true;var $n=!kn||mn(function(){var t;return In(In.call)||!In(Object)||!In(function(){t=true})||t})?An:In;var Rn=Yi;var En=$n;var jn=ot;var _n=Ae;var Nn=_n("species");var Fn=Array;var Dn=function(t){var e;if(Rn(t)){e=t.constructor;if(En(e)&&(e===Fn||Rn(e.prototype)))e=void 0;else if(jn(e)){e=e[Nn];if(null===e)e=void 0}}return void 0===e?Fn:e};var Vn=Dn;var Bn=function(t,e){return new(Vn(t))(0===e?0:e)};var Ln=x;var Hn=Ae;var Mn=xt;var Un=Hn("species");var zn=function(t){return Mn>=51||!Ln(function(){var e=[];var r=e.constructor={};r[Un]=function(){return{foo:1}};return 1!==e[t](Boolean).foo})};var qn=Wi;var Gn=x;var Wn=Yi;var Kn=ot;var Yn=fe;var Jn=ei;var Xn=Qi;var Qn=rn;var Zn=Bn;var to=zn;var eo=Ae;var ro=xt;var ao=eo("isConcatSpreadable");var io=ro>=51||!Gn(function(){var t=[];t[ao]=false;return t.concat()[0]!==t});var no=function(t){if(!Kn(t))return false;var e=t[ao];return void 0!==e?!!e:Wn(t)};var oo=!io||!to("concat");qn({target:"Array",proto:true,arity:1,forced:oo},{concat:function Dy(t){var e=Yn(this);var r=Zn(e,0);var a=0;var i,n,o,s,l;for(i=-1,o=arguments.length;i<o;i++){l=i===-1?e:arguments[i];if(no(l)){s=Jn(l);Xn(a+s);for(n=0;n<s;n++,a++)if(n in l)Qn(r,a,l[n])}else{Xn(a+1);Qn(r,a++,l)}}r.length=a;return r}});var so=U;var lo=B;var co=function(t){if("Function"===so(t))return lo(t)};var fo=co;var uo=Ht;var ho=C;var vo=fo(fo.bind);var po=function(t,e){uo(t);return void 0===e?t:ho?vo(t,e):function(){return t.apply(e,arguments)}};var go=po;var bo=B;var mo=Y;var yo=fe;var wo=ei;var So=Bn;var xo=bo([].push);var Oo=function(t){var e=1===t;var r=2===t;var a=3===t;var i=4===t;var n=6===t;var o=7===t;var s=5===t||n;return function(l,c,f,u){var h=yo(l);var v=mo(h);var d=wo(v);var p=go(c,f);var g=0;var b=u||So;var m=e?b(l,d):r||o?b(l,0):void 0;var y,w;for(;d>g;g++)if(s||g in v){y=v[g];w=p(y,g,h);if(t)if(e)m[g]=w;else if(w)switch(t){case 3:return true;case 5:return y;case 6:return g;case 2:xo(m,y)}else switch(t){case 4:return false;case 7:xo(m,y)}}return n?-1:a||i?i:m}};var ko={forEach:Oo(0),map:Oo(1),filter:Oo(2),some:Oo(3),every:Oo(4),find:Oo(5),findIndex:Oo(6),filterReject:Oo(7)};var Po=Wi;var Co=ko.filter;var To=zn;var Io=To("filter");Po({target:"Array",proto:true,forced:!Io},{filter:function Vy(t){return Co(this,t,arguments.length>1?arguments[1]:void 0)}});var Ao={};var $o=vi;var Ro=di;var Eo=Object.keys||function By(t){return $o(t,Ro)};var jo=k;var _o=cr;var No=or;var Fo=vr;var Do=rt;var Vo=Eo;Ao.f=jo&&!_o?Object.defineProperties:function Ly(t,e){Fo(t);var r=Do(e);var a=Vo(e);var i=a.length;var n=0;var o;while(i>n)No.f(t,o=a[n++],r[o]);return t};var Bo=ft;var Lo=Bo("document","documentElement");var Ho=vr;var Mo=Ao;var Uo=di;var zo=Xr;var qo=Lo;var Go=Ge;var Wo=Jr;var Ko=">";var Yo="<";var Jo="prototype";var Xo="script";var Qo=Wo("IE_PROTO");var Zo=function(){};var ts=function(t){return Yo+Xo+Ko+t+Yo+"/"+Xo+Ko};var es=function(t){t.write(ts(""));t.close();var e=t.parentWindow.Object;t=null;return e};var rs=function(){var t=Go("iframe");var e="java"+Xo+":";var r;t.style.display="none";qo.appendChild(t);t.src=String(e);r=t.contentWindow.document;r.open();r.write(ts("document.F=Object"));r.close();return r.F};var as;var is=function(){try{as=new ActiveXObject("htmlfile")}catch(t){}is="undefined"!=typeof document?document.domain&&as?es(as):rs():es(as);var e=Uo.length;while(e--)delete is[Jo][Uo[e]];return is()};zo[Qo]=true;var ns=Object.create||function Hy(t,e){var r;if(null!==t){Zo[Jo]=Ho(t);r=new Zo;Zo[Jo]=null;r[Qo]=t}else r=is();return void 0===e?r:Mo.f(r,e)};var os=Ae;var ss=ns;var ls=or.f;var cs=os("unscopables");var fs=Array.prototype;if(void 0===fs[cs])ls(fs,cs,{configurable:true,value:ss(null)});var us=function(t){fs[cs][t]=true};var hs=Wi;var vs=ko.find;var ds=us;var ps="find";var gs=true;if(ps in[])Array(1)[ps](function(){gs=false});hs({target:"Array",proto:true,forced:gs},{find:function My(t){return vs(this,t,arguments.length>1?arguments[1]:void 0)}});ds(ps);var bs=Wi;var ms=ko.findIndex;var ys=us;var ws="findIndex";var Ss=true;if(ws in[])Array(1)[ws](function(){Ss=false});bs({target:"Array",proto:true,forced:Ss},{findIndex:function Uy(t){return ms(this,t,arguments.length>1?arguments[1]:void 0)}});ys(ws);var xs=Wi;var Os=oi.includes;var ks=x;var Ps=us;var Cs=ks(function(){return!Array(1).includes()});xs({target:"Array",proto:true,forced:Cs},{includes:function zy(t){return Os(this,t,arguments.length>1?arguments[1]:void 0)}});Ps("includes");var Ts=x;var Is=function(t,e){var r=[][t];return!!r&&Ts(function(){r.call(null,e||function(){return 1},1)})};var As=Wi;var $s=co;var Rs=oi.indexOf;var Es=Is;var js=$s([].indexOf);var _s=!!js&&1/js([1],1,-0)<0;var Ns=_s||!Es("indexOf");As({target:"Array",proto:true,forced:Ns},{indexOf:function qy(t){var e=arguments.length>1?arguments[1]:void 0;return _s?js(this,t,e)||0:Rs(this,t,e)}});var Fs={};var Ds=x;var Vs=!Ds(function(){function t(){}t.prototype.constructor=null;return Object.getPrototypeOf(new t)!==t.prototype});var Bs=de;var Ls=it;var Hs=fe;var Ms=Jr;var Us=Vs;var zs=Ms("IE_PROTO");var qs=Object;var Gs=qs.prototype;var Ws=Us?qs.getPrototypeOf:function(t){var e=Hs(t);if(Bs(e,zs))return e[zs];var r=e.constructor;if(Ls(r)&&e instanceof r)return r.prototype;return e instanceof qs?Gs:null};var Ks=x;var Ys=it;var Js=ot;var Xs=Ws;var Qs=La;var Zs=Ae;var tl=Zs("iterator");var el=false;var rl,al,il;if([].keys){il=[].keys();if(!("next"in il))el=true;else{al=Xs(Xs(il));if(al!==Object.prototype)rl=al}}var nl=!Js(rl)||Ks(function(){var t={};return rl[tl].call(t)!==t});if(nl)rl={};if(!Ys(rl[tl]))Qs(rl,tl,function(){return this});var ol={IteratorPrototype:rl,BUGGY_SAFARI_ITERATORS:el};var sl=or.f;var ll=de;var cl=Ae;var fl=cl("toStringTag");var ul=function(t,e,r){if(t&&!r)t=t.prototype;if(t&&!ll(t,fl))sl(t,fl,{configurable:true,value:e})};var hl=ol.IteratorPrototype;var vl=ns;var dl=_;var pl=ul;var gl=Fs;var bl=function(){return this};var ml=function(t,e,r,a){var i=e+" Iterator";t.prototype=vl(hl,{next:dl(+!a,r)});pl(t,i,false);gl[i]=bl;return t};var yl=B;var wl=Ht;var Sl=function(t,e,r){try{return yl(wl(Object.getOwnPropertyDescriptor(t,e)[r]))}catch(a){}};var xl=ot;var Ol=function(t){return xl(t)||null===t};var kl=Ol;var Pl=String;var Cl=TypeError;var Tl=function(t){if(kl(t))return t;throw new Cl("Can't set "+Pl(t)+" as a prototype")};var Il=Sl;var Al=ot;var $l=Z;var Rl=Tl;var El=Object.setPrototypeOf||("__proto__"in{}?function(){var t=false;var e={};var r;try{r=Il(Object.prototype,"__proto__","set");r(e,[]);t=e instanceof Array}catch(a){}return function i(e,a){$l(e);Rl(a);if(!Al(e))return e;if(t)r(e,a);else e.__proto__=a;return e}}():void 0);var jl=Wi;var _l=A;var Nl=Dr;var Fl=it;var Dl=ml;var Vl=Ws;var Bl=El;var Ll=ul;var Hl=Ir;var Ml=La;var Ul=Ae;var zl=Fs;var ql=ol;var Gl=Nl.PROPER;var Wl=Nl.CONFIGURABLE;var Kl=ql.IteratorPrototype;var Yl=ql.BUGGY_SAFARI_ITERATORS;var Jl=Ul("iterator");var Xl="keys";var Ql="values";var Zl="entries";var tc=function(){return this};var ec=function(t,e,r,a,i,n,o){Dl(r,e,a);var s=function(t){if(t===i&&h)return h;if(!Yl&&t&&t in f)return f[t];switch(t){case Xl:return function e(){return new r(this,t)};case Ql:return function a(){return new r(this,t)};case Zl:return function n(){return new r(this,t)}}return function(){return new r(this)}};var l=e+" Iterator";var c=false;var f=t.prototype;var u=f[Jl]||f["@@iterator"]||i&&f[i];var h=!Yl&&u||s(i);var v="Array"===e?f.entries||u:u;var d,p,g;if(v){d=Vl(v.call(new t));if(d!==Object.prototype&&d.next){if(Vl(d)!==Kl)if(Bl)Bl(d,Kl);else if(!Fl(d[Jl]))Ml(d,Jl,tc);Ll(d,l,true)}}if(Gl&&i===Ql&&u&&u.name!==Ql)if(Wl)Hl(f,"name",Ql);else{c=true;h=function b(){return _l(u,this)}}if(i){p={values:s(Ql),keys:n?h:s(Xl),entries:s(Zl)};if(o){for(g in p)if(Yl||c||!(g in f))Ml(f,g,p[g])}else jl({target:e,proto:true,forced:Yl||c},p)}if(f[Jl]!==h)Ml(f,Jl,h,{name:i});zl[e]=h;return p};var rc=function(t,e){return{value:t,done:e}};var ac=rt;var ic=us;var nc=Fs;var oc=ga;var sc=or.f;var lc=ec;var cc=rc;var fc=k;var uc="Array Iterator";var hc=oc.set;var vc=oc.getterFor(uc);var dc=lc(Array,"Array",function(t,e){hc(this,{type:uc,target:ac(t),index:0,kind:e})},function(){var t=vc(this);var e=t.target;var r=t.index++;if(!e||r>=e.length){t.target=void 0;return cc(void 0,true)}switch(t.kind){case"keys":return cc(r,false);case"values":return cc(e[r],false)}return cc([r,e[r]],false)},"values");var pc=nc.Arguments=nc.Array;ic("keys");ic("values");ic("entries");if(fc&&"values"!==pc.name)try{sc(pc,"name",{value:"values"})}catch(gc){}var bc=Wi;var mc=B;var yc=Y;var wc=rt;var Sc=Is;var xc=mc([].join);var Oc=yc!==Object;var kc=Oc||!Sc("join",",");bc({target:"Array",proto:true,forced:kc},{join:function Gy(t){return xc(wc(this),void 0===t?",":t)}});var Pc=Wi;var Cc=ko.map;var Tc=zn;var Ic=Tc("map");Pc({target:"Array",proto:true,forced:!Ic},{map:function Wy(t){return Cc(this,t,arguments.length>1?arguments[1]:void 0)}});var Ac=Wi;var $c=B;var Rc=Yi;var Ec=$c([].reverse);var jc=[1,2];Ac({target:"Array",proto:true,forced:String(jc)===String(jc.reverse())},{reverse:function Ky(){if(Rc(this))this.length=this.length;return Ec(this)}});var _c=B;var Nc=_c([].slice);var Fc=Wi;var Dc=Yi;var Vc=$n;var Bc=ot;var Lc=Ja;var Hc=ei;var Mc=rt;var Uc=rn;var zc=Ae;var qc=zn;var Gc=Nc;var Wc=qc("slice");var Kc=zc("species");var Yc=Array;var Jc=Math.max;Fc({target:"Array",proto:true,forced:!Wc},{slice:function Yy(t,e){var r=Mc(this);var a=Hc(r);var i=Lc(t,a);var n=Lc(void 0===e?a:e,a);var o,s,l;if(Dc(r)){o=r.constructor;if(Vc(o)&&(o===Yc||Dc(o.prototype)))o=void 0;else if(Bc(o)){o=o[Kc];if(null===o)o=void 0}if(o===Yc||void 0===o)return Gc(r,i,n)}s=new(void 0===o?Yc:o)(Jc(n-i,0));for(l=0;i<n;i++,l++)if(i in r)Uc(s,l,r[i]);s.length=l;return s}});var Xc=Dt;var Qc=TypeError;var Zc=function(t,e){if(!delete t[e])throw new Qc("Cannot delete property "+Xc(e)+" of "+Xc(t))};var tf=gn;var ef=String;var rf=function(t){if("Symbol"===tf(t))throw new TypeError("Cannot convert a Symbol value to a string");return ef(t)};var af=Nc;var nf=Math.floor;var of=function(t,e){var r=t.length;if(r<8){var a=1;var i,n;while(a<r){n=a;i=t[a];while(n&&e(t[n-1],i)>0)t[n]=t[--n];if(n!==a++)t[n]=i}}else{var o=nf(r/2);var s=of(af(t,0,o),e);var l=of(af(t,o),e);var c=s.length;var f=l.length;var u=0;var h=0;while(u<c||h<f)t[u+h]=u<c&&h<f?e(s[u],l[h])<=0?s[u++]:l[h++]:u<c?s[u++]:l[h++]}return t};var sf=of;var lf=vt;var cf=lf.match(/firefox\/(\d+)/i);var ff=!!cf&&+cf[1];var uf=vt;var hf=/MSIE|Trident/.test(uf);var vf=vt;var df=vf.match(/AppleWebKit\/(\d+)\./);var pf=!!df&&+df[1];var gf=Wi;var bf=B;var mf=Ht;var yf=fe;var wf=ei;var Sf=Zc;var xf=rf;var Of=x;var kf=sf;var Pf=Is;var Cf=ff;var Tf=hf;var If=xt;var Af=pf;var $f=[];var Rf=bf($f.sort);var Ef=bf($f.push);var jf=Of(function(){$f.sort(void 0)});var _f=Of(function(){$f.sort(null)});var Nf=Pf("sort");var Ff=!Of(function(){if(If)return If<70;if(Cf&&Cf>3)return;if(Tf)return true;if(Af)return Af<603;var t="";var e,r,a,i;for(e=65;e<76;e++){r=String.fromCharCode(e);switch(e){case 66:case 69:case 70:case 72:a=3;break;case 68:case 71:a=4;break;default:a=2}for(i=0;i<47;i++)$f.push({k:r+i,v:a})}$f.sort(function(t,e){return e.v-t.v});for(i=0;i<$f.length;i++){r=$f[i].k.charAt(0);if(t.charAt(t.length-1)!==r)t+=r}return"DGBEFHACIJK"!==t});var Df=jf||!_f||!Nf||!Ff;var Vf=function(t){return function(e,r){if(void 0===r)return-1;if(void 0===e)return 1;if(void 0!==t)return+t(e,r)||0;return xf(e)>xf(r)?1:-1}};gf({target:"Array",proto:true,forced:Df},{sort:function Jy(t){if(void 0!==t)mf(t);var e=yf(this);if(Ff)return void 0===t?Rf(e):Rf(e,t);var r=[];var a=wf(e);var i,n;for(n=0;n<a;n++)if(n in e)Ef(r,e[n]);kf(r,Vf(t));i=wf(r);n=0;while(n<i)e[n]=r[n++];while(n<a)Sf(e,n++);return e}});var Bf=k;var Lf=Yi;var Hf=TypeError;var Mf=Object.getOwnPropertyDescriptor;var Uf=Bf&&!function(){if(void 0!==this)return true;try{Object.defineProperty([],"length",{writable:false}).length=1}catch(t){return t instanceof TypeError}}();var zf=Uf?function(t,e){if(Lf(t)&&!Mf(t,"length").writable)throw new Hf("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e};var qf=Wi;var Gf=fe;var Wf=Ja;var Kf=Ga;var Yf=ei;var Jf=zf;var Xf=Qi;var Qf=Bn;var Zf=rn;var tu=Zc;var eu=zn;var ru=eu("splice");var au=Math.max;var iu=Math.min;qf({target:"Array",proto:true,forced:!ru},{splice:function Xy(t,e){var r=Gf(this);var a=Yf(r);var i=Wf(t,a);var n=arguments.length;var o,s,l,c,f,u;if(0===n)o=s=0;else if(1===n){o=0;s=a-i}else{o=n-2;s=iu(au(Kf(e),0),a-i)}Xf(a+o-s);l=Qf(r,s);for(c=0;c<s;c++){f=i+c;if(f in r)Zf(l,c,r[f])}l.length=s;if(o<s){for(c=i;c<a-s;c++){f=c+s;u=c+o;if(f in r)r[u]=r[f];else tu(r,u)}for(c=a;c>a-s+o;c--)tu(r,c-1)}else if(o>s)for(c=a-s;c>i;c--){f=c+s-1;u=c+o-1;if(f in r)r[u]=r[f];else tu(r,u)}for(c=0;c<o;c++)r[c+i]=arguments[c+2];Jf(r,a-s+o);return l}});var nu=Wi;var ou=x;var su=fe;var lu=Ve;var cu=ou(function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})});nu({target:"Date",proto:true,arity:1,forced:cu},{toJSON:function Qy(t){var e=su(this);var r=lu(e,"number");return"number"==typeof r&&!isFinite(r)?null:e.toISOString()}});var fu=w;var uu=fu;var hu=it;var vu=ot;var du=El;var pu=function(t,e,r){var a,i;if(du&&hu(a=e.constructor)&&a!==r&&vu(i=a.prototype)&&i!==r.prototype)du(t,i);return t};var gu=B;var bu=gu(1..valueOf);var mu="\t\n\v\f\r "+" \u2028\u2029\ufeff";var yu=B;var wu=Z;var Su=rf;var xu=mu;var Ou=yu("".replace);var ku=RegExp("^["+xu+"]+");var Pu=RegExp("(^|[^"+xu+"])["+xu+"]+$");var Cu=function(t){return function(e){var r=Su(wu(e));if(1&t)r=Ou(r,ku,"");if(2&t)r=Ou(r,Pu,"$1");return r}};var Tu={start:Cu(1),end:Cu(2),trim:Cu(3)};var Iu=Wi;var Au=Xt;var $u=k;var Ru=w;var Eu=uu;var ju=B;var _u=Bi;var Nu=de;var Fu=pu;var Du=ht;var Vu=Nt;var Bu=Ve;var Lu=x;var Hu=Ha.f;var Mu=S.f;var Uu=or.f;var zu=bu;var qu=Tu.trim;var Gu="Number";var Wu=Ru[Gu];Eu[Gu];var Ku=Wu.prototype;var Yu=Ru.TypeError;var Ju=ju("".slice);var Xu=ju("".charCodeAt);var Qu=function(t){var e=Bu(t,"number");return"bigint"==typeof e?e:Zu(e)};var Zu=function(t){var e=Bu(t,"number");var r,a,i,n,o,s,l,c;if(Vu(e))throw new Yu("Cannot convert a Symbol value to a number");if("string"==typeof e&&e.length>2){e=qu(e);r=Xu(e,0);if(43===r||45===r){a=Xu(e,2);if(88===a||120===a)return NaN}else if(48===r){switch(Xu(e,1)){case 66:case 98:i=2;n=49;break;case 79:case 111:i=8;n=55;break;default:return+e}o=Ju(e,2);s=o.length;for(l=0;l<s;l++){c=Xu(o,l);if(c<48||c>n)return NaN}return parseInt(o,i)}}return+e};var th=_u(Gu,!Wu(" 0o1")||!Wu("0b1")||Wu("+0x1"));var eh=function(t){return Du(Ku,t)&&Lu(function(){zu(t)})};var rh=function Zy(t){var e=arguments.length<1?0:Wu(Qu(t));return eh(this)?Fu(Object(e),this,rh):e};rh.prototype=Ku;if(th&&!Au)Ku.constructor=rh;Iu({global:true,constructor:true,wrap:true,forced:th},{Number:rh});var ah=function(t,e){for(var r=$u?Hu(e):("MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,"+"EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,"+"fromString,range").split(","),a=0,i;r.length>a;a++)if(Nu(e,i=r[a])&&!Nu(t,i))Uu(t,i,Mu(e,i))};if(th||Au)ah(Eu[Gu],Wu);var ih=k;var nh=B;var oh=A;var sh=x;var lh=Eo;var ch=mi;var fh=$;var uh=fe;var hh=Y;var vh=Object.assign;var dh=Object.defineProperty;var ph=nh([].concat);var gh=!vh||sh(function(){if(ih&&1!==vh({b:1},vh(dh({},"a",{enumerable:true,get:function(){dh(this,"b",{value:3,enumerable:false})}}),{b:2})).b)return true;var t={};var e={};var r=Symbol("assign detection");var a="abcdefghijklmnopqrst";t[r]=7;a.split("").forEach(function(t){e[t]=t});return 7!==vh({},t)[r]||lh(vh({},e)).join("")!==a})?function tw(t,e){var r=uh(t);var a=arguments.length;var i=1;var n=ch.f;var o=fh.f;while(a>i){var s=hh(arguments[i++]);var l=n?ph(lh(s),n(s)):lh(s);var c=l.length;var f=0;var u;while(c>f){u=l[f++];if(!ih||oh(o,s,u))r[u]=s[u]}}return r}:vh;var bh=Wi;var mh=gh;bh({target:"Object",stat:true,arity:2,forced:Object.assign!==mh},{assign:mh});var yh=k;var wh=x;var Sh=B;var xh=Ws;var Oh=Eo;var kh=rt;var Ph=$.f;var Ch=Sh(Ph);var Th=Sh([].push);var Ih=yh&&wh(function(){var t=Object.create(null);t[2]=2;return!Ch(t,2)});var Ah=function(t){return function(e){var r=kh(e);var a=Oh(r);var i=Ih&&null===xh(r);var n=a.length;var o=0;var s=[];var l;while(n>o){l=a[o++];if(!yh||(i?l in r:Ch(r,l)))Th(s,t?[l,r[l]]:r[l])}return s}};var $h={entries:Ah(true),values:Ah(false)};var Rh=Wi;var Eh=$h.entries;Rh({target:"Object",stat:true},{entries:function ew(t){return Eh(t)}});var jh=Wi;var _h=fe;var Nh=Eo;var Fh=x;var Dh=Fh(function(){Nh(1)});jh({target:"Object",stat:true,forced:Dh},{keys:function rw(t){return Nh(_h(t))}});var Vh=sn;var Bh=gn;var Lh=Vh?{}.toString:function aw(){return"[object "+Bh(this)+"]"};var Hh=sn;var Mh=La;var Uh=Lh;if(!Hh)Mh(Object.prototype,"toString",Uh,{unsafe:true});var zh=w;var qh=x;var Gh=B;var Wh=rf;var Kh=Tu.trim;var Yh=mu;var Jh=Gh("".charAt);var Xh=zh.parseFloat;var Qh=zh.Symbol;var Zh=Qh&&Qh.iterator;var tv=1/Xh(Yh+"-0")!==-(1/0)||Zh&&!qh(function(){Xh(Object(Zh))});var ev=tv?function iw(t){var e=Kh(Wh(t));var r=Xh(e);return 0===r&&"-"===Jh(e,0)?-0:r}:Xh;var rv=Wi;var av=ev;rv({global:true,forced:parseFloat!==av},{parseFloat:av});var iv=w;var nv=x;var ov=B;var sv=rf;var lv=Tu.trim;var cv=mu;var fv=iv.parseInt;var uv=iv.Symbol;var hv=uv&&uv.iterator;var vv=/^[+-]?0x/i;var dv=ov(vv.exec);var pv=8!==fv(cv+"08")||22!==fv(cv+"0x16")||hv&&!nv(function(){fv(Object(hv))});var gv=pv?function nw(t,e){var r=lv(sv(t));return fv(r,e>>>0||(dv(vv,r)?16:10))}:fv;var bv=Wi;var mv=gv;bv({global:true,forced:parseInt!==mv},{parseInt:mv});var yv=ot;var wv=U;var Sv=Ae;var xv=Sv("match");var Ov=function(t){var e;return yv(t)&&(void 0!==(e=t[xv])?!!e:"RegExp"===wv(t))};var kv=vr;var Pv=function(){var t=kv(this);var e="";if(t.hasIndices)e+="d";if(t.global)e+="g";if(t.ignoreCase)e+="i";if(t.multiline)e+="m";if(t.dotAll)e+="s";if(t.unicode)e+="u";if(t.unicodeSets)e+="v";if(t.sticky)e+="y";return e};var Cv=A;var Tv=de;var Iv=ht;var Av=Pv;var $v=RegExp.prototype;var Rv=function(t){var e=t.flags;return void 0===e&&!("flags"in $v)&&!Tv(t,"flags")&&Iv($v,t)?Cv(Av,t):e};var Ev=x;var jv=w;var _v=jv.RegExp;var Nv=Ev(function(){var t=_v("a","y");t.lastIndex=2;return null!==t.exec("abcd")});var Fv=Nv||Ev(function(){return!_v("a","y").sticky});var Dv=Nv||Ev(function(){var t=_v("^r","gy");t.lastIndex=2;return null!==t.exec("str")});var Vv={BROKEN_CARET:Dv,MISSED_STICKY:Fv,UNSUPPORTED_Y:Nv};var Bv=or.f;var Lv=function(t,e,r){r in t||Bv(t,r,{configurable:true,get:function(){return e[r]},set:function(t){e[r]=t}})};var Hv=Na;var Mv=or;var Uv=function(t,e,r){if(r.get)Hv(r.get,e,{getter:true});if(r.set)Hv(r.set,e,{setter:true});return Mv.f(t,e,r)};var zv=ft;var qv=Uv;var Gv=Ae;var Wv=k;var Kv=Gv("species");var Yv=function(t){var e=zv(t);if(Wv&&e&&!e[Kv])qv(e,Kv,{configurable:true,get:function(){return this}})};var Jv=x;var Xv=w;var Qv=Xv.RegExp;var Zv=Jv(function(){var t=Qv(".","s");return!(t.dotAll&&t.test("\n")&&"s"===t.flags)});var td=x;var ed=w;var rd=ed.RegExp;var ad=td(function(){var t=rd("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")});var id=k;var nd=w;var od=B;var sd=Bi;var ld=pu;var cd=Ir;var fd=ns;var ud=Ha.f;var hd=ht;var vd=Ov;var dd=rf;var pd=Rv;var gd=Vv;var bd=Lv;var md=La;var yd=x;var wd=de;var Sd=ga.enforce;var xd=Yv;var Od=Ae;var kd=Zv;var Pd=ad;var Cd=Od("match");var Td=nd.RegExp;var Id=Td.prototype;var Ad=nd.SyntaxError;var $d=od(Id.exec);var Rd=od("".charAt);var Ed=od("".replace);var jd=od("".indexOf);var _d=od("".slice);var Nd=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/;var Fd=/a/g;var Dd=/a/g;var Vd=new Td(Fd)!==Fd;var Bd=gd.MISSED_STICKY;var Ld=gd.UNSUPPORTED_Y;var Hd=id&&(!Vd||Bd||kd||Pd||yd(function(){Dd[Cd]=false;return Td(Fd)!==Fd||Td(Dd)===Dd||"/a/i"!==String(Td(Fd,"i"))}));var Md=function(t){var e=t.length;var r=0;var a="";var i=false;var n;for(;r<=e;r++){n=Rd(t,r);if("\\"===n){a+=n+Rd(t,++r);continue}if(!i&&"."===n)a+="[\\s\\S]";else{if("["===n)i=true;else if("]"===n)i=false;a+=n}}return a};var Ud=function(t){var e=t.length;var r=0;var a="";var i=[];var n=fd(null);var o=false;var s=false;var l=0;var c="";var f;for(;r<=e;r++){f=Rd(t,r);if("\\"===f)f+=Rd(t,++r);else if("]"===f)o=false;else if(!o)switch(true){case"["===f:o=true;break;case"("===f:if($d(Nd,_d(t,r+1))){r+=2;s=true}a+=f;l++;continue;case">"===f&&s:if(""===c||wd(n,c))throw new Ad("Invalid capture group name");n[c]=true;i[i.length]=[c,l];s=false;c="";continue}if(s)c+=f;else a+=f}return[a,i]};if(sd("RegExp",Hd)){var zd=function ow(t,e){var r=hd(Id,this);var a=vd(t);var i=void 0===e;var n=[];var o=t;var s,l,c,f,u,h;if(!r&&a&&i&&t.constructor===zd)return t;if(a||hd(Id,t)){t=t.source;if(i)e=pd(o)}t=void 0===t?"":dd(t);e=void 0===e?"":dd(e);o=t;if(kd&&"dotAll"in Fd){l=!!e&&jd(e,"s")>-1;if(l)e=Ed(e,/s/g,"")}s=e;if(Bd&&"sticky"in Fd){c=!!e&&jd(e,"y")>-1;if(c&&Ld)e=Ed(e,/y/g,"")}if(Pd){f=Ud(t);t=f[0];n=f[1]}u=ld(Td(t,e),r?this:Id,zd);if(l||c||n.length){h=Sd(u);if(l){h.dotAll=true;h.raw=zd(Md(t),s)}if(c)h.sticky=true;if(n.length)h.groups=n}if(t!==o)try{cd(u,"source",""===o?"(?:)":o)}catch(v){}return u};for(var qd=ud(Td),Gd=0;qd.length>Gd;)bd(zd,Td,qd[Gd++]);Id.constructor=zd;zd.prototype=Id;md(nd,"RegExp",zd,{constructor:true})}xd("RegExp");var Wd=A;var Kd=B;var Yd=rf;var Jd=Pv;var Xd=Vv;var Qd=se;var Zd=ns;var tp=ga.get;var ep=Zv;var rp=ad;var ap=Qd("native-string-replace",String.prototype.replace);var ip=RegExp.prototype.exec;var np=ip;var op=Kd("".charAt);var sp=Kd("".indexOf);var lp=Kd("".replace);var cp=Kd("".slice);var fp=function(){var t=/a/;var e=/b*/g;Wd(ip,t,"a");Wd(ip,e,"a");return 0!==t.lastIndex||0!==e.lastIndex}();var up=Xd.BROKEN_CARET;var hp=void 0!==/()??/.exec("")[1];var vp=fp||hp||up||ep||rp;if(vp)np=function sw(t){var e=this;var r=tp(e);var a=Yd(t);var i=r.raw;var n,o,s,l,c,f,u;if(i){i.lastIndex=e.lastIndex;n=Wd(np,i,a);e.lastIndex=i.lastIndex;return n}var h=r.groups;var v=up&&e.sticky;var d=Wd(Jd,e);var p=e.source;var g=0;var b=a;if(v){d=lp(d,"y","");if(sp(d,"g")===-1)d+="g";b=cp(a,e.lastIndex);if(e.lastIndex>0&&(!e.multiline||e.multiline&&"\n"!==op(a,e.lastIndex-1))){p="(?: "+p+")";b=" "+b;g++}o=new RegExp("^(?:"+p+")",d)}if(hp)o=new RegExp("^"+p+"$(?!\\s)",d);if(fp)s=e.lastIndex;l=Wd(ip,v?o:e,b);if(v)if(l){l.input=cp(l.input,g);l[0]=cp(l[0],g);l.index=e.lastIndex;e.lastIndex+=l[0].length}else e.lastIndex=0;else if(fp&&l)e.lastIndex=e.global?l.index+l[0].length:s;if(hp&&l&&l.length>1)Wd(ap,l[0],o,function(){for(c=1;c<arguments.length-2;c++)if(void 0===arguments[c])l[c]=void 0});if(l&&h){l.groups=f=Zd(null);for(c=0;c<h.length;c++){u=h[c];f[u[0]]=l[u[1]]}}return l};var dp=np;var pp=Wi;var gp=dp;pp({target:"RegExp",proto:true,forced:/./.exec!==gp},{exec:gp});var bp=Dr.PROPER;var mp=La;var yp=vr;var wp=rf;var Sp=x;var xp=Rv;var Op="toString";var kp=RegExp.prototype;var Pp=kp[Op];var Cp=Sp(function(){return"/a/b"!==Pp.call({source:"a",flags:"b"})});var Tp=bp&&Pp.name!==Op;if(Cp||Tp)mp(kp,Op,function lw(){var t=yp(this);var e=wp(t.source);var r=wp(xp(t));return"/"+e+"/"+r},{unsafe:true});var Ip=Ov;var Ap=TypeError;var $p=function(t){if(Ip(t))throw new Ap("The method doesn't accept regular expressions");return t};var Rp=Ae;var Ep=Rp("match");var jp=function(t){var e=/./;try{"/./"[t](e)}catch(r){try{e[Ep]=false;return"/./"[t](e)}catch(a){}}return false};var _p=Wi;var Np=B;var Fp=$p;var Dp=Z;var Vp=rf;var Bp=jp;var Lp=Np("".indexOf);_p({target:"String",proto:true,forced:!Bp("includes")},{includes:function cw(t){return!!~Lp(Vp(Dp(this)),Vp(Fp(t)),arguments.length>1?arguments[1]:void 0)}});var Hp=C;var Mp=Function.prototype;var Up=Mp.apply;var zp=Mp.call;var qp="object"==typeof Reflect&&Reflect.apply||(Hp?zp.bind(Up):function(){return zp.apply(Up,arguments)});var Gp=A;var Wp=La;var Kp=dp;var Yp=x;var Jp=Ae;var Xp=Ir;var Qp=Jp("species");var Zp=RegExp.prototype;var tg=function(t,e,r,a){var i=Jp(t);var n=!Yp(function(){var e={};e[i]=function(){return 7};return 7!==""[t](e)});var o=n&&!Yp(function(){var e=false;var r=/a/;if("split"===t){r={};r.constructor={};r.constructor[Qp]=function(){return r};r.flags="";r[i]=/./[i]}r.exec=function(){e=true;return null};r[i]("");return!e});if(!n||!o||r){var s=/./[i];var l=e(i,""[t],function(t,e,r,a,i){var o=e.exec;if(o===Kp||o===Zp.exec){if(n&&!i)return{done:true,value:Gp(s,e,r,a)};return{done:true,value:Gp(t,r,e,a)}}return{done:false}});Wp(String.prototype,t,l[0]);Wp(Zp,i,l[1])}if(a)Xp(Zp[i],"sham",true)};var eg=B;var rg=Ga;var ag=rf;var ig=Z;var ng=eg("".charAt);var og=eg("".charCodeAt);var sg=eg("".slice);var lg=function(t){return function(e,r){var a=ag(ig(e));var i=rg(r);var n=a.length;var o,s;if(i<0||i>=n)return t?"":void 0;o=og(a,i);return o<55296||o>56319||i+1===n||(s=og(a,i+1))<56320||s>57343?t?ng(a,i):o:t?sg(a,i,i+2):(o-55296<<10)+(s-56320)+65536}};var cg={codeAt:lg(false),charAt:lg(true)};var fg=cg.charAt;var ug=function(t,e,r){return e+(r?fg(t,e).length:1)};var hg=B;var vg=fe;var dg=Math.floor;var pg=hg("".charAt);var gg=hg("".replace);var bg=hg("".slice);var mg=/\$([$&'`]|\d{1,2}|<[^>]*>)/g;var yg=/\$([$&'`]|\d{1,2})/g;var wg=function(t,e,r,a,i,n){var o=r+t.length;var s=a.length;var l=yg;if(void 0!==i){i=vg(i);l=mg}return gg(n,l,function(n,l){var c;switch(pg(l,0)){case"$":return"$";case"&":return t;case"`":return bg(e,0,r);case"'":return bg(e,o);case"<":c=i[bg(l,1,-1)];break;default:var f=+l;if(0===f)return n;if(f>s){var u=dg(f/10);if(0===u)return n;if(u<=s)return void 0===a[u-1]?pg(l,1):a[u-1]+pg(l,1);return n}c=a[f-1]}return void 0===c?"":c})};var Sg=A;var xg=vr;var Og=it;var kg=U;var Pg=dp;var Cg=TypeError;var Tg=function(t,e){var r=t.exec;if(Og(r)){var a=Sg(r,t,e);if(null!==a)xg(a);return a}if("RegExp"===kg(t))return Sg(Pg,t,e);throw new Cg("RegExp#exec called on incompatible receiver")};var Ig=qp;var Ag=A;var $g=B;var Rg=tg;var Eg=x;var jg=vr;var _g=it;var Ng=J;var Fg=Ga;var Dg=Za;var Vg=rf;var Bg=Z;var Lg=ug;var Hg=zt;var Mg=wg;var Ug=Tg;var zg=Ae;var qg=zg("replace");var Gg=Math.max;var Wg=Math.min;var Kg=$g([].concat);var Yg=$g([].push);var Jg=$g("".indexOf);var Xg=$g("".slice);var Qg=function(t){return void 0===t?t:String(t)};var Zg=function(){return"$0"==="a".replace(/./,"$0")}();var tb=function(){if(/./[qg])return""===/./[qg]("a","$0");return false}();var eb=!Eg(function(){var t=/./;t.exec=function(){var t=[];t.groups={a:"7"};return t};return"7"!=="".replace(t,"$<a>")});Rg("replace",function(t,e,r){var a=tb?"$":"$0";return[function i(t,r){var a=Bg(this);var i=Ng(t)?void 0:Hg(t,qg);return i?Ag(i,t,a,r):Ag(e,Vg(a),t,r)},function(t,i){var n=jg(this);var o=Vg(t);if("string"==typeof i&&Jg(i,a)===-1&&Jg(i,"$<")===-1){var s=r(e,n,o,i);if(s.done)return s.value}var l=_g(i);if(!l)i=Vg(i);var c=n.global;var f;if(c){f=n.unicode;n.lastIndex=0}var u=[];var h;while(true){h=Ug(n,o);if(null===h)break;Yg(u,h);if(!c)break;var v=Vg(h[0]);if(""===v)n.lastIndex=Lg(o,Dg(n.lastIndex),f)}var d="";var p=0;for(var g=0;g<u.length;g++){h=u[g];var b=Vg(h[0]);var m=Gg(Wg(Fg(h.index),o.length),0);var y=[];var w;for(var S=1;S<h.length;S++)Yg(y,Qg(h[S]));var x=h.groups;if(l){var O=Kg([b],y,m,o);if(void 0!==x)Yg(O,x);w=Vg(Ig(i,void 0,O))}else w=Mg(b,o,m,y,x,i);if(m>=p){d+=Xg(o,p,m)+w;p=m+b.length}}return d+Xg(o,p)}]},!eb||!Zg||tb);var rb=Object.is||function fw(t,e){return t===e?0!==t||1/t===1/e:t!==t&&e!==e};var ab=A;var ib=tg;var nb=vr;var ob=J;var sb=Z;var lb=rb;var cb=rf;var fb=zt;var ub=Tg;ib("search",function(t,e,r){return[function a(e){var r=sb(this);var a=ob(e)?void 0:fb(e,t);return a?ab(a,e,r):new RegExp(e)[t](cb(r))},function(t){var a=nb(this);var i=cb(t);var n=r(e,a,i);if(n.done)return n.value;var o=a.lastIndex;if(!lb(o,0))a.lastIndex=0;var s=ub(a,i);if(!lb(a.lastIndex,o))a.lastIndex=o;return null===s?-1:s.index}]});var hb=$n;var vb=Dt;var db=TypeError;var pb=function(t){if(hb(t))return t;throw new db(vb(t)+" is not a constructor")};var gb=vr;var bb=pb;var mb=J;var yb=Ae;var wb=yb("species");var Sb=function(t,e){var r=gb(t).constructor;var a;return void 0===r||mb(a=gb(r)[wb])?e:bb(a)};var xb=A;var Ob=B;var kb=tg;var Pb=vr;var Cb=J;var Tb=Z;var Ib=Sb;var Ab=ug;var $b=Za;var Rb=rf;var Eb=zt;var jb=Tg;var _b=Vv;var Nb=x;var Fb=_b.UNSUPPORTED_Y;var Db=4294967295;var Vb=Math.min;var Bb=Ob([].push);var Lb=Ob("".slice);var Hb=!Nb(function(){var t=/(?:)/;var e=t.exec;t.exec=function(){return e.apply(this,arguments)};var r="ab".split(t);return 2!==r.length||"a"!==r[0]||"b"!==r[1]});var Mb="c"==="abbc".split(/(b)*/)[1]||4!=="test".split(/(?:)/,-1).length||2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length;kb("split",function(t,e,r){var a="0".split(void 0,0).length?function(t,r){return void 0===t&&0===r?[]:xb(e,this,t,r)}:e;return[function i(e,r){var i=Tb(this);var n=Cb(e)?void 0:Eb(e,t);return n?xb(n,e,i,r):xb(a,Rb(i),e,r)},function(t,i){var n=Pb(this);var o=Rb(t);if(!Mb){var s=r(a,n,o,i,a!==e);if(s.done)return s.value}var l=Ib(n,RegExp);var c=n.unicode;var f=(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.unicode?"u":"")+(Fb?"g":"y");var u=new l(Fb?"^(?:"+n.source+")":n,f);var h=void 0===i?Db:i>>>0;if(0===h)return[];if(0===o.length)return null===jb(u,o)?[o]:[];var v=0;var d=0;var p=[];while(d<o.length){u.lastIndex=Fb?0:d;var g=jb(u,Fb?Lb(o,d):o);var b;if(null===g||(b=Vb($b(u.lastIndex+(Fb?d:0)),o.length))===v)d=Ab(o,d,c);else{Bb(p,Lb(o,v,d));if(p.length===h)return p;for(var m=1;m<=g.length-1;m++){Bb(p,g[m]);if(p.length===h)return p}d=v=b}}Bb(p,Lb(o,v));return p}]},Mb||!Hb,Fb);var Ub=Dr.PROPER;var zb=x;var qb=mu;var Gb="
";var Wb=function(t){return zb(function(){return!!qb[t]()||Gb[t]()!==Gb||Ub&&qb[t].name!==t})};var Kb=Wi;var Yb=Tu.trim;var Jb=Wb;Kb({target:"String",proto:true,forced:Jb("trim")},{trim:function uw(){return Yb(this)}});var Xb={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0};var Qb=Ge;var Zb=Qb("span").classList;var tm=Zb&&Zb.constructor&&Zb.constructor.prototype;var em=tm===Object.prototype?void 0:tm;var rm=ko.forEach;var am=Is;var im=am("forEach");var nm=!im?function hw(t){return rm(this,t,arguments.length>1?arguments[1]:void 0)}:[].forEach;var om=w;var sm=Xb;var lm=em;var cm=nm;var fm=Ir;var um=function(t){if(t&&t.forEach!==cm)try{fm(t,"forEach",cm)}catch(e){t.forEach=cm}};for(var hm in sm)if(sm[hm])um(om[hm]&&om[hm].prototype);um(lm);var vm=w;var dm=Xb;var pm=em;var gm=dc;var bm=Ir;var mm=ul;var ym=Ae;var wm=ym("iterator");var Sm=gm.values;var xm=function(t,e){if(t){if(t[wm]!==Sm)try{bm(t,wm,Sm)}catch(r){t[wm]=Sm}mm(t,e,true);if(dm[e])for(var a in gm)if(t[a]!==gm[a])try{bm(t,a,gm[a])}catch(r){t[a]=gm[a]}}};for(var Om in dm)xm(vm[Om]&&vm[Om].prototype,Om);xm(pm,"DOMTokenList");var km=Wi;var Pm=x;var Cm=fe;var Tm=Ws;var Im=Vs;var Am=Pm(function(){Tm(1)});km({target:"Object",stat:true,forced:Am,sham:!Im},{getPrototypeOf:function vw(t){return Tm(Cm(t))}});var $m=Wi;var Rm=co;var Em=S.f;var jm=Za;var _m=rf;var Nm=$p;var Fm=Z;var Dm=jp;var Vm=Rm("".slice);var Bm=Math.min;var Lm=Dm("endsWith");var Hm=!Lm&&!!function(){var t=Em(String.prototype,"endsWith");return t&&!t.writable}();$m({target:"String",proto:true,forced:!Hm&&!Lm},{endsWith:function dw(t){var e=_m(Fm(this));Nm(t);var r=arguments.length>1?arguments[1]:void 0;var a=e.length;var i=void 0===r?a:Bm(jm(r),a);var n=_m(t);return Vm(e,i-n.length,i)===n}});var Mm=A;var Um=tg;var zm=vr;var qm=J;var Gm=Za;var Wm=rf;var Km=Z;var Ym=zt;var Jm=ug;var Xm=Tg;Um("match",function(t,e,r){return[function a(e){var r=Km(this);var a=qm(e)?void 0:Ym(e,t);return a?Mm(a,e,r):new RegExp(e)[t](Wm(r))},function(t){var a=zm(this);var i=Wm(t);var n=r(e,a,i);if(n.done)return n.value;if(!a.global)return Xm(a,i);var o=a.unicode;a.lastIndex=0;var s=[];var l=0;var c;while(null!==(c=Xm(a,i))){var f=Wm(c[0]);s[l]=f;if(""===f)a.lastIndex=Jm(i,Gm(a.lastIndex),o);l++}return 0===l?null:s}]});var Qm=Wi;var Zm=co;var ty=S.f;var ey=Za;var ry=rf;var ay=$p;var iy=Z;var ny=jp;var oy=Zm("".slice);var sy=Math.min;var ly=ny("startsWith");var cy=!ly&&!!function(){var t=ty(String.prototype,"startsWith");return t&&!t.writable}();Qm({target:"String",proto:true,forced:!cy&&!ly},{startsWith:function pw(t){var e=ry(iy(this));ay(t);var r=ey(sy(arguments.length>1?arguments[1]:void 0,e.length));var a=ry(t);return oy(e,r,r+a.length)===a}});var fy={getBootstrapVersion:function gw(){var e=5;try{var r=t.fn.dropdown.Constructor.VERSION;if(void 0!==r)e=parseInt(r,10)}catch(a){}try{var i=bootstrap.Tooltip.VERSION;if(void 0!==i)e=parseInt(i,10)}catch(a){}return e},getIconsPrefix:function bw(t){return{bootstrap3:"glyphicon",bootstrap4:"fa",bootstrap5:"bi","bootstrap-table":"icon",bulma:"fa",foundation:"fa",materialize:"material-icons",semantic:"fa"}[t]||"fa"},getIcons:function mw(t){return{glyphicon:{paginationSwitchDown:"glyphicon-collapse-down icon-chevron-down",paginationSwitchUp:"glyphicon-collapse-up icon-chevron-up",refresh:"glyphicon-refresh icon-refresh",toggleOff:"glyphicon-list-alt icon-list-alt",toggleOn:"glyphicon-list-alt icon-list-alt",columns:"glyphicon-th icon-th",detailOpen:"glyphicon-plus icon-plus",detailClose:"glyphicon-minus icon-minus",fullscreen:"glyphicon-fullscreen",search:"glyphicon-search",clearSearch:"glyphicon-trash"},fa:{paginationSwitchDown:"fa-caret-square-down",paginationSwitchUp:"fa-caret-square-up",refresh:"fa-sync",toggleOff:"fa-toggle-off",toggleOn:"fa-toggle-on",columns:"fa-th-list",detailOpen:"fa-plus",detailClose:"fa-minus",fullscreen:"fa-arrows-alt",search:"fa-search",clearSearch:"fa-trash"},bi:{paginationSwitchDown:"bi-caret-down-square",paginationSwitchUp:"bi-caret-up-square",refresh:"bi-arrow-clockwise",toggleOff:"bi-toggle-off",toggleOn:"bi-toggle-on",columns:"bi-list-ul",detailOpen:"bi-plus",detailClose:"bi-dash",fullscreen:"bi-arrows-move",search:"bi-search",clearSearch:"bi-trash"},icon:{paginationSwitchDown:"icon-arrow-up-circle",paginationSwitchUp:"icon-arrow-down-circle",refresh:"icon-refresh-cw",toggleOff:"icon-toggle-right",toggleOn:"icon-toggle-right",columns:"icon-list",detailOpen:"icon-plus",detailClose:"icon-minus",fullscreen:"icon-maximize",search:"icon-search",clearSearch:"icon-trash-2"},"material-icons":{paginationSwitchDown:"grid_on",paginationSwitchUp:"grid_off",refresh:"refresh",toggleOff:"tablet",toggleOn:"tablet_android",columns:"view_list",detailOpen:"add",detailClose:"remove",fullscreen:"fullscreen",sort:"sort",search:"search",clearSearch:"delete"}}[t]||{}},getSearchInput:function yw(e){if("string"===typeof e.options.searchSelector)return t(e.options.searchSelector);return e.$toolbar.find(".search input")},extend:function ww(){var t=this;for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];var n=r[0]||{};var o=1;var s=false;var l;if("boolean"===typeof n){s=n;n=r[o]||{};o++}if("object"!==i(n)&&"function"!==typeof n)n={};for(;o<r.length;o++){var c=r[o];if("undefined"===typeof c||null===c)continue;for(var f in c){var u=c[f];if("__proto__"===f||n===u)continue;var h=Array.isArray(u);if(s&&u&&(this.isObject(u)||h)){var v=n[f];if(h&&Array.isArray(v))if(v.every(function(e){return!t.isObject(e)&&!Array.isArray(e)})){n[f]=u;continue}if(h&&!Array.isArray(v))l=[];else if(!h&&!this.isObject(v))l={};else l=v;n[f]=this.extend(s,l,u)}else if(void 0!==u)n[f]=u}}return n},sprintf:function Sw(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),a=1;a<e;a++)r[a-1]=arguments[a];var i=true;var n=0;var o=t.replace(/%s/g,function(){var t=r[n++];if("undefined"===typeof t){i=false;return""}return t});return i?o:""},isObject:function xw(t){if("object"!==i(t)||null===t)return false;var e=t;while(null!==Object.getPrototypeOf(e))e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e},isEmptyObject:function Ow(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return 0===Object.entries(t).length&&t.constructor===Object},isNumeric:function kw(t){return!isNaN(parseFloat(t))&&isFinite(t)},getFieldTitle:function Pw(t,e){var r=b(t),a;try{for(r.s();!(a=r.n()).done;){var i=a.value;if(i.field===e)return i.title}}catch(n){r.e(n)}finally{r.f()}return""},setFieldIndex:function Cw(t){var e=0;var r=[];var a=b(t[0]),i;try{for(a.s();!(i=a.n()).done;){var n=i.value;e+=n.colspan||1}}catch(o){a.e(o)}finally{a.f()}for(var s=0;s<t.length;s++){r[s]=[];for(var l=0;l<e;l++)r[s][l]=false}for(var c=0;c<t.length;c++){var f=b(t[c]),u;try{for(f.s();!(u=f.n()).done;){var h=u.value;var v=h.rowspan||1;var d=h.colspan||1;var p=r[c].indexOf(false);h.colspanIndex=p;if(1===d){h.fieldIndex=p;if("undefined"===typeof h.field)h.field=p}else h.colspanGroup=h.colspan;for(var g=0;g<v;g++)for(var m=0;m<d;m++)r[c+g][p+m]=true}}catch(o){f.e(o)}finally{f.f()}}},normalizeAccent:function Tw(t){if("string"!==typeof t)return t;return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"")},updateFieldGroup:function Iw(t,e){var r;var a=(r=[]).concat.apply(r,c(t));var i=b(t),n;try{for(i.s();!(n=i.n()).done;){var o=n.value;var s=b(o),l;try{for(s.s();!(l=s.n()).done;){var f=l.value;if(f.colspanGroup>1){var u=0;var h=function y(t){var e=a.filter(function(e){return e.fieldIndex===t});var r=e[e.length-1];if(e.length>1)for(var i=0;i<e.length-1;i++)e[i].visible=r.visible;if(r.visible)u++};for(var v=f.colspanIndex;v<f.colspanIndex+f.colspanGroup;v++)h(v);f.colspan=u;f.visible=u>0}}}catch(d){s.e(d)}finally{s.f()}}}catch(d){i.e(d)}finally{i.f()}if(t.length<2)return;var p=b(e),g;try{var m=function w(){var t=g.value;var e=a.filter(function(e){return e.fieldIndex===t.fieldIndex});if(e.length>1){var r=b(e),i;try{for(r.s();!(i=r.n()).done;){var n=i.value;n.visible=t.visible}}catch(o){r.e(o)}finally{r.f()}}};for(p.s();!(g=p.n()).done;)m()}catch(d){p.e(d)}finally{p.f()}},getScrollBarWidth:function Aw(){if(void 0===this.cachedWidth){var e=t("<div/>").addClass("fixed-table-scroll-inner");var r=t("<div/>").addClass("fixed-table-scroll-outer");r.append(e);t("body").append(r);var a=e[0].offsetWidth;r.css("overflow","scroll");var i=e[0].offsetWidth;if(a===i)i=r[0].clientWidth;r.remove();this.cachedWidth=a-i}return this.cachedWidth},calculateObjectValue:function $w(t,e,r,a){var n=e;if("string"===typeof e){var o=e.split(".");if(o.length>1){n=window;var s=b(o),l;try{for(s.s();!(l=s.n()).done;){var f=l.value;n=n[f]}}catch(u){s.e(u)}finally{s.f()}}else n=window[e]}if(null!==n&&"object"===i(n))return n;if("function"===typeof n)return n.apply(t,r||[]);if(!n&&"string"===typeof e&&r&&this.sprintf.apply(this,[e].concat(c(r))))return this.sprintf.apply(this,[e].concat(c(r)));return a},compareObjects:function Rw(t,e,r){var a=Object.keys(t);var i=Object.keys(e);if(r&&a.length!==i.length)return false;for(var n=0,o=a;n<o.length;n++){var s=o[n];if(i.includes(s)&&t[s]!==e[s])return false}return true},regexCompare:function Ew(t,e){try{var r=e.match(/^\/(.*?)\/([gim]*)$/);if(t.toString().search(r?new RegExp(r[1],r[2]):new RegExp(e,"gim"))!==-1)return true}catch(a){return false}return false},escapeApostrophe:function jw(t){return t.toString().replace(/'/g,"'")},escapeHTML:function _w(t){if(!t)return t;return t.toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},unescapeHTML:function Nw(t){if("string"!==typeof t||!t)return t;return t.toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")},removeHTML:function Fw(t){if(!t)return t;return t.toString().replace(/(<([^>]+)>)/gi,"").replace(/&[#A-Za-z0-9]+;/gi,"").trim()},getRealDataAttr:function Dw(t){for(var e=0,r=Object.entries(t);e<r.length;e++){var a=l(r[e],2),i=a[0],n=a[1];var o=i.split(/(?=[A-Z])/).join("-").toLowerCase();if(o!==i){t[o]=n;delete t[i]}}return t},getItemField:function Vw(t,e,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;var i=t;if("undefined"!==typeof a)r=a;if("string"!==typeof e||t.hasOwnProperty(e))return r?this.escapeHTML(t[e]):t[e];var n=e.split(".");var o=b(n),s;try{for(o.s();!(s=o.n()).done;){var l=s.value;i=i&&i[l]}}catch(c){o.e(c)}finally{o.f()}return r?this.escapeHTML(i):i},isIEBrowser:function Bw(){return navigator.userAgent.includes("MSIE ")||/Trident.*rv:11\./.test(navigator.userAgent)},findIndex:function Lw(t,e){var r=b(t),a;try{for(r.s();!(a=r.n()).done;){var i=a.value;if(JSON.stringify(i)===JSON.stringify(e))return t.indexOf(i)}}catch(n){r.e(n)}finally{r.f()}return-1},trToData:function Hw(e,r){var a=this;var i=[];var n=[];r.each(function(r,o){var s=t(o);var l={};l._id=s.attr("id");l._class=s.attr("class");l._data=a.getRealDataAttr(s.data());l._style=s.attr("style");s.find(">td,>th").each(function(i,o){var s=t(o);var c=+s.attr("colspan")||1;var f=+s.attr("rowspan")||1;var u=i;for(;n[r]&&n[r][u];u++);for(var h=u;h<u+c;h++)for(var v=r;v<r+f;v++){if(!n[v])n[v]=[];n[v][h]=true}var d=e[u].field;l[d]=a.escapeApostrophe(s.html().trim());l["_".concat(d,"_id")]=s.attr("id");l["_".concat(d,"_class")]=s.attr("class");l["_".concat(d,"_rowspan")]=s.attr("rowspan");l["_".concat(d,"_colspan")]=s.attr("colspan");l["_".concat(d,"_title")]=s.attr("title");l["_".concat(d,"_data")]=a.getRealDataAttr(s.data());l["_".concat(d,"_style")]=s.attr("style")});i.push(l)});return i},sort:function Mw(t,e,r,a,i,n){if(void 0===t||null===t)t="";if(void 0===e||null===e)e="";if(a.sortStable&&t===e){t=i;e=n}if(this.isNumeric(t)&&this.isNumeric(e)){t=parseFloat(t);e=parseFloat(e);if(t<e)return r*-1;if(t>e)return r;return 0}if(a.sortEmptyLast){if(""===t)return 1;if(""===e)return-1}if(t===e)return 0;if("string"!==typeof t)t=t.toString();if(t.localeCompare(e)===-1)return r*-1;return r},getEventName:function Uw(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";e=e||"".concat(+new Date).concat(~~(1e6*Math.random()));return"".concat(t,"-").concat(e)},hasDetailViewIcon:function zw(t){return t.detailView&&t.detailViewIcon&&!t.cardView},getDetailViewIndexOffset:function qw(t){return this.hasDetailViewIcon(t)&&"right"!==t.detailViewAlign?1:0},checkAutoMergeCells:function Gw(t){var e=b(t),r;try{for(e.s();!(r=e.n()).done;){var a=r.value;for(var i=0,n=Object.keys(a);i<n.length;i++){var o=n[i];if(o.startsWith("_")&&(o.endsWith("_rowspan")||o.endsWith("_colspan")))return true}}}catch(s){e.e(s)}finally{e.f()}return false},deepCopy:function Ww(t){if(void 0===t)return t;return this.extend(true,Array.isArray(t)?[]:{},t)},debounce:function Kw(t,e,r){var a;return function i(){var i=this;var n=arguments;var o=function l(){a=null;if(!r)t.apply(i,n)};var s=r&&!a;clearTimeout(a);a=setTimeout(o,e);if(s)t.apply(i,n)}}};var uy="1.22.6";var hy=fy.getBootstrapVersion();var vy={3:{classes:{buttonsPrefix:"btn",buttons:"default",buttonsGroup:"btn-group",buttonsDropdown:"btn-group",pull:"pull",inputGroup:"input-group",inputPrefix:"input-",input:"form-control",select:"form-control",paginationDropdown:"btn-group dropdown",dropup:"dropup",dropdownActive:"active",paginationActive:"active",buttonActive:"active"},html:{toolbarDropdown:['<ul class="dropdown-menu" role="menu">',"</ul>"],toolbarDropdownItem:'<li class="dropdown-item-marker" role="menuitem"><label>%s</label></li>',toolbarDropdownSeparator:'<li class="divider"></li>',pageDropdown:['<ul class="dropdown-menu" role="menu">',"</ul>"],pageDropdownItem:'<li role="menuitem" class="%s"><a href="#">%s</a></li>',dropdownCaret:'<span class="caret"></span>',pagination:['<ul class="pagination%s">',"</ul>"],paginationItem:'<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',icon:'<i class="%s %s"></i>',inputGroup:'<div class="input-group">%s<span class="input-group-btn">%s</span></div>',searchInput:'<input class="%s%s" type="text" placeholder="%s">',searchButton:'<button class="%s" type="button" name="search" title="%s">%s %s</button>',searchClearButton:'<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'}},4:{classes:{buttonsPrefix:"btn",buttons:"secondary",buttonsGroup:"btn-group",buttonsDropdown:"btn-group",pull:"float",inputGroup:"btn-group",inputPrefix:"form-control-",input:"form-control",select:"form-control",paginationDropdown:"btn-group dropdown",dropup:"dropup",dropdownActive:"active",paginationActive:"active",buttonActive:"active"},html:{toolbarDropdown:['<div class="dropdown-menu dropdown-menu-right">',"</div>"],toolbarDropdownItem:'<label class="dropdown-item dropdown-item-marker">%s</label>',pageDropdown:['<div class="dropdown-menu">',"</div>"],pageDropdownItem:'<a class="dropdown-item %s" href="#">%s</a>',toolbarDropdownSeparator:'<div class="dropdown-divider"></div>',dropdownCaret:'<span class="caret"></span>',pagination:['<ul class="pagination%s">',"</ul>"],paginationItem:'<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',icon:'<i class="%s %s"></i>',inputGroup:'<div class="input-group">%s<div class="input-group-append">%s</div></div>',searchInput:'<input class="%s%s" type="text" placeholder="%s">',searchButton:'<button class="%s" type="button" name="search" title="%s">%s %s</button>',searchClearButton:'<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'}},5:{classes:{buttonsPrefix:"btn",buttons:"secondary",buttonsGroup:"btn-group",buttonsDropdown:"btn-group",pull:"float",inputGroup:"btn-group",inputPrefix:"form-control-",input:"form-control",select:"form-select",paginationDropdown:"btn-group dropdown",dropup:"dropup",dropdownActive:"active",paginationActive:"active",buttonActive:"active"},html:{dataToggle:"data-bs-toggle",toolbarDropdown:['<div class="dropdown-menu dropdown-menu-end">',"</div>"],toolbarDropdownItem:'<label class="dropdown-item dropdown-item-marker">%s</label>',pageDropdown:['<div class="dropdown-menu">',"</div>"],pageDropdownItem:'<a class="dropdown-item %s" href="#">%s</a>',toolbarDropdownSeparator:'<div class="dropdown-divider"></div>',dropdownCaret:'<span class="caret"></span>',pagination:['<ul class="pagination%s">',"</ul>"],paginationItem:'<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',icon:'<i class="%s %s"></i>',inputGroup:'<div class="input-group">%s%s</div>',searchInput:'<input class="%s%s" type="text" placeholder="%s">',searchButton:'<button class="%s" type="button" name="search" title="%s">%s %s</button>',searchClearButton:'<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'}}}[hy];var dy={id:void 0,firstLoad:true,height:void 0,classes:"table table-bordered table-hover",buttons:{},theadClasses:"",striped:false,headerStyle:function Yw(t){return{}},rowStyle:function Jw(t,e){return{}},rowAttributes:function Xw(t,e){return{}},undefinedText:"-",locale:void 0,virtualScroll:false,virtualScrollItemHeight:void 0,sortable:true,sortClass:void 0,silentSort:true,sortEmptyLast:false,sortName:void 0,sortOrder:void 0,sortReset:false,sortStable:false,sortResetPage:false,rememberOrder:false,serverSort:true,customSort:void 0,columns:[[]],data:[],url:void 0,method:"get",cache:true,contentType:"application/json",dataType:"json",ajax:void 0,ajaxOptions:{},queryParams:function Qw(t){return t},queryParamsType:"limit",responseHandler:function Zw(t){return t},totalField:"total",totalNotFilteredField:"totalNotFiltered",dataField:"rows",footerField:"footer",pagination:false,paginationParts:["pageInfo","pageSize","pageList"],showExtendedPagination:false,paginationLoop:true,sidePagination:"client",totalRows:0,totalNotFiltered:0,pageNumber:1,pageSize:10,pageList:[10,25,50,100],paginationHAlign:"right",paginationVAlign:"bottom",paginationDetailHAlign:"left",paginationPreText:"‹",paginationNextText:"›",paginationSuccessivelySize:5,paginationPagesBySide:1,paginationUseIntermediate:false,paginationLoadMore:false,search:false,searchable:false,searchHighlight:false,searchOnEnterKey:false,strictSearch:false,regexSearch:false,searchSelector:false,visibleSearch:false,showButtonIcons:true,showButtonText:false,showSearchButton:false,showSearchClearButton:false,trimOnSearch:true,searchAlign:"right",searchTimeOut:500,searchText:"",customSearch:void 0,showHeader:true,showFooter:false,footerStyle:function tS(t){return{}},searchAccentNeutralise:false,showColumns:false,showSearch:false,showPageGo:false,showColumnsToggleAll:false,showColumnsSearch:false,minimumCountColumns:1,showPaginationSwitch:false,showRefresh:false,showToggle:false,showFullscreen:false,smartDisplay:true,escape:false,escapeTitle:true,filterOptions:{filterAlgorithm:"and"},idField:void 0,selectItemName:"btSelectItem",clickToSelect:false,ignoreClickToSelectOn:function eS(t){var e=t.tagName;return["A","BUTTON"].includes(e)},singleSelect:false,checkboxHeader:true,maintainMetaData:false,multipleSelectRow:false,uniqueId:void 0,cardView:false,detailView:false,detailViewIcon:true,detailViewByClick:false,detailViewAlign:"left",detailFormatter:function rS(t,e){return""},detailFilter:function aS(t,e){return true},toolbar:void 0,toolbarAlign:"left",buttonsToolbar:void 0,buttonsAlign:"right",buttonsOrder:["search","paginationSwitch","refresh","toggle","fullscreen","columns"],buttonsPrefix:vy.classes.buttonsPrefix,buttonsClass:vy.classes.buttons,iconsPrefix:void 0,icons:{},iconSize:void 0,fixedScroll:false,loadingFontSize:"auto",loadingTemplate:function iS(t){return'<span class="loading-wrap">\n <span class="loading-text">'.concat(t,'</span>\n <span class="animation-wrap"><span class="animation-dot"></span></span>\n </span>\n ')},onAll:function nS(t,e){return false},onClickCell:function oS(t,e,r,a){return false},onDblClickCell:function sS(t,e,r,a){return false},onClickRow:function lS(t,e){return false},onDblClickRow:function cS(t,e){return false},onSort:function fS(t,e){return false},onCheck:function uS(t){return false},onUncheck:function hS(t){return false},onCheckAll:function vS(t){return false},onUncheckAll:function dS(t){return false},onCheckSome:function pS(t){return false},onUncheckSome:function gS(t){return false},onLoadSuccess:function bS(t){return false},onLoadError:function mS(t){return false},onColumnSwitch:function yS(t,e){return false},onColumnSwitchAll:function wS(t){return false},onPageChange:function SS(t,e){return false},onSearch:function xS(t){return false},onShowSearch:function OS(){return false},onToggle:function kS(t){return false},onPreBody:function PS(t){return false},onPostBody:function CS(){return false},onPostHeader:function TS(){return false},onPostFooter:function IS(){return false},onExpandRow:function AS(t,e,r){return false},onCollapseRow:function $S(t,e){return false},onRefreshOptions:function RS(t){return false},onRefresh:function ES(t){return false},onResetView:function jS(){return false},onScrollBody:function _S(){return false},onTogglePagination:function NS(t){return false},onVirtualScroll:function FS(t,e){return false}};var py={formatLoadingMessage:function DS(){return"Loading, please wait"},formatRecordsPerPage:function VS(t){return"".concat(t," rows per page")},formatShowingRows:function BS(t,e,r,a){if(void 0!==a&&a>0&&a>r)return"Showing ".concat(t," to ").concat(e," of ").concat(r," rows (filtered from ").concat(a," total rows)");return"Showing ".concat(t," to ").concat(e," of ").concat(r," rows")},formatSRPaginationPreText:function LS(){return"previous page"},formatSRPaginationPageText:function HS(t){return"to page ".concat(t)},formatSRPaginationNextText:function MS(){return"next page"},formatDetailPagination:function US(t){return"Showing ".concat(t," rows")},formatSearch:function zS(){return"Search"},formatShowSearch:function qS(){return"Show Search"},formatPageGo:function(){return"Go"},formatClearSearch:function GS(){return"Clear Search"},formatNoMatches:function WS(){return"No matching records found"},formatPaginationSwitch:function KS(){return"Hide/Show pagination"},formatPaginationSwitchDown:function YS(){return"Show pagination"},formatPaginationSwitchUp:function JS(){return"Hide pagination"},formatRefresh:function XS(){return"Refresh"},formatToggleOn:function QS(){return"Show card view"},formatToggleOff:function ZS(){return"Hide card view"},formatColumns:function tx(){return"Columns"},formatColumnsToggleAll:function ex(){return"Toggle all"},formatFullscreen:function rx(){return"Fullscreen"},formatAllRows:function ax(){return"All"}};var gy={field:void 0,title:void 0,titleTooltip:void 0,class:void 0,width:void 0,widthUnit:"px",rowspan:void 0,colspan:void 0,align:void 0,halign:void 0,falign:void 0,valign:void 0,cellStyle:void 0,radio:false,checkbox:false,checkboxEnabled:true,clickToSelect:true,showSelectTitle:false,sortable:false,sortName:void 0,order:"asc",sorter:void 0,visible:true,ignore:false,switchable:true,switchableLabel:void 0,cardVisible:true,searchable:true,formatter:void 0,footerFormatter:void 0,footerStyle:void 0,detailFormatter:void 0,searchFormatter:true,searchHighlightFormatter:false,escape:void 0,events:void 0};var by=["getOptions","refreshOptions","getData","getSelections","load","append","prepend","remove","removeAll","insertRow","updateRow","getRowByUniqueId","updateByUniqueId","removeByUniqueId","updateCell","updateCellByUniqueId","showRow","hideRow","getHiddenRows","showColumn","hideColumn","getVisibleColumns","getHiddenColumns","showAllColumns","hideAllColumns","mergeCells","checkAll","uncheckAll","checkInvert","check","uncheck","checkBy","uncheckBy","refresh","destroy","resetView","showLoading","hideLoading","togglePagination","toggleFullscreen","toggleView","resetSearch","filterBy","sortBy","scrollTo","getScrollPosition","selectPage","prevPage","nextPage","toggleDetailView","expandRow","collapseRow","expandRowByUniqueId","collapseRowByUniqueId","expandAllRows","collapseAllRows","updateColumnTitle","updateFormatText"];var my={"all.bs.table":"onAll","click-row.bs.table":"onClickRow","dbl-click-row.bs.table":"onDblClickRow","click-cell.bs.table":"onClickCell","dbl-click-cell.bs.table":"onDblClickCell","sort.bs.table":"onSort","check.bs.table":"onCheck","uncheck.bs.table":"onUncheck","check-all.bs.table":"onCheckAll","uncheck-all.bs.table":"onUncheckAll","check-some.bs.table":"onCheckSome","uncheck-some.bs.table":"onUncheckSome","load-success.bs.table":"onLoadSuccess","load-error.bs.table":"onLoadError","column-switch.bs.table":"onColumnSwitch","column-switch-all.bs.table":"onColumnSwitchAll","page-change.bs.table":"onPageChange","search.bs.table":"onSearch","toggle.bs.table":"onToggle","pre-body.bs.table":"onPreBody","post-body.bs.table":"onPostBody","post-header.bs.table":"onPostHeader","post-footer.bs.table":"onPostFooter","expand-row.bs.table":"onExpandRow","collapse-row.bs.table":"onCollapseRow","refresh-options.bs.table":"onRefreshOptions","reset-view.bs.table":"onResetView","refresh.bs.table":"onRefresh","scroll-body.bs.table":"onScrollBody","toggle-pagination.bs.table":"onTogglePagination","virtual-scroll.bs.table":"onVirtualScroll"};Object.assign(dy,py);var yy={VERSION:uy,THEME:"bootstrap".concat(hy),CONSTANTS:vy,DEFAULTS:dy,COLUMN_DEFAULTS:gy,METHODS:by,EVENTS:my,LOCALES:{en:py,"en-US":py}};var wy=50;var Sy=4;var xy=function(){function t(e){var r=this;n(this,t);this.rows=e.rows;this.scrollEl=e.scrollEl;this.contentEl=e.contentEl;this.callback=e.callback;this.itemHeight=e.itemHeight;this.cache={};this.scrollTop=this.scrollEl.scrollTop;this.initDOM(this.rows,e.fixedScroll);this.scrollEl.scrollTop=this.scrollTop;this.lastCluster=0;var a=function i(){if(r.lastCluster!==(r.lastCluster=r.getNum())){r.initDOM(r.rows);r.callback(r.startIndex,r.endIndex)}};this.scrollEl.addEventListener("scroll",a,false);this.destroy=function(){r.contentEl.innerHtml="";r.scrollEl.removeEventListener("scroll",a,false)}}return s(t,[{key:"initDOM",value:function e(t,r){if("undefined"===typeof this.clusterHeight){this.cache.scrollTop=this.scrollEl.scrollTop;this.cache.data=this.contentEl.innerHTML=t[0]+t[0]+t[0];this.getRowsHeight(t)}else if(0===this.blockHeight)this.getRowsHeight(t);var a=this.initData(t,this.getNum(r));var i=a.rows.join("");var n=this.checkChanges("data",i);var o=this.checkChanges("top",a.topOffset);var s=this.checkChanges("bottom",a.bottomOffset);var l=[];if(n&&o){if(a.topOffset)l.push(this.getExtra("top",a.topOffset));l.push(i);if(a.bottomOffset)l.push(this.getExtra("bottom",a.bottomOffset));this.startIndex=a.start;this.endIndex=a.end;this.contentEl.innerHTML=l.join("");if(r)this.contentEl.scrollTop=this.cache.scrollTop}else if(s)this.contentEl.lastChild.style.height="".concat(a.bottomOffset,"px")}},{key:"getRowsHeight",value:function r(){if("undefined"===typeof this.itemHeight||0===this.itemHeight){var t=this.contentEl.children;var e=t[Math.floor(t.length/2)];this.itemHeight=e.offsetHeight}this.blockHeight=this.itemHeight*wy;this.clusterRows=wy*Sy;this.clusterHeight=this.blockHeight*Sy}},{key:"getNum",value:function a(t){this.scrollTop=t?this.cache.scrollTop:this.scrollEl.scrollTop;return Math.floor(this.scrollTop/(this.clusterHeight-this.blockHeight))||0}},{key:"initData",value:function i(t,e){if(t.length<wy)return{topOffset:0,bottomOffset:0,rowsAbove:0,rows:t};var r=Math.max((this.clusterRows-wy)*e,0);var a=r+this.clusterRows;var i=Math.max(r*this.itemHeight,0);var n=Math.max((t.length-a)*this.itemHeight,0);var o=[];var s=r;if(i<1)s++;for(var l=r;l<a;l++)t[l]&&o.push(t[l]);return{start:r,end:a,topOffset:i,bottomOffset:n,rowsAbove:s,rows:o}}},{key:"checkChanges",value:function o(t,e){var r=e!==this.cache[t];this.cache[t]=e;return r}},{key:"getExtra",value:function l(t,e){var r=document.createElement("tr");r.className="virtual-scroll-".concat(t);if(e)r.style.height="".concat(e,"px");return r.outerHTML}}])}();var Oy=function(){function e(r,a){n(this,e);this.options=a;this.$el=t(r);this.$el_=this.$el.clone();this.timeoutId_=0;this.timeoutFooter_=0}return s(e,[{key:"init",value:function r(){this.initConstants();this.initLocale();this.initContainer();this.initTable();this.initHeader();this.initData();this.initHiddenRows();this.initToolbar();this.initPagination();this.initBody();this.initSearchText();this.initServer()}},{key:"initConstants",value:function a(){var e=this.options;this.constants=yy.CONSTANTS;this.constants.theme=t.fn.bootstrapTable.theme;this.constants.dataToggle=this.constants.html.dataToggle||"data-toggle";var r=fy.getIconsPrefix(t.fn.bootstrapTable.theme);if("string"===typeof e.icons)e.icons=fy.calculateObjectValue(null,e.icons);e.iconsPrefix=e.iconsPrefix||t.fn.bootstrapTable.defaults.iconsPrefix||r;e.icons=Object.assign(fy.getIcons(e.iconsPrefix),t.fn.bootstrapTable.defaults.icons,e.icons);var a=e.buttonsPrefix?"".concat(e.buttonsPrefix,"-"):"";this.constants.buttonsClass=[e.buttonsPrefix,a+e.buttonsClass,fy.sprintf("".concat(a,"%s"),e.iconSize)].join(" ").trim();this.buttons=fy.calculateObjectValue(this,e.buttons,[],{});if("object"!==i(this.buttons))this.buttons={}}},{key:"initLocale",value:function o(){if(this.options.locale){var r=t.fn.bootstrapTable.locales;var a=this.options.locale.split(/-|_/);a[0]=a[0].toLowerCase();if(a[1])a[1]=a[1].toUpperCase();var i={};if(r[this.options.locale])i=r[this.options.locale];else if(r[a.join("-")])i=r[a.join("-")];else if(r[a[0]])i=r[a[0]];this._defaultLocales=this._defaultLocales||{};for(var n=0,o=Object.entries(i);n<o.length;n++){var s=l(o[n],2),c=s[0],f=s[1];var u=this._defaultLocales.hasOwnProperty(c)?this._defaultLocales[c]:e.DEFAULTS[c];if(this.options[c]!==u)continue;this.options[c]=f;this._defaultLocales[c]=f}}}},{key:"initContainer",value:function f(){var e=["top","both"].includes(this.options.paginationVAlign)?'<div class="fixed-table-pagination clearfix"></div>':"";var r=["bottom","both"].includes(this.options.paginationVAlign)?'<div class="fixed-table-pagination"></div>':"";var a=fy.calculateObjectValue(this.options,this.options.loadingTemplate,[this.options.formatLoadingMessage()]);this.$container=t('\n <div class="bootstrap-table '.concat(this.constants.theme,'">\n <div class="fixed-table-toolbar"></div>\n ').concat(e,'\n <div class="fixed-table-container">\n <div class="fixed-table-header"><table></table></div>\n <div class="fixed-table-body">\n <div class="fixed-table-loading">\n ').concat(a,'\n </div>\n </div>\n <div class="fixed-table-footer"></div>\n </div>\n ').concat(r,"\n </div>\n "));this.$container.insertAfter(this.$el);this.$tableContainer=this.$container.find(".fixed-table-container");this.$tableHeader=this.$container.find(".fixed-table-header");this.$tableBody=this.$container.find(".fixed-table-body");this.$tableLoading=this.$container.find(".fixed-table-loading");this.$tableFooter=this.$el.find("tfoot");if(this.options.buttonsToolbar)this.$toolbar=t("body").find(this.options.buttonsToolbar);else this.$toolbar=this.$container.find(".fixed-table-toolbar");this.$pagination=this.$container.find(".fixed-table-pagination");this.$tableBody.append(this.$el);this.$container.after('<div class="clearfix"></div>');this.$el.addClass(this.options.classes);this.$tableLoading.addClass(this.options.classes);if(this.options.striped)this.$el.addClass("table-striped");if(this.options.height){this.$tableContainer.addClass("fixed-height");if(this.options.showFooter)this.$tableContainer.addClass("has-footer");if(this.options.classes.split(" ").includes("table-bordered")){this.$tableBody.append('<div class="fixed-table-border"></div>');this.$tableBorder=this.$tableBody.find(".fixed-table-border");this.$tableLoading.addClass("fixed-table-border")}this.$tableFooter=this.$container.find(".fixed-table-footer")}}},{key:"initTable",value:function u(){var r=this;var a=[];this.$header=this.$el.find(">thead");if(!this.$header.length)this.$header=t('<thead class="'.concat(this.options.theadClasses,'"></thead>')).appendTo(this.$el);else if(this.options.theadClasses)this.$header.addClass(this.options.theadClasses);this._headerTrClasses=[];this._headerTrStyles=[];this.$header.find("tr").each(function(e,i){var n=t(i);var o=[];n.find("th").each(function(e,r){var a=t(r);if("undefined"!==typeof a.data("field"))a.data("field","".concat(a.data("field")));var i=Object.assign({},a.data());for(var n in i)if(t.fn.bootstrapTable.columnDefaults.hasOwnProperty(n))delete i[n];o.push(fy.extend({},{_data:fy.getRealDataAttr(i),title:a.html(),class:a.attr("class"),titleTooltip:a.attr("title"),rowspan:a.attr("rowspan")?+a.attr("rowspan"):void 0,colspan:a.attr("colspan")?+a.attr("colspan"):void 0},a.data()))});a.push(o);if(n.attr("class"))r._headerTrClasses.push(n.attr("class"));if(n.attr("style"))r._headerTrStyles.push(n.attr("style"))});if(!Array.isArray(this.options.columns[0]))this.options.columns=[this.options.columns];this.options.columns=fy.extend(true,[],a,this.options.columns);this.columns=[];this.fieldsColumnsIndex=[];fy.setFieldIndex(this.options.columns);this.options.columns.forEach(function(t,a){t.forEach(function(t,i){var n=fy.extend({},e.COLUMN_DEFAULTS,t,{passed:t});if("undefined"!==typeof n.fieldIndex){r.columns[n.fieldIndex]=n;r.fieldsColumnsIndex[n.field]=n.fieldIndex}r.options.columns[a][i]=n})});if(!this.options.data.length){var i=fy.trToData(this.columns,this.$el.find(">tbody>tr"));if(i.length){this.options.data=i;this.fromHtml=true}}if(!(this.options.pagination&&"server"!==this.options.sidePagination))this.footerData=fy.trToData(this.columns,this.$el.find(">tfoot>tr"));if(this.footerData)this.$el.find("tfoot").html("<tr></tr>");if(!this.options.showFooter||this.options.cardView)this.$tableFooter.hide();else this.$tableFooter.show()}},{key:"initHeader",value:function h(){var e=this;var r={};var a=[];this.header={fields:[],styles:[],classes:[],formatters:[],detailFormatters:[],events:[],sorters:[],sortNames:[],cellStyles:[],searchables:[]};fy.updateFieldGroup(this.options.columns,this.columns);this.options.columns.forEach(function(t,n){var o=[];o.push("<tr".concat(fy.sprintf(' class="%s"',e._headerTrClasses[n])," ").concat(fy.sprintf(' style="%s"',e._headerTrStyles[n]),">"));var s="";if(0===n&&fy.hasDetailViewIcon(e.options)){var c=e.options.columns.length>1?' rowspan="'.concat(e.options.columns.length,'"'):"";s='<th class="detail"'.concat(c,'>\n <div class="fht-cell"></div>\n </th>')}if(s&&"right"!==e.options.detailViewAlign)o.push(s);t.forEach(function(t,a){var s=fy.sprintf(' class="%s"',t["class"]);var c=t.widthUnit;var f=parseFloat(t.width);var u=t.halign?t.halign:t.align;var h=fy.sprintf("text-align: %s; ",u);var v=fy.sprintf("text-align: %s; ",t.align);var d=fy.sprintf("vertical-align: %s; ",t.valign);d+=fy.sprintf("width: %s; ",(t.checkbox||t.radio)&&!f?!t.showSelectTitle?"36px":void 0:f?f+c:void 0);if("undefined"===typeof t.fieldIndex&&!t.visible)return;var p=fy.calculateObjectValue(null,e.options.headerStyle,[t]);var g=[];var b=[];var m="";if(p&&p.css)for(var y=0,w=Object.entries(p.css);y<w.length;y++){var S=l(w[y],2),x=S[0],O=S[1];g.push("".concat(x,": ").concat(O))}if(p&&p.classes)m=fy.sprintf(' class="%s"',t["class"]?[t["class"],p.classes].join(" "):p.classes);if("undefined"!==typeof t.fieldIndex){e.header.fields[t.fieldIndex]=t.field;e.header.styles[t.fieldIndex]=v+d;e.header.classes[t.fieldIndex]=s;e.header.formatters[t.fieldIndex]=t.formatter;e.header.detailFormatters[t.fieldIndex]=t.detailFormatter;e.header.events[t.fieldIndex]=t.events;e.header.sorters[t.fieldIndex]=t.sorter;e.header.sortNames[t.fieldIndex]=t.sortName;e.header.cellStyles[t.fieldIndex]=t.cellStyle;e.header.searchables[t.fieldIndex]=t.searchable;if(!t.visible)return;if(e.options.cardView&&!t.cardVisible)return;r[t.field]=t}if(Object.keys(t._data||{}).length>0)for(var k=0,P=Object.entries(t._data);k<P.length;k++){var C=l(P[k],2),T=C[0],I=C[1];b.push("data-".concat(T,"='").concat("object"===i(I)?JSON.stringify(I):I,"'"))}o.push("<th".concat(fy.sprintf(' title="%s"',t.titleTooltip)),t.checkbox||t.radio?fy.sprintf(' class="bs-checkbox %s"',t["class"]||""):m||s,fy.sprintf(' style="%s"',h+d+g.join("; ")||void 0),fy.sprintf(' rowspan="%s"',t.rowspan),fy.sprintf(' colspan="%s"',t.colspan),fy.sprintf(' data-field="%s"',t.field),0===a&&n>0?" data-not-first-th":"",b.length>0?b.join(" "):"",">");o.push(fy.sprintf('<div class="th-inner %s">',e.options.sortable&&t.sortable?"sortable".concat("center"===u?" sortable-center":""," both"):""));var A=e.options.escape&&e.options.escapeTitle?fy.escapeHTML(t.title):t.title;var $=A;if(t.checkbox){A="";if(!e.options.singleSelect&&e.options.checkboxHeader)A='<label><input name="btSelectAll" type="checkbox" /><span></span></label>';e.header.stateField=t.field}if(t.radio){A="";e.header.stateField=t.field}if(!A&&t.showSelectTitle)A+=$;o.push(A);o.push("</div>");o.push('<div class="fht-cell"></div>');o.push("</div>");o.push("</th>")});if(s&&"right"===e.options.detailViewAlign)o.push(s);o.push("</tr>");if(o.length>3)a.push(o.join(""))});this.$header.html(a.join(""));this.$header.find("th[data-field]").each(function(e,a){t(a).data(r[t(a).data("field")])});this.$container.off("click",".th-inner").on("click",".th-inner",function(r){var a=t(r.currentTarget);if(e.options.detailView&&!a.parent().hasClass("bs-checkbox"))if(a.closest(".bootstrap-table")[0]!==e.$container[0])return false;if(e.options.sortable&&a.parent().data().sortable)e.onSort(r)});var n=fy.getEventName("resize.bootstrap-table",this.$el.attr("id"));t(window).off(n);if(!this.options.showHeader||this.options.cardView){this.$header.hide();this.$tableHeader.hide();this.$tableLoading.css("top",0)}else{this.$header.show();this.$tableHeader.show();this.$tableLoading.css("top",this.$header.outerHeight()+1);this.getCaret();t(window).on(n,function(){return e.resetView()})}this.$selectAll=this.$header.find('[name="btSelectAll"]');this.$selectAll.off("click").on("click",function(r){r.stopPropagation();var a=t(r.currentTarget).prop("checked");e[a?"checkAll":"uncheckAll"]();e.updateSelected()})}},{key:"initData",value:function v(t,e){if("append"===e)this.options.data=this.options.data.concat(t);else if("prepend"===e)this.options.data=[].concat(t).concat(this.options.data);else{t=t||fy.deepCopy(this.options.data);this.options.data=Array.isArray(t)?t:t[this.options.dataField]}this.data=c(this.options.data);if(this.options.sortReset)this.unsortedData=c(this.data);if("server"===this.options.sidePagination)return;this.initSort()}},{key:"initSort",value:function d(){var t=this;var e=this.options.sortName;var r="desc"===this.options.sortOrder?-1:1;var a=this.header.fields.indexOf(this.options.sortName);var i=0;if(a!==-1){if(this.options.sortStable)this.data.forEach(function(t,e){if(!t.hasOwnProperty("_position"))t._position=e});if(this.options.customSort)fy.calculateObjectValue(this.options,this.options.customSort,[this.options.sortName,this.options.sortOrder,this.data]);else this.data.sort(function(i,n){if(t.header.sortNames[a])e=t.header.sortNames[a];var o=fy.getItemField(i,e,t.options.escape);var s=fy.getItemField(n,e,t.options.escape);var l=fy.calculateObjectValue(t.header,t.header.sorters[a],[o,s,i,n]);if(void 0!==l){if(t.options.sortStable&&0===l)return r*(i._position-n._position);return r*l}return fy.sort(o,s,r,t.options,i._position,n._position)});if(void 0!==this.options.sortClass){clearTimeout(i);i=setTimeout(function(){t.$el.removeClass(t.options.sortClass);var e=t.$header.find('[data-field="'.concat(t.options.sortName,'"]')).index();t.$el.find("tr td:nth-child(".concat(e+1,")")).addClass(t.options.sortClass)},250)}}else if(this.options.sortReset)this.data=c(this.unsortedData)}},{key:"sortBy",value:function p(t){this.options.sortName=t.field;this.options.sortOrder=t.hasOwnProperty("sortOrder")?t.sortOrder:"asc";this._sort()}},{key:"onSort",value:function g(e){var r=e.type,a=e.currentTarget;var i="keypress"===r?t(a):t(a).parent();var n=this.$header.find("th").eq(i.index());this.$header.add(this.$header_).find("span.order").remove();if(this.options.sortName===i.data("field")){var o=this.options.sortOrder;var s=this.columns[this.fieldsColumnsIndex[i.data("field")]].sortOrder||this.columns[this.fieldsColumnsIndex[i.data("field")]].order;if(void 0===o)this.options.sortOrder="asc";else if("asc"===o)this.options.sortOrder=this.options.sortReset?"asc"===s?"desc":void 0:"desc";else if("desc"===this.options.sortOrder)this.options.sortOrder=this.options.sortReset?"desc"===s?"asc":void 0:"asc";if(void 0===this.options.sortOrder)this.options.sortName=void 0}else{this.options.sortName=i.data("field");if(this.options.rememberOrder)this.options.sortOrder="asc"===i.data("order")?"desc":"asc";else this.options.sortOrder=this.columns[this.fieldsColumnsIndex[i.data("field")]].sortOrder||this.columns[this.fieldsColumnsIndex[i.data("field")]].order}i.add(n).data("order",this.options.sortOrder);this.getCaret();this._sort()}},{key:"_sort",value:function m(){if("server"===this.options.sidePagination&&this.options.serverSort){this.options.pageNumber=1;this.trigger("sort",this.options.sortName,this.options.sortOrder);this.initServer(this.options.silentSort);return}if(this.options.pagination&&this.options.sortResetPage){this.options.pageNumber=1;this.initPagination()}this.trigger("sort",this.options.sortName,this.options.sortOrder);this.initSort();this.initBody()}},{key:"initToolbar",value:function y(){var e=this;var r=this.options;var a=[];var n=0;var o;var s=0;if(this.$toolbar.find(".bs-bars").children().length)t("body").append(t(r.toolbar));this.$toolbar.html("");if("string"===typeof r.toolbar||"object"===i(r.toolbar))t(fy.sprintf('<div class="bs-bars %s-%s"></div>',this.constants.classes.pull,r.toolbarAlign)).appendTo(this.$toolbar).append(t(r.toolbar));a=['<div class="'.concat(["columns","columns-".concat(r.buttonsAlign),this.constants.classes.buttonsGroup,"".concat(this.constants.classes.pull,"-").concat(r.buttonsAlign)].join(" "),'">')];if("string"===typeof r.buttonsOrder)r.buttonsOrder=r.buttonsOrder.replace(/\[|\]| |'/g,"").split(",");this.buttons=Object.assign(this.buttons,{search:{text:r.formatSearch(),icon:r.icons.search,render:false,event:this.toggleShowSearch,attributes:{"aria-label":r.formatShowSearch(),title:r.formatShowSearch()}},paginationSwitch:{text:r.pagination?r.formatPaginationSwitchUp():r.formatPaginationSwitchDown(),icon:r.pagination?r.icons.paginationSwitchDown:r.icons.paginationSwitchUp,render:false,event:this.togglePagination,attributes:{"aria-label":r.formatPaginationSwitch(),title:r.formatPaginationSwitch()}},refresh:{text:r.formatRefresh(),icon:r.icons.refresh,render:false,event:this.refresh,attributes:{"aria-label":r.formatRefresh(),title:r.formatRefresh()}},toggle:{text:r.formatToggleOn(),icon:r.icons.toggleOff,render:false,event:this.toggleView,attributes:{"aria-label":r.formatToggleOn(),title:r.formatToggleOn()}},fullscreen:{text:r.formatFullscreen(),icon:r.icons.fullscreen,render:false,event:this.toggleFullscreen,attributes:{"aria-label":r.formatFullscreen(),title:r.formatFullscreen()}},columns:{render:false,html:function z(){var z=[];z.push('<div class="keep-open '.concat(e.constants.classes.buttonsDropdown,'">\n <button class="').concat(e.constants.buttonsClass,' dropdown-toggle" type="button" ').concat(e.constants.dataToggle,'="dropdown"\n aria-label="').concat(r.formatColumns(),'" title="').concat(r.formatColumns(),'">\n ').concat(r.showButtonIcons?fy.sprintf(e.constants.html.icon,r.iconsPrefix,r.icons.columns):"","\n ").concat(r.showButtonText?r.formatColumns():"","\n ").concat(e.constants.html.dropdownCaret,"\n </button>\n ").concat(e.constants.html.toolbarDropdown[0]));if(r.showColumnsSearch){z.push(fy.sprintf(e.constants.html.toolbarDropdownItem,fy.sprintf('<input type="text" class="%s" name="columnsSearch" placeholder="%s" autocomplete="off">',e.constants.classes.input,r.formatSearch())));z.push(e.constants.html.toolbarDropdownSeparator)}if(r.showColumnsToggleAll){var t=e.getVisibleColumns().length===e.columns.filter(function(t){return!e.isSelectionColumn(t)}).length;z.push(fy.sprintf(e.constants.html.toolbarDropdownItem,fy.sprintf('<input type="checkbox" class="toggle-all" %s> <span>%s</span>',t?'checked="checked"':"",r.formatColumnsToggleAll())));z.push(e.constants.html.toolbarDropdownSeparator)}var a=0;e.columns.forEach(function(t){if(t.visible)a++});e.columns.forEach(function(t,i){if(e.isSelectionColumn(t))return;if(r.cardView&&!t.cardVisible)return;if(t.ignore)return;var n=t.visible?' checked="checked"':"";var o=a<=r.minimumCountColumns&&n?' disabled="disabled"':"";if(t.switchable){z.push(fy.sprintf(e.constants.html.toolbarDropdownItem,fy.sprintf('<input type="checkbox" data-field="%s" value="%s"%s%s> <span>%s</span>',t.field,i,n,o,t.switchableLabel||t.title)));s++}});z.push(e.constants.html.toolbarDropdown[1],"</div>");return z.join("")}}});var c={};for(var f=0,u=Object.entries(this.buttons);f<u.length;f++){var h=l(u[f],2),v=h[0],d=h[1];var p=void 0;if(d.hasOwnProperty("html")){if("function"===typeof d.html)p=d.html();else if("string"===typeof d.html)p=d.html}else{var g=this.constants.buttonsClass;if(d.hasOwnProperty("attributes")&&d.attributes["class"])g+=" ".concat(d.attributes["class"]);p='<button class="'.concat(g,'" type="button" name="').concat(v,'"');if(d.hasOwnProperty("attributes"))for(var m=0,y=Object.entries(d.attributes);m<y.length;m++){var w=l(y[m],2),S=w[0],x=w[1];if("class"===S)continue;p+=" ".concat(S,'="').concat(x,'"')}p+=">";if(r.showButtonIcons&&d.hasOwnProperty("icon"))p+="".concat(fy.sprintf(this.constants.html.icon,r.iconsPrefix,d.icon)," ");if(r.showButtonText&&d.hasOwnProperty("text"))p+=d.text;p+="</button>"}c[v]=p;var O="show".concat(v.charAt(0).toUpperCase()).concat(v.substring(1));var k=r[O];if((!d.hasOwnProperty("render")||d.hasOwnProperty("render")&&d.render)&&(void 0===k||true===k))r[O]=true;if(!r.buttonsOrder.includes(v))r.buttonsOrder.push(v)}var P=b(r.buttonsOrder),C;try{for(P.s();!(C=P.n()).done;){var T=C.value;var I=r["show".concat(T.charAt(0).toUpperCase()).concat(T.substring(1))];if(I)a.push(c[T])}}catch(A){P.e(A)}finally{P.f()}a.push("</div>");if(this.showToolbar||a.length>2)this.$toolbar.append(a.join(""));if(r.showSearch)this.$toolbar.find('button[name="showSearch"]').off("click").on("click",function(){return e.toggleShowSearch()});var $=function q(){var t=l(E[R],2),r=t[0],a=t[1];if(a.hasOwnProperty("event")){if("function"===typeof a.event||"string"===typeof a.event){var i="string"===typeof a.event?window[a.event]:a.event;e.$toolbar.find('button[name="'.concat(r,'"]')).off("click").on("click",function(){return i.call(e)});return 1}var n=function c(){var t=l(s[o],2),a=t[0],i=t[1];var n="string"===typeof i?window[i]:i;e.$toolbar.find('button[name="'.concat(r,'"]')).off(a).on(a,function(){return n.call(e)})};for(var o=0,s=Object.entries(a.event);o<s.length;o++)n()}};for(var R=0,E=Object.entries(this.buttons);R<E.length;R++)if($())continue;if(r.showColumns){o=this.$toolbar.find(".keep-open");var j=o.find('input[type="checkbox"]:not(".toggle-all")');var _=o.find('input[type="checkbox"].toggle-all');if(s<=r.minimumCountColumns)o.find("input").prop("disabled",true);o.find("li, label").off("click").on("click",function(t){t.stopImmediatePropagation()});j.off("click").on("click",function(r){var a=r.currentTarget;var i=t(a);e._toggleColumn(i.val(),i.prop("checked"),false);e.trigger("column-switch",i.data("field"),i.prop("checked"));_.prop("checked",j.filter(":checked").length===e.columns.filter(function(t){return!e.isSelectionColumn(t)}).length)});_.off("click").on("click",function(r){var a=r.currentTarget;e._toggleAllColumns(t(a).prop("checked"));e.trigger("column-switch-all",t(a).prop("checked"))});if(r.showColumnsSearch){var N=o.find('[name="columnsSearch"]');var F=o.find(".dropdown-item-marker");N.on("keyup paste change",function(e){var r=e.currentTarget;var a=t(r);var i=a.val().toLowerCase();F.show();j.each(function(e,r){var a=t(r);var n=a.parents(".dropdown-item-marker");var o=n.text().toLowerCase();if(!o.includes(i))n.hide()})})}}var D=function G(t){var a=t.is("select")?"change":"keyup drop blur mouseup";t.off(a).on(a,function(t){if(r.searchOnEnterKey&&13!==t.keyCode)return;if([37,38,39,40].includes(t.keyCode))return;clearTimeout(n);n=setTimeout(function(){e.onSearch({currentTarget:t.currentTarget})},r.searchTimeOut)})};if((r.search||this.showSearchClearButton)&&"string"!==typeof r.searchSelector){a=[];var V=fy.sprintf(this.constants.html.searchButton,this.constants.buttonsClass,r.formatSearch(),r.showButtonIcons?fy.sprintf(this.constants.html.icon,r.iconsPrefix,r.icons.search):"",r.showButtonText?r.formatSearch():"");var B=fy.sprintf(this.constants.html.searchClearButton,this.constants.buttonsClass,r.formatClearSearch(),r.showButtonIcons?fy.sprintf(this.constants.html.icon,r.iconsPrefix,r.icons.clearSearch):"",r.showButtonText?r.formatClearSearch():"");var L='<input class="'.concat(this.constants.classes.input,"\n ").concat(fy.sprintf(" %s%s",this.constants.classes.inputPrefix,r.iconSize),'\n search-input" type="search" aria-label="').concat(r.formatSearch(),'" placeholder="').concat(r.formatSearch(),'" autocomplete="off">');var H=L;if(r.showSearchButton||r.showSearchClearButton){var M=(r.showSearchButton?V:"")+(r.showSearchClearButton?B:"");H=r.search?fy.sprintf(this.constants.html.inputGroup,L,M):M}a.push(fy.sprintf('\n <div class="'.concat(this.constants.classes.pull,"-").concat(r.searchAlign," search ").concat(this.constants.classes.inputGroup,'">\n %s\n </div>\n '),H));this.$toolbar.append(a.join(""));var U=fy.getSearchInput(this);if(r.showSearchButton){this.$toolbar.find(".search button[name=search]").off("click").on("click",function(){clearTimeout(n);n=setTimeout(function(){e.onSearch({currentTarget:U})},r.searchTimeOut)});if(r.searchOnEnterKey)D(U)}else D(U);if(r.showSearchClearButton)this.$toolbar.find(".search button[name=clearSearch]").click(function(){e.resetSearch()})}else if("string"===typeof r.searchSelector)D(fy.getSearchInput(this))}},{key:"onSearch",value:function w(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.currentTarget,a=e.firedByInitSearchText;var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:true;if(void 0!==r&&t(r).length&&i){var n=t(r).val().trim();if(this.options.trimOnSearch&&t(r).val()!==n)t(r).val(n);if(this.searchText===n)return;var o=fy.getSearchInput(this);var s=r instanceof jQuery?r:t(r);if(s.is(o)||s.hasClass("search-input")){this.searchText=n;this.options.searchText=n}}if(!a)this.options.pageNumber=1;this.initSearch();if(a){if("client"===this.options.sidePagination)this.updatePagination()}else this.updatePagination();this.trigger("search",this.searchText)}},{key:"initSearch",value:function S(){var t=this;this.filterOptions=this.filterOptions||this.options.filterOptions;if("server"!==this.options.sidePagination){if(this.options.customSearch){this.data=fy.calculateObjectValue(this.options,this.options.customSearch,[this.options.data,this.searchText,this.filterColumns]);if(this.options.sortReset)this.unsortedData=c(this.data);this.initSort();return}var e=this.searchText&&(this.fromHtml?fy.escapeHTML(this.searchText):this.searchText);var r=e?e.toLowerCase():"";var a=fy.isEmptyObject(this.filterColumns)?null:this.filterColumns;if(this.options.searchAccentNeutralise)r=fy.normalizeAccent(r);if("function"===typeof this.filterOptions.filterAlgorithm)this.data=this.options.data.filter(function(e){return t.filterOptions.filterAlgorithm.apply(null,[e,a])});else if("string"===typeof this.filterOptions.filterAlgorithm)this.data=a?this.options.data.filter(function(e){var r=t.filterOptions.filterAlgorithm;if("and"===r){for(var i in a)if(Array.isArray(a[i])&&!a[i].includes(e[i])||!Array.isArray(a[i])&&e[i]!==a[i])return false}else if("or"===r){var n=false;for(var o in a)if(Array.isArray(a[o])&&a[o].includes(e[o])||!Array.isArray(a[o])&&e[o]===a[o])n=true;return n}return true}):c(this.options.data);var i=this.getVisibleFields();this.data=r?this.data.filter(function(a,n){for(var o=0;o<t.header.fields.length;o++){if(!t.header.searchables[o]||t.options.visibleSearch&&i.indexOf(t.header.fields[o])===-1)continue;var s=fy.isNumeric(t.header.fields[o])?parseInt(t.header.fields[o],10):t.header.fields[o];var l=t.columns[t.fieldsColumnsIndex[s]];var c=void 0;if("string"===typeof s&&!a.hasOwnProperty(s)){c=a;var f=s.split(".");for(var u=0;u<f.length;u++)if(null!==c[f[u]])c=c[f[u]];else{c=null;break}}else c=a[s];if(t.options.searchAccentNeutralise)c=fy.normalizeAccent(c);if(l&&l.searchFormatter)c=fy.calculateObjectValue(l,t.header.formatters[o],[c,a,n,l.field],c);if("string"===typeof c||"number"===typeof c){if(t.options.strictSearch&&"".concat(c).toLowerCase()===r||t.options.regexSearch&&fy.regexCompare(c,e))return true;var h=/(?:(<=|=>|=<|>=|>|<)(?:\s+)?(-?\d+)?|(-?\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm;var v=h.exec(t.searchText);var d=false;if(v){var p=v[1]||"".concat(v[5],"l");var g=v[2]||v[3];var b=parseInt(c,10);var m=parseInt(g,10);switch(p){case">":case"<l":d=b>m;break;case"<":case">l":d=b<m;break;case"<=":case"=<":case">=l":case"=>l":d=b<=m;break;case">=":case"=>":case"<=l":case"=<l":d=b>=m}}if(d||"".concat(c).toLowerCase().includes(r))return true}}return false}):this.data;if(this.options.sortReset)this.unsortedData=c(this.data);this.initSort()}}},{key:"initPagination",value:function x(){var e=this;var r=this.options;if(!r.pagination){this.$pagination.hide();return}this.$pagination.show();var a=[];var i=false;var n;var o;var s;var l;var c;var f;var u;var h=this.getData({includeHiddenRows:false});var v=r.pageList;if("string"===typeof v)v=v.replace(/\[|\]| /g,"").toLowerCase().split(",");v=v.map(function(t){if("string"===typeof t)return t.toLowerCase()===r.formatAllRows().toLowerCase()||["all","unlimited"].includes(t.toLowerCase())?r.formatAllRows():+t;return t});this.paginationParts=r.paginationParts;if("string"===typeof this.paginationParts)this.paginationParts=this.paginationParts.replace(/\[|\]| |'/g,"").split(",");if("server"!==r.sidePagination)r.totalRows=h.length;this.totalPages=0;if(r.totalRows){if(r.pageSize===r.formatAllRows()){r.pageSize=r.totalRows;i=true}this.totalPages=~~((r.totalRows-1)/r.pageSize)+1;r.totalPages=this.totalPages}if(this.totalPages>0&&r.pageNumber>this.totalPages)r.pageNumber=this.totalPages;this.pageFrom=(r.pageNumber-1)*r.pageSize+1;this.pageTo=r.pageNumber*r.pageSize;if(this.pageTo>r.totalRows)this.pageTo=r.totalRows;if(this.options.pagination&&"server"!==this.options.sidePagination)this.options.totalNotFiltered=this.options.data.length;if(!this.options.showExtendedPagination)this.options.totalNotFiltered=void 0;if(this.paginationParts.includes("pageInfo")||this.paginationParts.includes("pageInfoShort")||this.paginationParts.includes("pageSize"))a.push('<div class="'.concat(this.constants.classes.pull,"-").concat(r.paginationDetailHAlign,' pagination-detail">'));if(this.paginationParts.includes("pageInfo")||this.paginationParts.includes("pageInfoShort")){var d=this.options.totalRows+("client"===this.options.sidePagination&&this.options.paginationLoadMore&&!this._paginationLoaded?" +":"");var p=this.paginationParts.includes("pageInfoShort")?r.formatDetailPagination(d):r.formatShowingRows(this.pageFrom,this.pageTo,d,r.totalNotFiltered);a.push('<span class="pagination-info">\n '.concat(p,"\n </span>"))}if(this.paginationParts.includes("pageSize")){a.push('<div class="page-list">');var g=['<div class="'.concat(this.constants.classes.paginationDropdown,'">\n <button class="').concat(this.constants.buttonsClass,' dropdown-toggle" type="button" ').concat(this.constants.dataToggle,'="dropdown">\n <span class="page-size">\n ').concat(i?r.formatAllRows():r.pageSize,"\n </span>\n ").concat(this.constants.html.dropdownCaret,"\n </button>\n ").concat(this.constants.html.pageDropdown[0])];v.forEach(function(t,a){if(!r.smartDisplay||0===a||v[a-1]<r.totalRows||t===r.formatAllRows()){var n;if(i)n=t===r.formatAllRows()?e.constants.classes.dropdownActive:"";else n=t===r.pageSize?e.constants.classes.dropdownActive:"";g.push(fy.sprintf(e.constants.html.pageDropdownItem,n,t))}});g.push("".concat(this.constants.html.pageDropdown[1],"</div>"));a.push(r.formatRecordsPerPage(g.join("")))}if(this.paginationParts.includes("pageInfo")||this.paginationParts.includes("pageInfoShort")||this.paginationParts.includes("pageSize"))a.push("</div></div>");if(this.paginationParts.includes("pageList")){a.push('<div class="'.concat(this.constants.classes.pull,"-").concat(r.paginationHAlign,' pagination">'),fy.sprintf(this.constants.html.pagination[0],fy.sprintf(" pagination-%s",r.iconSize)),fy.sprintf(this.constants.html.paginationItem," page-pre",r.formatSRPaginationPreText(),r.paginationPreText));if(this.totalPages<r.paginationSuccessivelySize){o=1;s=this.totalPages}else{o=r.pageNumber-r.paginationPagesBySide;s=o+2*r.paginationPagesBySide}if(r.pageNumber<r.paginationSuccessivelySize-1)s=r.paginationSuccessivelySize;if(r.paginationSuccessivelySize>this.totalPages-o)o=o-(r.paginationSuccessivelySize-(this.totalPages-o))+1;if(o<1)o=1;if(s>this.totalPages)s=this.totalPages;var b=Math.round(r.paginationPagesBySide/2);var m=function P(t){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return fy.sprintf(e.constants.html.paginationItem,a+(t===r.pageNumber?" ".concat(e.constants.classes.paginationActive):""),r.formatSRPaginationPageText(t),t)};if(o>1){var y=r.paginationPagesBySide;if(y>=o)y=o-1;for(n=1;n<=y;n++)a.push(m(n));if(o-1===y+1){n=o-1;a.push(m(n))}else if(o-1>y)if(o-2*r.paginationPagesBySide>r.paginationPagesBySide&&r.paginationUseIntermediate){n=Math.round((o-b)/2+b);a.push(m(n," page-intermediate"))}else a.push(fy.sprintf(this.constants.html.paginationItem," page-first-separator disabled","","..."))}for(n=o;n<=s;n++)a.push(m(n));if(this.totalPages>s){var w=this.totalPages-(r.paginationPagesBySide-1);if(s>=w)w=s+1;if(s+1===w-1){n=s+1;a.push(m(n))}else if(w>s+1)if(this.totalPages-s>2*r.paginationPagesBySide&&r.paginationUseIntermediate){n=Math.round((this.totalPages-b-s)/2+s);a.push(m(n," page-intermediate"))}else a.push(fy.sprintf(this.constants.html.paginationItem," page-last-separator disabled","","..."));for(n=w;n<=this.totalPages;n++)a.push(m(n))}a.push(fy.sprintf(this.constants.html.paginationItem," page-next",r.formatSRPaginationNextText(),r.paginationNextText));a.push(this.constants.html.pagination[1],"</div>")}this.$pagination.html(a.join(""));var S=["bottom","both"].includes(r.paginationVAlign)?" ".concat(this.constants.classes.dropup):"";this.$pagination.last().find(".page-list > div").addClass(S);if(!r.onlyInfoPagination){l=this.$pagination.find(".page-list a");c=this.$pagination.find(".page-pre");f=this.$pagination.find(".page-next");u=this.$pagination.find(".page-item").not(".page-next, .page-pre, .page-last-separator, .page-first-separator");if(this.totalPages<=1)this.$pagination.find("div.pagination").hide();if(r.smartDisplay)if(v.length<2||r.totalRows<=v[0])this.$pagination.find("div.page-list").hide();this.$pagination[this.getData().length?"show":"hide"]();if(!r.paginationLoop){if(1===r.pageNumber)c.addClass("disabled");if(r.pageNumber===this.totalPages)f.addClass("disabled")}if(i)r.pageSize=r.formatAllRows();l.off("click").on("click",function(t){return e.onPageListChange(t)});c.off("click").on("click",function(t){return e.onPagePre(t)});f.off("click").on("click",function(t){return e.onPageNext(t)});u.off("click").on("click",function(t){return e.onPageNumber(t)});if(this.options.showPageGo){var x=this,O=this.$pagination.find("ul.pagination"),k=O.find("li.pageGo");if(!k.length){k=t(['<li class="pageGo">',fy.sprintf('<input type="text" class="form-control" value="%s">',this.options.pageNumber),'<button class="btn'+fy.sprintf(" btn-%s",this.constants.buttonsClass)+fy.sprintf(" btn-%s",r.iconSize)+'" title="'+r.formatPageGo()+'" '+' type="button">'+r.formatPageGo(),"</button>","</li>"].join("")).appendTo(O);k.find("button").click(function(){var t=parseInt(k.find("input").val())||1;if(t<1||t>x.options.totalPages)t=1;x.selectPage(t)})}}}}},{key:"updatePagination",value:function O(e){if(e&&t(e.currentTarget).hasClass("disabled"))return;if(!this.options.maintainMetaData)this.resetRows();this.initPagination();this.trigger("page-change",this.options.pageNumber,this.options.pageSize);if("server"===this.options.sidePagination||"client"===this.options.sidePagination&&this.options.paginationLoadMore&&!this._paginationLoaded&&this.options.pageNumber===this.totalPages)this.initServer();else this.initBody()}},{key:"onPageListChange",value:function k(e){e.preventDefault();var r=t(e.currentTarget);r.parent().addClass(this.constants.classes.dropdownActive).siblings().removeClass(this.constants.classes.dropdownActive);this.options.pageSize=r.text().toUpperCase()===this.options.formatAllRows().toUpperCase()?this.options.formatAllRows():+r.text();this.$toolbar.find(".page-size").text(this.options.pageSize);this.updatePagination(e);return false}},{key:"onPagePre",value:function P(e){if(t(e.target).hasClass("disabled"))return;e.preventDefault();if(this.options.pageNumber-1===0)this.options.pageNumber=this.options.totalPages;else this.options.pageNumber--;this.updatePagination(e);return false}},{key:"onPageNext",value:function C(e){if(t(e.target).hasClass("disabled"))return;e.preventDefault();if(this.options.pageNumber+1>this.options.totalPages)this.options.pageNumber=1;else this.options.pageNumber++;this.updatePagination(e);return false}},{key:"onPageNumber",value:function T(e){e.preventDefault();if(this.options.pageNumber===+t(e.currentTarget).text())return;this.options.pageNumber=+t(e.currentTarget).text();this.updatePagination(e);return false}},{key:"initRow",value:function I(t,e,r,a){var n=this;var o=[];var s={};var c=[];var f="";var u={};var h=[];if(fy.findIndex(this.hiddenRows,t)>-1)return;s=fy.calculateObjectValue(this.options,this.options.rowStyle,[t,e],s);if(s&&s.css)for(var v=0,d=Object.entries(s.css);v<d.length;v++){var p=l(d[v],2),g=p[0],b=p[1];c.push("".concat(g,": ").concat(b))}u=fy.calculateObjectValue(this.options,this.options.rowAttributes,[t,e],u);if(u)for(var m=0,y=Object.entries(u);m<y.length;m++){var w=l(y[m],2),S=w[0],x=w[1];h.push("".concat(S,'="').concat(fy.escapeHTML(x),'"'))}if(t._data&&!fy.isEmptyObject(t._data))for(var O=0,k=Object.entries(t._data);O<k.length;O++){var P=l(k[O],2),C=P[0],T=P[1];if("index"===C)return;f+=" data-".concat(C,"='").concat("object"===i(T)?JSON.stringify(T):T,"'")}o.push("<tr",fy.sprintf(" %s",h.length?h.join(" "):void 0),fy.sprintf(' id="%s"',Array.isArray(t)?void 0:t._id),fy.sprintf(' class="%s"',s.classes||(Array.isArray(t)?void 0:t._class)),fy.sprintf(' style="%s"',Array.isArray(t)?void 0:t._style),' data-index="'.concat(e,'"'),fy.sprintf(' data-uniqueid="%s"',fy.getItemField(t,this.options.uniqueId,false)),fy.sprintf(' data-has-detail-view="%s"',this.options.detailView&&fy.calculateObjectValue(null,this.options.detailFilter,[e,t])?"true":void 0),fy.sprintf("%s",f),">");if(this.options.cardView)o.push('<td colspan="'.concat(this.header.fields.length,'"><div class="card-views">'));var I="";if(fy.hasDetailViewIcon(this.options)){I="<td>";if(fy.calculateObjectValue(null,this.options.detailFilter,[e,t]))I+='\n <a class="detail-icon" href="#">\n '.concat(fy.sprintf(this.constants.html.icon,this.options.iconsPrefix,this.options.icons.detailOpen),"\n </a>\n ");I+="</td>"}if(I&&"right"!==this.options.detailViewAlign)o.push(I);this.header.fields.forEach(function(r,a){var i=n.columns[a];var s="";var f=fy.getItemField(t,r,n.options.escape,i.escape);var u="";var h="";var v={};var d="";var p=n.header.classes[a];var g="";var b="";var m="";var y="";var w="";var S="";if((n.fromHtml||n.autoMergeCells)&&"undefined"===typeof f)if(!i.checkbox&&!i.radio)return;if(!i.visible)return;if(n.options.cardView&&!i.cardVisible)return;if(c.concat([n.header.styles[a]]).length)b+="".concat(c.concat([n.header.styles[a]]).join("; "));if(t["_".concat(r,"_style")])b+="".concat(t["_".concat(r,"_style")]);if(b)g=' style="'.concat(b,'"');if(t["_".concat(r,"_id")])d=fy.sprintf(' id="%s"',t["_".concat(r,"_id")]);if(t["_".concat(r,"_class")])p=fy.sprintf(' class="%s"',t["_".concat(r,"_class")]);if(t["_".concat(r,"_rowspan")])y=fy.sprintf(' rowspan="%s"',t["_".concat(r,"_rowspan")]);if(t["_".concat(r,"_colspan")])w=fy.sprintf(' colspan="%s"',t["_".concat(r,"_colspan")]);if(t["_".concat(r,"_title")])S=fy.sprintf(' title="%s"',t["_".concat(r,"_title")]);v=fy.calculateObjectValue(n.header,n.header.cellStyles[a],[f,t,e,r],v);if(v.classes)p=' class="'.concat(v.classes,'"');if(v.css){var x=[];for(var O=0,k=Object.entries(v.css);O<k.length;O++){var P=l(k[O],2),C=P[0],T=P[1];x.push("".concat(C,": ").concat(T))}g=' style="'.concat(x.concat(n.header.styles[a]).join("; "),'"')}u=fy.calculateObjectValue(i,n.header.formatters[a],[f,t,e,r],f);if(!(i.checkbox||i.radio))u="undefined"===typeof u||null===u?n.options.undefinedText:u;if(i.searchable&&n.searchText&&n.options.searchHighlight&&!(i.checkbox||i.radio)){var I="";var A=n.searchText.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(n.options.searchAccentNeutralise){var $=new RegExp("".concat(fy.normalizeAccent(A)),"gmi");var R=$.exec(fy.normalizeAccent(u));if(R)A=u.substring(R.index,R.index+A.length)}var E=new RegExp("(".concat(A,")"),"gim");var j="<mark>$1</mark>";var _=u&&/<(?=.*? .*?\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\/\1>/i.test(u);if(_){var N=(new DOMParser).parseFromString(u.toString(),"text/html").documentElement.textContent;var F=N.replace(E,j);N=N.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");I=u.replace(new RegExp("(>\\s*)(".concat(N,")(\\s*)"),"gm"),"$1".concat(F,"$3"))}else I=u.toString().replace(E,j);u=fy.calculateObjectValue(i,i.searchHighlightFormatter,[u,n.searchText],I)}if(t["_".concat(r,"_data")]&&!fy.isEmptyObject(t["_".concat(r,"_data")]))for(var D=0,V=Object.entries(t["_".concat(r,"_data")]);D<V.length;D++){var B=l(V[D],2),L=B[0],H=B[1];if("index"===L)return;m+=" data-".concat(L,'="').concat(H,'"')}if(i.checkbox||i.radio){h=i.checkbox?"checkbox":h;h=i.radio?"radio":h;var M=i["class"]||"";var U=fy.isObject(u)&&u.hasOwnProperty("checked")?u.checked:(true===u||f)&&false!==u;var z=!i.checkboxEnabled||u&&u.disabled;s=[n.options.cardView?'<div class="card-view '.concat(M,'">'):'<td class="bs-checkbox '.concat(M,'"').concat(p).concat(g,">"),'<label>\n <input\n data-index="'.concat(e,'"\n name="').concat(n.options.selectItemName,'"\n type="').concat(h,'"\n ').concat(fy.sprintf('value="%s"',t[n.options.idField]),"\n ").concat(fy.sprintf('checked="%s"',U?"checked":void 0),"\n ").concat(fy.sprintf('disabled="%s"',z?"disabled":void 0)," />\n <span></span>\n </label>"),n.header.formatters[a]&&"string"===typeof u?u:"",n.options.cardView?"</div>":"</td>"].join("");t[n.header.stateField]=true===u||!!f||u&&u.checked}else if(n.options.cardView){var q=n.options.showHeader?'<span class="card-view-title '.concat(v.classes||"",'"').concat(g,">").concat(fy.getFieldTitle(n.columns,r),"</span>"):"";s='<div class="card-view">'.concat(q,'<span class="card-view-value ').concat(v.classes||"",'"').concat(g,">").concat(u,"</span></div>");if(n.options.smartDisplay&&""===u)s='<div class="card-view"></div>'}else s="<td".concat(d).concat(p).concat(g).concat(m).concat(y).concat(w).concat(S,">").concat(u,"</td>");o.push(s)});if(I&&"right"===this.options.detailViewAlign)o.push(I);if(this.options.cardView)o.push("</div></td>");o.push("</tr>");return o.join("")}},{key:"initBody",value:function A(e,r){var a=this;var i=this.getData();this.trigger("pre-body",i);this.$body=this.$el.find(">tbody");if(!this.$body.length)this.$body=t("<tbody></tbody>").appendTo(this.$el);if(!this.options.pagination||"server"===this.options.sidePagination){this.pageFrom=1;this.pageTo=i.length}var n=[];var o=t(document.createDocumentFragment());var s=false;var l=[];this.autoMergeCells=fy.checkAutoMergeCells(i.slice(this.pageFrom-1,this.pageTo));for(var c=this.pageFrom-1;c<this.pageTo;c++){var f=i[c];var u=this.initRow(f,c,i,o);s=s||!!u;if(u&&"string"===typeof u){var h=this.options.uniqueId;if(h&&f.hasOwnProperty(h)){var v=f[h];var d=this.$body.find(fy.sprintf('> tr[data-uniqueid="%s"][data-has-detail-view]',v));var p=d.next();if(p.is("tr.detail-view")){l.push(c);if(!r||v!==r)u+=p[0].outerHTML}}if(!this.options.virtualScroll)o.append(u);else n.push(u)}}if(!s)this.$body.html('<tr class="no-records-found">'.concat(fy.sprintf('<td colspan="%s">%s</td>',this.getVisibleFields().length+fy.getDetailViewIndexOffset(this.options),this.options.formatNoMatches()),"</tr>"));else if(!this.options.virtualScroll)this.$body.html(o);else{if(this.virtualScroll)this.virtualScroll.destroy();this.virtualScroll=new xy({rows:n,fixedScroll:e,scrollEl:this.$tableBody[0],contentEl:this.$body[0],itemHeight:this.options.virtualScrollItemHeight,callback:function g(t,e){a.fitHeader();a.initBodyEvent();a.trigger("virtual-scroll",t,e)}})}l.forEach(function(t){a.expandRow(t)});if(!e)this.scrollTo(0);this.initBodyEvent();this.initFooter();this.resetView();this.updateSelected();if("server"!==this.options.sidePagination)this.options.totalRows=i.length;this.trigger("post-body",i)}},{key:"initBodyEvent",value:function $(){var e=this;this.$body.find("> tr[data-index] > td").off("click dblclick").on("click dblclick",function(r){var a=t(r.currentTarget);if(a.find(".detail-icon").length||a.index()-fy.getDetailViewIndexOffset(e.options)<0)return;var i=a.parent();var n=t(r.target).parents(".card-views").children();var o=t(r.target).parents(".card-view");var s=i.data("index");var l=e.data[s];var c=e.options.cardView?n.index(o):a[0].cellIndex;var f=e.getVisibleFields();var u=f[c-fy.getDetailViewIndexOffset(e.options)];var h=e.columns[e.fieldsColumnsIndex[u]];var v=fy.getItemField(l,u,e.options.escape,h.escape);e.trigger("click"===r.type?"click-cell":"dbl-click-cell",u,v,l,a);e.trigger("click"===r.type?"click-row":"dbl-click-row",l,i,u);if("click"===r.type&&e.options.clickToSelect&&h.clickToSelect&&!fy.calculateObjectValue(e.options,e.options.ignoreClickToSelectOn,[r.target])){var d=i.find(fy.sprintf('[name="%s"]',e.options.selectItemName));if(d.length)d[0].click()}if("click"===r.type&&e.options.detailViewByClick)e.toggleDetailView(s,e.header.detailFormatters[e.fieldsColumnsIndex[u]])}).off("mousedown").on("mousedown",function(t){e.multipleSelectRowCtrlKey=t.ctrlKey||t.metaKey;e.multipleSelectRowShiftKey=t.shiftKey});this.$body.find("> tr[data-index] > td > .detail-icon").off("click").on("click",function(r){r.preventDefault();e.toggleDetailView(t(r.currentTarget).parent().parent().data("index"));return false});this.$selectItem=this.$body.find(fy.sprintf('[name="%s"]',this.options.selectItemName));this.$selectItem.off("click").on("click",function(r){r.stopImmediatePropagation();var a=t(r.currentTarget);e._toggleCheck(a.prop("checked"),a.data("index"))});this.header.events.forEach(function(r,a){var i=r;if(!i)return;if("string"===typeof i)i=fy.calculateObjectValue(null,i);if(!i)throw new Error("Unknown event in the scope: ".concat(r));var n=e.header.fields[a];var o=e.getVisibleFields().indexOf(n);if(o===-1)return;o+=fy.getDetailViewIndexOffset(e.options);var s=function c(r){if(!i.hasOwnProperty(r))return 1;var a=i[r];e.$body.find(">tr:not(.no-records-found)").each(function(i,s){var l=t(s);var c=l.find(e.options.cardView?".card-views>.card-view":">td").eq(o);var f=r.indexOf(" ");var u=r.substring(0,f);var h=r.substring(f+1);c.find(h).off(u).on(u,function(t){var r=l.data("index");var i=e.data[r];var o=i[n];a.apply(e,[t,o,i,r])})})};for(var l in i)if(s(l))continue})}},{key:"initServer",value:function R(e,r,a){var i=this;var n={};var o=this.header.fields.indexOf(this.options.sortName);var s={searchText:this.searchText,sortName:this.options.sortName,sortOrder:this.options.sortOrder};if(this.header.sortNames[o])s.sortName=this.header.sortNames[o];if(this.options.pagination&&"server"===this.options.sidePagination){s.pageSize=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize;s.pageNumber=this.options.pageNumber}if(!this.options.firstLoad&&!firstLoadTable.includes(this.options.id)){firstLoadTable.push(this.options.id);return}if(!(a||this.options.url)&&!this.options.ajax)return;if("limit"===this.options.queryParamsType){s={search:s.searchText,sort:s.sortName,order:s.sortOrder};if(this.options.pagination&&"server"===this.options.sidePagination){s.offset=this.options.pageSize===this.options.formatAllRows()?0:this.options.pageSize*(this.options.pageNumber-1);s.limit=this.options.pageSize;if(0===s.limit||this.options.pageSize===this.options.formatAllRows())delete s.limit}}if(this.options.search&&"server"===this.options.sidePagination&&this.options.searchable&&this.columns.filter(function(t){return t.searchable}).length){s.searchable=[];var l=b(this.columns),c;try{for(l.s();!(c=l.n()).done;){var f=c.value;if(!f.checkbox&&f.searchable&&(this.options.visibleSearch&&f.visible||!this.options.visibleSearch))s.searchable.push(f.field)}}catch(u){l.e(u)}finally{l.f()}}if(!fy.isEmptyObject(this.filterColumnsPartial))s.filter=JSON.stringify(this.filterColumnsPartial,null);fy.extend(s,r||{});n=fy.calculateObjectValue(this.options,this.options.queryParams,[s],n);if(false===n)return;if(!e)this.showLoading();var h=fy.extend({},fy.calculateObjectValue(null,this.options.ajaxOptions),{type:this.options.method,url:a||this.options.url,data:"application/json"===this.options.contentType&&"post"===this.options.method?JSON.stringify(n):n,cache:this.options.cache,contentType:this.options.contentType,dataType:this.options.dataType,success:function v(t,r,a){var n=fy.calculateObjectValue(i.options,i.options.responseHandler,[t,a],t);if("client"===i.options.sidePagination&&i.options.paginationLoadMore)i._paginationLoaded=i.data.length===n.length;i.load(n);i.trigger("load-success",n,a&&a.status,a);if(!e)i.hideLoading();if("server"===i.options.sidePagination&&i.options.pageNumber>1&&n[i.options.totalField]>0&&!n[i.options.dataField].length)i.updatePagination()},error:function d(t){if(t&&0===t.status&&i._xhrAbort){i._xhrAbort=false;return}var r=[];if("server"===i.options.sidePagination){r={};r[i.options.totalField]=0;r[i.options.dataField]=[]}i.load(r);i.trigger("load-error",t&&t.status,t);if(!e)i.hideLoading()}});if(this.options.ajax)fy.calculateObjectValue(this,this.options.ajax,[h],null);else{if(this._xhr&&4!==this._xhr.readyState){this._xhrAbort=true;this._xhr.abort()}this._xhr=t.ajax(h)}return n}},{key:"initSearchText",value:function E(){if(this.options.search){this.searchText="";if(""!==this.options.searchText){var t=fy.getSearchInput(this);t.val(this.options.searchText);this.onSearch({currentTarget:t,firedByInitSearchText:true})}}}},{key:"getCaret",value:function j(){var e=this;this.$header.find("th").each(function(r,a){t(a).find(".sortable").removeClass("desc asc").addClass(t(a).data("field")===e.options.sortName?e.options.sortOrder:"both")})}},{key:"updateSelected",value:function _(){var e=this.$selectItem.filter(":enabled").length&&this.$selectItem.filter(":enabled").length===this.$selectItem.filter(":enabled").filter(":checked").length;this.$selectAll.add(this.$selectAll_).prop("checked",e);this.$selectItem.each(function(e,r){t(r).closest("tr")[t(r).prop("checked")?"addClass":"removeClass"]("selected")})}},{key:"updateRows",value:function N(){var e=this;this.$selectItem.each(function(r,a){e.data[t(a).data("index")][e.header.stateField]=t(a).prop("checked")})}},{key:"resetRows",value:function F(){var t=b(this.data),e;try{for(t.s();!(e=t.n()).done;){var r=e.value;this.$selectAll.prop("checked",false);this.$selectItem.prop("checked",false);if(this.header.stateField)r[this.header.stateField]=false}}catch(a){t.e(a)}finally{t.f()}this.initHiddenRows()}},{key:"trigger",value:function D(r){var a,i;var n="".concat(r,".bs.table");for(var o=arguments.length,s=new Array(o>1?o-1:0),l=1;l<o;l++)s[l-1]=arguments[l];(a=this.options)[e.EVENTS[n]].apply(a,[].concat(s,[this]));this.$el.trigger(t.Event(n,{sender:this}),s);(i=this.options).onAll.apply(i,[n].concat([].concat(s,[this])));this.$el.trigger(t.Event("all.bs.table",{sender:this}),[n,s])}},{key:"resetHeader",value:function V(){var t=this;clearTimeout(this.timeoutId_);this.timeoutId_=setTimeout(function(){return t.fitHeader()},this.$el.is(":hidden")?100:0)}},{key:"fitHeader",value:function B(){var e=this;if(this.$el.is(":hidden")){this.timeoutId_=setTimeout(function(){return e.fitHeader()},100);return}var r=this.$tableBody.get(0);var a=this.hasScrollBar&&r.scrollHeight>r.clientHeight+this.$header.outerHeight()?fy.getScrollBarWidth():0;this.$el.css("margin-top",-this.$header.outerHeight());var i=this.$tableHeader.find(":focus");if(i.length>0){var n=i.parents("th");if(n.length>0){var o=n.attr("data-field");if(void 0!==o){var s=this.$header.find("[data-field='".concat(o,"']"));if(s.length>0)s.find(":input").addClass("focus-temp")}}}this.$header_=this.$header.clone(true,true);this.$selectAll_=this.$header_.find('[name="btSelectAll"]');this.$tableHeader.css("margin-right",a).find("table").css("width",this.$el.outerWidth()).html("").attr("class",this.$el.attr("class")).append(this.$header_);this.$tableLoading.css("width",this.$el.outerWidth());var l=t(".focus-temp:visible:eq(0)");if(l.length>0){l.focus();this.$header.find(".focus-temp").removeClass("focus-temp")}this.$header.find("th[data-field]").each(function(r,a){e.$header_.find(fy.sprintf('th[data-field="%s"]',t(a).data("field"))).data(t(a).data())});var c=this.getVisibleFields();var f=this.$header_.find("th");var u=this.$body.find(">tr:not(.no-records-found,.virtual-scroll-top)").eq(0);while(u.length&&u.find('>td[colspan]:not([colspan="1"])').length)u=u.next();var h=u.find("> *").length;u.find("> *").each(function(r,a){var i=t(a);if(fy.hasDetailViewIcon(e.options))if(0===r&&"right"!==e.options.detailViewAlign||r===h-1&&"right"===e.options.detailViewAlign){var n=f.filter(".detail");var o=n.innerWidth()-n.find(".fht-cell").width();n.find(".fht-cell").width(i.innerWidth()-o);return}var s=r-fy.getDetailViewIndexOffset(e.options);var l=e.$header_.find(fy.sprintf('th[data-field="%s"]',c[s]));if(l.length>1)l=t(f[i[0].cellIndex]);var u=l.innerWidth()-l.find(".fht-cell").width();l.find(".fht-cell").width(i.innerWidth()-u)});this.horizontalScroll();this.trigger("post-header")}},{key:"initFooter",value:function L(){if(!this.options.showFooter||this.options.cardView)return;var t=this.getData();var e=[];var r="";if(fy.hasDetailViewIcon(this.options))r='<th class="detail"><div class="th-inner"></div><div class="fht-cell"></div></th>';if(r&&"right"!==this.options.detailViewAlign)e.push(r);var a=b(this.columns),i;try{for(a.s();!(i=a.n()).done;){var n=i.value;var o="";var s="";var c=[];var f={};var u=fy.sprintf(' class="%s"',n["class"]);if(!n.visible||this.footerData&&this.footerData.length>0&&!(n.field in this.footerData[0]))continue;if(this.options.cardView&&!n.cardVisible)return;o=fy.sprintf("text-align: %s; ",n.falign?n.falign:n.align);s=fy.sprintf("vertical-align: %s; ",n.valign);f=fy.calculateObjectValue(null,n.footerStyle||this.options.footerStyle,[n]);if(f&&f.css)for(var h=0,v=Object.entries(f.css);h<v.length;h++){var d=l(v[h],2),p=d[0],g=d[1];c.push("".concat(p,": ").concat(g))}if(f&&f.classes)u=fy.sprintf(' class="%s"',n["class"]?[n["class"],f.classes].join(" "):f.classes);e.push("<th",u,fy.sprintf(' style="%s"',o+s+c.concat().join("; ")||void 0));var m=0;if(this.footerData&&this.footerData.length>0)m=this.footerData[0]["_".concat(n.field,"_colspan")]||0;if(m)e.push(' colspan="'.concat(m,'" '));e.push(">");e.push('<div class="th-inner">');var y="";if(this.footerData&&this.footerData.length>0)y=this.footerData[0][n.field]||"";e.push(fy.calculateObjectValue(n,n.footerFormatter,[t,y],y));e.push("</div>");e.push('<div class="fht-cell"></div>');e.push("</div>");e.push("</th>")}}catch(w){a.e(w)}finally{a.f()}if(r&&"right"===this.options.detailViewAlign)e.push(r);if(!this.options.height&&!this.$tableFooter.length){this.$el.append("<tfoot><tr></tr></tfoot>");this.$tableFooter=this.$el.find("tfoot")}if(!this.$tableFooter.find("tr").length)this.$tableFooter.html("<table><thead><tr></tr></thead></table>");this.$tableFooter.find("tr").html(e.join(""));this.trigger("post-footer",this.$tableFooter)}},{key:"fitFooter",value:function H(){var e=this;if(this.$el.is(":hidden")){setTimeout(function(){return e.fitFooter()},100);return}var r=this.$tableBody.get(0);var a=this.hasScrollBar&&r.scrollHeight>r.clientHeight+this.$header.outerHeight()?fy.getScrollBarWidth():0;this.$tableFooter.css("margin-right",a).find("table").css("width",this.$el.outerWidth()).attr("class",this.$el.attr("class"));var i=this.$tableFooter.find("th");var n=this.$body.find(">tr:first-child:not(.no-records-found)");i.find(".fht-cell").width("auto");while(n.length&&n.find('>td[colspan]:not([colspan="1"])').length)n=n.next();var o=n.find("> *").length;n.find("> *").each(function(r,a){var n=t(a);if(fy.hasDetailViewIcon(e.options))if(0===r&&"left"===e.options.detailViewAlign||r===o-1&&"right"===e.options.detailViewAlign){var s=i.filter(".detail");var l=s.innerWidth()-s.find(".fht-cell").width();s.find(".fht-cell").width(n.innerWidth()-l);return}var c=i.eq(r);var f=c.innerWidth()-c.find(".fht-cell").width();c.find(".fht-cell").width(n.innerWidth()-f)});this.horizontalScroll()}},{key:"horizontalScroll",value:function M(){var t=this;this.$tableBody.off("scroll").on("scroll",function(){var e=t.$tableBody.scrollLeft();if(t.options.showHeader&&t.options.height)t.$tableHeader.scrollLeft(e);if(t.options.showFooter&&!t.options.cardView)t.$tableFooter.scrollLeft(e);t.trigger("scroll-body",t.$tableBody)})}},{key:"getVisibleFields",value:function U(){var t=[];var e=b(this.header.fields),r;try{for(e.s();!(r=e.n()).done;){var a=r.value;var i=this.columns[this.fieldsColumnsIndex[a]];if(!i||!i.visible||this.options.cardView&&!i.cardVisible)continue;t.push(a)}}catch(n){e.e(n)}finally{e.f()}return t}},{key:"initHiddenRows",value:function z(){this.hiddenRows=[]}},{key:"getOptions",value:function q(){var t=fy.extend({},this.options);delete t.data;return fy.extend(true,{},t)}},{key:"refreshOptions",value:function G(t){if(fy.compareObjects(this.options,t,true))return;this.options=fy.extend(this.options,t);this.trigger("refresh-options",this.options);this.destroy();this.init()}},{key:"getData",value:function W(t){var e=this;var r=this.options.data;if((this.searchText||this.options.customSearch||void 0!==this.options.sortName||this.enableCustomSort||!fy.isEmptyObject(this.filterColumns)||"function"===typeof this.options.filterOptions.filterAlgorithm||!fy.isEmptyObject(this.filterColumnsPartial))&&(!t||!t.unfiltered))r=this.data;if(t&&!t.includeHiddenRows){var a=this.getHiddenRows();r=r.filter(function(t){return fy.findIndex(a,t)===-1})}if(t&&t.useCurrentPage)r=r.slice(this.pageFrom-1,this.pageTo);if(t&&t.formatted)r.forEach(function(t){for(var r=0,a=Object.entries(t);r<a.length;r++){var i=l(a[r],2),n=i[0],o=i[1];var s=e.columns[e.fieldsColumnsIndex[n]];if(!s)return;t[n]=fy.calculateObjectValue(s,e.header.formatters[s.fieldIndex],[o,t,t.index,s.field],o)}});return r}},{key:"getSelections",value:function K(){var t=this;return(this.options.maintainMetaData?this.options.data:this.data).filter(function(e){return true===e[t.header.stateField]})}},{key:"load",value:function Y(t){var e=false;var r=t;if(this.options.pagination&&"server"===this.options.sidePagination){this.options.totalRows=r[this.options.totalField];this.options.totalNotFiltered=r[this.options.totalNotFilteredField];this.footerData=r[this.options.footerField]?[r[this.options.footerField]]:void 0}e=this.options.fixedScroll||r.fixedScroll;r=Array.isArray(r)?r:r[this.options.dataField];this.initData(r);this.initSearch();this.initPagination();this.initBody(e)}},{key:"append",value:function J(t){this.initData(t,"append");this.initSearch();this.initPagination();this.initSort();this.initBody(true)}},{key:"prepend",value:function X(t){this.initData(t,"prepend");this.initSearch();this.initPagination();this.initSort();this.initBody(true)}},{key:"remove",value:function Q(t){var e=0;for(var r=this.options.data.length-1;r>=0;r--){var a=this.options.data[r];var i=fy.getItemField(a,t.field,this.options.escape,a.escape);if(void 0===i&&"$index"!==t.field)continue;if(!a.hasOwnProperty(t.field)&&"$index"===t.field&&t.values.includes(r)||t.values.includes(i)){e++;this.options.data.splice(r,1)}}if(!e)return;if("server"===this.options.sidePagination){this.options.totalRows-=e;this.data=c(this.options.data)}this.initSearch();this.initPagination();this.initSort();this.initBody(true)}},{key:"removeAll",value:function Z(){if(this.options.data.length>0){this.options.data.splice(0,this.options.data.length);this.initSearch();this.initPagination();this.initBody(true)}}},{key:"insertRow",value:function tt(t){if(!t.hasOwnProperty("index")||!t.hasOwnProperty("row"))return;this.options.data.splice(t.index,0,t.row);this.initSearch();this.initPagination();this.initSort();this.initBody(true)}},{key:"updateRow",value:function et(t){var e=Array.isArray(t)?t:[t];var r=b(e),a;try{for(r.s();!(a=r.n()).done;){var i=a.value;if(!i.hasOwnProperty("index")||!i.hasOwnProperty("row"))continue;if(i.hasOwnProperty("replace")&&i.replace)this.options.data[i.index]=i.row;else fy.extend(this.options.data[i.index],i.row)}}catch(n){r.e(n)}finally{r.f()}this.initSearch();this.initPagination();this.initSort();this.initBody(true)}},{key:"getRowByUniqueId",value:function rt(t){var e=this.options.uniqueId;var r=this.options.data.length;var a=t;var i=null;var n;var o;for(n=r-1;n>=0;n--){o=this.options.data[n];var s=fy.getItemField(o,e,this.options.escape,o.escape);if(void 0===s)continue;if("string"===typeof s)a=t.toString();else if("number"===typeof s)if(Number(s)===s&&s%1===0)a=parseInt(t,10);else if(s===Number(s)&&0!==s)a=parseFloat(t);if(s===a){i=o;break}}return i}},{key:"updateByUniqueId",value:function at(t){var e=Array.isArray(t)?t:[t];var r=null;var a=b(e),i;try{for(a.s();!(i=a.n()).done;){var n=i.value;if(!n.hasOwnProperty("id")||!n.hasOwnProperty("row"))continue;var o=this.options.data.indexOf(this.getRowByUniqueId(n.id));if(o===-1)continue;if(n.hasOwnProperty("replace")&&n.replace)this.options.data[o]=n.row;else fy.extend(this.options.data[o],n.row);r=n.id}}catch(s){a.e(s)}finally{a.f()}this.initSearch();this.initPagination();this.initSort();this.initBody(true,r)}},{key:"removeByUniqueId",value:function it(t){var e=this.options.data.length;var r=this.getRowByUniqueId(t);if(r)this.options.data.splice(this.options.data.indexOf(r),1);if(e===this.options.data.length)return;if("server"===this.options.sidePagination){this.options.totalRows-=1;this.data=c(this.options.data)}this.initSearch();this.initPagination();this.initBody(true)}},{key:"_updateCellOnly",value:function nt(e,r){var a=this.initRow(this.options.data[r],r);var i=this.getVisibleFields().indexOf(e);if(i===-1)return;i+=fy.getDetailViewIndexOffset(this.options);this.$body.find(">tr[data-index=".concat(r,"]")).find(">td:eq(".concat(i,")")).replaceWith(t(a).find(">td:eq(".concat(i,")")));this.initBodyEvent();this.initFooter();this.resetView();this.updateSelected()}},{key:"updateCell",value:function ot(t){if(!t.hasOwnProperty("index")||!t.hasOwnProperty("field")||!t.hasOwnProperty("value"))return;this.options.data[t.index][t.field]=t.value;if(false===t.reinit){this._updateCellOnly(t.field,t.index);return}this.initSort();this.initBody(true)}},{key:"updateCellByUniqueId",value:function st(t){var e=this;var r=Array.isArray(t)?t:[t];r.forEach(function(t){var r=t.id,a=t.field,i=t.value;var n=e.options.data.indexOf(e.getRowByUniqueId(r));if(n===-1)return;e.options.data[n][a]=i});if(false===t.reinit){this._updateCellOnly(t.field,this.options.data.indexOf(this.getRowByUniqueId(t.id)));return}this.initSort();this.initBody(true)}},{key:"showRow",value:function lt(t){this._toggleRow(t,true)}},{key:"hideRow",value:function ct(t){this._toggleRow(t,false)}},{key:"_toggleRow",value:function ft(t,e){var r;if(t.hasOwnProperty("index"))r=this.getData()[t.index];else if(t.hasOwnProperty("uniqueId"))r=this.getRowByUniqueId(t.uniqueId);if(!r)return;var a=fy.findIndex(this.hiddenRows,r);if(!e&&a===-1)this.hiddenRows.push(r);else if(e&&a>-1)this.hiddenRows.splice(a,1);this.initBody(true);this.initPagination()}},{key:"getHiddenRows",value:function ut(t){if(t){this.initHiddenRows();this.initBody(true);this.initPagination();return}var e=this.getData();var r=[];var a=b(e),i;try{for(a.s();!(i=a.n()).done;){var n=i.value;if(this.hiddenRows.includes(n))r.push(n)}}catch(o){a.e(o)}finally{a.f()}this.hiddenRows=r;return r}},{key:"showColumn",value:function ht(t){var e=this;var r=Array.isArray(t)?t:[t];r.forEach(function(t){e._toggleColumn(e.fieldsColumnsIndex[t],true,true)})}},{key:"hideColumn",value:function vt(t){var e=this;var r=Array.isArray(t)?t:[t];r.forEach(function(t){e._toggleColumn(e.fieldsColumnsIndex[t],false,true)})}},{key:"_toggleColumn",value:function dt(t,e,r){if(t===-1||this.columns[t].visible===e)return;this.columns[t].visible=e;this.initHeader();this.initSearch();this.initPagination();this.initBody();if(this.options.showColumns){var a=this.$toolbar.find('.keep-open input:not(".toggle-all")').prop("disabled",false);if(r)a.filter(fy.sprintf('[value="%s"]',t)).prop("checked",e);if(a.filter(":checked").length<=this.options.minimumCountColumns)a.filter(":checked").prop("disabled",true)}}},{key:"getVisibleColumns",value:function pt(){var t=this;return this.columns.filter(function(e){return e.visible&&!t.isSelectionColumn(e)})}},{key:"getHiddenColumns",value:function gt(){return this.columns.filter(function(t){var e=t.visible;return!e})}},{key:"isSelectionColumn",value:function bt(t){return t.radio||t.checkbox}},{key:"showAllColumns",value:function mt(){this._toggleAllColumns(true)}},{key:"hideAllColumns",value:function yt(){this._toggleAllColumns(false)}},{key:"_toggleAllColumns",value:function wt(e){var r=this;var a=b(this.columns.slice().reverse()),i;try{for(a.s();!(i=a.n()).done;){var n=i.value;if(n.switchable){if(!e&&this.options.showColumns&&this.getVisibleColumns().filter(function(t){return t.switchable}).length===this.options.minimumCountColumns)continue;n.visible=e}}}catch(o){a.e(o)}finally{a.f()}this.initHeader();this.initSearch();this.initPagination();this.initBody();if(this.options.showColumns){var s=this.$toolbar.find('.keep-open input[type="checkbox"]:not(".toggle-all")').prop("disabled",false);if(e)s.prop("checked",e);else s.get().reverse().forEach(function(a){if(s.filter(":checked").length>r.options.minimumCountColumns)t(a).prop("checked",e)});if(s.filter(":checked").length<=this.options.minimumCountColumns)s.filter(":checked").prop("disabled",true)}}},{key:"mergeCells",value:function St(t){var e=t.index;var r=this.getVisibleFields().indexOf(t.field);var a=t.rowspan||1;var i=t.colspan||1;var n;var o;var s=this.$body.find(">tr[data-index]");r+=fy.getDetailViewIndexOffset(this.options);var l=s.eq(e).find(">td").eq(r);if(e<0||r<0||e>=this.data.length)return;for(n=e;n<e+a;n++)for(o=r;o<r+i;o++)s.eq(n).find(">td").eq(o).hide();l.attr("rowspan",a).attr("colspan",i).show()}},{key:"checkAll",value:function xt(){this._toggleCheckAll(true)}},{key:"uncheckAll",value:function Ot(){this._toggleCheckAll(false)}},{key:"_toggleCheckAll",value:function kt(t){var e=this.getSelections();this.$selectAll.add(this.$selectAll_).prop("checked",t);this.$selectItem.filter(":enabled").prop("checked",t);this.updateRows();this.updateSelected();var r=this.getSelections();if(t){this.trigger("check-all",r,e);return}this.trigger("uncheck-all",r,e)}},{key:"checkInvert",value:function Pt(){var e=this.$selectItem.filter(":enabled");var r=e.filter(":checked");e.each(function(e,r){t(r).prop("checked",!t(r).prop("checked"))});this.updateRows();this.updateSelected();this.trigger("uncheck-some",r);r=this.getSelections();this.trigger("check-some",r)}},{key:"check",value:function Ct(t){this._toggleCheck(true,t)}},{key:"uncheck",value:function Tt(t){this._toggleCheck(false,t)}},{key:"_toggleCheck",value:function It(t,e){var r=this.$selectItem.filter('[data-index="'.concat(e,'"]'));var a=this.data[e];if(r.is(":radio")||this.options.singleSelect||this.options.multipleSelectRow&&!this.multipleSelectRowCtrlKey&&!this.multipleSelectRowShiftKey){var i=b(this.options.data),n;try{for(i.s();!(n=i.n()).done;){var o=n.value;o[this.header.stateField]=false}}catch(s){i.e(s)}finally{i.f()}this.$selectItem.filter(":checked").not(r).prop("checked",false)}a[this.header.stateField]=t;if(this.options.multipleSelectRow){if(this.multipleSelectRowShiftKey&&this.multipleSelectRowLastSelectedIndex>=0){var c=this.multipleSelectRowLastSelectedIndex<e?[this.multipleSelectRowLastSelectedIndex,e]:[e,this.multipleSelectRowLastSelectedIndex],f=l(c,2),u=f[0],h=f[1];for(var v=u+1;v<h;v++){this.data[v][this.header.stateField]=true;this.$selectItem.filter('[data-index="'.concat(v,'"]')).prop("checked",true)}}this.multipleSelectRowCtrlKey=false;this.multipleSelectRowShiftKey=false;this.multipleSelectRowLastSelectedIndex=t?e:-1}r.prop("checked",t);this.updateSelected();this.trigger(t?"check":"uncheck",this.data[e],r)}},{key:"checkBy",value:function At(t){this._toggleCheckBy(true,t)}},{key:"uncheckBy",value:function $t(t){this._toggleCheckBy(false,t)}},{key:"_toggleCheckBy",value:function Rt(t,e){var r=this;if(!e.hasOwnProperty("field")||!e.hasOwnProperty("values"))return;var a=[];this.data.forEach(function(i,n){if(!i.hasOwnProperty(e.field))return false;if(e.values.includes(i[e.field])){var o=r.$selectItem.filter(":enabled").filter(fy.sprintf('[data-index="%s"]',n));var s=e.hasOwnProperty("onlyCurrentPage")?e.onlyCurrentPage:false;o=t?o.not(":checked"):o.filter(":checked");if(!o.length&&s)return;o.prop("checked",t);i[r.header.stateField]=t;a.push(i);r.trigger(t?"check":"uncheck",i,o)}});this.updateSelected();this.trigger(t?"check-some":"uncheck-some",a)}},{key:"refresh",value:function Et(t){if(t&&t.url)this.options.url=t.url;if(t&&t.pageNumber)this.options.pageNumber=t.pageNumber;if(t&&t.pageSize)this.options.pageSize=t.pageSize;table.rememberSelecteds={};table.rememberSelectedIds={};this.trigger("refresh",this.initServer(t&&t.silent,t&&t.query,t&&t.url))}},{key:"destroy",value:function jt(){this.$el.insertBefore(this.$container);t(this.options.toolbar).insertBefore(this.$el);this.$container.next().remove();this.$container.remove();this.$el.html(this.$el_.html()).css("margin-top","0").attr("class",this.$el_.attr("class")||"");var e=fy.getEventName("resize.bootstrap-table",this.$el.attr("id"));t(window).off(e)}},{key:"resetView",value:function _t(t){var e=0;if(t&&t.height)this.options.height=t.height;this.$tableContainer.toggleClass("has-card-view",this.options.cardView);if(this.options.height){var r=this.$tableBody.get(0);this.hasScrollBar=r.scrollWidth>r.clientWidth}if(!this.options.cardView&&this.options.showHeader&&this.options.height){this.$tableHeader.show();this.resetHeader();e+=this.$header.outerHeight(true)+1}else{this.$tableHeader.hide();this.trigger("post-header")}if(!this.options.cardView&&this.options.showFooter){this.$tableFooter.show();this.fitFooter();if(this.options.height)e+=this.$tableFooter.outerHeight(true)}if(this.$container.hasClass("fullscreen")){this.$tableContainer.css("height","");this.$tableContainer.css("width","")}else if(this.options.height){if(this.$tableBorder){this.$tableBorder.css("width","");this.$tableBorder.css("height","")}var a=this.$toolbar.outerHeight(true);var i=this.$pagination.outerHeight(true);var n=this.options.height-a-i;var o=this.$tableBody.find(">table");var s=o.outerHeight();this.$tableContainer.css("height","".concat(n,"px"));if(this.$tableBorder&&o.is(":visible")){var l=n-s-2;if(this.hasScrollBar)l-=fy.getScrollBarWidth();this.$tableBorder.css("width","".concat(o.outerWidth(),"px"));this.$tableBorder.css("height","".concat(l,"px"))}}if(this.options.cardView){this.$el.css("margin-top","0");this.$tableContainer.css("padding-bottom","0");this.$tableFooter.hide()}else{this.getCaret();this.$tableContainer.css("padding-bottom","".concat(e,"px"))}this.trigger("reset-view")}},{key:"showLoading",value:function Nt(){this.$tableLoading.toggleClass("open",true);var t=this.options.loadingFontSize;if("auto"===this.options.loadingFontSize){t=.04*this.$tableLoading.width();t=Math.max(12,t);t=Math.min(32,t);t="".concat(t,"px")}this.$tableLoading.find(".loading-text").css("font-size",t)}},{key:"hideLoading",value:function Ft(){this.$tableLoading.toggleClass("open",false)}},{key:"toggleShowSearch",value:function Dt(){this.$el.parents(".select-table").siblings().slideToggle()}},{key:"togglePagination",value:function Vt(){this.options.pagination=!this.options.pagination;var t=this.options.showButtonIcons?this.options.pagination?this.options.icons.paginationSwitchDown:this.options.icons.paginationSwitchUp:"";var e=this.options.showButtonText?this.options.pagination?this.options.formatPaginationSwitchUp():this.options.formatPaginationSwitchDown():"";this.$toolbar.find('button[name="paginationSwitch"]').html("".concat(fy.sprintf(this.constants.html.icon,this.options.iconsPrefix,t)," ").concat(e));this.updatePagination();this.trigger("toggle-pagination",this.options.pagination)}},{key:"toggleFullscreen",value:function Bt(){this.$el.closest(".bootstrap-table").toggleClass("fullscreen");this.resetView()}},{key:"toggleView",value:function Lt(){this.options.cardView=!this.options.cardView;this.initHeader();var t=this.options.showButtonIcons?this.options.cardView?this.options.icons.toggleOn:this.options.icons.toggleOff:"";var e=this.options.showButtonText?this.options.cardView?this.options.formatToggleOff():this.options.formatToggleOn():"";this.$toolbar.find('button[name="toggle"]').html("".concat(fy.sprintf(this.constants.html.icon,this.options.iconsPrefix,t)," ").concat(e)).attr("aria-label",e).attr("title",e);this.initBody();this.trigger("toggle",this.options.cardView)}},{key:"resetSearch",value:function Ht(t){var e=fy.getSearchInput(this);var r=t||"";e.val(r);this.searchText=r;this.onSearch({currentTarget:e},false)}},{key:"filterBy",value:function Mt(t,e){this.filterOptions=fy.isEmptyObject(e)?this.options.filterOptions:fy.extend(this.options.filterOptions,e);this.filterColumns=fy.isEmptyObject(t)?{}:t;this.options.pageNumber=1;this.initSearch();this.updatePagination()}},{key:"scrollTo",value:function Ut(e){var r={unit:"px",value:0};if("object"===i(e))r=Object.assign(r,e);else if("string"===typeof e&&"bottom"===e)r.value=this.$tableBody[0].scrollHeight;else if("string"===typeof e||"number"===typeof e)r.value=e;var Ut=r.value;if("rows"===r.unit){Ut=0;this.$body.find("> tr:lt(".concat(r.value,")")).each(function(e,r){Ut+=t(r).outerHeight(true)})}this.$tableBody.scrollTop(Ut)}},{key:"getScrollPosition",value:function zt(){return this.$tableBody.scrollTop()}},{key:"selectPage",value:function qt(t){if(t>0&&t<=this.options.totalPages){this.options.pageNumber=t;this.updatePagination()}}},{key:"prevPage",value:function Gt(){if(this.options.pageNumber>1){this.options.pageNumber--;this.updatePagination()}}},{key:"nextPage",value:function Wt(){if(this.options.pageNumber<this.options.totalPages){this.options.pageNumber++;this.updatePagination()}}},{key:"toggleDetailView",value:function Kt(t,e){var r=this.$body.find(fy.sprintf('> tr[data-index="%s"]',t));if(r.next().is("tr.detail-view"))this.collapseRow(t);else this.expandRow(t,e);this.resetView()}},{key:"expandRow",value:function Yt(t,e){var r=this.data[t];var a=this.$body.find(fy.sprintf('> tr[data-index="%s"][data-has-detail-view]',t));if(this.options.detailViewIcon)a.find("a.detail-icon").html(fy.sprintf(this.constants.html.icon,this.options.iconsPrefix,this.options.icons.detailClose));if(a.next().is("tr.detail-view"))return;a.after(fy.sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>',a.children("td").length));var i=a.next().find("td");var n=e||this.options.detailFormatter;var o=fy.calculateObjectValue(this.options,n,[t,r,i],"");if(1===i.length)i.append(o);this.trigger("expand-row",t,r,i)}},{key:"expandRowByUniqueId",value:function Jt(t){var e=this.getRowByUniqueId(t);if(!e)return;this.expandRow(this.data.indexOf(e))}},{key:"collapseRow",value:function Xt(t){var e=this.data[t];var r=this.$body.find(fy.sprintf('> tr[data-index="%s"][data-has-detail-view]',t));if(!r.next().is("tr.detail-view"))return;if(this.options.detailViewIcon)r.find("a.detail-icon").html(fy.sprintf(this.constants.html.icon,this.options.iconsPrefix,this.options.icons.detailOpen));this.trigger("collapse-row",t,e,r.next());r.next().remove()}},{key:"collapseRowByUniqueId",value:function Qt(t){var e=this.getRowByUniqueId(t);if(!e)return;this.collapseRow(this.data.indexOf(e))}},{key:"expandAllRows",value:function Zt(){var e=this.$body.find("> tr[data-index][data-has-detail-view]");for(var r=0;r<e.length;r++)this.expandRow(t(e[r]).data("index"))}},{key:"collapseAllRows",value:function te(){var e=this.$body.find("> tr[data-index][data-has-detail-view]");for(var r=0;r<e.length;r++)this.collapseRow(t(e[r]).data("index"))}},{key:"updateColumnTitle",value:function ee(e){if(!e.hasOwnProperty("field")||!e.hasOwnProperty("title"))return;this.columns[this.fieldsColumnsIndex[e.field]].title=this.options.escape&&this.options.escapeTitle?fy.escapeHTML(e.title):e.title;if(this.columns[this.fieldsColumnsIndex[e.field]].visible){this.$header.find("th[data-field]").each(function(r,a){if(t(a).data("field")===e.field){t(t(a).find(".th-inner")[0]).html(e.title);return false}});this.resetView()}}},{key:"updateFormatText",value:function re(t,e){if(!/^format/.test(t)||!this.options[t])return;if("string"===typeof e)this.options[t]=function(){return e};else if("function"===typeof e)this.options[t]=e;this.initToolbar();this.initPagination();this.initBody()}}])}();Oy.VERSION=yy.VERSION;Oy.DEFAULTS=yy.DEFAULTS;Oy.LOCALES=yy.LOCALES;Oy.COLUMN_DEFAULTS=yy.COLUMN_DEFAULTS;Oy.METHODS=yy.METHODS;Oy.EVENTS=yy.EVENTS;t.BootstrapTable=Oy;t.fn.bootstrapTable=function(e){for(var r=arguments.length,a=new Array(r>1?r-1:0),n=1;n<r;n++)a[n-1]=arguments[n];var o;this.each(function(r,n){var s=t(n).data("bootstrap.table");if("string"===typeof e){var l;if(!yy.METHODS.includes(e))throw new Error("Unknown method: ".concat(e));if(!s)return;o=(l=s)[e].apply(l,a);if("destroy"===e)t(n).removeData("bootstrap.table");return}if(s){console.warn("You cannot initialize the table more than once!");return}var c=fy.extend(true,{},Oy.DEFAULTS,t(n).data(),"object"===i(e)&&e);s=new t.BootstrapTable(n,c);t(n).data("bootstrap.table",s);s.init()});return"undefined"===typeof o?this:o};t.fn.bootstrapTable.Constructor=Oy;t.fn.bootstrapTable.theme=yy.THEME;t.fn.bootstrapTable.VERSION=yy.VERSION;t.fn.bootstrapTable.defaults=Oy.DEFAULTS;t.fn.bootstrapTable.columnDefaults=Oy.COLUMN_DEFAULTS;t.fn.bootstrapTable.events=Oy.EVENTS;t.fn.bootstrapTable.locales=Oy.LOCALES;t.fn.bootstrapTable.methods=Oy.METHODS;t.fn.bootstrapTable.utils=fy;t(function(){t('[data-toggle="table"]').bootstrapTable()});return Oy});var TABLE_EVENTS="all.bs.table click-cell.bs.table dbl-click-cell.bs.table click-row.bs.table dbl-click-row.bs.table sort.bs.table check.bs.table uncheck.bs.table onUncheck check-all.bs.table uncheck-all.bs.table check-some.bs.table uncheck-some.bs.table load-success.bs.table load-error.bs.table column-switch.bs.table page-change.bs.table search.bs.table toggle.bs.table show-search.bs.table expand-row.bs.table collapse-row.bs.table refresh-options.bs.table reset-view.bs.table refresh.bs.table";var firstLoadTable=[];var union=function(t,e){if($.isPlainObject(e))addRememberRow(t,e);else if($.isArray(e))$.each(e,function(e,r){if($.isPlainObject(r))addRememberRow(t,r);else if($.inArray(r,t)==-1)t[t.length]=r});else if($.inArray(e,t)==-1)t[t.length]=e;return t};var difference=function(t,e){if($.isPlainObject(e))removeRememberRow(t,e);else if($.isArray(e))$.each(e,function(e,r){if($.isPlainObject(r))removeRememberRow(t,r);else{var a=$.inArray(r,t);if(a!=-1)t.splice(a,1)}});else{var r=$.inArray(e,t);if(r!=-1)t.splice(r,1)}return t};function getRememberRowIds(t,e){if($.isArray(t))props=$.map(t,function(t){return t[e]});else props=[t[e]];return props}function addRememberRow(t,e){var r=null==table.options.uniqueId?table.options.columns[1].field:table.options.uniqueId;var a=getRememberRowIds(t,r);if($.inArray(e[r],a)==-1)t[t.length]=e}function removeRememberRow(t,e){var r=null==table.options.uniqueId?table.options.columns[1].field:table.options.uniqueId;var a=getRememberRowIds(t,r);var i=$.inArray(e[r],a);if(i!=-1)t.splice(i,1)}var _={union:union,difference:difference}; |
New file |
| | |
| | | /** |
| | | * @author: Alec Fenichel |
| | | * @webSite: https://fenichelar.com |
| | | * @update: zhixin wen <wenzhixin2010@gmail.com> |
| | | */ |
| | | |
| | | var Utils = $.fn.bootstrapTable.utils |
| | | |
| | | $.extend($.fn.bootstrapTable.defaults, { |
| | | autoRefresh: false, |
| | | showAutoRefresh: true, |
| | | autoRefreshInterval: 60, |
| | | autoRefreshSilent: true, |
| | | autoRefreshStatus: true, |
| | | autoRefreshFunction: null |
| | | }) |
| | | |
| | | $.extend($.fn.bootstrapTable.defaults.icons, { |
| | | autoRefresh: { |
| | | bootstrap3: 'glyphicon-time icon-time', |
| | | bootstrap5: 'bi-clock', |
| | | materialize: 'access_time', |
| | | 'bootstrap-table': 'icon-clock' |
| | | }[$.fn.bootstrapTable.theme] || 'fa-clock' |
| | | }) |
| | | |
| | | $.extend($.fn.bootstrapTable.locales, { |
| | | formatAutoRefresh () { |
| | | return 'Auto Refresh' |
| | | } |
| | | }) |
| | | |
| | | $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales) |
| | | |
| | | $.BootstrapTable = class extends $.BootstrapTable { |
| | | init (...args) { |
| | | super.init(...args) |
| | | |
| | | if (this.options.autoRefresh && this.options.autoRefreshStatus) { |
| | | this.setupRefreshInterval() |
| | | } |
| | | } |
| | | |
| | | initToolbar (...args) { |
| | | if (this.options.autoRefresh) { |
| | | this.buttons = Object.assign(this.buttons, { |
| | | autoRefresh: { |
| | | html: ` |
| | | <button class="auto-refresh ${this.constants.buttonsClass} |
| | | ${this.options.autoRefreshStatus ? ` ${this.constants.classes.buttonActive}` : ''}" |
| | | type="button" name="autoRefresh" title="${this.options.formatAutoRefresh()}"> |
| | | ${this.options.showButtonIcons ? Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.autoRefresh) : ''} |
| | | ${this.options.showButtonText ? this.options.formatAutoRefresh() : ''} |
| | | </button> |
| | | `, |
| | | event: this.toggleAutoRefresh |
| | | } |
| | | }) |
| | | } |
| | | |
| | | super.initToolbar(...args) |
| | | } |
| | | |
| | | toggleAutoRefresh () { |
| | | if (this.options.autoRefresh) { |
| | | if (this.options.autoRefreshStatus) { |
| | | clearInterval(this.options.autoRefreshFunction) |
| | | this.$toolbar.find('>.columns .auto-refresh') |
| | | .removeClass(this.constants.classes.buttonActive) |
| | | } else { |
| | | this.setupRefreshInterval() |
| | | this.$toolbar.find('>.columns .auto-refresh') |
| | | .addClass(this.constants.classes.buttonActive) |
| | | } |
| | | this.options.autoRefreshStatus = !this.options.autoRefreshStatus |
| | | } |
| | | } |
| | | |
| | | destroy () { |
| | | if (this.options.autoRefresh && this.options.autoRefreshStatus) { |
| | | clearInterval(this.options.autoRefreshFunction) |
| | | } |
| | | |
| | | super.destroy() |
| | | } |
| | | |
| | | setupRefreshInterval () { |
| | | this.options.autoRefreshFunction = setInterval(() => { |
| | | if (!this.options.autoRefresh || !this.options.autoRefreshStatus) { |
| | | return |
| | | } |
| | | this.refresh({ silent: this.options.autoRefreshSilent }) |
| | | }, this.options.autoRefreshInterval * 1000) |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * @author zhixin wen <wenzhixin2010@gmail.com> |
| | | * @github: bootstrap-table/dist/extensions/fixed-columns/bootstrap-table-fixed-columns.min.js |
| | | */ |
| | | !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).jQuery)}(this,(function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=e(t);function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function o(t){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},o(t)}function u(t,e){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},u(t,e)}function f(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=o(t);if(e){var r=o(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return f(this,n)}}function c(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=o(t)););return t}function s(){return s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var i=c(t,e);if(i){var r=Object.getOwnPropertyDescriptor(i,e);return r.get?r.get.call(arguments.length<3?t:n):r.value}},s.apply(this,arguments)}var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},d=function(t){return t&&t.Math==Math&&t},h=d("object"==typeof globalThis&&globalThis)||d("object"==typeof window&&window)||d("object"==typeof self&&self)||d("object"==typeof l&&l)||function(){return this}()||Function("return this")(),p={},y=function(t){try{return!!t()}catch(t){return!0}},b=!y((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),g=!y((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),v=g,m=Function.prototype.call,x=v?m.bind(m):function(){return m.apply(m,arguments)},$={},w={}.propertyIsEnumerable,C=Object.getOwnPropertyDescriptor,O=C&&!w.call({1:2},1);$.f=O?function(t){var e=C(this,t);return!!e&&e.enumerable}:w;var S,j,R=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},B=g,T=Function.prototype,F=T.call,k=B&&T.bind.bind(F,F),P=function(t){return B?k(t):function(){return F.apply(t,arguments)}},E=P,A=E({}.toString),N=E("".slice),H=function(t){return N(A(t),8,-1)},D=H,I=P,L=function(t){if("Function"===D(t))return I(t)},M=y,_=H,W=Object,z=L("".split),X=M((function(){return!W("z").propertyIsEnumerable(0)}))?function(t){return"String"==_(t)?z(t,""):W(t)}:W,Y=function(t){return null==t},q=Y,G=TypeError,V=function(t){if(q(t))throw G("Can't call method on "+t);return t},U=X,K=V,Q=function(t){return U(K(t))},Z="object"==typeof document&&document.all,J={all:Z,IS_HTMLDDA:void 0===Z&&void 0!==Z},tt=J.all,et=J.IS_HTMLDDA?function(t){return"function"==typeof t||t===tt}:function(t){return"function"==typeof t},nt=et,it=J.all,rt=J.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:nt(t)||t===it}:function(t){return"object"==typeof t?null!==t:nt(t)},ot=h,ut=et,ft=function(t){return ut(t)?t:void 0},at=function(t,e){return arguments.length<2?ft(ot[t]):ot[t]&&ot[t][e]},ct=L({}.isPrototypeOf),st=h,lt=at("navigator","userAgent")||"",dt=st.process,ht=st.Deno,pt=dt&&dt.versions||ht&&ht.version,yt=pt&&pt.v8;yt&&(j=(S=yt.split("."))[0]>0&&S[0]<4?1:+(S[0]+S[1])),!j&<&&(!(S=lt.match(/Edge\/(\d+)/))||S[1]>=74)&&(S=lt.match(/Chrome\/(\d+)/))&&(j=+S[1]);var bt=j,gt=bt,vt=y,mt=!!Object.getOwnPropertySymbols&&!vt((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&>&><41})),xt=mt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,$t=at,wt=et,Ct=ct,Ot=Object,St=xt?function(t){return"symbol"==typeof t}:function(t){var e=$t("Symbol");return wt(e)&&Ct(e.prototype,Ot(t))},jt=String,Rt=et,Bt=function(t){try{return jt(t)}catch(t){return"Object"}},Tt=TypeError,Ft=function(t){if(Rt(t))return t;throw Tt(Bt(t)+" is not a function")},kt=Ft,Pt=Y,Et=x,At=et,Nt=rt,Ht=TypeError,Dt={exports:{}},It=h,Lt=Object.defineProperty,Mt=function(t,e){try{Lt(It,t,{value:e,configurable:!0,writable:!0})}catch(n){It[t]=e}return e},_t=Mt,Wt="__core-js_shared__",zt=h[Wt]||_t(Wt,{}),Xt=zt;(Dt.exports=function(t,e){return Xt[t]||(Xt[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.25.5",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.25.5/LICENSE",source:"https://github.com/zloirock/core-js"});var Yt=V,qt=Object,Gt=function(t){return qt(Yt(t))},Vt=Gt,Ut=L({}.hasOwnProperty),Kt=Object.hasOwn||function(t,e){return Ut(Vt(t),e)},Qt=L,Zt=0,Jt=Math.random(),te=Qt(1..toString),ee=function(t){return"Symbol("+(void 0===t?"":t)+")_"+te(++Zt+Jt,36)},ne=h,ie=Dt.exports,re=Kt,oe=ee,ue=mt,fe=xt,ae=ie("wks"),ce=ne.Symbol,se=ce&&ce.for,le=fe?ce:ce&&ce.withoutSetter||oe,de=function(t){if(!re(ae,t)||!ue&&"string"!=typeof ae[t]){var e="Symbol."+t;ue&&re(ce,t)?ae[t]=ce[t]:ae[t]=fe&&se?se(e):le(e)}return ae[t]},he=x,pe=rt,ye=St,be=function(t,e){var n=t[e];return Pt(n)?void 0:kt(n)},ge=function(t,e){var n,i;if("string"===e&&At(n=t.toString)&&!Nt(i=Et(n,t)))return i;if(At(n=t.valueOf)&&!Nt(i=Et(n,t)))return i;if("string"!==e&&At(n=t.toString)&&!Nt(i=Et(n,t)))return i;throw Ht("Can't convert object to primitive value")},ve=TypeError,me=de("toPrimitive"),xe=function(t,e){if(!pe(t)||ye(t))return t;var n,i=be(t,me);if(i){if(void 0===e&&(e="default"),n=he(i,t,e),!pe(n)||ye(n))return n;throw ve("Can't convert object to primitive value")}return void 0===e&&(e="number"),ge(t,e)},$e=St,we=function(t){var e=xe(t,"string");return $e(e)?e:e+""},Ce=rt,Oe=h.document,Se=Ce(Oe)&&Ce(Oe.createElement),je=function(t){return Se?Oe.createElement(t):{}},Re=je,Be=!b&&!y((function(){return 7!=Object.defineProperty(Re("div"),"a",{get:function(){return 7}}).a})),Te=b,Fe=x,ke=$,Pe=R,Ee=Q,Ae=we,Ne=Kt,He=Be,De=Object.getOwnPropertyDescriptor;p.f=Te?De:function(t,e){if(t=Ee(t),e=Ae(e),He)try{return De(t,e)}catch(t){}if(Ne(t,e))return Pe(!Fe(ke.f,t,e),t[e])};var Ie={},Le=b&&y((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Me=rt,_e=String,We=TypeError,ze=function(t){if(Me(t))return t;throw We(_e(t)+" is not an object")},Xe=b,Ye=Be,qe=Le,Ge=ze,Ve=we,Ue=TypeError,Ke=Object.defineProperty,Qe=Object.getOwnPropertyDescriptor,Ze="enumerable",Je="configurable",tn="writable";Ie.f=Xe?qe?function(t,e,n){if(Ge(t),e=Ve(e),Ge(n),"function"==typeof t&&"prototype"===e&&"value"in n&&tn in n&&!n.writable){var i=Qe(t,e);i&&i.writable&&(t[e]=n.value,n={configurable:Je in n?n.configurable:i.configurable,enumerable:Ze in n?n.enumerable:i.enumerable,writable:!1})}return Ke(t,e,n)}:Ke:function(t,e,n){if(Ge(t),e=Ve(e),Ge(n),Ye)try{return Ke(t,e,n)}catch(t){}if("get"in n||"set"in n)throw Ue("Accessors not supported");return"value"in n&&(t[e]=n.value),t};var en=Ie,nn=R,rn=b?function(t,e,n){return en.f(t,e,nn(1,n))}:function(t,e,n){return t[e]=n,t},on={exports:{}},un=b,fn=Kt,an=Function.prototype,cn=un&&Object.getOwnPropertyDescriptor,sn=fn(an,"name"),ln={EXISTS:sn,PROPER:sn&&"something"===function(){}.name,CONFIGURABLE:sn&&(!un||un&&cn(an,"name").configurable)},dn=et,hn=zt,pn=L(Function.toString);dn(hn.inspectSource)||(hn.inspectSource=function(t){return pn(t)});var yn,bn,gn,vn=hn.inspectSource,mn=et,xn=h.WeakMap,$n=mn(xn)&&/native code/.test(String(xn)),wn=Dt.exports,Cn=ee,On=wn("keys"),Sn=function(t){return On[t]||(On[t]=Cn(t))},jn={},Rn=$n,Bn=h,Tn=rt,Fn=rn,kn=Kt,Pn=zt,En=Sn,An=jn,Nn="Object already initialized",Hn=Bn.TypeError,Dn=Bn.WeakMap;if(Rn||Pn.state){var In=Pn.state||(Pn.state=new Dn);In.get=In.get,In.has=In.has,In.set=In.set,yn=function(t,e){if(In.has(t))throw Hn(Nn);return e.facade=t,In.set(t,e),e},bn=function(t){return In.get(t)||{}},gn=function(t){return In.has(t)}}else{var Ln=En("state");An[Ln]=!0,yn=function(t,e){if(kn(t,Ln))throw Hn(Nn);return e.facade=t,Fn(t,Ln,e),e},bn=function(t){return kn(t,Ln)?t[Ln]:{}},gn=function(t){return kn(t,Ln)}}var Mn={set:yn,get:bn,has:gn,enforce:function(t){return gn(t)?bn(t):yn(t,{})},getterFor:function(t){return function(e){var n;if(!Tn(e)||(n=bn(e)).type!==t)throw Hn("Incompatible receiver, "+t+" required");return n}}},_n=y,Wn=et,zn=Kt,Xn=b,Yn=ln.CONFIGURABLE,qn=vn,Gn=Mn.enforce,Vn=Mn.get,Un=Object.defineProperty,Kn=Xn&&!_n((function(){return 8!==Un((function(){}),"length",{value:8}).length})),Qn=String(String).split("String"),Zn=on.exports=function(t,e,n){"Symbol("===String(e).slice(0,7)&&(e="["+String(e).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!zn(t,"name")||Yn&&t.name!==e)&&(Xn?Un(t,"name",{value:e,configurable:!0}):t.name=e),Kn&&n&&zn(n,"arity")&&t.length!==n.arity&&Un(t,"length",{value:n.arity});try{n&&zn(n,"constructor")&&n.constructor?Xn&&Un(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var i=Gn(t);return zn(i,"source")||(i.source=Qn.join("string"==typeof e?e:"")),t};Function.prototype.toString=Zn((function(){return Wn(this)&&Vn(this).source||qn(this)}),"toString");var Jn=et,ti=Ie,ei=on.exports,ni=Mt,ii=function(t,e,n,i){i||(i={});var r=i.enumerable,o=void 0!==i.name?i.name:e;if(Jn(n)&&ei(n,o,i),i.global)r?t[e]=n:ni(e,n);else{try{i.unsafe?t[e]&&(r=!0):delete t[e]}catch(t){}r?t[e]=n:ti.f(t,e,{value:n,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return t},ri={},oi=Math.ceil,ui=Math.floor,fi=Math.trunc||function(t){var e=+t;return(e>0?ui:oi)(e)},ai=function(t){var e=+t;return e!=e||0===e?0:fi(e)},ci=ai,si=Math.max,li=Math.min,di=ai,hi=Math.min,pi=function(t){return t>0?hi(di(t),9007199254740991):0},yi=function(t){return pi(t.length)},bi=Q,gi=function(t,e){var n=ci(t);return n<0?si(n+e,0):li(n,e)},vi=yi,mi=function(t){return function(e,n,i){var r,o=bi(e),u=vi(o),f=gi(i,u);if(t&&n!=n){for(;u>f;)if((r=o[f++])!=r)return!0}else for(;u>f;f++)if((t||f in o)&&o[f]===n)return t||f||0;return!t&&-1}},xi={includes:mi(!0),indexOf:mi(!1)},$i=Kt,wi=Q,Ci=xi.indexOf,Oi=jn,Si=L([].push),ji=function(t,e){var n,i=wi(t),r=0,o=[];for(n in i)!$i(Oi,n)&&$i(i,n)&&Si(o,n);for(;e.length>r;)$i(i,n=e[r++])&&(~Ci(o,n)||Si(o,n));return o},Ri=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Bi=ji,Ti=Ri.concat("length","prototype");ri.f=Object.getOwnPropertyNames||function(t){return Bi(t,Ti)};var Fi={};Fi.f=Object.getOwnPropertySymbols;var ki=at,Pi=ri,Ei=Fi,Ai=ze,Ni=L([].concat),Hi=ki("Reflect","ownKeys")||function(t){var e=Pi.f(Ai(t)),n=Ei.f;return n?Ni(e,n(t)):e},Di=Kt,Ii=Hi,Li=p,Mi=Ie,_i=y,Wi=et,zi=/#|\.prototype\./,Xi=function(t,e){var n=qi[Yi(t)];return n==Vi||n!=Gi&&(Wi(e)?_i(e):!!e)},Yi=Xi.normalize=function(t){return String(t).replace(zi,".").toLowerCase()},qi=Xi.data={},Gi=Xi.NATIVE="N",Vi=Xi.POLYFILL="P",Ui=Xi,Ki=h,Qi=p.f,Zi=rn,Ji=ii,tr=Mt,er=function(t,e,n){for(var i=Ii(e),r=Mi.f,o=Li.f,u=0;u<i.length;u++){var f=i[u];Di(t,f)||n&&Di(n,f)||r(t,f,o(e,f))}},nr=Ui,ir=function(t,e){var n,i,r,o,u,f=t.target,a=t.global,c=t.stat;if(n=a?Ki:c?Ki[f]||tr(f,{}):(Ki[f]||{}).prototype)for(i in e){if(o=e[i],r=t.dontCallGetSet?(u=Qi(n,i))&&u.value:n[i],!nr(a?i:f+(c?".":"#")+i,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;er(o,r)}(t.sham||r&&r.sham)&&Zi(o,"sham",!0),Ji(n,i,o,t)}},rr=Ft,or=g,ur=L(L.bind),fr=H,ar=Array.isArray||function(t){return"Array"==fr(t)},cr={};cr[de("toStringTag")]="z";var sr="[object z]"===String(cr),lr=sr,dr=et,hr=H,pr=de("toStringTag"),yr=Object,br="Arguments"==hr(function(){return arguments}()),gr=lr?hr:function(t){var e,n,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=yr(t),pr))?n:br?hr(e):"Object"==(i=hr(e))&&dr(e.callee)?"Arguments":i},vr=L,mr=y,xr=et,$r=gr,wr=vn,Cr=function(){},Or=[],Sr=at("Reflect","construct"),jr=/^\s*(?:class|function)\b/,Rr=vr(jr.exec),Br=!jr.exec(Cr),Tr=function(t){if(!xr(t))return!1;try{return Sr(Cr,Or,t),!0}catch(t){return!1}},Fr=function(t){if(!xr(t))return!1;switch($r(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Br||!!Rr(jr,wr(t))}catch(t){return!0}};Fr.sham=!0;var kr=!Sr||mr((function(){var t;return Tr(Tr.call)||!Tr(Object)||!Tr((function(){t=!0}))||t}))?Fr:Tr,Pr=ar,Er=kr,Ar=rt,Nr=de("species"),Hr=Array,Dr=function(t){var e;return Pr(t)&&(e=t.constructor,(Er(e)&&(e===Hr||Pr(e.prototype))||Ar(e)&&null===(e=e[Nr]))&&(e=void 0)),void 0===e?Hr:e},Ir=function(t,e){return new(Dr(t))(0===e?0:e)},Lr=function(t,e){return rr(t),void 0===e?t:or?ur(t,e):function(){return t.apply(e,arguments)}},Mr=X,_r=Gt,Wr=yi,zr=Ir,Xr=L([].push),Yr=function(t){var e=1==t,n=2==t,i=3==t,r=4==t,o=6==t,u=7==t,f=5==t||o;return function(a,c,s,l){for(var d,h,p=_r(a),y=Mr(p),b=Lr(c,s),g=Wr(y),v=0,m=l||zr,x=e?m(a,g):n||u?m(a,0):void 0;g>v;v++)if((f||v in y)&&(h=b(d=y[v],v,p),t))if(e)x[v]=h;else if(h)switch(t){case 3:return!0;case 5:return d;case 6:return v;case 2:Xr(x,d)}else switch(t){case 4:return!1;case 7:Xr(x,d)}return o?-1:i||r?r:x}},qr={forEach:Yr(0),map:Yr(1),filter:Yr(2),some:Yr(3),every:Yr(4),find:Yr(5),findIndex:Yr(6),filterReject:Yr(7)},Gr={},Vr=ji,Ur=Ri,Kr=Object.keys||function(t){return Vr(t,Ur)},Qr=b,Zr=Le,Jr=Ie,to=ze,eo=Q,no=Kr;Gr.f=Qr&&!Zr?Object.defineProperties:function(t,e){to(t);for(var n,i=eo(e),r=no(e),o=r.length,u=0;o>u;)Jr.f(t,n=r[u++],i[n]);return t};var io,ro=at("document","documentElement"),oo=ze,uo=Gr,fo=Ri,ao=jn,co=ro,so=je,lo=Sn("IE_PROTO"),ho=function(){},po=function(t){return"<script>"+t+"</"+"script>"},yo=function(t){t.write(po("")),t.close();var e=t.parentWindow.Object;return t=null,e},bo=function(){try{io=new ActiveXObject("htmlfile")}catch(t){}var t,e;bo="undefined"!=typeof document?document.domain&&io?yo(io):((e=so("iframe")).style.display="none",co.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(po("document.F=Object")),t.close(),t.F):yo(io);for(var n=fo.length;n--;)delete bo.prototype[fo[n]];return bo()};ao[lo]=!0;var go=de,vo=Object.create||function(t,e){var n;return null!==t?(ho.prototype=oo(t),n=new ho,ho.prototype=null,n[lo]=t):n=bo(),void 0===e?n:uo.f(n,e)},mo=Ie.f,xo=go("unscopables"),$o=Array.prototype;null==$o[xo]&&mo($o,xo,{configurable:!0,value:vo(null)});var wo=ir,Co=qr.find,Oo=function(t){$o[xo][t]=!0},So="find",jo=!0;So in[]&&Array(1).find((function(){jo=!1})),wo({target:"Array",proto:!0,forced:jo},{find:function(t){return Co(this,t,arguments.length>1?arguments[1]:void 0)}}),Oo(So);var Ro=gr,Bo=sr?{}.toString:function(){return"[object "+Ro(this)+"]"};sr||ii(Object.prototype,"toString",Bo,{unsafe:!0});var To=TypeError,Fo=we,ko=Ie,Po=R,Eo=y,Ao=bt,No=de("species"),Ho=ir,Do=y,Io=ar,Lo=rt,Mo=Gt,_o=yi,Wo=function(t){if(t>9007199254740991)throw To("Maximum allowed index exceeded");return t},zo=function(t,e,n){var i=Fo(e);i in t?ko.f(t,i,Po(0,n)):t[i]=n},Xo=Ir,Yo=function(t){return Ao>=51||!Eo((function(){var e=[];return(e.constructor={})[No]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},qo=bt,Go=de("isConcatSpreadable"),Vo=qo>=51||!Do((function(){var t=[];return t[Go]=!1,t.concat()[0]!==t})),Uo=Yo("concat"),Ko=function(t){if(!Lo(t))return!1;var e=t[Go];return void 0!==e?!!e:Io(t)};Ho({target:"Array",proto:!0,arity:1,forced:!Vo||!Uo},{concat:function(t){var e,n,i,r,o,u=Mo(this),f=Xo(u,0),a=0;for(e=-1,i=arguments.length;e<i;e++)if(Ko(o=-1===e?u:arguments[e]))for(r=_o(o),Wo(a+r),n=0;n<r;n++,a++)n in o&&zo(f,a,o[n]);else Wo(a+1),zo(f,a++,o);return f.length=a,f}});var Qo=ir,Zo=ar,Jo=L([].reverse),tu=[1,2];Qo({target:"Array",proto:!0,forced:String(tu)===String(tu.reverse())},{reverse:function(){return Zo(this)&&(this.length=this.length),Jo(this)}});var eu=gr,nu=String,iu=function(t){if("Symbol"===eu(t))throw TypeError("Cannot convert a Symbol value to a string");return nu(t)},ru="\t\n\v\f\r \u2028\u2029\ufeff",ou=V,uu=iu,fu=L("".replace),au="[\t\n\v\f\r \u2028\u2029\ufeff]",cu=RegExp("^"+au+au+"*"),su=RegExp(au+au+"*$"),lu=function(t){return function(e){var n=uu(ou(e));return 1&t&&(n=fu(n,cu,"")),2&t&&(n=fu(n,su,"")),n}},du={start:lu(1),end:lu(2),trim:lu(3)},hu=h,pu=y,yu=L,bu=iu,gu=du.trim,vu=ru,mu=hu.parseInt,xu=hu.Symbol,$u=xu&&xu.iterator,wu=/^[+-]?0x/i,Cu=yu(wu.exec),Ou=8!==mu(vu+"08")||22!==mu(vu+"0x16")||$u&&!pu((function(){mu(Object($u))}))?function(t,e){var n=gu(bu(t));return mu(n,e>>>0||(Cu(wu,n)?16:10))}:mu;ir({global:!0,forced:parseInt!=Ou},{parseInt:Ou});var Su=y,ju=ir,Ru=xi.indexOf,Bu=function(t,e){var n=[][t];return!!n&&Su((function(){n.call(null,e||function(){return 1},1)}))},Tu=L([].indexOf),Fu=!!Tu&&1/Tu([1],1,-0)<0,ku=Bu("indexOf");ju({target:"Array",proto:!0,forced:Fu||!ku},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return Fu?Tu(this,t,e)||0:Ru(this,t,e)}});var Pu=n.default.fn.bootstrapTable.utils;n.default.extend(n.default.fn.bootstrapTable.defaults,{fixedColumns:!1,fixedNumber:0,fixedRightNumber:0}),n.default.BootstrapTable=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&u(t,e)}(d,t);var e,f,c,l=a(d);function d(){return i(this,d),l.apply(this,arguments)}return e=d,f=[{key:"fixedColumnsSupported",value:function(){return this.options.fixedColumns&&!this.options.detailView&&!this.options.cardView}},{key:"initContainer",value:function(){s(o(d.prototype),"initContainer",this).call(this),this.fixedColumnsSupported()&&(this.options.fixedNumber&&(this.$tableContainer.append('<div class="fixed-columns"></div>'),this.$fixedColumns=this.$tableContainer.find(".fixed-columns")),this.options.fixedRightNumber&&(this.$tableContainer.append('<div class="fixed-columns-right"></div>'),this.$fixedColumnsRight=this.$tableContainer.find(".fixed-columns-right")))}},{key:"initBody",value:function(){for(var t,e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];(t=s(o(d.prototype),"initBody",this)).call.apply(t,[this].concat(n)),this.$fixedColumns&&this.$fixedColumns.length&&this.$fixedColumns.toggle(this.fixedColumnsSupported()),this.$fixedColumnsRight&&this.$fixedColumnsRight.length&&this.$fixedColumnsRight.toggle(this.fixedColumnsSupported()),this.fixedColumnsSupported()&&(this.options.showHeader&&this.options.height||(this.initFixedColumnsBody(),this.initFixedColumnsEvents()))}},{key:"trigger",value:function(){for(var t,e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];(t=s(o(d.prototype),"trigger",this)).call.apply(t,[this].concat(n)),this.fixedColumnsSupported()&&("post-header"===n[0]?this.initFixedColumnsHeader():"scroll-body"===n[0]&&(this.needFixedColumns&&this.options.fixedNumber&&this.$fixedBody.scrollTop(this.$tableBody.scrollTop()),this.needFixedColumns&&this.options.fixedRightNumber&&this.$fixedBodyRight.scrollTop(this.$tableBody.scrollTop())))}},{key:"updateSelected",value:function(){var t=this;s(o(d.prototype),"updateSelected",this).call(this),this.fixedColumnsSupported()&&this.$tableBody.find("tr").each((function(e,i){var r=n.default(i),o=r.data("index"),u=r.attr("class"),f='[name="'.concat(t.options.selectItemName,'"]'),a=r.find(f);if(void 0!==o){var c=function(e,n){var i=n.find('tr[data-index="'.concat(o,'"]'));i.attr("class",u),a.length&&i.find(f).prop("checked",a.prop("checked")),t.$selectAll.length&&e.add(n).find('[name="btSelectAll"]').prop("checked",t.$selectAll.prop("checked"))};t.$fixedBody&&t.options.fixedNumber&&c(t.$fixedHeader,t.$fixedBody),t.$fixedBodyRight&&t.options.fixedRightNumber&&c(t.$fixedHeaderRight,t.$fixedBodyRight)}}))}},{key:"hideLoading",value:function(){s(o(d.prototype),"hideLoading",this).call(this),this.needFixedColumns&&this.options.fixedNumber&&this.$fixedColumns.find(".fixed-table-loading").hide(),this.needFixedColumns&&this.options.fixedRightNumber&&this.$fixedColumnsRight.find(".fixed-table-loading").hide()}},{key:"initFixedColumnsHeader",value:function(){var t=this;this.options.height?this.needFixedColumns=this.$tableHeader.outerWidth(!0)<this.$tableHeader.find("table").outerWidth(!0):this.needFixedColumns=this.$tableBody.outerWidth(!0)<this.$tableBody.find("table").outerWidth(!0);var e=function(e,n){return e.find(".fixed-table-header").remove(),e.append(t.$tableHeader.clone(!0)),e.css({width:t.getFixedColumnsWidth(n)}),e.find(".fixed-table-header")};this.needFixedColumns&&this.options.fixedNumber?(this.$fixedHeader=e(this.$fixedColumns),this.$fixedHeader.css("margin-right","")):this.$fixedColumns&&this.$fixedColumns.html("").css("width",""),this.needFixedColumns&&this.options.fixedRightNumber?(this.$fixedHeaderRight=e(this.$fixedColumnsRight,!0),this.$fixedHeaderRight.scrollLeft(this.$fixedHeaderRight.find("table").width())):this.$fixedColumnsRight&&this.$fixedColumnsRight.html("").css("width",""),this.initFixedColumnsBody(),this.initFixedColumnsEvents()}},{key:"initFixedColumnsBody",value:function(){var t=this,e=function(e,n){e.find(".fixed-table-body").remove(),e.append(t.$tableBody.clone(!0)),e.find(".fixed-table-body table").removeAttr("id");var i=e.find(".fixed-table-body"),r=t.$tableBody.get(0),o=r.scrollWidth>r.clientWidth?Pu.getScrollBarWidth():0,u=t.$tableContainer.outerHeight(!0)-o-1;return e.css({height:u}),i.css({height:u-n.height()}),i};this.needFixedColumns&&this.options.fixedNumber&&(this.$fixedBody=e(this.$fixedColumns,this.$fixedHeader)),this.needFixedColumns&&this.options.fixedRightNumber&&(this.$fixedBodyRight=e(this.$fixedColumnsRight,this.$fixedHeaderRight),this.$fixedBodyRight.scrollLeft(this.$fixedBodyRight.find("table").width()),this.$fixedBodyRight.css("overflow-y",this.options.height?"auto":"hidden"))}},{key:"getFixedColumnsWidth",value:function(t){var e=this.getVisibleFields(),n=0,i=this.options.fixedNumber,r=0;t&&(e=e.reverse(),i=this.options.fixedRightNumber,r=parseInt(this.$tableHeader.css("margin-right"),10));for(var o=0;o<i;o++)n+=this.$header.find('th[data-field="'.concat(e[o],'"]')).outerWidth(!0);return n+r+1}},{key:"initFixedColumnsEvents",value:function(){var t=this,e=function(e,i){var r='tr[data-index="'.concat(n.default(e.currentTarget).data("index"),'"]'),o=t.$tableBody.find(r);t.$fixedBody&&(o=o.add(t.$fixedBody.find(r))),t.$fixedBodyRight&&(o=o.add(t.$fixedBodyRight.find(r))),o.css("background-color",i?n.default(e.currentTarget).css("background-color"):"")};this.$tableBody.find("tr").hover((function(t){e(t,!0)}),(function(t){e(t,!1)}));var i="undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().indexOf("firefox")>-1?"DOMMouseScroll":"mousewheel";this.needFixedColumns&&this.options.fixedNumber&&(this.$fixedBody.find("tr").hover((function(t){e(t,!0)}),(function(t){e(t,!1)})),this.$fixedBody[0].addEventListener(i,(function(e){!function(e,n){var i,r,o,u,f,a=(r=0,o=0,u=0,f=0,"detail"in(i=e)&&(o=i.detail),"wheelDelta"in i&&(o=-i.wheelDelta/120),"wheelDeltaY"in i&&(o=-i.wheelDeltaY/120),"wheelDeltaX"in i&&(r=-i.wheelDeltaX/120),"axis"in i&&i.axis===i.HORIZONTAL_AXIS&&(r=o,o=0),u=10*r,f=10*o,"deltaY"in i&&(f=i.deltaY),"deltaX"in i&&(u=i.deltaX),(u||f)&&i.deltaMode&&(1===i.deltaMode?(u*=40,f*=40):(u*=800,f*=800)),u&&!r&&(r=u<1?-1:1),f&&!o&&(o=f<1?-1:1),{spinX:r,spinY:o,pixelX:u,pixelY:f}),c=Math.ceil(a.pixelY),s=t.$tableBody.scrollTop()+c;(c<0&&s>0||c>0&&s<n.scrollHeight-n.clientHeight)&&e.preventDefault(),t.$tableBody.scrollTop(s),t.$fixedBody&&t.$fixedBody.scrollTop(s),t.$fixedBodyRight&&t.$fixedBodyRight.scrollTop(s)}(e,t.$fixedBody[0])}))),this.needFixedColumns&&this.options.fixedRightNumber&&(this.$fixedBodyRight.find("tr").hover((function(t){e(t,!0)}),(function(t){e(t,!1)})),this.$fixedBodyRight.off("scroll").on("scroll",(function(){var e=t.$fixedBodyRight.scrollTop();t.$tableBody.scrollTop(e),t.$fixedBody&&t.$fixedBody.scrollTop(e)}))),this.options.filterControl&&n.default(this.$fixedColumns).off("keyup change").on("keyup change",(function(e){var i=n.default(e.target),r=i.val(),o=i.parents("th").data("field"),u=t.$header.find('th[data-field="'.concat(o,'"]'));if(i.is("input"))u.find("input").val(r);else if(i.is("select")){var f=u.find("select");f.find("option[selected]").removeAttr("selected"),f.find('option[value="'.concat(r,'"]')).attr("selected",!0)}t.triggerSearch()}))}},{key:"renderStickyHeader",value:function(){if(this.options.stickyHeader&&(this.$stickyContainer=this.$container.find(".sticky-header-container"),s(o(d.prototype),"renderStickyHeader",this).call(this),this.needFixedColumns&&this.options.fixedNumber&&this.$fixedColumns.css("z-index",101).find(".sticky-header-container").css("right","").width(this.$fixedColumns.outerWidth()),this.needFixedColumns&&this.options.fixedRightNumber)){var t=this.$fixedColumnsRight.find(".sticky-header-container");this.$fixedColumnsRight.css("z-index",101),t.css("left","").scrollLeft(t.find(".table").outerWidth()).width(this.$fixedColumnsRight.outerWidth())}}},{key:"matchPositionX",value:function(){this.options.stickyHeader&&this.$stickyContainer.eq(0).scrollLeft(this.$tableBody.scrollLeft())}}],f&&r(e.prototype,f),c&&r(e,c),Object.defineProperty(e,"prototype",{writable:!1}),d}(n.default.BootstrapTable)})); |
New file |
| | |
| | | /** |
| | | * @author: Dennis Hernández |
| | | * @update zhixin wen <wenzhixin2010@gmail.com> |
| | | */ |
| | | var Utils = $.fn.bootstrapTable.utils |
| | | var UtilsCookie = { |
| | | cookieIds: { |
| | | sortOrder: 'bs.table.sortOrder', |
| | | sortName: 'bs.table.sortName', |
| | | sortPriority: 'bs.table.sortPriority', |
| | | pageNumber: 'bs.table.pageNumber', |
| | | pageList: 'bs.table.pageList', |
| | | hiddenColumns: 'bs.table.hiddenColumns', |
| | | cardView: 'bs.table.cardView', |
| | | customView: 'bs.table.customView', |
| | | searchText: 'bs.table.searchText', |
| | | reorderColumns: 'bs.table.reorderColumns', |
| | | filterControl: 'bs.table.filterControl', |
| | | filterBy: 'bs.table.filterBy' |
| | | }, |
| | | getCurrentHeader (that) { |
| | | return that.options.height ? that.$tableHeader : that.$header |
| | | }, |
| | | getCurrentSearchControls (that) { |
| | | return that.options.height ? 'table select, table input' : 'select, input' |
| | | }, |
| | | isCookieSupportedByBrowser () { |
| | | return navigator.cookieEnabled |
| | | }, |
| | | isCookieEnabled (that, cookieName) { |
| | | return that.options.cookiesEnabled.includes(cookieName) |
| | | }, |
| | | setCookie (that, cookieName, cookieValue) { |
| | | if ( |
| | | !that.options.cookie || |
| | | !UtilsCookie.isCookieEnabled(that, cookieName) |
| | | ) { |
| | | return |
| | | } |
| | | |
| | | return that._storage.setItem(`${that.options.cookieIdTable}.${cookieName}`, cookieValue) |
| | | }, |
| | | getCookie (that, cookieName) { |
| | | if ( |
| | | !cookieName || |
| | | !UtilsCookie.isCookieEnabled(that, cookieName) |
| | | ) { |
| | | return null |
| | | } |
| | | |
| | | return that._storage.getItem(`${that.options.cookieIdTable}.${cookieName}`) |
| | | }, |
| | | deleteCookie (that, cookieName) { |
| | | return that._storage.removeItem(`${that.options.cookieIdTable}.${cookieName}`) |
| | | }, |
| | | calculateExpiration (cookieExpire) { |
| | | const time = cookieExpire.replace(/[0-9]*/, '') // s,mi,h,d,m,y |
| | | |
| | | cookieExpire = cookieExpire.replace(/[A-Za-z]{1,2}/, '') // number |
| | | |
| | | switch (time.toLowerCase()) { |
| | | case 's': |
| | | cookieExpire = +cookieExpire |
| | | break |
| | | case 'mi': |
| | | cookieExpire *= 60 |
| | | break |
| | | case 'h': |
| | | cookieExpire = cookieExpire * 60 * 60 |
| | | break |
| | | case 'd': |
| | | cookieExpire = cookieExpire * 24 * 60 * 60 |
| | | break |
| | | case 'm': |
| | | cookieExpire = cookieExpire * 30 * 24 * 60 * 60 |
| | | break |
| | | case 'y': |
| | | cookieExpire = cookieExpire * 365 * 24 * 60 * 60 |
| | | break |
| | | default: |
| | | cookieExpire = undefined |
| | | break |
| | | } |
| | | if (!cookieExpire) { |
| | | return '' |
| | | } |
| | | const d = new Date() |
| | | |
| | | d.setTime(d.getTime() + cookieExpire * 1000) |
| | | return d.toGMTString() |
| | | }, |
| | | initCookieFilters (that) { |
| | | setTimeout(() => { |
| | | const parsedCookieFilters = JSON.parse( |
| | | UtilsCookie.getCookie(that, UtilsCookie.cookieIds.filterControl)) |
| | | |
| | | if (!that._filterControlValuesLoaded && parsedCookieFilters) { |
| | | const cachedFilters = {} |
| | | const header = UtilsCookie.getCurrentHeader(that) |
| | | const searchControls = UtilsCookie.getCurrentSearchControls(that) |
| | | |
| | | const applyCookieFilters = (element, filteredCookies) => { |
| | | filteredCookies.forEach(cookie => { |
| | | const value = element.value.toString() |
| | | const text = cookie.text |
| | | |
| | | if ( |
| | | text === '' || |
| | | element.type === 'radio' && |
| | | value !== text |
| | | ) { |
| | | return |
| | | } |
| | | |
| | | if ( |
| | | element.tagName === 'INPUT' && |
| | | element.type === 'radio' && |
| | | value === text |
| | | ) { |
| | | element.checked = true |
| | | cachedFilters[cookie.field] = text |
| | | } else if (element.tagName === 'INPUT') { |
| | | element.value = text |
| | | cachedFilters[cookie.field] = text |
| | | } else if ( |
| | | element.tagName === 'SELECT' && |
| | | that.options.filterControlContainer |
| | | ) { |
| | | element.value = text |
| | | cachedFilters[cookie.field] = text |
| | | } else if (text !== '' && element.tagName === 'SELECT') { |
| | | cachedFilters[cookie.field] = text |
| | | for (const currentElement of element) { |
| | | if (currentElement.value === text) { |
| | | currentElement.selected = true |
| | | return |
| | | } |
| | | } |
| | | const option = document.createElement('option') |
| | | |
| | | option.value = text |
| | | option.text = text |
| | | element.add(option, element[1]) |
| | | element.selectedIndex = 1 |
| | | } |
| | | }) |
| | | } |
| | | |
| | | let filterContainer = header |
| | | |
| | | if (that.options.filterControlContainer) { |
| | | filterContainer = $(`${that.options.filterControlContainer}`) |
| | | } |
| | | |
| | | filterContainer.find(searchControls).each(function () { |
| | | const field = $(this).closest('[data-field]').data('field') |
| | | const filteredCookies = parsedCookieFilters.filter(cookie => cookie.field === field) |
| | | |
| | | applyCookieFilters(this, filteredCookies) |
| | | }) |
| | | |
| | | that.initColumnSearch(cachedFilters) |
| | | that._filterControlValuesLoaded = true |
| | | that.initServer() |
| | | } |
| | | }, 250) |
| | | } |
| | | } |
| | | |
| | | Object.assign($.fn.bootstrapTable.defaults, { |
| | | cookie: false, |
| | | cookieExpire: '2h', |
| | | cookiePath: null, |
| | | cookieDomain: null, |
| | | cookieSecure: null, |
| | | cookieSameSite: 'Lax', |
| | | cookieIdTable: '', |
| | | cookiesEnabled: [ |
| | | 'bs.table.sortOrder', 'bs.table.sortName', 'bs.table.sortPriority', |
| | | 'bs.table.pageNumber', 'bs.table.pageList', |
| | | 'bs.table.hiddenColumns', 'bs.table.searchText', |
| | | 'bs.table.filterControl', 'bs.table.filterBy', |
| | | 'bs.table.reorderColumns', 'bs.table.cardView', 'bs.table.customView' |
| | | ], |
| | | cookieStorage: 'cookieStorage', // localStorage, sessionStorage, customStorage |
| | | cookieCustomStorageGet: null, |
| | | cookieCustomStorageSet: null, |
| | | cookieCustomStorageDelete: null, |
| | | // internal variable |
| | | _filterControls: [], |
| | | _filterControlValuesLoaded: false, |
| | | _storage: { |
| | | setItem: undefined, |
| | | getItem: undefined, |
| | | removeItem: undefined |
| | | } |
| | | }) |
| | | |
| | | $.fn.bootstrapTable.methods.push('getCookies') |
| | | $.fn.bootstrapTable.methods.push('deleteCookie') |
| | | |
| | | Object.assign($.fn.bootstrapTable.utils, { |
| | | setCookie: UtilsCookie.setCookie, |
| | | getCookie: UtilsCookie.getCookie |
| | | }) |
| | | |
| | | $.BootstrapTable = class extends $.BootstrapTable { |
| | | init () { |
| | | if (this.options.cookie) { |
| | | if ( |
| | | this.options.cookieStorage === 'cookieStorage' && |
| | | !UtilsCookie.isCookieSupportedByBrowser() |
| | | ) { |
| | | throw new Error('Cookies are not enabled in this browser.') |
| | | } |
| | | |
| | | this.configureStorage() |
| | | |
| | | // FilterBy logic |
| | | const filterByCookieValue = UtilsCookie.getCookie(this, UtilsCookie.cookieIds.filterBy) |
| | | |
| | | if (typeof filterByCookieValue === 'boolean' && !filterByCookieValue) { |
| | | throw new Error('The cookie value of filterBy must be a json!') |
| | | } |
| | | |
| | | let filterByCookie = {} |
| | | |
| | | try { |
| | | filterByCookie = JSON.parse(filterByCookieValue) |
| | | } catch (e) { |
| | | throw new Error('Could not parse the json of the filterBy cookie!') |
| | | } |
| | | this.filterColumns = filterByCookie ? filterByCookie : {} |
| | | |
| | | // FilterControl logic |
| | | this._filterControls = [] |
| | | this._filterControlValuesLoaded = false |
| | | |
| | | this.options.cookiesEnabled = typeof this.options.cookiesEnabled === 'string' ? |
| | | this.options.cookiesEnabled.replace('[', '').replace(']', '') |
| | | .replace(/'/g, '').replace(/ /g, '').split(',') : |
| | | this.options.cookiesEnabled |
| | | |
| | | if (this.options.filterControl) { |
| | | const that = this |
| | | |
| | | this.$el.on('column-search.bs.table', (e, field, text) => { |
| | | let isNewField = true |
| | | |
| | | for (let i = 0; i < that._filterControls.length; i++) { |
| | | if (that._filterControls[i].field === field) { |
| | | that._filterControls[i].text = text |
| | | isNewField = false |
| | | break |
| | | } |
| | | } |
| | | if (isNewField) { |
| | | that._filterControls.push({ |
| | | field, |
| | | text |
| | | }) |
| | | } |
| | | |
| | | UtilsCookie.setCookie(that, UtilsCookie.cookieIds.filterControl, JSON.stringify(that._filterControls)) |
| | | }).on('created-controls.bs.table', UtilsCookie.initCookieFilters(that)) |
| | | } |
| | | } |
| | | super.init() |
| | | } |
| | | |
| | | initServer (...args) { |
| | | if ( |
| | | this.options.cookie && |
| | | this.options.filterControl && |
| | | !this._filterControlValuesLoaded |
| | | ) { |
| | | const cookie = JSON.parse(UtilsCookie.getCookie(this, UtilsCookie.cookieIds.filterControl)) |
| | | |
| | | if (cookie) { |
| | | return |
| | | } |
| | | } |
| | | super.initServer(...args) |
| | | } |
| | | |
| | | initTable (...args) { |
| | | super.initTable(...args) |
| | | this.initCookie() |
| | | } |
| | | |
| | | onSort (...args) { |
| | | super.onSort(...args) |
| | | |
| | | if (!this.options.cookie) { |
| | | return |
| | | } |
| | | |
| | | if (this.options.sortName === undefined || this.options.sortOrder === undefined) { |
| | | UtilsCookie.deleteCookie(this, UtilsCookie.cookieIds.sortName) |
| | | UtilsCookie.deleteCookie(this, UtilsCookie.cookieIds.sortOrder) |
| | | } else { |
| | | this.options.sortPriority = null |
| | | UtilsCookie.deleteCookie(this, UtilsCookie.cookieIds.sortPriority) |
| | | |
| | | UtilsCookie.setCookie(this, UtilsCookie.cookieIds.sortOrder, this.options.sortOrder) |
| | | UtilsCookie.setCookie(this, UtilsCookie.cookieIds.sortName, this.options.sortName) |
| | | } |
| | | } |
| | | |
| | | onMultipleSort (...args) { |
| | | super.onMultipleSort(...args) |
| | | |
| | | if (!this.options.cookie) { |
| | | return |
| | | } |
| | | |
| | | if (this.options.sortPriority === undefined) { |
| | | UtilsCookie.deleteCookie(this, UtilsCookie.cookieIds.sortPriority) |
| | | } else { |
| | | this.options.sortName = undefined |
| | | this.options.sortOrder = undefined |
| | | UtilsCookie.deleteCookie(this, UtilsCookie.cookieIds.sortName) |
| | | UtilsCookie.deleteCookie(this, UtilsCookie.cookieIds.sortOrder) |
| | | |
| | | UtilsCookie.setCookie(this, UtilsCookie.cookieIds.sortPriority, JSON.stringify(this.options.sortPriority)) |
| | | } |
| | | } |
| | | |
| | | onPageNumber (...args) { |
| | | super.onPageNumber(...args) |
| | | if (!this.options.cookie) { |
| | | return |
| | | } |
| | | UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber) |
| | | } |
| | | |
| | | onPageListChange (...args) { |
| | | super.onPageListChange(...args) |
| | | if (!this.options.cookie) { |
| | | return |
| | | } |
| | | UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageList, |
| | | this.options.pageSize === this.options.formatAllRows() ? 'all' : this.options.pageSize) |
| | | UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber) |
| | | } |
| | | |
| | | onPagePre (...args) { |
| | | super.onPagePre(...args) |
| | | if (!this.options.cookie) { |
| | | return |
| | | } |
| | | UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber) |
| | | } |
| | | |
| | | onPageNext (...args) { |
| | | super.onPageNext(...args) |
| | | if (!this.options.cookie) { |
| | | return |
| | | } |
| | | UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber) |
| | | } |
| | | |
| | | _toggleColumn (...args) { |
| | | super._toggleColumn(...args) |
| | | if (!this.options.cookie) { |
| | | return |
| | | } |
| | | UtilsCookie.setCookie(this, UtilsCookie.cookieIds.hiddenColumns, JSON.stringify(this.getHiddenColumns().map(column => column.field))) |
| | | } |
| | | |
| | | _toggleAllColumns (...args) { |
| | | super._toggleAllColumns(...args) |
| | | if (!this.options.cookie) { |
| | | return |
| | | } |
| | | UtilsCookie.setCookie(this, UtilsCookie.cookieIds.hiddenColumns, JSON.stringify(this.getHiddenColumns().map(column => column.field))) |
| | | } |
| | | |
| | | toggleView () { |
| | | super.toggleView() |
| | | UtilsCookie.setCookie(this, UtilsCookie.cookieIds.cardView, this.options.cardView) |
| | | } |
| | | |
| | | toggleCustomView () { |
| | | super.toggleCustomView() |
| | | UtilsCookie.setCookie(this, UtilsCookie.cookieIds.customView, this.customViewDefaultView) |
| | | } |
| | | |
| | | selectPage (page) { |
| | | super.selectPage(page) |
| | | if (!this.options.cookie) { |
| | | return |
| | | } |
| | | UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, page) |
| | | } |
| | | |
| | | onSearch (event) { |
| | | super.onSearch(event, arguments.length > 1 ? arguments[1] : true) |
| | | if (!this.options.cookie) { |
| | | return |
| | | } |
| | | if (this.options.search) { |
| | | UtilsCookie.setCookie(this, UtilsCookie.cookieIds.searchText, this.searchText) |
| | | } |
| | | UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber) |
| | | } |
| | | |
| | | initHeader (...args) { |
| | | if (this.options.reorderableColumns && this.options.cookie) { |
| | | this.columnsSortOrder = JSON.parse(UtilsCookie.getCookie(this, UtilsCookie.cookieIds.reorderColumns)) |
| | | } |
| | | super.initHeader(...args) |
| | | } |
| | | |
| | | persistReorderColumnsState (that) { |
| | | UtilsCookie.setCookie(that, UtilsCookie.cookieIds.reorderColumns, JSON.stringify(that.columnsSortOrder)) |
| | | } |
| | | |
| | | filterBy (...args) { |
| | | super.filterBy(...args) |
| | | if (!this.options.cookie) { |
| | | return |
| | | } |
| | | UtilsCookie.setCookie(this, UtilsCookie.cookieIds.filterBy, JSON.stringify(this.filterColumns)) |
| | | } |
| | | |
| | | initCookie () { |
| | | if (!this.options.cookie) { |
| | | return |
| | | } |
| | | |
| | | if (this.options.cookieIdTable === '' || this.options.cookieExpire === '') { |
| | | console.error('Configuration error. Please review the cookieIdTable and the cookieExpire property. If the properties are correct, then this browser does not support cookies.') |
| | | this.options.cookie = false // Make sure that the cookie extension is disabled |
| | | return |
| | | } |
| | | |
| | | const sortOrderCookie = UtilsCookie.getCookie(this, UtilsCookie.cookieIds.sortOrder) |
| | | const sortOrderNameCookie = UtilsCookie.getCookie(this, UtilsCookie.cookieIds.sortName) |
| | | let sortPriorityCookie = UtilsCookie.getCookie(this, UtilsCookie.cookieIds.sortPriority) |
| | | const pageNumberCookie = UtilsCookie.getCookie(this, UtilsCookie.cookieIds.pageNumber) |
| | | const pageListCookie = UtilsCookie.getCookie(this, UtilsCookie.cookieIds.pageList) |
| | | const searchTextCookie = UtilsCookie.getCookie(this, UtilsCookie.cookieIds.searchText) |
| | | const cardViewCookie = UtilsCookie.getCookie(this, UtilsCookie.cookieIds.cardView) |
| | | const customViewCookie = UtilsCookie.getCookie(this, UtilsCookie.cookieIds.customView) |
| | | const hiddenColumnsCookieValue = UtilsCookie.getCookie(this, UtilsCookie.cookieIds.hiddenColumns) |
| | | |
| | | let hiddenColumnsCookie = {} |
| | | |
| | | try { |
| | | hiddenColumnsCookie = JSON.parse(hiddenColumnsCookieValue) |
| | | } catch (e) { |
| | | throw new Error('Could not parse the json of the hidden columns cookie!', hiddenColumnsCookieValue) |
| | | } |
| | | |
| | | try { |
| | | sortPriorityCookie = JSON.parse(sortPriorityCookie) |
| | | } catch (e) { |
| | | throw new Error('Could not parse the json of the sortPriority cookie!', sortPriorityCookie) |
| | | } |
| | | |
| | | if (!sortPriorityCookie) { |
| | | // sortOrder |
| | | this.options.sortOrder = sortOrderCookie ? sortOrderCookie : this.options.sortOrder |
| | | // sortName |
| | | this.options.sortName = sortOrderNameCookie ? sortOrderNameCookie : this.options.sortName |
| | | } else { |
| | | this.options.sortOrder = undefined |
| | | this.options.sortName = undefined |
| | | } |
| | | |
| | | // sortPriority |
| | | this.options.sortPriority = sortPriorityCookie ? sortPriorityCookie : this.options.sortPriority |
| | | |
| | | if (this.options.sortOrder || this.options.sortName) { |
| | | // sortPriority |
| | | this.options.sortPriority = null |
| | | } |
| | | |
| | | // pageNumber |
| | | this.options.pageNumber = pageNumberCookie ? +pageNumberCookie : this.options.pageNumber |
| | | // pageSize |
| | | this.options.pageSize = pageListCookie ? pageListCookie === 'all' ? |
| | | this.options.formatAllRows() : +pageListCookie : this.options.pageSize |
| | | // searchText |
| | | if (UtilsCookie.isCookieEnabled(this, UtilsCookie.cookieIds.searchText) && this.options.searchText === '') { |
| | | this.options.searchText = searchTextCookie ? searchTextCookie : '' |
| | | } |
| | | // cardView |
| | | if (cardViewCookie !== null) { |
| | | this.options.cardView = cardViewCookie === 'true' ? cardViewCookie : false |
| | | } |
| | | this.customViewDefaultView = customViewCookie === 'true' |
| | | |
| | | if (hiddenColumnsCookie) { |
| | | for (const column of this.columns) { |
| | | if (!column.switchable) { |
| | | continue |
| | | } |
| | | |
| | | column.visible = this.isSelectionColumn(column) || |
| | | !hiddenColumnsCookie.includes(column.field) |
| | | } |
| | | } |
| | | } |
| | | |
| | | getCookies () { |
| | | const bootstrapTable = this |
| | | const cookies = {} |
| | | |
| | | for (const [key, value] of Object.entries(UtilsCookie.cookieIds)) { |
| | | cookies[key] = UtilsCookie.getCookie(bootstrapTable, value) |
| | | if (key === 'columns' || key === 'hiddenColumns' || key === 'sortPriority') { |
| | | cookies[key] = JSON.parse(cookies[key]) |
| | | } |
| | | } |
| | | return cookies |
| | | } |
| | | |
| | | deleteCookie (cookieName) { |
| | | if (!cookieName) { |
| | | return |
| | | } |
| | | |
| | | UtilsCookie.deleteCookie(this, UtilsCookie.cookieIds[cookieName]) |
| | | } |
| | | |
| | | configureStorage () { |
| | | const that = this |
| | | |
| | | this._storage = {} |
| | | switch (this.options.cookieStorage) { |
| | | case 'cookieStorage': |
| | | this._storage.setItem = function (cookieName, cookieValue) { |
| | | document.cookie = [ |
| | | cookieName, '=', encodeURIComponent(cookieValue), |
| | | `; expires=${UtilsCookie.calculateExpiration(that.options.cookieExpire)}`, |
| | | that.options.cookiePath ? `; path=${that.options.cookiePath}` : '', |
| | | that.options.cookieDomain ? `; domain=${that.options.cookieDomain}` : '', |
| | | that.options.cookieSecure ? '; secure' : '', |
| | | `;SameSite=${that.options.cookieSameSite}` |
| | | ].join('') |
| | | } |
| | | this._storage.getItem = function (cookieName) { |
| | | const value = `; ${document.cookie}` |
| | | const parts = value.split(`; ${cookieName}=`) |
| | | |
| | | return parts.length === 2 ? decodeURIComponent(parts.pop().split(';').shift()) : null |
| | | } |
| | | this._storage.removeItem = function (cookieName) { |
| | | document.cookie = [ |
| | | encodeURIComponent(cookieName), '=', |
| | | '; expires=Thu, 01 Jan 1970 00:00:00 GMT', |
| | | that.options.cookiePath ? `; path=${that.options.cookiePath}` : '', |
| | | that.options.cookieDomain ? `; domain=${that.options.cookieDomain}` : '', |
| | | `;SameSite=${that.options.cookieSameSite}` |
| | | ].join('') |
| | | } |
| | | break |
| | | case 'localStorage': |
| | | this._storage.setItem = function (cookieName, cookieValue) { |
| | | localStorage.setItem(cookieName, cookieValue) |
| | | } |
| | | this._storage.getItem = function (cookieName) { |
| | | return localStorage.getItem(cookieName) |
| | | } |
| | | this._storage.removeItem = function (cookieName) { |
| | | localStorage.removeItem(cookieName) |
| | | } |
| | | break |
| | | case 'sessionStorage': |
| | | this._storage.setItem = function (cookieName, cookieValue) { |
| | | sessionStorage.setItem(cookieName, cookieValue) |
| | | } |
| | | this._storage.getItem = function (cookieName) { |
| | | return sessionStorage.getItem(cookieName) |
| | | } |
| | | this._storage.removeItem = function (cookieName) { |
| | | sessionStorage.removeItem(cookieName) |
| | | } |
| | | break |
| | | case 'customStorage': |
| | | if ( |
| | | !this.options.cookieCustomStorageSet || |
| | | !this.options.cookieCustomStorageGet || |
| | | !this.options.cookieCustomStorageDelete |
| | | ) { |
| | | throw new Error('The following options must be set while using the customStorage: cookieCustomStorageSet, cookieCustomStorageGet and cookieCustomStorageDelete') |
| | | } |
| | | |
| | | this._storage.setItem = function (cookieName, cookieValue) { |
| | | Utils.calculateObjectValue(that.options, that.options.cookieCustomStorageSet, [cookieName, cookieValue], '') |
| | | } |
| | | this._storage.getItem = function (cookieName) { |
| | | return Utils.calculateObjectValue(that.options, that.options.cookieCustomStorageGet, [cookieName], '') |
| | | } |
| | | this._storage.removeItem = function (cookieName) { |
| | | Utils.calculateObjectValue(that.options, that.options.cookieCustomStorageDelete, [cookieName], '') |
| | | } |
| | | |
| | | break |
| | | default: |
| | | throw new Error('Storage method not supported.') |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * @author: Dustin Utecht |
| | | * @github: https://github.com/UtechtDustin |
| | | */ |
| | | |
| | | var Utils = $.fn.bootstrapTable.utils |
| | | |
| | | Object.assign($.fn.bootstrapTable.defaults, { |
| | | customView: false, |
| | | showCustomView: false, |
| | | customViewDefaultView: false |
| | | }) |
| | | |
| | | Object.assign($.fn.bootstrapTable.defaults.icons, { |
| | | customViewOn: { |
| | | bootstrap3: 'glyphicon glyphicon-list', |
| | | bootstrap5: 'bi-list', |
| | | bootstrap4: 'fa fa-list', |
| | | semantic: 'fa fa-list', |
| | | foundation: 'fa fa-list', |
| | | bulma: 'fa fa-list', |
| | | materialize: 'list' |
| | | }[$.fn.bootstrapTable.theme] || 'fa-list', |
| | | customViewOff: { |
| | | bootstrap3: 'glyphicon glyphicon-eye-open', |
| | | bootstrap5: 'bi-grid', |
| | | bootstrap4: 'fa fa-th', |
| | | semantic: 'fa fa-th', |
| | | foundation: 'fa fa-th', |
| | | bulma: 'fa fa-th', |
| | | materialize: 'grid_on' |
| | | }[$.fn.bootstrapTable.theme] || 'fa-th' |
| | | }) |
| | | |
| | | Object.assign($.fn.bootstrapTable.defaults, { |
| | | onCustomViewPostBody () { |
| | | return false |
| | | }, |
| | | onCustomViewPreBody () { |
| | | return false |
| | | }, |
| | | onToggleCustomView () { |
| | | return false |
| | | } |
| | | }) |
| | | |
| | | Object.assign($.fn.bootstrapTable.locales, { |
| | | formatToggleCustomViewOn () { |
| | | return 'Show custom view' |
| | | }, |
| | | formatToggleCustomViewOff () { |
| | | return 'Hide custom view' |
| | | } |
| | | }) |
| | | Object.assign($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales) |
| | | |
| | | $.fn.bootstrapTable.methods.push('toggleCustomView') |
| | | |
| | | Object.assign($.fn.bootstrapTable.events, { |
| | | 'custom-view-post-body.bs.table': 'onCustomViewPostBody', |
| | | 'custom-view-pre-body.bs.table': 'onCustomViewPreBody', |
| | | 'toggle-custom-view.bs.table': 'onToggleCustomView' |
| | | }) |
| | | |
| | | $.BootstrapTable = class extends $.BootstrapTable { |
| | | |
| | | init () { |
| | | this.customViewDefaultView = this.options.customViewDefaultView |
| | | |
| | | super.init() |
| | | } |
| | | |
| | | initToolbar (...args) { |
| | | if (this.options.customView && this.options.showCustomView) { |
| | | this.buttons = Object.assign(this.buttons, { |
| | | customView: { |
| | | text: this.options.customViewDefaultView ? this.options.formatToggleCustomViewOff() : this.options.formatToggleCustomViewOn(), |
| | | icon: this.options.customViewDefaultView ? this.options.icons.customViewOn : this.options.icons.customViewOff, |
| | | event: this.toggleCustomView, |
| | | attributes: { |
| | | 'aria-label': this.options.customViewDefaultView ? this.options.formatToggleCustomViewOff() : this.options.formatToggleCustomViewOn(), |
| | | title: this.options.customViewDefaultView ? this.options.formatToggleCustomViewOff() : this.options.formatToggleCustomViewOn() |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | super.initToolbar(...args) |
| | | } |
| | | |
| | | initBody () { |
| | | super.initBody() |
| | | |
| | | if (!this.options.customView) { |
| | | return |
| | | } |
| | | |
| | | const $table = this.$el |
| | | const $customViewContainer = this.$container.find('.fixed-table-custom-view') |
| | | |
| | | $table.hide() |
| | | $customViewContainer.hide() |
| | | if (!this.options.customView || !this.customViewDefaultView) { |
| | | $table.show() |
| | | return |
| | | } |
| | | |
| | | const data = this.getData().slice(this.pageFrom - 1, this.pageTo) |
| | | const value = Utils.calculateObjectValue(this, this.options.customView, [data], '') |
| | | |
| | | this.trigger('custom-view-pre-body', data, value) |
| | | if ($customViewContainer.length === 1) { |
| | | $customViewContainer.show().html(value) |
| | | } else { |
| | | this.$tableBody.after(`<div class="fixed-table-custom-view">${value}</div>`) |
| | | } |
| | | |
| | | this.trigger('custom-view-post-body', data, value) |
| | | } |
| | | |
| | | toggleCustomView () { |
| | | this.customViewDefaultView = !this.customViewDefaultView |
| | | |
| | | const icon = this.options.showButtonIcons ? this.customViewDefaultView ? this.options.icons.customViewOn : this.options.icons.customViewOff : '' |
| | | const text = this.options.showButtonText ? this.customViewDefaultView ? this.options.formatToggleCustomViewOff() : this.options.formatToggleCustomViewOn() : '' |
| | | |
| | | this.$toolbar.find('button[name="customView"]') |
| | | .html(`${Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon)} ${text}`) |
| | | .attr('aria-label', text) |
| | | .attr('title', text) |
| | | |
| | | this.initBody() |
| | | this.trigger('toggle-custom-view', this.customViewDefaultView) |
| | | } |
| | | } |
New file |
| | |
| | | /*! X-editable - v1.5.3 |
| | | * In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery |
| | | * http://github.com/vitalets/x-editable |
| | | * Copyright (c) 2019 Vitaliy Potapov; Licensed MIT */ |
| | | .editableform { |
| | | margin-bottom: 0; /* overwrites bootstrap margin */ |
| | | } |
| | | |
| | | .editableform .control-group { |
| | | margin-bottom: 0; /* overwrites bootstrap margin */ |
| | | white-space: nowrap; /* prevent wrapping buttons on new line */ |
| | | line-height: 20px; /* overwriting bootstrap line-height. See #133 */ |
| | | } |
| | | |
| | | /* |
| | | BS3 fix: stop css from breaking when the form is inside a popup and inside a form with the class .form-horizontal |
| | | See: https://github.com/vitalets/x-editable/issues/682 |
| | | */ |
| | | .form-horizontal .editable-popup .editableform .form-group { |
| | | margin-left:0; |
| | | margin-right:0; |
| | | } |
| | | |
| | | |
| | | /* |
| | | BS3 width:1005 for inputs breaks editable form in popup |
| | | See: https://github.com/vitalets/x-editable/issues/393 |
| | | */ |
| | | .editableform .form-control { |
| | | width: auto; |
| | | } |
| | | |
| | | .editable-buttons { |
| | | display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */ |
| | | vertical-align: top; |
| | | margin-left: 7px; |
| | | /* inline-block emulation for IE7*/ |
| | | zoom: 1; |
| | | *display: inline; |
| | | } |
| | | |
| | | .editable-buttons.editable-buttons-bottom { |
| | | display: block; |
| | | margin-top: 7px; |
| | | margin-left: 0; |
| | | } |
| | | |
| | | .editable-input { |
| | | vertical-align: top; |
| | | display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */ |
| | | width: auto; /* bootstrap-responsive has width: 100% that breakes layout */ |
| | | white-space: normal; /* reset white-space decalred in parent*/ |
| | | /* display-inline emulation for IE7*/ |
| | | zoom: 1; |
| | | *display: inline; |
| | | } |
| | | |
| | | .editable-buttons .editable-cancel { |
| | | margin-left: 7px; |
| | | } |
| | | |
| | | /*for jquery-ui buttons need set height to look more pretty*/ |
| | | .editable-buttons button.ui-button-icon-only { |
| | | height: 24px; |
| | | width: 30px; |
| | | } |
| | | |
| | | .editableform-loading { |
| | | background: url('loading.gif') center center no-repeat; |
| | | height: 25px; |
| | | width: auto; |
| | | min-width: 25px; |
| | | } |
| | | |
| | | .editable-inline .editableform-loading { |
| | | background-position: left 5px; |
| | | } |
| | | |
| | | .editable-error-block { |
| | | max-width: 300px; |
| | | margin: 5px 0 0 0; |
| | | width: auto; |
| | | white-space: normal; |
| | | } |
| | | |
| | | /*add padding for jquery ui*/ |
| | | .editable-error-block.ui-state-error { |
| | | padding: 3px; |
| | | } |
| | | |
| | | .editable-error { |
| | | color: red; |
| | | } |
| | | |
| | | /* ---- For specific types ---- */ |
| | | |
| | | .editableform .editable-date { |
| | | padding: 0; |
| | | margin: 0; |
| | | float: left; |
| | | } |
| | | |
| | | /* move datepicker icon to center of add-on button. See https://github.com/vitalets/x-editable/issues/183 */ |
| | | .editable-inline .add-on .icon-th { |
| | | margin-top: 3px; |
| | | margin-left: 1px; |
| | | } |
| | | |
| | | |
| | | /* checklist vertical alignment */ |
| | | .editable-checklist label input[type="checkbox"], |
| | | .editable-checklist label span { |
| | | vertical-align: middle; |
| | | margin: 0; |
| | | } |
| | | |
| | | .editable-checklist label { |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | /* set exact width of textarea to fit buttons toolbar */ |
| | | .editable-wysihtml5 { |
| | | width: 566px; |
| | | height: 250px; |
| | | } |
| | | |
| | | /* clear button shown as link in date inputs */ |
| | | .editable-clear { |
| | | clear: both; |
| | | font-size: 0.9em; |
| | | text-decoration: none; |
| | | text-align: right; |
| | | } |
| | | |
| | | /* IOS-style clear button for text inputs */ |
| | | .editable-clear-x { |
| | | background: url('clear.png') center center no-repeat; |
| | | display: block; |
| | | width: 13px; |
| | | height: 13px; |
| | | position: absolute; |
| | | opacity: 0.6; |
| | | z-index: 100; |
| | | |
| | | top: 50%; |
| | | right: 6px; |
| | | margin-top: -6px; |
| | | |
| | | } |
| | | |
| | | .editable-clear-x:hover { |
| | | opacity: 1; |
| | | } |
| | | |
| | | .editable-pre-wrapped { |
| | | white-space: pre-wrap; |
| | | } |
| | | |
| | | .editable-container.editable-popup { |
| | | max-width: none !important; /* without this rule poshytip/tooltip does not stretch */ |
| | | } |
| | | |
| | | .editable-container.popover { |
| | | width: auto; /* without this rule popover does not stretch */ |
| | | } |
| | | |
| | | .editable-container.editable-inline { |
| | | display: inline-block; |
| | | vertical-align: middle; |
| | | width: auto; |
| | | /* inline-block emulation for IE7*/ |
| | | zoom: 1; |
| | | *display: inline; |
| | | } |
| | | |
| | | .editable-container.ui-widget { |
| | | font-size: inherit; /* jqueryui widget font 1.1em too big, overwrite it */ |
| | | z-index: 9990; /* should be less than select2 dropdown z-index to close dropdown first when click */ |
| | | } |
| | | .editable-click, |
| | | a.editable-click, |
| | | a.editable-click:hover { |
| | | text-decoration: none; |
| | | border-bottom: dashed 1px #0088cc; |
| | | } |
| | | |
| | | .editable-click.editable-disabled, |
| | | a.editable-click.editable-disabled, |
| | | a.editable-click.editable-disabled:hover { |
| | | color: #585858; |
| | | cursor: default; |
| | | border-bottom: none; |
| | | } |
| | | |
| | | .editable-empty, .editable-empty:hover, .editable-empty:focus{ |
| | | font-style: italic; |
| | | color: #DD1144; |
| | | /* border-bottom: none; */ |
| | | text-decoration: none; |
| | | } |
| | | |
| | | .editable-unsaved { |
| | | font-weight: bold; |
| | | } |
| | | |
| | | .editable-unsaved:after { |
| | | /* content: '*'*/ |
| | | } |
| | | |
| | | .editable-bg-transition { |
| | | -webkit-transition: background-color 1400ms ease-out; |
| | | -moz-transition: background-color 1400ms ease-out; |
| | | -o-transition: background-color 1400ms ease-out; |
| | | -ms-transition: background-color 1400ms ease-out; |
| | | transition: background-color 1400ms ease-out; |
| | | } |
| | | |
| | | /*see https://github.com/vitalets/x-editable/issues/139 */ |
| | | .form-horizontal .editable |
| | | { |
| | | padding-top: 5px; |
| | | display:inline-block; |
| | | } |
| | | |
| | | |
| | | /*! |
| | | * Datepicker for Bootstrap |
| | | * |
| | | * Copyright 2012 Stefan Petre |
| | | * Improvements by Andrew Rowls |
| | | * Licensed under the Apache License v2.0 |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | */ |
| | | .datepicker { |
| | | padding: 4px; |
| | | -webkit-border-radius: 4px; |
| | | -moz-border-radius: 4px; |
| | | border-radius: 4px; |
| | | direction: ltr; |
| | | /*.dow { |
| | | border-top: 1px solid #ddd !important; |
| | | }*/ |
| | | |
| | | } |
| | | .datepicker-inline { |
| | | width: 220px; |
| | | } |
| | | .datepicker.datepicker-rtl { |
| | | direction: rtl; |
| | | } |
| | | .datepicker.datepicker-rtl table tr td span { |
| | | float: right; |
| | | } |
| | | .datepicker-dropdown { |
| | | top: 0; |
| | | left: 0; |
| | | } |
| | | .datepicker-dropdown:before { |
| | | content: ''; |
| | | display: inline-block; |
| | | border-left: 7px solid transparent; |
| | | border-right: 7px solid transparent; |
| | | border-bottom: 7px solid #ccc; |
| | | border-bottom-color: rgba(0, 0, 0, 0.2); |
| | | position: absolute; |
| | | top: -7px; |
| | | left: 6px; |
| | | } |
| | | .datepicker-dropdown:after { |
| | | content: ''; |
| | | display: inline-block; |
| | | border-left: 6px solid transparent; |
| | | border-right: 6px solid transparent; |
| | | border-bottom: 6px solid #ffffff; |
| | | position: absolute; |
| | | top: -6px; |
| | | left: 7px; |
| | | } |
| | | .datepicker > div { |
| | | display: none; |
| | | } |
| | | .datepicker.days div.datepicker-days { |
| | | display: block; |
| | | } |
| | | .datepicker.months div.datepicker-months { |
| | | display: block; |
| | | } |
| | | .datepicker.years div.datepicker-years { |
| | | display: block; |
| | | } |
| | | .datepicker table { |
| | | margin: 0; |
| | | } |
| | | .datepicker td, |
| | | .datepicker th { |
| | | text-align: center; |
| | | width: 20px; |
| | | height: 20px; |
| | | -webkit-border-radius: 4px; |
| | | -moz-border-radius: 4px; |
| | | border-radius: 4px; |
| | | border: none; |
| | | } |
| | | .table-striped .datepicker table tr td, |
| | | .table-striped .datepicker table tr th { |
| | | background-color: transparent; |
| | | } |
| | | .datepicker table tr td.day:hover { |
| | | background: #eeeeee; |
| | | cursor: pointer; |
| | | } |
| | | .datepicker table tr td.old, |
| | | .datepicker table tr td.new { |
| | | color: #999999; |
| | | } |
| | | .datepicker table tr td.disabled, |
| | | .datepicker table tr td.disabled:hover { |
| | | background: none; |
| | | color: #999999; |
| | | cursor: default; |
| | | } |
| | | .datepicker table tr td.today, |
| | | .datepicker table tr td.today:hover, |
| | | .datepicker table tr td.today.disabled, |
| | | .datepicker table tr td.today.disabled:hover { |
| | | background-color: #fde19a; |
| | | background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a); |
| | | background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a); |
| | | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a)); |
| | | background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a); |
| | | background-image: -o-linear-gradient(top, #fdd49a, #fdf59a); |
| | | background-image: linear-gradient(top, #fdd49a, #fdf59a); |
| | | background-repeat: repeat-x; |
| | | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0); |
| | | border-color: #fdf59a #fdf59a #fbed50; |
| | | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); |
| | | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); |
| | | color: #000; |
| | | } |
| | | .datepicker table tr td.today:hover, |
| | | .datepicker table tr td.today:hover:hover, |
| | | .datepicker table tr td.today.disabled:hover, |
| | | .datepicker table tr td.today.disabled:hover:hover, |
| | | .datepicker table tr td.today:active, |
| | | .datepicker table tr td.today:hover:active, |
| | | .datepicker table tr td.today.disabled:active, |
| | | .datepicker table tr td.today.disabled:hover:active, |
| | | .datepicker table tr td.today.active, |
| | | .datepicker table tr td.today:hover.active, |
| | | .datepicker table tr td.today.disabled.active, |
| | | .datepicker table tr td.today.disabled:hover.active, |
| | | .datepicker table tr td.today.disabled, |
| | | .datepicker table tr td.today:hover.disabled, |
| | | .datepicker table tr td.today.disabled.disabled, |
| | | .datepicker table tr td.today.disabled:hover.disabled, |
| | | .datepicker table tr td.today[disabled], |
| | | .datepicker table tr td.today:hover[disabled], |
| | | .datepicker table tr td.today.disabled[disabled], |
| | | .datepicker table tr td.today.disabled:hover[disabled] { |
| | | background-color: #fdf59a; |
| | | } |
| | | .datepicker table tr td.today:active, |
| | | .datepicker table tr td.today:hover:active, |
| | | .datepicker table tr td.today.disabled:active, |
| | | .datepicker table tr td.today.disabled:hover:active, |
| | | .datepicker table tr td.today.active, |
| | | .datepicker table tr td.today:hover.active, |
| | | .datepicker table tr td.today.disabled.active, |
| | | .datepicker table tr td.today.disabled:hover.active { |
| | | background-color: #fbf069 \9; |
| | | } |
| | | .datepicker table tr td.today:hover:hover { |
| | | color: #000; |
| | | } |
| | | .datepicker table tr td.today.active:hover { |
| | | color: #fff; |
| | | } |
| | | .datepicker table tr td.range, |
| | | .datepicker table tr td.range:hover, |
| | | .datepicker table tr td.range.disabled, |
| | | .datepicker table tr td.range.disabled:hover { |
| | | background: #eeeeee; |
| | | -webkit-border-radius: 0; |
| | | -moz-border-radius: 0; |
| | | border-radius: 0; |
| | | } |
| | | .datepicker table tr td.range.today, |
| | | .datepicker table tr td.range.today:hover, |
| | | .datepicker table tr td.range.today.disabled, |
| | | .datepicker table tr td.range.today.disabled:hover { |
| | | background-color: #f3d17a; |
| | | background-image: -moz-linear-gradient(top, #f3c17a, #f3e97a); |
| | | background-image: -ms-linear-gradient(top, #f3c17a, #f3e97a); |
| | | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f3c17a), to(#f3e97a)); |
| | | background-image: -webkit-linear-gradient(top, #f3c17a, #f3e97a); |
| | | background-image: -o-linear-gradient(top, #f3c17a, #f3e97a); |
| | | background-image: linear-gradient(top, #f3c17a, #f3e97a); |
| | | background-repeat: repeat-x; |
| | | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f3c17a', endColorstr='#f3e97a', GradientType=0); |
| | | border-color: #f3e97a #f3e97a #edde34; |
| | | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); |
| | | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); |
| | | -webkit-border-radius: 0; |
| | | -moz-border-radius: 0; |
| | | border-radius: 0; |
| | | } |
| | | .datepicker table tr td.range.today:hover, |
| | | .datepicker table tr td.range.today:hover:hover, |
| | | .datepicker table tr td.range.today.disabled:hover, |
| | | .datepicker table tr td.range.today.disabled:hover:hover, |
| | | .datepicker table tr td.range.today:active, |
| | | .datepicker table tr td.range.today:hover:active, |
| | | .datepicker table tr td.range.today.disabled:active, |
| | | .datepicker table tr td.range.today.disabled:hover:active, |
| | | .datepicker table tr td.range.today.active, |
| | | .datepicker table tr td.range.today:hover.active, |
| | | .datepicker table tr td.range.today.disabled.active, |
| | | .datepicker table tr td.range.today.disabled:hover.active, |
| | | .datepicker table tr td.range.today.disabled, |
| | | .datepicker table tr td.range.today:hover.disabled, |
| | | .datepicker table tr td.range.today.disabled.disabled, |
| | | .datepicker table tr td.range.today.disabled:hover.disabled, |
| | | .datepicker table tr td.range.today[disabled], |
| | | .datepicker table tr td.range.today:hover[disabled], |
| | | .datepicker table tr td.range.today.disabled[disabled], |
| | | .datepicker table tr td.range.today.disabled:hover[disabled] { |
| | | background-color: #f3e97a; |
| | | } |
| | | .datepicker table tr td.range.today:active, |
| | | .datepicker table tr td.range.today:hover:active, |
| | | .datepicker table tr td.range.today.disabled:active, |
| | | .datepicker table tr td.range.today.disabled:hover:active, |
| | | .datepicker table tr td.range.today.active, |
| | | .datepicker table tr td.range.today:hover.active, |
| | | .datepicker table tr td.range.today.disabled.active, |
| | | .datepicker table tr td.range.today.disabled:hover.active { |
| | | background-color: #efe24b \9; |
| | | } |
| | | .datepicker table tr td.selected, |
| | | .datepicker table tr td.selected:hover, |
| | | .datepicker table tr td.selected.disabled, |
| | | .datepicker table tr td.selected.disabled:hover { |
| | | background-color: #9e9e9e; |
| | | background-image: -moz-linear-gradient(top, #b3b3b3, #808080); |
| | | background-image: -ms-linear-gradient(top, #b3b3b3, #808080); |
| | | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#b3b3b3), to(#808080)); |
| | | background-image: -webkit-linear-gradient(top, #b3b3b3, #808080); |
| | | background-image: -o-linear-gradient(top, #b3b3b3, #808080); |
| | | background-image: linear-gradient(top, #b3b3b3, #808080); |
| | | background-repeat: repeat-x; |
| | | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#b3b3b3', endColorstr='#808080', GradientType=0); |
| | | border-color: #808080 #808080 #595959; |
| | | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); |
| | | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); |
| | | color: #fff; |
| | | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); |
| | | } |
| | | .datepicker table tr td.selected:hover, |
| | | .datepicker table tr td.selected:hover:hover, |
| | | .datepicker table tr td.selected.disabled:hover, |
| | | .datepicker table tr td.selected.disabled:hover:hover, |
| | | .datepicker table tr td.selected:active, |
| | | .datepicker table tr td.selected:hover:active, |
| | | .datepicker table tr td.selected.disabled:active, |
| | | .datepicker table tr td.selected.disabled:hover:active, |
| | | .datepicker table tr td.selected.active, |
| | | .datepicker table tr td.selected:hover.active, |
| | | .datepicker table tr td.selected.disabled.active, |
| | | .datepicker table tr td.selected.disabled:hover.active, |
| | | .datepicker table tr td.selected.disabled, |
| | | .datepicker table tr td.selected:hover.disabled, |
| | | .datepicker table tr td.selected.disabled.disabled, |
| | | .datepicker table tr td.selected.disabled:hover.disabled, |
| | | .datepicker table tr td.selected[disabled], |
| | | .datepicker table tr td.selected:hover[disabled], |
| | | .datepicker table tr td.selected.disabled[disabled], |
| | | .datepicker table tr td.selected.disabled:hover[disabled] { |
| | | background-color: #808080; |
| | | } |
| | | .datepicker table tr td.selected:active, |
| | | .datepicker table tr td.selected:hover:active, |
| | | .datepicker table tr td.selected.disabled:active, |
| | | .datepicker table tr td.selected.disabled:hover:active, |
| | | .datepicker table tr td.selected.active, |
| | | .datepicker table tr td.selected:hover.active, |
| | | .datepicker table tr td.selected.disabled.active, |
| | | .datepicker table tr td.selected.disabled:hover.active { |
| | | background-color: #666666 \9; |
| | | } |
| | | .datepicker table tr td.active, |
| | | .datepicker table tr td.active:hover, |
| | | .datepicker table tr td.active.disabled, |
| | | .datepicker table tr td.active.disabled:hover { |
| | | background-color: #006dcc; |
| | | background-image: -moz-linear-gradient(top, #0088cc, #0044cc); |
| | | background-image: -ms-linear-gradient(top, #0088cc, #0044cc); |
| | | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); |
| | | background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); |
| | | background-image: -o-linear-gradient(top, #0088cc, #0044cc); |
| | | background-image: linear-gradient(top, #0088cc, #0044cc); |
| | | background-repeat: repeat-x; |
| | | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); |
| | | border-color: #0044cc #0044cc #002a80; |
| | | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); |
| | | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); |
| | | color: #fff; |
| | | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); |
| | | } |
| | | .datepicker table tr td.active:hover, |
| | | .datepicker table tr td.active:hover:hover, |
| | | .datepicker table tr td.active.disabled:hover, |
| | | .datepicker table tr td.active.disabled:hover:hover, |
| | | .datepicker table tr td.active:active, |
| | | .datepicker table tr td.active:hover:active, |
| | | .datepicker table tr td.active.disabled:active, |
| | | .datepicker table tr td.active.disabled:hover:active, |
| | | .datepicker table tr td.active.active, |
| | | .datepicker table tr td.active:hover.active, |
| | | .datepicker table tr td.active.disabled.active, |
| | | .datepicker table tr td.active.disabled:hover.active, |
| | | .datepicker table tr td.active.disabled, |
| | | .datepicker table tr td.active:hover.disabled, |
| | | .datepicker table tr td.active.disabled.disabled, |
| | | .datepicker table tr td.active.disabled:hover.disabled, |
| | | .datepicker table tr td.active[disabled], |
| | | .datepicker table tr td.active:hover[disabled], |
| | | .datepicker table tr td.active.disabled[disabled], |
| | | .datepicker table tr td.active.disabled:hover[disabled] { |
| | | background-color: #0044cc; |
| | | } |
| | | .datepicker table tr td.active:active, |
| | | .datepicker table tr td.active:hover:active, |
| | | .datepicker table tr td.active.disabled:active, |
| | | .datepicker table tr td.active.disabled:hover:active, |
| | | .datepicker table tr td.active.active, |
| | | .datepicker table tr td.active:hover.active, |
| | | .datepicker table tr td.active.disabled.active, |
| | | .datepicker table tr td.active.disabled:hover.active { |
| | | background-color: #003399 \9; |
| | | } |
| | | .datepicker table tr td span { |
| | | display: block; |
| | | width: 23%; |
| | | height: 54px; |
| | | line-height: 54px; |
| | | float: left; |
| | | margin: 1%; |
| | | cursor: pointer; |
| | | -webkit-border-radius: 4px; |
| | | -moz-border-radius: 4px; |
| | | border-radius: 4px; |
| | | } |
| | | .datepicker table tr td span:hover { |
| | | background: #eeeeee; |
| | | } |
| | | .datepicker table tr td span.disabled, |
| | | .datepicker table tr td span.disabled:hover { |
| | | background: none; |
| | | color: #999999; |
| | | cursor: default; |
| | | } |
| | | .datepicker table tr td span.active, |
| | | .datepicker table tr td span.active:hover, |
| | | .datepicker table tr td span.active.disabled, |
| | | .datepicker table tr td span.active.disabled:hover { |
| | | background-color: #006dcc; |
| | | background-image: -moz-linear-gradient(top, #0088cc, #0044cc); |
| | | background-image: -ms-linear-gradient(top, #0088cc, #0044cc); |
| | | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); |
| | | background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); |
| | | background-image: -o-linear-gradient(top, #0088cc, #0044cc); |
| | | background-image: linear-gradient(top, #0088cc, #0044cc); |
| | | background-repeat: repeat-x; |
| | | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); |
| | | border-color: #0044cc #0044cc #002a80; |
| | | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); |
| | | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); |
| | | color: #fff; |
| | | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); |
| | | } |
| | | .datepicker table tr td span.active:hover, |
| | | .datepicker table tr td span.active:hover:hover, |
| | | .datepicker table tr td span.active.disabled:hover, |
| | | .datepicker table tr td span.active.disabled:hover:hover, |
| | | .datepicker table tr td span.active:active, |
| | | .datepicker table tr td span.active:hover:active, |
| | | .datepicker table tr td span.active.disabled:active, |
| | | .datepicker table tr td span.active.disabled:hover:active, |
| | | .datepicker table tr td span.active.active, |
| | | .datepicker table tr td span.active:hover.active, |
| | | .datepicker table tr td span.active.disabled.active, |
| | | .datepicker table tr td span.active.disabled:hover.active, |
| | | .datepicker table tr td span.active.disabled, |
| | | .datepicker table tr td span.active:hover.disabled, |
| | | .datepicker table tr td span.active.disabled.disabled, |
| | | .datepicker table tr td span.active.disabled:hover.disabled, |
| | | .datepicker table tr td span.active[disabled], |
| | | .datepicker table tr td span.active:hover[disabled], |
| | | .datepicker table tr td span.active.disabled[disabled], |
| | | .datepicker table tr td span.active.disabled:hover[disabled] { |
| | | background-color: #0044cc; |
| | | } |
| | | .datepicker table tr td span.active:active, |
| | | .datepicker table tr td span.active:hover:active, |
| | | .datepicker table tr td span.active.disabled:active, |
| | | .datepicker table tr td span.active.disabled:hover:active, |
| | | .datepicker table tr td span.active.active, |
| | | .datepicker table tr td span.active:hover.active, |
| | | .datepicker table tr td span.active.disabled.active, |
| | | .datepicker table tr td span.active.disabled:hover.active { |
| | | background-color: #003399 \9; |
| | | } |
| | | .datepicker table tr td span.old, |
| | | .datepicker table tr td span.new { |
| | | color: #999999; |
| | | } |
| | | .datepicker th.datepicker-switch { |
| | | width: 145px; |
| | | } |
| | | .datepicker thead tr:first-child th, |
| | | .datepicker tfoot tr th { |
| | | cursor: pointer; |
| | | } |
| | | .datepicker thead tr:first-child th:hover, |
| | | .datepicker tfoot tr th:hover { |
| | | background: #eeeeee; |
| | | } |
| | | .datepicker .cw { |
| | | font-size: 10px; |
| | | width: 12px; |
| | | padding: 0 2px 0 5px; |
| | | vertical-align: middle; |
| | | } |
| | | .datepicker thead tr:first-child th.cw { |
| | | cursor: default; |
| | | background-color: transparent; |
| | | } |
| | | .input-append.date .add-on i, |
| | | .input-prepend.date .add-on i { |
| | | display: block; |
| | | cursor: pointer; |
| | | width: 16px; |
| | | height: 16px; |
| | | } |
| | | .input-daterange input { |
| | | text-align: center; |
| | | } |
| | | .input-daterange input:first-child { |
| | | -webkit-border-radius: 3px 0 0 3px; |
| | | -moz-border-radius: 3px 0 0 3px; |
| | | border-radius: 3px 0 0 3px; |
| | | } |
| | | .input-daterange input:last-child { |
| | | -webkit-border-radius: 0 3px 3px 0; |
| | | -moz-border-radius: 0 3px 3px 0; |
| | | border-radius: 0 3px 3px 0; |
| | | } |
| | | .input-daterange .add-on { |
| | | display: inline-block; |
| | | width: auto; |
| | | min-width: 16px; |
| | | height: 18px; |
| | | padding: 4px 5px; |
| | | font-weight: normal; |
| | | line-height: 18px; |
| | | text-align: center; |
| | | text-shadow: 0 1px 0 #ffffff; |
| | | vertical-align: middle; |
| | | background-color: #eeeeee; |
| | | border: 1px solid #ccc; |
| | | margin-left: -5px; |
| | | margin-right: -5px; |
| | | } |
New file |
| | |
| | | /*! X-editable - v1.5.3 |
| | | * In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery |
| | | * http://github.com/vitalets/x-editable |
| | | * Copyright (c) 2019 Vitaliy Potapov; Licensed MIT */ |
| | | !function(a){"use strict";var b=function(b,c){this.options=a.extend({},a.fn.editableform.defaults,c),this.$div=a(b),this.options.scope||(this.options.scope=this)};b.prototype={constructor:b,initInput:function(){this.input=this.options.input,this.value=this.input.str2value(this.options.value),this.input.prerender()},initTemplate:function(){this.$form=a(a.fn.editableform.template)},initButtons:function(){var b=this.$form.find(".editable-buttons");b.append(a.fn.editableform.buttons),"bottom"===this.options.showbuttons&&b.addClass("editable-buttons-bottom")},render:function(){this.$loading=a(a.fn.editableform.loading),this.$div.empty().append(this.$loading),this.initTemplate(),this.options.showbuttons?this.initButtons():this.$form.find(".editable-buttons").remove(),this.showLoading(),this.isSaving=!1,this.$div.triggerHandler("rendering"),this.initInput(),this.$form.find("div.editable-input").append(this.input.$tpl),this.$div.append(this.$form),a.when(this.input.render()).then(a.proxy(function(){if(this.options.showbuttons||this.input.autosubmit(),this.$form.find(".editable-cancel").click(a.proxy(this.cancel,this)),this.input.error)this.error(this.input.error),this.$form.find(".editable-submit").attr("disabled",!0),this.input.$input.attr("disabled",!0),this.$form.submit(function(a){a.preventDefault()});else{this.error(!1),this.input.$input.removeAttr("disabled"),this.$form.find(".editable-submit").removeAttr("disabled");var b=null===this.value||void 0===this.value||""===this.value?this.options.defaultValue:this.value;this.input.value2input(b),this.$form.submit(a.proxy(this.submit,this))}this.$div.triggerHandler("rendered"),this.showForm(),this.input.postrender&&this.input.postrender()},this))},cancel:function(){this.$div.triggerHandler("cancel")},showLoading:function(){var a,b;this.$form?(a=this.$form.outerWidth(),b=this.$form.outerHeight(),a&&this.$loading.width(a),b&&this.$loading.height(b),this.$form.hide()):(a=this.$loading.parent().width(),a&&this.$loading.width(a)),this.$loading.show()},showForm:function(a){this.$loading.hide(),this.$form.show(),a!==!1&&this.input.activate(),this.$div.triggerHandler("show")},error:function(b){var c,d=this.$form.find(".control-group"),e=this.$form.find(".editable-error-block");if(b===!1)d.removeClass(a.fn.editableform.errorGroupClass),e.removeClass(a.fn.editableform.errorBlockClass).empty().hide();else{if(b){c=(""+b).split("\n");for(var f=0;f<c.length;f++)c[f]=a("<div>").text(c[f]).html();b=c.join("<br>")}d.addClass(a.fn.editableform.errorGroupClass),e.addClass(a.fn.editableform.errorBlockClass).html(b).show()}},submit:function(b){b.stopPropagation(),b.preventDefault();var c=this.input.input2value(),d=this.validate(c);if("object"===a.type(d)&&void 0!==d.newValue){if(c=d.newValue,this.input.value2input(c),"string"==typeof d.msg)return this.error(d.msg),void this.showForm()}else if(d)return this.error(d),void this.showForm();if(!this.options.savenochange&&this.input.value2str(c)===this.input.value2str(this.value))return void this.$div.triggerHandler("nochange");var e=this.input.value2submit(c);this.isSaving=!0,a.when(this.save(e)).done(a.proxy(function(a){this.isSaving=!1;var b="function"==typeof this.options.success?this.options.success.call(this.options.scope,a,c):null;return b===!1?(this.error(!1),void this.showForm(!1)):"string"==typeof b?(this.error(b),void this.showForm()):(b&&"object"==typeof b&&b.hasOwnProperty("newValue")&&(c=b.newValue),this.error(!1),this.value=c,void this.$div.triggerHandler("save",{newValue:c,submitValue:e,response:a}))},this)).fail(a.proxy(function(a){this.isSaving=!1;var b;b="function"==typeof this.options.error?this.options.error.call(this.options.scope,a,c):"string"==typeof a?a:a.responseText||a.statusText||"Unknown error!",this.error(b),this.showForm()},this))},save:function(b){this.options.pk=a.fn.editableutils.tryParseJson(this.options.pk,!0);var c,d="function"==typeof this.options.pk?this.options.pk.call(this.options.scope):this.options.pk,e=!!("function"==typeof this.options.url||this.options.url&&("always"===this.options.send||"auto"===this.options.send&&null!==d&&void 0!==d));return e?(this.showLoading(),c={name:this.options.name||"",value:b,pk:d},"function"==typeof this.options.params?c=this.options.params.call(this.options.scope,c):(this.options.params=a.fn.editableutils.tryParseJson(this.options.params,!0),a.extend(c,this.options.params)),"function"==typeof this.options.url?this.options.url.call(this.options.scope,c):a.ajax(a.extend({url:this.options.url,data:c,type:"POST"},this.options.ajaxOptions))):void 0},validate:function(a){return void 0===a&&(a=this.value),"function"==typeof this.options.validate?this.options.validate.call(this.options.scope,a):void 0},option:function(a,b){a in this.options&&(this.options[a]=b),"value"===a&&this.setValue(b)},setValue:function(a,b){b?this.value=this.input.str2value(a):this.value=a,this.$form&&this.$form.is(":visible")&&this.input.value2input(this.value)}},a.fn.editableform=function(c){var d=arguments;return this.each(function(){var e=a(this),f=e.data("editableform"),g="object"==typeof c&&c;f||e.data("editableform",f=new b(this,g)),"string"==typeof c&&f[c].apply(f,Array.prototype.slice.call(d,1))})},a.fn.editableform.Constructor=b,a.fn.editableform.defaults={type:"text",url:null,params:null,name:null,pk:null,value:null,defaultValue:null,send:"auto",validate:null,success:null,error:null,ajaxOptions:null,showbuttons:!0,scope:null,savenochange:!1},a.fn.editableform.template='<form class="form-inline editableform"><div class="control-group"><div><div class="editable-input"></div><div class="editable-buttons"></div></div><div class="editable-error-block"></div></div></form>',a.fn.editableform.loading='<div class="editableform-loading"></div>',a.fn.editableform.buttons='<button type="submit" class="editable-submit">ok</button><button type="button" class="editable-cancel">cancel</button>',a.fn.editableform.errorGroupClass=null,a.fn.editableform.errorBlockClass="editable-error",a.fn.editableform.engine="jquery"}(window.jQuery),function(a){"use strict";a.fn.editableutils={inherit:function(a,b){var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a,a.superclass=b.prototype},setCursorPosition:function(a,b){if(a.setSelectionRange&&/text|search|password|tel|url/i.test(a.type))try{a.setSelectionRange(b,b)}catch(c){}else if(a.createTextRange){var d=a.createTextRange();d.collapse(!0),d.moveEnd("character",b),d.moveStart("character",b),d.select()}},tryParseJson:function(a,b){if("string"==typeof a&&a.length&&a.match(/^[\{\[].*[\}\]]$/))if(b)try{a=new Function("return "+a)()}catch(c){}finally{return a}else a=new Function("return "+a)();return a},sliceObj:function(b,c,d){var e,f,g={};if(!a.isArray(c)||!c.length)return g;for(var h=0;h<c.length;h++)e=c[h],b.hasOwnProperty(e)&&(g[e]=b[e]),d!==!0&&(f=e.toLowerCase(),b.hasOwnProperty(f)&&(g[e]=b[f]));return g},getConfigData:function(b){var c={};return a.each(b[0].dataset,function(a,b){("object"!=typeof b||b&&"object"==typeof b&&(b.constructor===Object||b.constructor===Array))&&(c[a]=b)}),c},objectKeys:function(a){if(Object.keys)return Object.keys(a);if(a!==Object(a))throw new TypeError("Object.keys called on a non-object");var b,c=[];for(b in a)Object.prototype.hasOwnProperty.call(a,b)&&c.push(b);return c},escape:function(b){return a("<div>").text(b).html()},itemsByValue:function(b,c,d){if(!c||null===b)return[];if("function"!=typeof d){var e=d||"value";d=function(a){return a[e]}}var f=a.isArray(b),g=[],h=this;return a.each(c,function(c,e){if(e.children)g=g.concat(h.itemsByValue(b,e.children,d));else if(f)a.grep(b,function(a){return a==(e&&"object"==typeof e?d(e):e)}).length&&g.push(e);else{var i=e&&"object"==typeof e?d(e):e;b==i&&g.push(e)}}),g},createInput:function(b){var c,d,e,f=b.type;return"date"===f&&("inline"===b.mode?a.fn.editabletypes.datefield?f="datefield":a.fn.editabletypes.dateuifield&&(f="dateuifield"):a.fn.editabletypes.date?f="date":a.fn.editabletypes.dateui&&(f="dateui"),"date"!==f||a.fn.editabletypes.date||(f="combodate")),"datetime"===f&&"inline"===b.mode&&(f="datetimefield"),"wysihtml5"!==f||a.fn.editabletypes[f]||(f="textarea"),"function"==typeof a.fn.editabletypes[f]?(c=a.fn.editabletypes[f],d=this.sliceObj(b,this.objectKeys(c.defaults)),e=new c(d)):(a.error("Unknown type: "+f),!1)},supportsTransitions:function(){var a=document.body||document.documentElement,b=a.style,c="transition",d=["Moz","Webkit","Khtml","O","ms"];if("string"==typeof b[c])return!0;c=c.charAt(0).toUpperCase()+c.substr(1);for(var e=0;e<d.length;e++)if("string"==typeof b[d[e]+c])return!0;return!1}}}(window.jQuery),function(a){"use strict";var b=function(a,b){this.init(a,b)},c=function(a,b){this.init(a,b)};b.prototype={containerName:null,containerDataName:null,innerCss:null,containerClass:"editable-container editable-popup",defaults:{},init:function(c,d){this.$element=a(c),this.options=a.extend({},a.fn.editableContainer.defaults,d),this.splitOptions(),this.formOptions.scope=this.$element[0],this.initContainer(),this.delayedHide=!1,this.$element.on("destroyed",a.proxy(function(){this.destroy()},this)),a(document).data("editable-handlers-attached")||(a(document).on("keyup.editable",function(b){27===b.which&&a(".editable-open").editableContainer("hide","cancel")}),a(document).on("click.editable",function(c){var d,e=a(c.target),f=[".editable-container",".ui-datepicker-header",".datepicker",".modal-backdrop",".bootstrap-wysihtml5-insert-image-modal",".bootstrap-wysihtml5-insert-link-modal"];if(!a(".select2-drop-mask").is(":visible")&&a.contains(document.documentElement,c.target)&&!e.is(document)){for(d=0;d<f.length;d++)if(e.is(f[d])||e.parents(f[d]).length)return;b.prototype.closeOthers(c.target)}}),a(document).data("editable-handlers-attached",!0))},splitOptions:function(){if(this.containerOptions={},this.formOptions={},!a.fn[this.containerName])throw new Error(this.containerName+" not found. Have you included corresponding js file?");for(var b in this.options)b in this.defaults?this.containerOptions[b]=this.options[b]:this.formOptions[b]=this.options[b]},tip:function(){return this.container()?this.container().$tip:null},container:function(){var a;return this.containerDataName&&(a=this.$element.data(this.containerDataName))?a:a=this.$element.data(this.containerName)},call:function(){this.$element[this.containerName].apply(this.$element,arguments)},initContainer:function(){this.call(this.containerOptions)},renderForm:function(){this.$form.editableform(this.formOptions).on({save:a.proxy(this.save,this),nochange:a.proxy(function(){this.hide("nochange")},this),cancel:a.proxy(function(){this.hide("cancel")},this),show:a.proxy(function(){this.delayedHide?(this.hide(this.delayedHide.reason),this.delayedHide=!1):this.setPosition()},this),rendering:a.proxy(this.setPosition,this),resize:a.proxy(this.setPosition,this),rendered:a.proxy(function(){this.$element.triggerHandler("shown",a(this.options.scope).data("editable"))},this)}).editableform("render")},show:function(b){this.$element.addClass("editable-open"),b!==!1&&this.closeOthers(this.$element[0]),this.innerShow(),this.tip().addClass(this.containerClass),this.$form,this.$form=a("<div>"),this.tip().is(this.innerCss)?this.tip().append(this.$form):this.tip().find(this.innerCss).append(this.$form),this.renderForm()},hide:function(a){if(this.tip()&&this.tip().is(":visible")&&this.$element.hasClass("editable-open")){if(this.$form.data("editableform").isSaving)return void(this.delayedHide={reason:a});this.delayedHide=!1,this.$element.removeClass("editable-open"),this.innerHide(),this.$element.triggerHandler("hidden",a||"manual")}},innerShow:function(){},innerHide:function(){},toggle:function(a){this.container()&&this.tip()&&this.tip().is(":visible")?this.hide():this.show(a)},setPosition:function(){},save:function(a,b){this.$element.triggerHandler("save",b),this.hide("save")},option:function(a,b){this.options[a]=b,a in this.containerOptions?(this.containerOptions[a]=b,this.setContainerOption(a,b)):(this.formOptions[a]=b,this.$form&&this.$form.editableform("option",a,b))},setContainerOption:function(a,b){this.call("option",a,b)},destroy:function(){this.hide(),this.innerDestroy(),this.$element.off("destroyed"),this.$element.removeData("editableContainer")},innerDestroy:function(){},closeOthers:function(b){a(".editable-open").each(function(c,d){if(d!==b&&!a(d).find(b).length){var e=a(d),f=e.data("editableContainer");f&&("cancel"===f.options.onblur?e.data("editableContainer").hide("onblur"):"submit"===f.options.onblur&&e.data("editableContainer").tip().find("form").submit())}})},activate:function(){this.tip&&this.tip().is(":visible")&&this.$form&&this.$form.data("editableform").input.activate()}},a.fn.editableContainer=function(d){var e=arguments;return this.each(function(){var f=a(this),g="editableContainer",h=f.data(g),i="object"==typeof d&&d,j="inline"===i.mode?c:b;h||f.data(g,h=new j(this,i)),"string"==typeof d&&h[d].apply(h,Array.prototype.slice.call(e,1))})},a.fn.editableContainer.Popup=b,a.fn.editableContainer.Inline=c,a.fn.editableContainer.defaults={value:null,placement:"top",autohide:!0,onblur:"cancel",anim:!1,mode:"popup"},jQuery.event.special.destroyed={remove:function(a){a.handler&&a.handler()}}}(window.jQuery),function(a){"use strict";a.extend(a.fn.editableContainer.Inline.prototype,a.fn.editableContainer.Popup.prototype,{containerName:"editableform",innerCss:".editable-inline",containerClass:"editable-container editable-inline",initContainer:function(){this.$tip=a("<span></span>"),this.options.anim||(this.options.anim=0)},splitOptions:function(){this.containerOptions={},this.formOptions=this.options},tip:function(){return this.$tip},innerShow:function(){this.$element.hide(),this.tip().insertAfter(this.$element).show()},innerHide:function(){this.$tip.hide(this.options.anim,a.proxy(function(){this.$element.show(),this.innerDestroy()},this))},innerDestroy:function(){this.tip()&&this.tip().empty().remove()}})}(window.jQuery),function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.editable.defaults,c,a.fn.editableutils.getConfigData(this.$element)),this.options.selector?this.initLive():this.init(),this.options.highlight&&!a.fn.editableutils.supportsTransitions()&&(this.options.highlight=!1)};b.prototype={constructor:b,init:function(){var b,c=!1;if(this.options.name=this.options.name||this.$element.attr("id"),this.options.scope=this.$element[0],this.input=a.fn.editableutils.createInput(this.options),this.input){switch(void 0===this.options.value||null===this.options.value?(this.value=this.input.html2value(a.trim(this.$element.html())),c=!0):(this.options.value=a.fn.editableutils.tryParseJson(this.options.value,!0),"string"==typeof this.options.value?this.value=this.input.str2value(this.options.value):this.value=this.options.value),this.$element.addClass("editable"),"textarea"===this.input.type&&this.$element.addClass("editable-pre-wrapped"),"manual"!==this.options.toggle?(this.$element.addClass("editable-click"),this.$element.on(this.options.toggle+".editable",a.proxy(function(a){if(this.options.disabled||a.preventDefault(),"mouseenter"===this.options.toggle)this.show();else{var b="click"!==this.options.toggle;this.toggle(b)}},this))):this.$element.attr("tabindex",-1),"function"==typeof this.options.display&&(this.options.autotext="always"),this.options.autotext){case"always":b=!0;break;case"auto":b=!a.trim(this.$element.text()).length&&null!==this.value&&void 0!==this.value&&!c;break;default:b=!1}a.when(b?this.render():!0).then(a.proxy(function(){this.options.disabled?this.disable():this.enable(),this.$element.triggerHandler("init",this)},this))}},initLive:function(){var b=this.options.selector;this.options.selector=!1,this.options.autotext="never",this.$element.on(this.options.toggle+".editable",b,a.proxy(function(c){var d=a(c.target).closest(b);d.data("editable")||(d.hasClass(this.options.emptyclass)&&d.empty(),d.editable(this.options).trigger(c))},this))},render:function(a){return this.options.display!==!1?this.input.value2htmlFinal?this.input.value2html(this.value,this.$element[0],this.options.display,a):"function"==typeof this.options.display?this.options.display.call(this.$element[0],this.value,a):this.input.value2html(this.value,this.$element[0]):void 0},enable:function(){this.options.disabled=!1,this.$element.removeClass("editable-disabled"),this.handleEmpty(this.isEmpty),"manual"!==this.options.toggle&&"-1"===this.$element.attr("tabindex")&&this.$element.removeAttr("tabindex")},disable:function(){this.options.disabled=!0,this.hide(),this.$element.addClass("editable-disabled"),this.handleEmpty(this.isEmpty),this.$element.attr("tabindex",-1)},toggleDisabled:function(){this.options.disabled?this.enable():this.disable()},option:function(b,c){return b&&"object"==typeof b?void a.each(b,a.proxy(function(b,c){this.option(a.trim(b),c)},this)):(this.options[b]=c,"disabled"===b?c?this.disable():this.enable():("value"===b&&this.setValue(c),this.container&&this.container.option(b,c),void(this.input.option&&this.input.option(b,c))))},handleEmpty:function(b){this.options.display!==!1&&(void 0!==b?this.isEmpty=b:"function"==typeof this.input.isEmpty?this.isEmpty=this.input.isEmpty(this.$element):this.isEmpty=""===a.trim(this.$element.html()),this.options.disabled?this.isEmpty&&(this.$element.empty(),this.options.emptyclass&&this.$element.removeClass(this.options.emptyclass)):this.isEmpty?(this.$element.html(this.options.emptytext),this.options.emptyclass&&this.$element.addClass(this.options.emptyclass)):this.options.emptyclass&&this.$element.removeClass(this.options.emptyclass))},show:function(b){if(!this.options.disabled){if(this.container){if(this.container.tip().is(":visible"))return}else{var c=a.extend({},this.options,{value:this.value,input:this.input});this.$element.editableContainer(c),this.$element.on("save.internal",a.proxy(this.save,this)),this.container=this.$element.data("editableContainer")}this.container.show(b)}},hide:function(){this.container&&this.container.hide()},toggle:function(a){this.container&&this.container.tip().is(":visible")?this.hide():this.show(a)},save:function(a,b){if(this.options.unsavedclass){var c=!1;c=c||"function"==typeof this.options.url,c=c||this.options.display===!1,c=c||void 0!==b.response,c=c||this.options.savenochange&&this.input.value2str(this.value)!==this.input.value2str(b.newValue),c?this.$element.removeClass(this.options.unsavedclass):this.$element.addClass(this.options.unsavedclass)}if(this.options.highlight){var d=this.$element,e=d.css("background-color");d.css("background-color",this.options.highlight),setTimeout(function(){"transparent"===e&&(e=""),d.css("background-color",e),d.addClass("editable-bg-transition"),setTimeout(function(){d.removeClass("editable-bg-transition")},1700)},10)}this.setValue(b.newValue,!1,b.response)},validate:function(){return"function"==typeof this.options.validate?this.options.validate.call(this,this.value):void 0},setValue:function(b,c,d){c?this.value=this.input.str2value(b):this.value=b,this.container&&this.container.option("value",this.value),a.when(this.render(d)).then(a.proxy(function(){this.handleEmpty()},this))},activate:function(){this.container&&this.container.activate()},destroy:function(){this.disable(),this.container&&this.container.destroy(),this.input.destroy(),"manual"!==this.options.toggle&&(this.$element.removeClass("editable-click"),this.$element.off(this.options.toggle+".editable")),this.$element.off("save.internal"),this.$element.removeClass("editable editable-open editable-disabled"),this.$element.removeData("editable")}},a.fn.editable=function(c){var d={},e=arguments,f="editable";switch(c){case"validate":return this.each(function(){var b,c=a(this),e=c.data(f);e&&(b=e.validate())&&(d[e.options.name]=b)}),d;case"getValue":return 2===arguments.length&&arguments[1]===!0?d=this.eq(0).data(f).value:this.each(function(){var b=a(this),c=b.data(f);c&&void 0!==c.value&&null!==c.value&&(d[c.options.name]=c.input.value2submit(c.value))}),d;case"submit":var g=arguments[1]||{},h=this,i=this.editable("validate");if(a.isEmptyObject(i)){var j={};if(1===h.length){var k=h.data("editable"),l={name:k.options.name||"",value:k.input.value2submit(k.value),pk:"function"==typeof k.options.pk?k.options.pk.call(k.options.scope):k.options.pk};"function"==typeof k.options.params?l=k.options.params.call(k.options.scope,l):(k.options.params=a.fn.editableutils.tryParseJson(k.options.params,!0),a.extend(l,k.options.params)),j={url:k.options.url,data:l,type:"POST"},g.success=g.success||k.options.success,g.error=g.error||k.options.error}else{var m=this.editable("getValue");j={url:g.url,data:m,type:"POST"}}j.success="function"==typeof g.success?function(a){g.success.call(h,a,g)}:a.noop,j.error="function"==typeof g.error?function(){g.error.apply(h,arguments)}:a.noop,g.ajaxOptions&&a.extend(j,g.ajaxOptions),g.data&&a.extend(j.data,g.data),a.ajax(j)}else"function"==typeof g.error&&g.error.call(h,i);return this}return this.each(function(){var d=a(this),g=d.data(f),h="object"==typeof c&&c;return h&&h.selector?void(g=new b(this,h)):(g||d.data(f,g=new b(this,h)),void("string"==typeof c&&g[c].apply(g,Array.prototype.slice.call(e,1))))})},a.fn.editable.defaults={type:"text",disabled:!1,toggle:"click",emptytext:"Empty",autotext:"auto",value:null,display:null,emptyclass:"editable-empty",unsavedclass:"editable-unsaved",selector:null,highlight:"#FFFF80"}}(window.jQuery),function(a){"use strict";a.fn.editabletypes={};var b=function(){};b.prototype={init:function(b,c,d){this.type=b,this.options=a.extend({},d,c)},prerender:function(){this.$tpl=a(this.options.tpl),this.$input=this.$tpl,this.$clear=null,this.error=null},render:function(){},value2html:function(b,c){a(c)[this.options.escape?"text":"html"](a.trim(b))},html2value:function(b){return a("<div>").html(b).text()},value2str:function(a){return String(a)},str2value:function(a){return a},value2submit:function(a){return a},value2input:function(a){this.$input.val(a)},input2value:function(){return this.$input.val()},activate:function(){this.$input.is(":visible")&&this.$input.focus()},clear:function(){this.$input.val(null)},escape:function(b){return a("<div>").text(b).html()},autosubmit:function(){},destroy:function(){},setClass:function(){this.options.inputclass&&this.$input.addClass(this.options.inputclass)},setAttr:function(a){void 0!==this.options[a]&&null!==this.options[a]&&this.$input.attr(a,this.options[a])},option:function(a,b){this.options[a]=b}},b.defaults={tpl:"",inputclass:null,escape:!0,scope:null,showbuttons:!0},a.extend(a.fn.editabletypes,{abstractinput:b})}(window.jQuery),function(a){"use strict";var b=function(a){};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{render:function(){var b=a.Deferred();return this.error=null,this.onSourceReady(function(){this.renderList(),b.resolve()},function(){this.error=this.options.sourceError,b.resolve()}),b.promise()},html2value:function(a){return null},value2html:function(b,c,d,e){var f=a.Deferred(),g=function(){"function"==typeof d?d.call(c,b,this.sourceData,e):this.value2htmlFinal(b,c),f.resolve()};return null===b?g.call(this):this.onSourceReady(g,function(){f.resolve()}),f.promise()},onSourceReady:function(b,c){var d;if(a.isFunction(this.options.source)?(d=this.options.source.call(this.options.scope),this.sourceData=null):d=this.options.source,this.options.sourceCache&&a.isArray(this.sourceData))return void b.call(this);try{d=a.fn.editableutils.tryParseJson(d,!1)}catch(e){return void c.call(this)}if("string"==typeof d){if(this.options.sourceCache){var f,g=d;if(a(document).data(g)||a(document).data(g,{}),f=a(document).data(g),f.loading===!1&&f.sourceData)return this.sourceData=f.sourceData,this.doPrepend(),void b.call(this);if(f.loading===!0)return f.callbacks.push(a.proxy(function(){this.sourceData=f.sourceData,this.doPrepend(),b.call(this)},this)),void f.err_callbacks.push(a.proxy(c,this));f.loading=!0,f.callbacks=[],f.err_callbacks=[]}var h=a.extend({url:d,type:"get",cache:!1,dataType:"json",success:a.proxy(function(d){f&&(f.loading=!1),this.sourceData=this.makeArray(d),a.isArray(this.sourceData)?(f&&(f.sourceData=this.sourceData,a.each(f.callbacks,function(){this.call()})),this.doPrepend(),b.call(this)):(c.call(this),f&&a.each(f.err_callbacks,function(){this.call()}))},this),error:a.proxy(function(){c.call(this),f&&(f.loading=!1,a.each(f.err_callbacks,function(){this.call()}))},this)},this.options.sourceOptions);a.ajax(h)}else this.sourceData=this.makeArray(d),a.isArray(this.sourceData)?(this.doPrepend(),b.call(this)):c.call(this)},doPrepend:function(){null!==this.options.prepend&&void 0!==this.options.prepend&&(a.isArray(this.prependData)||(a.isFunction(this.options.prepend)&&(this.options.prepend=this.options.prepend.call(this.options.scope)),this.options.prepend=a.fn.editableutils.tryParseJson(this.options.prepend,!0),"string"==typeof this.options.prepend&&(this.options.prepend={"":this.options.prepend}),this.prependData=this.makeArray(this.options.prepend)),a.isArray(this.prependData)&&a.isArray(this.sourceData)&&(this.sourceData=this.prependData.concat(this.sourceData)))},renderList:function(){},value2htmlFinal:function(a,b){},makeArray:function(b){var c,d,e,f,g=[];if(!b||"string"==typeof b)return null;if(a.isArray(b)){f=function(a,b){return d={value:a,text:b},c++>=2?!1:void 0};for(var h=0;h<b.length;h++)e=b[h],"object"==typeof e?(c=0,a.each(e,f),1===c?g.push(d):c>1&&(e.children&&(e.children=this.makeArray(e.children)),g.push(e))):g.push({value:e,text:e})}else a.each(b,function(a,b){g.push({value:a,text:b})});return g},option:function(a,b){this.options[a]=b,"source"===a&&(this.sourceData=null),"prepend"===a&&(this.prependData=null)}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{source:null,prepend:!1,sourceError:"Error when loading list",sourceCache:!0,sourceOptions:null}),a.fn.editabletypes.list=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("text",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{render:function(){this.renderClear(),this.setClass(),this.setAttr("placeholder")},activate:function(){this.$input.is(":visible")&&(this.$input.focus(),this.$input.is("input,textarea")&&!this.$input.is('[type="checkbox"],[type="range"]')&&a.fn.editableutils.setCursorPosition(this.$input.get(0),this.$input.val().length),this.toggleClear&&this.toggleClear())},renderClear:function(){this.options.clear&&(this.$clear=a('<span class="editable-clear-x"></span>'),this.$input.after(this.$clear).css("padding-right",24).keyup(a.proxy(function(b){if(!~a.inArray(b.keyCode,[40,38,9,13,27])){clearTimeout(this.t);var c=this;this.t=setTimeout(function(){c.toggleClear(b)},100)}},this)).parent().css("position","relative"),this.$clear.click(a.proxy(this.clear,this)))},postrender:function(){},toggleClear:function(a){if(this.$clear){var b=this.$input.val().length,c=this.$clear.is(":visible");b&&!c&&this.$clear.show(),!b&&c&&this.$clear.hide()}},clear:function(){this.$clear.hide(),this.$input.val("").focus()}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{tpl:'<input type="text">',placeholder:null,clear:!0}),a.fn.editabletypes.text=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("textarea",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{render:function(){this.setClass(),this.setAttr("placeholder"),this.setAttr("rows"),this.$input.keydown(function(b){b.ctrlKey&&13===b.which&&a(this).closest("form").submit()})},activate:function(){a.fn.editabletypes.text.prototype.activate.call(this)}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{tpl:"<textarea></textarea>",inputclass:"input-large",placeholder:null,rows:7}),a.fn.editabletypes.textarea=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("select",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.list),a.extend(b.prototype,{renderList:function(){this.$input.empty();var b=this.options.escape,c=function(d,e){var f;if(a.isArray(e))for(var g=0;g<e.length;g++)if(f={},e[g].children)f.label=e[g].text,d.append(c(a("<optgroup>",f),e[g].children));else{f.value=e[g].value,e[g].disabled&&(f.disabled=!0);var h=a("<option>",f);h[b?"text":"html"](e[g].text),d.append(h)}return d};c(this.$input,this.sourceData),this.setClass(),this.$input.on("keydown.editable",function(b){13===b.which&&a(this).closest("form").submit()})},value2htmlFinal:function(b,c){var d="",e=a.fn.editableutils.itemsByValue(b,this.sourceData);e.length&&(d=e[0].text),a.fn.editabletypes.abstractinput.prototype.value2html.call(this,d,c)},autosubmit:function(){this.$input.off("keydown.editable").on("change.editable",function(){a(this).closest("form").submit()})}}),b.defaults=a.extend({},a.fn.editabletypes.list.defaults,{tpl:"<select></select>"}),a.fn.editabletypes.select=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("checklist",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.list),a.extend(b.prototype,{renderList:function(){var b;if(this.$tpl.empty(),a.isArray(this.sourceData)){for(var c=0;c<this.sourceData.length;c++){b=a("<label>").append(a("<input>",{type:"checkbox",value:this.sourceData[c].value}));var d=a("<span>");d[this.options.escape?"text":"html"](" "+this.sourceData[c].text),b.append(d),a("<div>").append(b).appendTo(this.$tpl)}this.$input=this.$tpl.find('input[type="checkbox"]'),this.setClass()}},value2str:function(b){return a.isArray(b)?b.sort().join(a.trim(this.options.separator)):""},str2value:function(b){var c,d=null;return"string"==typeof b&&b.length?(c=new RegExp("\\s*"+a.trim(this.options.separator)+"\\s*"),d=b.split(c)):d=a.isArray(b)?b:[b],d},value2input:function(b){this.$input.prop("checked",!1),a.isArray(b)&&b.length&&this.$input.each(function(c,d){var e=a(d);a.each(b,function(a,b){e.val()==b&&e.prop("checked",!0)})})},input2value:function(){var b=[];return this.$input.filter(":checked").each(function(c,d){b.push(a(d).val())}),b},value2htmlFinal:function(b,c){var d=[],e=a.fn.editableutils.itemsByValue(b,this.sourceData),f=this.options.escape;e.length?(a.each(e,function(b,c){var e=f?a.fn.editableutils.escape(c.text):c.text;d.push(e)}),a(c).html(d.join("<br>"))):a(c).empty()},activate:function(){this.$input.first().focus()},autosubmit:function(){this.$input.on("keydown",function(b){13===b.which&&a(this).closest("form").submit()})}}),b.defaults=a.extend({},a.fn.editabletypes.list.defaults,{tpl:'<div class="editable-checklist"></div>',inputclass:null,separator:","}),a.fn.editabletypes.checklist=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("password",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.text),a.extend(b.prototype,{value2html:function(b,c){b?a(c).text("[hidden]"):a(c).empty()},html2value:function(a){return null}}),b.defaults=a.extend({},a.fn.editabletypes.text.defaults,{tpl:'<input type="password">'}),a.fn.editabletypes.password=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("email",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.text),b.defaults=a.extend({},a.fn.editabletypes.text.defaults,{tpl:'<input type="email">'}),a.fn.editabletypes.email=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("url",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.text),b.defaults=a.extend({},a.fn.editabletypes.text.defaults,{tpl:'<input type="url">'}),a.fn.editabletypes.url=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("tel",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.text),b.defaults=a.extend({},a.fn.editabletypes.text.defaults,{tpl:'<input type="tel">'}),a.fn.editabletypes.tel=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("number",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.text),a.extend(b.prototype,{render:function(){ |
| | | b.superclass.render.call(this),this.setAttr("min"),this.setAttr("max"),this.setAttr("step")},postrender:function(){this.$clear&&this.$clear.css({right:24})}}),b.defaults=a.extend({},a.fn.editabletypes.text.defaults,{tpl:'<input type="number">',inputclass:"input-mini",min:null,max:null,step:null}),a.fn.editabletypes.number=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("range",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.number),a.extend(b.prototype,{render:function(){this.$input=this.$tpl.filter("input"),this.setClass(),this.setAttr("min"),this.setAttr("max"),this.setAttr("step"),this.$input.on("input",function(){a(this).siblings("output").text(a(this).val())})},activate:function(){this.$input.focus()}}),b.defaults=a.extend({},a.fn.editabletypes.number.defaults,{tpl:'<input type="range"><output style="width: 30px; display: inline-block"></output>',inputclass:"input-medium"}),a.fn.editabletypes.range=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("time",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{render:function(){this.setClass()}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{tpl:'<input type="time">'}),a.fn.editabletypes.time=b}(window.jQuery),function(a){"use strict";var b=function(c){if(this.init("select2",c,b.defaults),c.select2=c.select2||{},this.sourceData=null,c.placeholder&&(c.select2.placeholder=c.placeholder),!c.select2.tags&&c.source){var d=c.source;a.isFunction(c.source)&&(d=c.source.call(c.scope)),"string"==typeof d?(c.select2.ajax=c.select2.ajax||{},c.select2.ajax.data||(c.select2.ajax.data=function(a){return{query:a}}),c.select2.ajax.results||(c.select2.ajax.results=function(a){return{results:a}}),c.select2.ajax.url=d):(this.sourceData=this.convertSource(d),c.select2.data=this.sourceData)}if(this.options.select2=a.extend({},b.defaults.select2,c.select2),this.isMultiple=this.options.select2.tags||this.options.select2.multiple,this.isRemote="ajax"in this.options.select2,this.idFunc=this.options.select2.id,"function"!=typeof this.idFunc){var e=this.idFunc||"id";this.idFunc=function(a){return a[e]}}this.formatSelection=this.options.select2.formatSelection,"function"!=typeof this.formatSelection&&(this.formatSelection=function(a){return a.text})};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{render:function(){this.setClass(),this.isRemote&&this.$input.on("select2-loaded",a.proxy(function(a){this.sourceData=a.items.results},this)),this.isMultiple&&this.$input.on("change",function(){a(this).closest("form").parent().triggerHandler("resize")})},value2html:function(c,d){var e,f="",g=this;this.options.select2.tags?e=c:this.sourceData&&(e=a.fn.editableutils.itemsByValue(c,this.sourceData,this.idFunc)),a.isArray(e)?(f=[],a.each(e,function(a,b){f.push(b&&"object"==typeof b?g.formatSelection(b):b)})):e&&(f=g.formatSelection(e)),f=a.isArray(f)?f.join(this.options.viewseparator):f,b.superclass.value2html.call(this,f,d)},html2value:function(a){return this.options.select2.tags?this.str2value(a,this.options.viewseparator):null},value2input:function(b){if(a.isArray(b)&&(b=b.join(this.getSeparator())),this.$input.data("select2")?this.$input.val(b).trigger("change",!0):(this.$input.val(b),this.$input.select2(this.options.select2)),this.isRemote&&!this.isMultiple&&!this.options.select2.initSelection){var c=this.options.select2.id,d=this.options.select2.formatSelection;if(!c&&!d){var e=a(this.options.scope);if(!e.data("editable").isEmpty){var f={id:b,text:e.text()};this.$input.select2("data",f)}}}},input2value:function(){return this.$input.select2("val")},str2value:function(b,c){if("string"!=typeof b||!this.isMultiple)return b;c=c||this.getSeparator();var d,e,f;if(null===b||b.length<1)return null;for(d=b.split(c),e=0,f=d.length;f>e;e+=1)d[e]=a.trim(d[e]);return d},autosubmit:function(){this.$input.on("change",function(b,c){c||a(this).closest("form").submit()})},getSeparator:function(){return this.options.select2.separator||a.fn.select2.defaults.separator},convertSource:function(b){if(a.isArray(b)&&b.length&&void 0!==b[0].value)for(var c=0;c<b.length;c++)void 0!==b[c].value&&(b[c].id=b[c].value,delete b[c].value);return b},destroy:function(){this.$input&&this.$input.data("select2")&&this.$input.select2("destroy")}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{tpl:'<input type="hidden">',select2:null,placeholder:null,source:null,viewseparator:", "}),a.fn.editabletypes.select2=b}(window.jQuery),function(a){var b=function(b,c){return this.$element=a(b),this.$element.is("input")?(this.options=a.extend({},a.fn.combodate.defaults,c,this.$element.data()),void this.init()):void a.error("Combodate should be applied to INPUT element")};b.prototype={constructor:b,init:function(){this.map={day:["D","date"],month:["M","month"],year:["Y","year"],hour:["[Hh]","hours"],minute:["m","minutes"],second:["s","seconds"],ampm:["[Aa]",""]},this.$widget=a('<span class="combodate"></span>').html(this.getTemplate()),this.initCombos(),this.datetime=null,this.$widget.on("change","select",a.proxy(function(b){this.$element.val(this.getValue()).change(),this.options.smartDays&&(a(b.target).is(".month")||a(b.target).is(".year"))&&this.fillCombo("day")},this)),this.$widget.find("select").css("width","auto"),this.$element.hide().after(this.$widget),this.setValue(this.$element.val()||this.options.value)},getTemplate:function(){var b=this.options.template,c=this.$element.prop("disabled"),d=this.options.customClass;return a.each(this.map,function(a,c){c=c[0];var d=new RegExp(c+"+"),e=c.length>1?c.substring(1,2):c;b=b.replace(d,"{"+e+"}")}),b=b.replace(/ /g," "),a.each(this.map,function(a,e){e=e[0];var f=e.length>1?e.substring(1,2):e;b=b.replace("{"+f+"}",'<select class="'+a+" "+d+'"'+(c?' disabled="disabled"':"")+"></select>")}),b},initCombos:function(){for(var a in this.map){var b=this.$widget.find("."+a);this["$"+a]=b.length?b:null,this.fillCombo(a)}},fillCombo:function(a){var b=this["$"+a];if(b){var c="fill"+a.charAt(0).toUpperCase()+a.slice(1),d=this[c](),e=b.val();b.empty();for(var f=0;f<d.length;f++)b.append('<option value="'+d[f][0]+'">'+d[f][1]+"</option>");b.val(e)}},fillCommon:function(a){var b,c=[];if("name"===this.options.firstItem){b=moment.localeData?moment.localeData()._relativeTime:moment.relativeTime||moment.langData()._relativeTime;var d="function"==typeof b[a]?b[a](1,!0,a,!1):b[a];d=d.split(" ").reverse()[0],c.push(["",d])}else"empty"===this.options.firstItem&&c.push(["",""]);return c},fillDay:function(){var a,b,c=this.fillCommon("d"),d=-1!==this.options.template.indexOf("DD"),e=31;if(this.options.smartDays&&this.$month&&this.$year){var f=parseInt(this.$month.val(),10),g=parseInt(this.$year.val(),10);isNaN(f)||isNaN(g)||(e=moment([g,f]).daysInMonth())}for(b=1;e>=b;b++)a=d?this.leadZero(b):b,c.push([b,a]);return c},fillMonth:function(){var a,b,c=this.fillCommon("M"),d=-1!==this.options.template.indexOf("MMMMMM"),e=-1!==this.options.template.indexOf("MMMMM"),f=-1!==this.options.template.indexOf("MMMM"),g=-1!==this.options.template.indexOf("MMM"),h=-1!==this.options.template.indexOf("MM");for(b=0;11>=b;b++)a=d?moment().date(1).month(b).format("MM - MMMM"):e?moment().date(1).month(b).format("MM - MMM"):f?moment().date(1).month(b).format("MMMM"):g?moment().date(1).month(b).format("MMM"):h?this.leadZero(b+1):b+1,c.push([b,a]);return c},fillYear:function(){var a,b,c=[],d=-1!==this.options.template.indexOf("YYYY");for(b=this.options.maxYear;b>=this.options.minYear;b--)a=d?b:(b+"").substring(2),c[this.options.yearDescending?"push":"unshift"]([b,a]);return c=this.fillCommon("y").concat(c)},fillHour:function(){var a,b,c=this.fillCommon("h"),d=-1!==this.options.template.indexOf("h"),e=(-1!==this.options.template.indexOf("H"),-1!==this.options.template.toLowerCase().indexOf("hh")),f=d?1:0,g=d?12:23;for(b=f;g>=b;b++)a=e?this.leadZero(b):b,c.push([b,a]);return c},fillMinute:function(){var a,b,c=this.fillCommon("m"),d=-1!==this.options.template.indexOf("mm");for(b=0;59>=b;b+=this.options.minuteStep)a=d?this.leadZero(b):b,c.push([b,a]);return c},fillSecond:function(){var a,b,c=this.fillCommon("s"),d=-1!==this.options.template.indexOf("ss");for(b=0;59>=b;b+=this.options.secondStep)a=d?this.leadZero(b):b,c.push([b,a]);return c},fillAmpm:function(){var a=-1!==this.options.template.indexOf("a"),b=(-1!==this.options.template.indexOf("A"),[["am",a?"am":"AM"],["pm",a?"pm":"PM"]]);return b},getValue:function(b){var c,d={},e=this,f=!1;return a.each(this.map,function(a,b){if("ampm"!==a){if(e["$"+a])d[a]=parseInt(e["$"+a].val(),10);else{var c;c=e.datetime?e.datetime[b[1]]():"day"===a?1:0,d[a]=c}return isNaN(d[a])?(f=!0,!1):void 0}}),f?"":(this.$ampm&&(12===d.hour?d.hour="am"===this.$ampm.val()?0:12:d.hour="am"===this.$ampm.val()?d.hour:d.hour+12),c=moment([d.year,d.month,d.day,d.hour,d.minute,d.second]),this.highlight(c),b=void 0===b?this.options.format:b,null===b?c.isValid()?c:null:c.isValid()?c.format(b):"")},setValue:function(b){function c(b,c){var d={};return b.children("option").each(function(b,e){var f,g=a(e).attr("value");""!==g&&(f=Math.abs(g-c),("undefined"==typeof d.distance||f<d.distance)&&(d={value:g,distance:f}))}),d.value}if(b){var d="string"==typeof b?moment(b,this.options.format,!0):moment(b),e=this,f={};d.isValid()?(a.each(this.map,function(a,b){"ampm"!==a&&(f[a]=d[b[1]]())}),this.$ampm&&(f.hour>=12?(f.ampm="pm",f.hour>12&&(f.hour-=12)):(f.ampm="am",0===f.hour&&(f.hour=12))),a.each(f,function(a,b){e["$"+a]&&("minute"===a&&e.options.minuteStep>1&&e.options.roundTime&&(b=c(e["$"+a],b)),"second"===a&&e.options.secondStep>1&&e.options.roundTime&&(b=c(e["$"+a],b)),e["$"+a].val(b))}),this.options.smartDays&&this.fillCombo("day"),this.$element.val(d.format(this.options.format)).change(),this.datetime=d):this.datetime=null}},highlight:function(a){a.isValid()?this.options.errorClass?this.$widget.removeClass(this.options.errorClass):this.$widget.find("select").css("border-color",this.borderColor):this.options.errorClass?this.$widget.addClass(this.options.errorClass):(this.borderColor||(this.borderColor=this.$widget.find("select").css("border-color")),this.$widget.find("select").css("border-color","red"))},leadZero:function(a){return 9>=a?"0"+a:a},destroy:function(){this.$widget.remove(),this.$element.removeData("combodate").show()}},a.fn.combodate=function(c){var d,e=Array.apply(null,arguments);return e.shift(),"getValue"===c&&this.length&&(d=this.eq(0).data("combodate"))?d.getValue.apply(d,e):this.each(function(){var d=a(this),f=d.data("combodate"),g="object"==typeof c&&c;f||d.data("combodate",f=new b(this,g)),"string"==typeof c&&"function"==typeof f[c]&&f[c].apply(f,e)})},a.fn.combodate.defaults={format:"DD-MM-YYYY HH:mm",template:"D / MMM / YYYY H : mm",value:null,minYear:1970,maxYear:(new Date).getFullYear(),yearDescending:!0,minuteStep:5,secondStep:1,firstItem:"empty",errorClass:null,customClass:"",roundTime:!0,smartDays:!1}}(window.jQuery),function(a){"use strict";var b=function(c){this.init("combodate",c,b.defaults),this.options.viewformat||(this.options.viewformat=this.options.format),c.combodate=a.fn.editableutils.tryParseJson(c.combodate,!0),this.options.combodate=a.extend({},b.defaults.combodate,c.combodate,{format:this.options.format,template:this.options.template})};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{render:function(){this.$input.combodate(this.options.combodate),"bs3"===a.fn.editableform.engine&&this.$input.siblings().find("select").addClass("form-control"),this.options.inputclass&&this.$input.siblings().find("select").addClass(this.options.inputclass)},value2html:function(a,c){var d=a?a.format(this.options.viewformat):"";b.superclass.value2html.call(this,d,c)},html2value:function(a){return a?moment(a,this.options.viewformat):null},value2str:function(a){return a?a.format(this.options.format):""},str2value:function(a){return a?moment(a,this.options.format):null},value2submit:function(a){return this.value2str(a)},value2input:function(a){this.$input.combodate("setValue",a)},input2value:function(){return this.$input.combodate("getValue",null)},activate:function(){this.$input.siblings(".combodate").find("select").eq(0).focus()},autosubmit:function(){}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{tpl:'<input type="text">',inputclass:null,format:"YYYY-MM-DD",viewformat:null,template:"D / MMM / YYYY",combodate:null}),a.fn.editabletypes.combodate=b}(window.jQuery),function(a){"use strict";var b=a.fn.editableform.Constructor.prototype.initInput;a.extend(a.fn.editableform.Constructor.prototype,{initTemplate:function(){this.$form=a(a.fn.editableform.template),this.$form.find(".control-group").addClass("form-group"),this.$form.find(".editable-error-block").addClass("help-block")},initInput:function(){b.apply(this);var c=null===this.input.options.inputclass||this.input.options.inputclass===!1,d="input-sm",e="text,select,textarea,password,email,url,tel,number,range,time,typeaheadjs".split(",");~a.inArray(this.input.type,e)&&(this.input.$input.addClass("form-control"),c&&(this.input.options.inputclass=d,this.input.$input.addClass(d)));for(var f=this.$form.find(".editable-buttons"),g=c?[d]:this.input.options.inputclass.split(" "),h=0;h<g.length;h++)"input-lg"===g[h].toLowerCase()&&f.find("button").removeClass("btn-sm").addClass("btn-lg")}}),a.fn.editableform.buttons='<button type="submit" class="btn btn-primary btn-sm editable-submit"><i class="glyphicon glyphicon-ok"></i></button><button type="button" class="btn btn-default btn-sm editable-cancel"><i class="glyphicon glyphicon-remove"></i></button>',a.fn.editableform.errorGroupClass="has-error",a.fn.editableform.errorBlockClass=null,a.fn.editableform.engine="bs3"}(window.jQuery),function(a){"use strict";a.extend(a.fn.editableContainer.Popup.prototype,{containerName:"popover",containerDataName:"bs.popover",innerCss:".popover-content",defaults:a.fn.popover.Constructor.DEFAULTS,initContainer:function(){a.extend(this.containerOptions,{trigger:"manual",selector:!1,content:" ",template:this.defaults.template});var b;this.$element.data("template")&&(b=this.$element.data("template"),this.$element.removeData("template")),this.call(this.containerOptions),b&&this.$element.data("template",b)},innerShow:function(){this.call("show")},innerHide:function(){this.call("hide")},innerDestroy:function(){this.call("destroy")},setContainerOption:function(a,b){this.container().options[a]=b},setPosition:function(){(function(){var a=this.tip(),b="function"==typeof this.options.placement?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,c=/\s?auto?\s?/i,d=c.test(b);d&&(b=b.replace(c,"")||"top");var e=this.getPosition(),f=a[0].offsetWidth,g=a[0].offsetHeight;if(d){var h=this.$element.parent(),i=b,j=document.documentElement.scrollTop||document.body.scrollTop,k="body"==this.options.container?window.innerWidth:h.outerWidth(),l="body"==this.options.container?window.innerHeight:h.outerHeight(),m="body"==this.options.container?0:h.offset().left;b="bottom"==b&&e.top+e.height+g-j>l?"top":"top"==b&&e.top-j-g<0?"bottom":"right"==b&&e.right+f>k?"left":"left"==b&&e.left-f<m?"right":b,a.removeClass(i).addClass(b)}var n=this.getCalculatedOffset(b,e,f,g);this.applyPlacement(n,b)}).call(this.container())}})}(window.jQuery),function(a){function b(){return new Date(Date.UTC.apply(Date,arguments))}function c(b,c){var d,e=a(b).data(),f={},g=new RegExp("^"+c.toLowerCase()+"([A-Z])"),c=new RegExp("^"+c.toLowerCase());for(var h in e)c.test(h)&&(d=h.replace(g,function(a,b){return b.toLowerCase()}),f[d]=e[h]);return f}function d(b){var c={};if(k[b]||(b=b.split("-")[0],k[b])){var d=k[b];return a.each(j,function(a,b){b in d&&(c[b]=d[b])}),c}}var e=function(b,c){this._process_options(c),this.element=a(b),this.isInline=!1,this.isInput=this.element.is("input"),this.component=this.element.is(".date")?this.element.find(".add-on, .btn"):!1,this.hasInput=this.component&&this.element.find("input").length,this.component&&0===this.component.length&&(this.component=!1),this.picker=a(l.template),this._buildEvents(),this._attachEvents(),this.isInline?this.picker.addClass("datepicker-inline").appendTo(this.element):this.picker.addClass("datepicker-dropdown dropdown-menu"),this.o.rtl&&(this.picker.addClass("datepicker-rtl"),this.picker.find(".prev i, .next i").toggleClass("icon-arrow-left icon-arrow-right")),this.viewMode=this.o.startView,this.o.calendarWeeks&&this.picker.find("tfoot th.today").attr("colspan",function(a,b){return parseInt(b)+1}),this._allow_update=!1,this.setStartDate(this.o.startDate),this.setEndDate(this.o.endDate),this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled),this.fillDow(),this.fillMonths(),this._allow_update=!0,this.update(),this.showMode(),this.isInline&&this.show()};e.prototype={constructor:e,_process_options:function(b){this._o=a.extend({},this._o,b);var c=this.o=a.extend({},this._o),d=c.language;switch(k[d]||(d=d.split("-")[0],k[d]||(d=i.language)),c.language=d,c.startView){case 2:case"decade":c.startView=2;break;case 1:case"year":c.startView=1;break;default:c.startView=0}switch(c.minViewMode){case 1:case"months":c.minViewMode=1;break;case 2:case"years":c.minViewMode=2;break;default:c.minViewMode=0}c.startView=Math.max(c.startView,c.minViewMode),c.weekStart%=7,c.weekEnd=(c.weekStart+6)%7;var e=l.parseFormat(c.format);c.startDate!==-(1/0)&&(c.startDate=l.parseDate(c.startDate,e,c.language)),c.endDate!==1/0&&(c.endDate=l.parseDate(c.endDate,e,c.language)),c.daysOfWeekDisabled=c.daysOfWeekDisabled||[],a.isArray(c.daysOfWeekDisabled)||(c.daysOfWeekDisabled=c.daysOfWeekDisabled.split(/[,\s]*/)),c.daysOfWeekDisabled=a.map(c.daysOfWeekDisabled,function(a){return parseInt(a,10)})},_events:[],_secondaryEvents:[],_applyEvents:function(a){for(var b,c,d=0;d<a.length;d++)b=a[d][0],c=a[d][1],b.on(c)},_unapplyEvents:function(a){for(var b,c,d=0;d<a.length;d++)b=a[d][0],c=a[d][1],b.off(c)},_buildEvents:function(){this.isInput?this._events=[[this.element,{focus:a.proxy(this.show,this),keyup:a.proxy(this.update,this),keydown:a.proxy(this.keydown,this)}]]:this.component&&this.hasInput?this._events=[[this.element.find("input"),{focus:a.proxy(this.show,this),keyup:a.proxy(this.update,this),keydown:a.proxy(this.keydown,this)}],[this.component,{click:a.proxy(this.show,this)}]]:this.element.is("div")?this.isInline=!0:this._events=[[this.element,{click:a.proxy(this.show,this)}]],this._secondaryEvents=[[this.picker,{click:a.proxy(this.click,this)}],[a(window),{resize:a.proxy(this.place,this)}],[a(document),{mousedown:a.proxy(function(a){this.element.is(a.target)||this.element.find(a.target).size()||this.picker.is(a.target)||this.picker.find(a.target).size()||this.hide()},this)}]]},_attachEvents:function(){this._detachEvents(),this._applyEvents(this._events)},_detachEvents:function(){this._unapplyEvents(this._events)},_attachSecondaryEvents:function(){this._detachSecondaryEvents(),this._applyEvents(this._secondaryEvents)},_detachSecondaryEvents:function(){this._unapplyEvents(this._secondaryEvents)},_trigger:function(b,c){var d=c||this.date,e=new Date(d.getTime()+6e4*d.getTimezoneOffset());this.element.trigger({type:b,date:e,format:a.proxy(function(a){var b=a||this.o.format;return l.formatDate(d,b,this.o.language)},this)})},show:function(a){this.isInline||this.picker.appendTo("body"),this.picker.show(),this.height=this.component?this.component.outerHeight():this.element.outerHeight(),this.place(),this._attachSecondaryEvents(),a&&a.preventDefault(),this._trigger("show")},hide:function(a){this.isInline||this.picker.is(":visible")&&(this.picker.hide().detach(),this._detachSecondaryEvents(),this.viewMode=this.o.startView,this.showMode(),this.o.forceParse&&(this.isInput&&this.element.val()||this.hasInput&&this.element.find("input").val())&&this.setValue(),this._trigger("hide"))},remove:function(){this.hide(),this._detachEvents(),this._detachSecondaryEvents(),this.picker.remove(),delete this.element.data().datepicker,this.isInput||delete this.element.data().date},getDate:function(){var a=this.getUTCDate();return new Date(a.getTime()+6e4*a.getTimezoneOffset())},getUTCDate:function(){return this.date},setDate:function(a){this.setUTCDate(new Date(a.getTime()-6e4*a.getTimezoneOffset()))},setUTCDate:function(a){this.date=a,this.setValue()},setValue:function(){var a=this.getFormattedDate();this.isInput?this.element.val(a):this.component&&this.element.find("input").val(a)},getFormattedDate:function(a){return void 0===a&&(a=this.o.format),l.formatDate(this.date,a,this.o.language)},setStartDate:function(a){this._process_options({startDate:a}),this.update(),this.updateNavArrows()},setEndDate:function(a){this._process_options({endDate:a}),this.update(),this.updateNavArrows()},setDaysOfWeekDisabled:function(a){this._process_options({daysOfWeekDisabled:a}),this.update(),this.updateNavArrows()},place:function(){if(!this.isInline){var b=parseInt(this.element.parents().filter(function(){return"auto"!=a(this).css("z-index")}).first().css("z-index"))+10,c=this.component?this.component.parent().offset():this.element.offset(),d=this.component?this.component.outerHeight(!0):this.element.outerHeight(!0);this.picker.css({top:c.top+d,left:c.left,zIndex:b})}},_allow_update:!0,update:function(){if(this._allow_update){var a,b=!1;arguments&&arguments.length&&("string"==typeof arguments[0]||arguments[0]instanceof Date)?(a=arguments[0],b=!0):(a=this.isInput?this.element.val():this.element.data("date")||this.element.find("input").val(),delete this.element.data().date),this.date=l.parseDate(a,this.o.format,this.o.language),b&&this.setValue(),this.date<this.o.startDate?this.viewDate=new Date(this.o.startDate):this.date>this.o.endDate?this.viewDate=new Date(this.o.endDate):this.viewDate=new Date(this.date),this.fill()}},fillDow:function(){var a=this.o.weekStart,b="<tr>";if(this.o.calendarWeeks){var c='<th class="cw"> </th>';b+=c,this.picker.find(".datepicker-days thead tr:first-child").prepend(c)}for(;a<this.o.weekStart+7;)b+='<th class="dow">'+k[this.o.language].daysMin[a++%7]+"</th>";b+="</tr>",this.picker.find(".datepicker-days thead").append(b)},fillMonths:function(){for(var a="",b=0;12>b;)a+='<span class="month">'+k[this.o.language].monthsShort[b++]+"</span>";this.picker.find(".datepicker-months td").html(a)},setRange:function(b){b&&b.length?this.range=a.map(b,function(a){return a.valueOf()}):delete this.range,this.fill()},getClassNames:function(b){var c=[],d=this.viewDate.getUTCFullYear(),e=this.viewDate.getUTCMonth(),f=this.date.valueOf(),g=new Date;return b.getUTCFullYear()<d||b.getUTCFullYear()==d&&b.getUTCMonth()<e?c.push("old"):(b.getUTCFullYear()>d||b.getUTCFullYear()==d&&b.getUTCMonth()>e)&&c.push("new"),this.o.todayHighlight&&b.getUTCFullYear()==g.getFullYear()&&b.getUTCMonth()==g.getMonth()&&b.getUTCDate()==g.getDate()&&c.push("today"),f&&b.valueOf()==f&&c.push("active"),(b.valueOf()<this.o.startDate||b.valueOf()>this.o.endDate||-1!==a.inArray(b.getUTCDay(),this.o.daysOfWeekDisabled))&&c.push("disabled"),this.range&&(b>this.range[0]&&b<this.range[this.range.length-1]&&c.push("range"),-1!=a.inArray(b.valueOf(),this.range)&&c.push("selected")),c},fill:function(){var c,d=new Date(this.viewDate),e=d.getUTCFullYear(),f=d.getUTCMonth(),g=this.o.startDate!==-(1/0)?this.o.startDate.getUTCFullYear():-(1/0),h=this.o.startDate!==-(1/0)?this.o.startDate.getUTCMonth():-(1/0),i=this.o.endDate!==1/0?this.o.endDate.getUTCFullYear():1/0,j=this.o.endDate!==1/0?this.o.endDate.getUTCMonth():1/0;this.date&&this.date.valueOf();this.picker.find(".datepicker-days thead th.datepicker-switch").text(k[this.o.language].months[f]+" "+e),this.picker.find("tfoot th.today").text(k[this.o.language].today).toggle(this.o.todayBtn!==!1),this.picker.find("tfoot th.clear").text(k[this.o.language].clear).toggle(this.o.clearBtn!==!1),this.updateNavArrows(),this.fillMonths();var m=b(e,f-1,28,0,0,0,0),n=l.getDaysInMonth(m.getUTCFullYear(),m.getUTCMonth());m.setUTCDate(n),m.setUTCDate(n-(m.getUTCDay()-this.o.weekStart+7)%7);var o=new Date(m);o.setUTCDate(o.getUTCDate()+42),o=o.valueOf();for(var p,q=[];m.valueOf()<o;){if(m.getUTCDay()==this.o.weekStart&&(q.push("<tr>"),this.o.calendarWeeks)){var r=new Date(+m+(this.o.weekStart-m.getUTCDay()-7)%7*864e5),s=new Date(+r+(11-r.getUTCDay())%7*864e5),t=new Date(+(t=b(s.getUTCFullYear(),0,1))+(11-t.getUTCDay())%7*864e5),u=(s-t)/864e5/7+1;q.push('<td class="cw">'+u+"</td>")}p=this.getClassNames(m),p.push("day");var v=this.o.beforeShowDay(m);void 0===v?v={}:"boolean"==typeof v?v={enabled:v}:"string"==typeof v&&(v={classes:v}),v.enabled===!1&&p.push("disabled"),v.classes&&(p=p.concat(v.classes.split(/\s+/))),v.tooltip&&(c=v.tooltip),p=a.unique(p),q.push('<td class="'+p.join(" ")+'"'+(c?' title="'+c+'"':"")+">"+m.getUTCDate()+"</td>"),m.getUTCDay()==this.o.weekEnd&&q.push("</tr>"),m.setUTCDate(m.getUTCDate()+1)}this.picker.find(".datepicker-days tbody").empty().append(q.join(""));var w=this.date&&this.date.getUTCFullYear(),x=this.picker.find(".datepicker-months").find("th:eq(1)").text(e).end().find("span").removeClass("active");w&&w==e&&x.eq(this.date.getUTCMonth()).addClass("active"),(g>e||e>i)&&x.addClass("disabled"),e==g&&x.slice(0,h).addClass("disabled"),e==i&&x.slice(j+1).addClass("disabled"),q="",e=10*parseInt(e/10,10);var y=this.picker.find(".datepicker-years").find("th:eq(1)").text(e+"-"+(e+9)).end().find("td");e-=1;for(var z=-1;11>z;z++)q+='<span class="year'+(-1==z?" old":10==z?" new":"")+(w==e?" active":"")+(g>e||e>i?" disabled":"")+'">'+e+"</span>",e+=1;y.html(q)},updateNavArrows:function(){if(this._allow_update){var a=new Date(this.viewDate),b=a.getUTCFullYear(),c=a.getUTCMonth();switch(this.viewMode){case 0:this.o.startDate!==-(1/0)&&b<=this.o.startDate.getUTCFullYear()&&c<=this.o.startDate.getUTCMonth()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"}),this.o.endDate!==1/0&&b>=this.o.endDate.getUTCFullYear()&&c>=this.o.endDate.getUTCMonth()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"});break;case 1:case 2:this.o.startDate!==-(1/0)&&b<=this.o.startDate.getUTCFullYear()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"}),this.o.endDate!==1/0&&b>=this.o.endDate.getUTCFullYear()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"})}}},click:function(c){c.preventDefault();var d=a(c.target).closest("span, td, th");if(1==d.length)switch(d[0].nodeName.toLowerCase()){case"th":switch(d[0].className){case"datepicker-switch":this.showMode(1);break;case"prev":case"next":var e=l.modes[this.viewMode].navStep*("prev"==d[0].className?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveMonth(this.viewDate,e);break;case 1:case 2:this.viewDate=this.moveYear(this.viewDate,e)}this.fill();break;case"today":var f=new Date;f=b(f.getFullYear(),f.getMonth(),f.getDate(),0,0,0),this.showMode(-2);var g="linked"==this.o.todayBtn?null:"view";this._setDate(f,g);break;case"clear":var h;this.isInput?h=this.element:this.component&&(h=this.element.find("input")),h&&h.val("").change(),this._trigger("changeDate"),this.update(),this.o.autoclose&&this.hide()}break;case"span":if(!d.is(".disabled")){if(this.viewDate.setUTCDate(1),d.is(".month")){var i=1,j=d.parent().find("span").index(d),k=this.viewDate.getUTCFullYear();this.viewDate.setUTCMonth(j),this._trigger("changeMonth",this.viewDate),1===this.o.minViewMode&&this._setDate(b(k,j,i,0,0,0,0))}else{var k=parseInt(d.text(),10)||0,i=1,j=0;this.viewDate.setUTCFullYear(k),this._trigger("changeYear",this.viewDate),2===this.o.minViewMode&&this._setDate(b(k,j,i,0,0,0,0))}this.showMode(-1),this.fill()}break;case"td":if(d.is(".day")&&!d.is(".disabled")){var i=parseInt(d.text(),10)||1,k=this.viewDate.getUTCFullYear(),j=this.viewDate.getUTCMonth();d.is(".old")?0===j?(j=11,k-=1):j-=1:d.is(".new")&&(11==j?(j=0,k+=1):j+=1),this._setDate(b(k,j,i,0,0,0,0))}}},_setDate:function(a,b){b&&"date"!=b||(this.date=new Date(a)),b&&"view"!=b||(this.viewDate=new Date(a)),this.fill(),this.setValue(),this._trigger("changeDate");var c;this.isInput?c=this.element:this.component&&(c=this.element.find("input")),c&&(c.change(),!this.o.autoclose||b&&"date"!=b||this.hide())},moveMonth:function(a,b){if(!b)return a;var c,d,e=new Date(a.valueOf()),f=e.getUTCDate(),g=e.getUTCMonth(),h=Math.abs(b);if(b=b>0?1:-1,1==h)d=-1==b?function(){return e.getUTCMonth()==g}:function(){return e.getUTCMonth()!=c},c=g+b,e.setUTCMonth(c),(0>c||c>11)&&(c=(c+12)%12);else{for(var i=0;h>i;i++)e=this.moveMonth(e,b);c=e.getUTCMonth(),e.setUTCDate(f),d=function(){return c!=e.getUTCMonth()}}for(;d();)e.setUTCDate(--f),e.setUTCMonth(c);return e},moveYear:function(a,b){return this.moveMonth(a,12*b)},dateWithinRange:function(a){return a>=this.o.startDate&&a<=this.o.endDate},keydown:function(a){if(this.picker.is(":not(:visible)"))return void(27==a.keyCode&&this.show());var b,c,d,e=!1;switch(a.keyCode){case 27:this.hide(),a.preventDefault();break;case 37:case 39:if(!this.o.keyboardNavigation)break;b=37==a.keyCode?-1:1,a.ctrlKey?(c=this.moveYear(this.date,b),d=this.moveYear(this.viewDate,b)):a.shiftKey?(c=this.moveMonth(this.date,b),d=this.moveMonth(this.viewDate,b)):(c=new Date(this.date),c.setUTCDate(this.date.getUTCDate()+b),d=new Date(this.viewDate),d.setUTCDate(this.viewDate.getUTCDate()+b)),this.dateWithinRange(c)&&(this.date=c,this.viewDate=d,this.setValue(),this.update(),a.preventDefault(),e=!0);break;case 38:case 40:if(!this.o.keyboardNavigation)break;b=38==a.keyCode?-1:1,a.ctrlKey?(c=this.moveYear(this.date,b),d=this.moveYear(this.viewDate,b)):a.shiftKey?(c=this.moveMonth(this.date,b),d=this.moveMonth(this.viewDate,b)):(c=new Date(this.date),c.setUTCDate(this.date.getUTCDate()+7*b),d=new Date(this.viewDate),d.setUTCDate(this.viewDate.getUTCDate()+7*b)),this.dateWithinRange(c)&&(this.date=c,this.viewDate=d,this.setValue(),this.update(),a.preventDefault(),e=!0);break;case 13:this.hide(),a.preventDefault();break;case 9:this.hide()}if(e){this._trigger("changeDate");var f;this.isInput?f=this.element:this.component&&(f=this.element.find("input")),f&&f.change()}},showMode:function(a){a&&(this.viewMode=Math.max(this.o.minViewMode,Math.min(2,this.viewMode+a))),this.picker.find(">div").hide().filter(".datepicker-"+l.modes[this.viewMode].clsName).css("display","block"),this.updateNavArrows()}};var f=function(b,c){this.element=a(b),this.inputs=a.map(c.inputs,function(a){return a.jquery?a[0]:a}),delete c.inputs,a(this.inputs).datepicker(c).bind("changeDate",a.proxy(this.dateUpdated,this)),this.pickers=a.map(this.inputs,function(b){return a(b).data("datepicker")}),this.updateDates()};f.prototype={updateDates:function(){this.dates=a.map(this.pickers,function(a){return a.date}),this.updateRanges()},updateRanges:function(){var b=a.map(this.dates,function(a){return a.valueOf()});a.each(this.pickers,function(a,c){c.setRange(b)})},dateUpdated:function(b){var c=a(b.target).data("datepicker"),d=c.getUTCDate(),e=a.inArray(b.target,this.inputs),f=this.inputs.length;if(-1!=e){if(d<this.dates[e])for(;e>=0&&d<this.dates[e];)this.pickers[e--].setUTCDate(d);else if(d>this.dates[e])for(;f>e&&d>this.dates[e];)this.pickers[e++].setUTCDate(d);this.updateDates()}},remove:function(){a.map(this.pickers,function(a){a.remove()}),delete this.element.data().datepicker}};var g=a.fn.datepicker,h=a.fn.datepicker=function(b){var g=Array.apply(null,arguments);g.shift();var h;return this.each(function(){var j=a(this),k=j.data("datepicker"),l="object"==typeof b&&b;if(!k){var m=c(this,"date"),n=a.extend({},i,m,l),o=d(n.language),p=a.extend({},i,o,m,l);if(j.is(".input-daterange")||p.inputs){var q={inputs:p.inputs||j.find("input").toArray()};j.data("datepicker",k=new f(this,a.extend(p,q)))}else j.data("datepicker",k=new e(this,p))}return"string"==typeof b&&"function"==typeof k[b]&&(h=k[b].apply(k,g),void 0!==h)?!1:void 0; |
| | | }),void 0!==h?h:this},i=a.fn.datepicker.defaults={autoclose:!1,beforeShowDay:a.noop,calendarWeeks:!1,clearBtn:!1,daysOfWeekDisabled:[],endDate:1/0,forceParse:!0,format:"mm/dd/yyyy",keyboardNavigation:!0,language:"en",minViewMode:0,rtl:!1,startDate:-(1/0),startView:0,todayBtn:!1,todayHighlight:!1,weekStart:0},j=a.fn.datepicker.locale_opts=["format","rtl","weekStart"];a.fn.datepicker.Constructor=e;var k=a.fn.datepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today",clear:"Clear"}},l={modes:[{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(a){return a%4===0&&a%100!==0||a%400===0},getDaysInMonth:function(a,b){return[31,l.isLeapYear(a)?29:28,31,30,31,30,31,31,30,31,30,31][b]},validParts:/dd?|DD?|mm?|MM?|yy(?:yy)?/g,nonpunctuation:/[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,parseFormat:function(a){var b=a.replace(this.validParts,"\x00").split("\x00"),c=a.match(this.validParts);if(!b||!b.length||!c||0===c.length)throw new Error("Invalid date format.");return{separators:b,parts:c}},parseDate:function(c,d,f){if(c instanceof Date)return c;if("string"==typeof d&&(d=l.parseFormat(d)),/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(c)){var g,h,i=/([\-+]\d+)([dmwy])/,j=c.match(/([\-+]\d+)([dmwy])/g);c=new Date;for(var m=0;m<j.length;m++)switch(g=i.exec(j[m]),h=parseInt(g[1]),g[2]){case"d":c.setUTCDate(c.getUTCDate()+h);break;case"m":c=e.prototype.moveMonth.call(e.prototype,c,h);break;case"w":c.setUTCDate(c.getUTCDate()+7*h);break;case"y":c=e.prototype.moveYear.call(e.prototype,c,h)}return b(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate(),0,0,0)}var n,o,g,j=c&&c.match(this.nonpunctuation)||[],c=new Date,p={},q=["yyyy","yy","M","MM","m","mm","d","dd"],r={yyyy:function(a,b){return a.setUTCFullYear(b)},yy:function(a,b){return a.setUTCFullYear(2e3+b)},m:function(a,b){for(b-=1;0>b;)b+=12;for(b%=12,a.setUTCMonth(b);a.getUTCMonth()!=b;)a.setUTCDate(a.getUTCDate()-1);return a},d:function(a,b){return a.setUTCDate(b)}};r.M=r.MM=r.mm=r.m,r.dd=r.d,c=b(c.getFullYear(),c.getMonth(),c.getDate(),0,0,0);var s=d.parts.slice();if(j.length!=s.length&&(s=a(s).filter(function(b,c){return-1!==a.inArray(c,q)}).toArray()),j.length==s.length){for(var m=0,t=s.length;t>m;m++){if(n=parseInt(j[m],10),g=s[m],isNaN(n))switch(g){case"MM":o=a(k[f].months).filter(function(){var a=this.slice(0,j[m].length),b=j[m].slice(0,a.length);return a==b}),n=a.inArray(o[0],k[f].months)+1;break;case"M":o=a(k[f].monthsShort).filter(function(){var a=this.slice(0,j[m].length),b=j[m].slice(0,a.length);return a==b}),n=a.inArray(o[0],k[f].monthsShort)+1}p[g]=n}for(var u,m=0;m<q.length;m++)u=q[m],u in p&&!isNaN(p[u])&&r[u](c,p[u])}return c},formatDate:function(b,c,d){"string"==typeof c&&(c=l.parseFormat(c));var e={d:b.getUTCDate(),D:k[d].daysShort[b.getUTCDay()],DD:k[d].days[b.getUTCDay()],m:b.getUTCMonth()+1,M:k[d].monthsShort[b.getUTCMonth()],MM:k[d].months[b.getUTCMonth()],yy:b.getUTCFullYear().toString().substring(2),yyyy:b.getUTCFullYear()};e.dd=(e.d<10?"0":"")+e.d,e.mm=(e.m<10?"0":"")+e.m;for(var b=[],f=a.extend([],c.separators),g=0,h=c.parts.length;h>=g;g++)f.length&&b.push(f.shift()),b.push(e[c.parts[g]]);return b.join("")},headTemplate:'<thead><tr><th class="prev"><i class="icon-arrow-left"/></th><th colspan="5" class="datepicker-switch"></th><th class="next"><i class="icon-arrow-right"/></th></tr></thead>',contTemplate:'<tbody><tr><td colspan="7"></td></tr></tbody>',footTemplate:'<tfoot><tr><th colspan="7" class="today"></th></tr><tr><th colspan="7" class="clear"></th></tr></tfoot>'};l.template='<div class="datepicker"><div class="datepicker-days"><table class=" table-condensed">'+l.headTemplate+"<tbody></tbody>"+l.footTemplate+'</table></div><div class="datepicker-months"><table class="table-condensed">'+l.headTemplate+l.contTemplate+l.footTemplate+'</table></div><div class="datepicker-years"><table class="table-condensed">'+l.headTemplate+l.contTemplate+l.footTemplate+"</table></div></div>",a.fn.datepicker.DPGlobal=l,a.fn.datepicker.noConflict=function(){return a.fn.datepicker=g,this},a(document).on("focus.datepicker.data-api click.datepicker.data-api",'[data-provide="datepicker"]',function(b){var c=a(this);c.data("datepicker")||(b.preventDefault(),h.call(c,"show"))}),a(function(){h.call(a('[data-provide="datepicker-inline"]'))})}(window.jQuery),function(a){"use strict";a.fn.bdatepicker=a.fn.datepicker.noConflict(),a.fn.datepicker||(a.fn.datepicker=a.fn.bdatepicker);var b=function(a){this.init("date",a,b.defaults),this.initPicker(a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{initPicker:function(b,c){this.options.viewformat||(this.options.viewformat=this.options.format),b.datepicker=a.fn.editableutils.tryParseJson(b.datepicker,!0),this.options.datepicker=a.extend({},c.datepicker,b.datepicker,{format:this.options.viewformat}),this.options.datepicker.language=this.options.datepicker.language||"en",this.dpg=a.fn.bdatepicker.DPGlobal,this.parsedFormat=this.dpg.parseFormat(this.options.format),this.parsedViewFormat=this.dpg.parseFormat(this.options.viewformat)},render:function(){this.$input.bdatepicker(this.options.datepicker),this.options.clear&&(this.$clear=a('<a href="#"></a>').html(this.options.clear).click(a.proxy(function(a){a.preventDefault(),a.stopPropagation(),this.clear()},this)),this.$tpl.parent().append(a('<div class="editable-clear">').append(this.$clear)))},value2html:function(a,c){var d=a?this.dpg.formatDate(a,this.parsedViewFormat,this.options.datepicker.language):"";b.superclass.value2html.call(this,d,c)},html2value:function(a){return this.parseDate(a,this.parsedViewFormat)},value2str:function(a){return a?this.dpg.formatDate(a,this.parsedFormat,this.options.datepicker.language):""},str2value:function(a){return this.parseDate(a,this.parsedFormat)},value2submit:function(a){return this.value2str(a)},value2input:function(a){this.$input.bdatepicker("update",a)},input2value:function(){return this.$input.data("datepicker").date},activate:function(){},clear:function(){this.$input.data("datepicker").date=null,this.$input.find(".active").removeClass("active"),this.options.showbuttons||this.$input.closest("form").submit()},autosubmit:function(){this.$input.on("mouseup",".day",function(b){if(!a(b.currentTarget).is(".old")&&!a(b.currentTarget).is(".new")){var c=a(this).closest("form");setTimeout(function(){c.submit()},200)}})},parseDate:function(a,b){var c,d=null;return a&&(d=this.dpg.parseDate(a,b,this.options.datepicker.language),"string"==typeof a&&(c=this.dpg.formatDate(d,b,this.options.datepicker.language),a!==c&&(d=null))),d}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{tpl:'<div class="editable-date well"></div>',inputclass:null,format:"yyyy-mm-dd",viewformat:null,datepicker:{weekStart:0,startView:0,minViewMode:0,autoclose:!1},clear:"× clear"}),a.fn.editabletypes.date=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("datefield",a,b.defaults),this.initPicker(a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.date),a.extend(b.prototype,{render:function(){this.$input=this.$tpl.find("input"),this.setClass(),this.setAttr("placeholder"),this.$input.bdatepicker(this.options.datepicker),this.$input.off("focus keydown"),this.$input.keyup(a.proxy(function(){this.$tpl.removeData("date"),this.$tpl.bdatepicker("update")},this))},value2input:function(a){this.$input.val(a?this.dpg.formatDate(a,this.parsedViewFormat,this.options.datepicker.language):""),this.$tpl.bdatepicker("update")},input2value:function(){return this.html2value(this.$input.val())},activate:function(){a.fn.editabletypes.text.prototype.activate.call(this)},autosubmit:function(){}}),b.defaults=a.extend({},a.fn.editabletypes.date.defaults,{tpl:'<div class="input-append date"><input type="text"/><span class="add-on"><i class="icon-th"></i></span></div>',inputclass:"input-small",datepicker:{weekStart:0,startView:0,minViewMode:0,autoclose:!0}}),a.fn.editabletypes.datefield=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("datetime",a,b.defaults),this.initPicker(a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{initPicker:function(b,c){this.options.viewformat||(this.options.viewformat=this.options.format),b.datetimepicker=a.fn.editableutils.tryParseJson(b.datetimepicker,!0),this.options.datetimepicker=a.extend({},c.datetimepicker,b.datetimepicker,{format:this.options.viewformat}),this.options.datetimepicker.language=this.options.datetimepicker.language||"en",this.dpg=a.fn.datetimepicker.DPGlobal,this.parsedFormat=this.dpg.parseFormat(this.options.format,this.options.formatType),this.parsedViewFormat=this.dpg.parseFormat(this.options.viewformat,this.options.formatType)},render:function(){this.$input.datetimepicker(this.options.datetimepicker),this.$input.on("changeMode",function(b){var c=a(this).closest("form").parent();setTimeout(function(){c.triggerHandler("resize")},0)}),this.options.clear&&(this.$clear=a('<a href="#"></a>').html(this.options.clear).click(a.proxy(function(a){a.preventDefault(),a.stopPropagation(),this.clear()},this)),this.$tpl.parent().append(a('<div class="editable-clear">').append(this.$clear)))},value2html:function(a,c){var d=a?this.dpg.formatDate(this.toUTC(a),this.parsedViewFormat,this.options.datetimepicker.language,this.options.formatType):"";return c?void b.superclass.value2html.call(this,d,c):d},html2value:function(a){var b=this.parseDate(a,this.parsedViewFormat);return b?this.fromUTC(b):null},value2str:function(a){return a?this.dpg.formatDate(this.toUTC(a),this.parsedFormat,this.options.datetimepicker.language,this.options.formatType):""},str2value:function(a){var b=this.parseDate(a,this.parsedFormat);return b?this.fromUTC(b):null},value2submit:function(a){return this.value2str(a)},value2input:function(a){a&&this.$input.data("datetimepicker").setDate(a)},input2value:function(){var a=this.$input.data("datetimepicker");return a.date?a.getDate():null},activate:function(){},clear:function(){this.$input.data("datetimepicker").date=null,this.$input.find(".active").removeClass("active"),this.options.showbuttons||this.$input.closest("form").submit()},autosubmit:function(){this.$input.on("mouseup",".minute",function(b){var c=a(this).closest("form");setTimeout(function(){c.submit()},200)})},toUTC:function(a){return a?new Date(a.valueOf()-6e4*a.getTimezoneOffset()):a},fromUTC:function(a){return a?new Date(a.valueOf()+6e4*a.getTimezoneOffset()):a},parseDate:function(a,b){var c,d=null;return a&&(d=this.dpg.parseDate(a,b,this.options.datetimepicker.language,this.options.formatType),"string"==typeof a&&(c=this.dpg.formatDate(d,b,this.options.datetimepicker.language,this.options.formatType),a!==c&&(d=null))),d}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{tpl:'<div class="editable-date well"></div>',inputclass:null,format:"yyyy-mm-dd hh:ii",formatType:"standard",viewformat:null,datetimepicker:{todayHighlight:!1,autoclose:!1},clear:"× clear"}),a.fn.editabletypes.datetime=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("datetimefield",a,b.defaults),this.initPicker(a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.datetime),a.extend(b.prototype,{render:function(){this.$input=this.$tpl.find("input"),this.setClass(),this.setAttr("placeholder"),this.$tpl.datetimepicker(this.options.datetimepicker),this.$input.off("focus keydown"),this.$input.keyup(a.proxy(function(){this.$tpl.removeData("date"),this.$tpl.datetimepicker("update")},this))},value2input:function(a){this.$input.val(this.value2html(a)),this.$tpl.datetimepicker("update")},input2value:function(){return this.html2value(this.$input.val())},activate:function(){a.fn.editabletypes.text.prototype.activate.call(this)},autosubmit:function(){}}),b.defaults=a.extend({},a.fn.editabletypes.datetime.defaults,{tpl:'<div class="input-append date"><input type="text"/><span class="add-on"><i class="icon-th"></i></span></div>',inputclass:"input-medium",datetimepicker:{todayHighlight:!1,autoclose:!0}}),a.fn.editabletypes.datetimefield=b}(window.jQuery); |
New file |
| | |
| | | /* eslint-disable no-unused-vars */ |
| | | /** |
| | | * @author zhixin wen <wenzhixin2010@gmail.com> |
| | | * extensions: https://github.com/vitalets/x-editable |
| | | */ |
| | | |
| | | var Utils = $.fn.bootstrapTable.utils |
| | | |
| | | $.extend($.fn.bootstrapTable.defaults, { |
| | | editable: true, |
| | | onEditableInit () { |
| | | return false |
| | | }, |
| | | onEditableSave (field, row, rowIndex, oldValue, $el) { |
| | | return false |
| | | }, |
| | | onEditableShown (field, row, $el, editable) { |
| | | return false |
| | | }, |
| | | onEditableHidden (field, row, $el, reason) { |
| | | return false |
| | | } |
| | | }) |
| | | |
| | | $.extend($.fn.bootstrapTable.columnDefaults, { |
| | | alwaysUseFormatter: false |
| | | }) |
| | | |
| | | $.extend($.fn.bootstrapTable.events, { |
| | | 'editable-init.bs.table': 'onEditableInit', |
| | | 'editable-save.bs.table': 'onEditableSave', |
| | | 'editable-shown.bs.table': 'onEditableShown', |
| | | 'editable-hidden.bs.table': 'onEditableHidden' |
| | | }) |
| | | |
| | | $.BootstrapTable = class extends $.BootstrapTable { |
| | | initTable () { |
| | | super.initTable() |
| | | |
| | | if (!this.options.editable) { |
| | | return |
| | | } |
| | | |
| | | this.editedCells = [] |
| | | $.each(this.columns, (i, column) => { |
| | | if (!column.editable) { |
| | | return |
| | | } |
| | | |
| | | const editableOptions = {} |
| | | const editableDataMarkup = [] |
| | | const editableDataPrefix = 'editable-' |
| | | const processDataOptions = (key, value) => { |
| | | // Replace camel case with dashes. |
| | | const dashKey = key.replace(/([A-Z])/g, $1 => `-${$1.toLowerCase()}`) |
| | | |
| | | if (dashKey.indexOf(editableDataPrefix) === 0) { |
| | | editableOptions[dashKey.replace(editableDataPrefix, 'data-')] = value |
| | | } |
| | | } |
| | | |
| | | $.each(this.options, processDataOptions) |
| | | |
| | | column.formatter = column.formatter || (value => value) |
| | | column._formatter = column._formatter ? column._formatter : column.formatter |
| | | column.formatter = (value, row, index, field) => { |
| | | let result = Utils.calculateObjectValue(column, column._formatter, [value, row, index], value) |
| | | |
| | | result = typeof result === 'undefined' || result === null ? this.options.undefinedText : result |
| | | if (this.options.uniqueId !== undefined && !column.alwaysUseFormatter) { |
| | | const uniqueId = Utils.getItemField(row, this.options.uniqueId, false) |
| | | |
| | | if ($.inArray(column.field + uniqueId, this.editedCells) !== -1) { |
| | | result = value |
| | | } |
| | | } |
| | | |
| | | $.each(column, processDataOptions) |
| | | |
| | | $.each(editableOptions, (key, value) => { |
| | | editableDataMarkup.push(` ${key}="${value}"`) |
| | | }) |
| | | |
| | | let noEditFormatter = false |
| | | const editableOpts = Utils.calculateObjectValue(column, |
| | | column.editable, [index, row], {}) |
| | | |
| | | if (editableOpts.hasOwnProperty('noEditFormatter')) { |
| | | noEditFormatter = editableOpts.noEditFormatter(value, row, index, field) |
| | | } |
| | | |
| | | if (noEditFormatter === false) { |
| | | return `<a href="javascript:void(0)" |
| | | data-name="${column.field}" |
| | | data-pk="${row[this.options.idField]}" |
| | | data-value="${result}" |
| | | ${editableDataMarkup.join('')}></a>` |
| | | } |
| | | return noEditFormatter |
| | | } |
| | | }) |
| | | } |
| | | |
| | | initBody (fixedScroll) { |
| | | super.initBody(fixedScroll) |
| | | |
| | | if (!this.options.editable) { |
| | | return |
| | | } |
| | | |
| | | $.each(this.columns, (i, column) => { |
| | | if (!column.editable) { |
| | | return |
| | | } |
| | | |
| | | const data = this.getData({ escape: true }) |
| | | const $field = this.$body.find(`a[data-name="${column.field}"]`) |
| | | |
| | | $field.each((i, element) => { |
| | | const $element = $(element) |
| | | const $tr = $element.closest('tr') |
| | | const index = $tr.data('index') |
| | | const row = data[index] |
| | | |
| | | const editableOpts = Utils.calculateObjectValue(column, |
| | | column.editable, [index, row, $element], {}) |
| | | |
| | | $element.editable(editableOpts) |
| | | }) |
| | | |
| | | $field.off('save').on('save', ({ currentTarget }, { submitValue }) => { |
| | | const $this = $(currentTarget) |
| | | const data = this.getData() |
| | | const rowIndex = $this.parents('tr[data-index]').data('index') |
| | | const row = data[rowIndex] |
| | | const oldValue = row[column.field] |
| | | |
| | | if (this.options.uniqueId !== undefined && !column.alwaysUseFormatter) { |
| | | const uniqueId = Utils.getItemField(row, this.options.uniqueId, false) |
| | | |
| | | if ($.inArray(column.field + uniqueId, this.editedCells) === -1) { |
| | | this.editedCells.push(column.field + uniqueId) |
| | | } |
| | | } |
| | | |
| | | submitValue = Utils.escapeHTML(submitValue) |
| | | $this.data('value', submitValue) |
| | | row[column.field] = submitValue |
| | | this.trigger('editable-save', column.field, row, rowIndex, oldValue, $this) |
| | | this.initBody() |
| | | }) |
| | | |
| | | $field.off('shown').on('shown', ({ currentTarget }, editable) => { |
| | | const $this = $(currentTarget) |
| | | const data = this.getData() |
| | | const rowIndex = $this.parents('tr[data-index]').data('index') |
| | | const row = data[rowIndex] |
| | | |
| | | this.trigger('editable-shown', column.field, row, $this, editable) |
| | | }) |
| | | |
| | | $field.off('hidden').on('hidden', ({ currentTarget }, reason) => { |
| | | const $this = $(currentTarget) |
| | | const data = this.getData() |
| | | const rowIndex = $this.parents('tr[data-index]').data('index') |
| | | const row = data[rowIndex] |
| | | |
| | | this.trigger('editable-hidden', column.field, row, $this, reason) |
| | | }) |
| | | }) |
| | | this.trigger('editable-init') |
| | | } |
| | | |
| | | getData (params) { |
| | | const data = super.getData(params) |
| | | |
| | | if (params && params.escape) { |
| | | for (const row of data) { |
| | | for (const [key, value] of Object.entries(row)) { |
| | | if (typeof(value) !== "number") { |
| | | row[key] = Utils.unescapeHTML(value) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return data |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * @author zhixin wen <wenzhixin2010@gmail.com> |
| | | * extensions: https://github.com/hhurz/tableExport.jquery.plugin |
| | | */ |
| | | |
| | | var Utils = $.fn.bootstrapTable.utils |
| | | |
| | | const TYPE_NAME = { |
| | | json: 'JSON', |
| | | xml: 'XML', |
| | | png: 'PNG', |
| | | csv: 'CSV', |
| | | txt: 'TXT', |
| | | sql: 'SQL', |
| | | doc: 'MS-Word', |
| | | excel: 'MS-Excel', |
| | | xlsx: 'MS-Excel (OpenXML)', |
| | | powerpoint: 'MS-Powerpoint', |
| | | pdf: 'PDF' |
| | | } |
| | | |
| | | Object.assign($.fn.bootstrapTable.defaults, { |
| | | showExport: false, |
| | | exportDataType: 'basic', // basic, all, selected |
| | | exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel'], |
| | | exportOptions: {}, |
| | | exportFooter: false |
| | | }) |
| | | |
| | | Object.assign($.fn.bootstrapTable.columnDefaults, { |
| | | forceExport: false, |
| | | forceHide: false |
| | | }) |
| | | |
| | | Object.assign($.fn.bootstrapTable.defaults.icons, { |
| | | export: { |
| | | bootstrap3: 'glyphicon-export icon-share', |
| | | bootstrap5: 'bi-download', |
| | | materialize: 'file_download', |
| | | 'bootstrap-table': 'icon-download' |
| | | }[$.fn.bootstrapTable.theme] || 'fa-download' |
| | | }) |
| | | |
| | | Object.assign($.fn.bootstrapTable.locales, { |
| | | formatExport () { |
| | | return 'Export data' |
| | | } |
| | | }) |
| | | Object.assign($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales) |
| | | |
| | | $.fn.bootstrapTable.methods.push('exportTable') |
| | | |
| | | Object.assign($.fn.bootstrapTable.defaults, { |
| | | // eslint-disable-next-line no-unused-vars |
| | | onExportSaved (exportedRows) { |
| | | return false |
| | | }, |
| | | onExportStarted () { |
| | | return false |
| | | } |
| | | }) |
| | | |
| | | Object.assign($.fn.bootstrapTable.events, { |
| | | 'export-saved.bs.table': 'onExportSaved', |
| | | 'export-started.bs.table': 'onExportStarted' |
| | | }) |
| | | |
| | | $.BootstrapTable = class extends $.BootstrapTable { |
| | | initToolbar (...args) { |
| | | const o = this.options |
| | | let exportTypes = o.exportTypes |
| | | |
| | | this.showToolbar = this.showToolbar || o.showExport |
| | | |
| | | if (this.options.showExport) { |
| | | |
| | | if (typeof exportTypes === 'string') { |
| | | const types = exportTypes.slice(1, -1).replace(/ /g, '').split(',') |
| | | |
| | | exportTypes = types.map(t => t.slice(1, -1)) |
| | | } |
| | | |
| | | if (typeof o.exportOptions === 'string') { |
| | | o.exportOptions = Utils.calculateObjectValue(null, o.exportOptions) |
| | | } |
| | | |
| | | this.$export = this.$toolbar.find('>.columns div.export') |
| | | if (this.$export.length) { |
| | | this.updateExportButton() |
| | | return |
| | | } |
| | | |
| | | this.buttons = Object.assign(this.buttons, { |
| | | export: { |
| | | html: |
| | | () => { |
| | | if (exportTypes.length === 1) { |
| | | return ` |
| | | <div class="export ${this.constants.classes.buttonsDropdown}" |
| | | data-type="${exportTypes[0]}"> |
| | | <button class="${this.constants.buttonsClass}" |
| | | aria-label="${o.formatExport()}" |
| | | type="button" |
| | | title="${o.formatExport()}"> |
| | | ${o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.export) : ''} |
| | | ${o.showButtonText ? o.formatExport() : ''} |
| | | </button> |
| | | </div> |
| | | ` |
| | | } |
| | | |
| | | const html = [] |
| | | |
| | | html.push(` |
| | | <div class="export ${this.constants.classes.buttonsDropdown}"> |
| | | <button class="${this.constants.buttonsClass} dropdown-toggle" |
| | | aria-label="${o.formatExport()}" |
| | | ${this.constants.dataToggle}="dropdown" |
| | | type="button" |
| | | title="${o.formatExport()}"> |
| | | ${o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.export) : ''} |
| | | ${o.showButtonText ? o.formatExport() : ''} |
| | | ${this.constants.html.dropdownCaret} |
| | | </button> |
| | | ${this.constants.html.toolbarDropdown[0]} |
| | | `) |
| | | |
| | | for (const type of exportTypes) { |
| | | if (TYPE_NAME.hasOwnProperty(type)) { |
| | | const $item = $(Utils.sprintf(this.constants.html.pageDropdownItem, '', TYPE_NAME[type])) |
| | | |
| | | $item.attr('data-type', type) |
| | | html.push($item.prop('outerHTML')) |
| | | } |
| | | } |
| | | |
| | | html.push(this.constants.html.toolbarDropdown[1], '</div>') |
| | | return html.join('') |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | super.initToolbar(...args) |
| | | this.$export = this.$toolbar.find('>.columns div.export') |
| | | |
| | | if (!this.options.showExport) { |
| | | return |
| | | } |
| | | |
| | | this.updateExportButton() |
| | | let $exportButtons = this.$export.find('[data-type]') |
| | | |
| | | if (exportTypes.length === 1) { |
| | | $exportButtons = this.$export |
| | | } |
| | | |
| | | $exportButtons.click(e => { |
| | | e.preventDefault() |
| | | this.trigger('export-started') |
| | | this.exportTable({ |
| | | type: $(e.currentTarget).data('type') |
| | | }) |
| | | }) |
| | | this.handleToolbar() |
| | | } |
| | | |
| | | handleToolbar () { |
| | | if (!this.$export) { |
| | | return |
| | | } |
| | | |
| | | if (super.handleToolbar) { |
| | | super.handleToolbar() |
| | | } |
| | | } |
| | | |
| | | exportTable (options) { |
| | | const o = this.options |
| | | const stateField = this.header.stateField |
| | | const isCardView = o.cardView |
| | | |
| | | const doExport = callback => { |
| | | if (stateField) { |
| | | this.hideColumn(stateField) |
| | | } |
| | | if (isCardView) { |
| | | this.toggleView() |
| | | } |
| | | |
| | | this.columns.forEach(row => { |
| | | if (row.forceHide) { |
| | | this.hideColumn(row.field) |
| | | } |
| | | }) |
| | | |
| | | const data = this.getData() |
| | | |
| | | if (o.detailView && o.detailViewIcon) { |
| | | const detailViewIndex = o.detailViewAlign === 'left' ? 0 : this.getVisibleFields().length + Utils.getDetailViewIndexOffset(this.options) |
| | | |
| | | o.exportOptions.ignoreColumn = [detailViewIndex].concat(o.exportOptions.ignoreColumn || []) |
| | | } |
| | | |
| | | if (o.exportFooter && o.height) { |
| | | const $footerRow = this.$tableFooter.find('tr').first() |
| | | const footerData = {} |
| | | const footerHtml = [] |
| | | |
| | | $.each($footerRow.children(), (index, footerCell) => { |
| | | const footerCellHtml = $(footerCell).children('.th-inner').first().html() |
| | | |
| | | footerData[this.columns[index].field] = footerCellHtml === ' ' ? null : footerCellHtml |
| | | |
| | | // grab footer cell text into cell index-based array |
| | | footerHtml.push(footerCellHtml) |
| | | }) |
| | | |
| | | this.$body.append(this.$body.children().last()[0].outerHTML) |
| | | const $lastTableRow = this.$body.children().last() |
| | | |
| | | $.each($lastTableRow.children(), (index, lastTableRowCell) => { |
| | | $(lastTableRowCell).html(footerHtml[index]) |
| | | }) |
| | | } |
| | | |
| | | const hiddenColumns = this.getHiddenColumns() |
| | | |
| | | hiddenColumns.forEach(row => { |
| | | if (row.forceExport) { |
| | | this.showColumn(row.field) |
| | | } |
| | | }) |
| | | |
| | | if (typeof o.exportOptions.fileName === 'function') { |
| | | options.fileName = o.exportOptions.fileName() |
| | | } |
| | | |
| | | this.$el.tableExport(Utils.extend({ |
| | | onAfterSaveToFile: () => { |
| | | if (o.exportFooter) { |
| | | this.load(data) |
| | | } |
| | | |
| | | if (stateField) { |
| | | this.showColumn(stateField) |
| | | } |
| | | if (isCardView) { |
| | | this.toggleView() |
| | | } |
| | | |
| | | hiddenColumns.forEach(row => { |
| | | if (row.forceExport) { |
| | | this.hideColumn(row.field) |
| | | } |
| | | }) |
| | | |
| | | this.columns.forEach(row => { |
| | | if (row.forceHide) { |
| | | this.showColumn(row.field) |
| | | } |
| | | }) |
| | | |
| | | if (callback) callback() |
| | | } |
| | | }, o.exportOptions, options)) |
| | | } |
| | | |
| | | if (o.exportDataType === 'all' && o.pagination) { |
| | | const eventName = o.sidePagination === 'server' ? |
| | | 'post-body.bs.table' : 'page-change.bs.table' |
| | | const virtualScroll = this.options.virtualScroll |
| | | |
| | | this.$el.one(eventName, () => { |
| | | setTimeout(() => { |
| | | const data = this.getData() |
| | | |
| | | doExport(() => { |
| | | this.options.virtualScroll = virtualScroll |
| | | this.togglePagination() |
| | | }) |
| | | this.trigger('export-saved', data) |
| | | }, 0) |
| | | }) |
| | | this.options.virtualScroll = false |
| | | this.togglePagination() |
| | | } else if (o.exportDataType === 'selected') { |
| | | let data = this.getData() |
| | | let selectedData = this.getSelections() |
| | | const pagination = o.pagination |
| | | |
| | | if (!selectedData.length) { |
| | | return |
| | | } |
| | | |
| | | if (o.sidePagination === 'server') { |
| | | data = { |
| | | total: o.totalRows, |
| | | [this.options.dataField]: data |
| | | } |
| | | selectedData = { |
| | | total: selectedData.length, |
| | | [this.options.dataField]: selectedData |
| | | } |
| | | } |
| | | |
| | | this.load(selectedData) |
| | | if (pagination) { |
| | | this.togglePagination() |
| | | } |
| | | doExport(() => { |
| | | if (pagination) { |
| | | this.togglePagination() |
| | | } |
| | | this.load(data) |
| | | }) |
| | | this.trigger('export-saved', selectedData) |
| | | } else { |
| | | doExport() |
| | | this.trigger('export-saved', this.getData(true)) |
| | | } |
| | | } |
| | | |
| | | updateSelected () { |
| | | super.updateSelected() |
| | | this.updateExportButton() |
| | | } |
| | | |
| | | updateExportButton () { |
| | | if (this.options.exportDataType === 'selected') { |
| | | this.$export.find('> button') |
| | | .prop('disabled', !this.getSelections().length) |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | /* |
| | | tableExport.jquery.plugin |
| | | Version 1.10.24 |
| | | Copyright (c) 2015-2021 hhurz, https://github.com/hhurz/tableExport.jquery.plugin |
| | | Based on https://github.com/kayalshri/tableExport.jquery.plugin |
| | | Licensed under the MIT License |
| | | */ |
| | | var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(d,k,y){d instanceof String&&(d=String(d));for(var C=d.length,v=0;v<C;v++){var R=d[v];if(k.call(y,R,v,d))return{i:v,v:R}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(d,k,y){d!=Array.prototype&&d!=Object.prototype&&(d[k]=y.value)}; |
| | | $jscomp.getGlobal=function(d){return"undefined"!=typeof window&&window===d?d:"undefined"!=typeof global&&null!=global?global:d};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(d,k,y,C){if(k){y=$jscomp.global;d=d.split(".");for(C=0;C<d.length-1;C++){var v=d[C];v in y||(y[v]={});y=y[v]}d=d[d.length-1];C=y[d];k=k(C);k!=C&&null!=k&&$jscomp.defineProperty(y,d,{configurable:!0,writable:!0,value:k})}}; |
| | | $jscomp.polyfill("Array.prototype.find",function(d){return d?d:function(d,y){return $jscomp.findInternal(this,d,y).v}},"es6","es3"); |
| | | (function(d){d.fn.tableExport=function(k){function y(b){var c=[];v(b,"thead").each(function(){c.push.apply(c,v(d(this),a.theadSelector).toArray())});return c}function C(b){var c=[];v(b,"tbody").each(function(){c.push.apply(c,v(d(this),a.tbodySelector).toArray())});a.tfootSelector.length&&v(b,"tfoot").each(function(){c.push.apply(c,v(d(this),a.tfootSelector).toArray())});return c}function v(b,a){var c=b[0].tagName,q=b.parents(c).length;return b.find(a).filter(function(){return q===d(this).closest(c).parents(c).length})} |
| | | function R(b){var a=[],e=0,q=0,f=0;d(b).find("thead").first().find("th").each(function(b,c){b=void 0!==d(c).attr("data-field");"undefined"!==typeof c.parentNode.rowIndex&&q!==c.parentNode.rowIndex&&(q=c.parentNode.rowIndex,e=f=0);var h=J(c);for(e+=h?h:1;f<e;)a[f]=b?d(c).attr("data-field"):f.toString(),f++});return a}function I(b){var a="undefined"!==typeof b[0].rowIndex,e=!1===a&&"undefined"!==typeof b[0].cellIndex,q=e||a?Ja(b):b.is(":visible"),f=b.attr("data-tableexport-display");e&&"none"!==f&& |
| | | "always"!==f&&(b=d(b[0].parentNode),a="undefined"!==typeof b[0].rowIndex,f=b.attr("data-tableexport-display"));a&&"none"!==f&&"always"!==f&&(f=b.closest("table").attr("data-tableexport-display"));return"none"!==f&&(!0===q||"always"===f)}function Ja(b){var a=[];V&&(a=K.filter(function(){var a=!1;this.nodeType===b[0].nodeType&&("undefined"!==typeof this.rowIndex&&this.rowIndex===b[0].rowIndex?a=!0:"undefined"!==typeof this.cellIndex&&this.cellIndex===b[0].cellIndex&&"undefined"!==typeof this.parentNode.rowIndex&& |
| | | "undefined"!==typeof b[0].parentNode.rowIndex&&this.parentNode.rowIndex===b[0].parentNode.rowIndex&&(a=!0));return a}));return!1===V||0===a.length}function ta(b,c,e){var q=!1;I(b)?0<a.ignoreColumn.length&&(-1!==d.inArray(e,a.ignoreColumn)||-1!==d.inArray(e-c,a.ignoreColumn)||S.length>e&&"undefined"!==typeof S[e]&&-1!==d.inArray(S[e],a.ignoreColumn))&&(q=!0):q=!0;return q}function E(b,c,e,q,f){if("function"===typeof f){var h=!1;"function"===typeof a.onIgnoreRow&&(h=a.onIgnoreRow(d(b),e));if(!1===h&& |
| | | (0===a.ignoreRow.length||-1===d.inArray(e,a.ignoreRow)&&-1===d.inArray(e-q,a.ignoreRow))&&I(d(b))){b=v(d(b),c);var n=b.length,l=0,u=0;b.each(function(){var b=d(this),a=J(this),c=T(this),h;d.each(G,function(){if(e>this.s.r&&e<=this.e.r&&l>=this.s.c&&l<=this.e.c)for(h=0;h<=this.e.c-this.s.c;++h)n++,u++,f(null,e,l++)});if(c||a)a=a||1,G.push({s:{r:e,c:l},e:{r:e+(c||1)-1,c:l+a-1}});!1===ta(b,n,u++)&&f(this,e,l++);if(1<a)for(h=0;h<a-1;++h)u++,f(null,e,l++)});d.each(G,function(){if(e>=this.s.r&&e<=this.e.r&& |
| | | l>=this.s.c&&l<=this.e.c)for(ea=0;ea<=this.e.c-this.s.c;++ea)f(null,e,l++)})}}}function ua(b,a,e,d){if("undefined"!==typeof d.images&&(e=d.images[e],"undefined"!==typeof e)){a=a.getBoundingClientRect();var c=b.width/b.height,h=a.width/a.height,q=b.width,l=b.height,u=19.049976/25.4,g=0;h<=c?(l=Math.min(b.height,a.height),q=a.width*l/a.height):h>c&&(q=Math.min(b.width,a.width),l=a.height*q/a.width);q*=u;l*=u;l<b.height&&(g=(b.height-l)/2);try{d.doc.addImage(e.src,b.textPos.x,b.y+g,q,l)}catch(Pa){}b.textPos.x+= |
| | | q}}function va(b,c){if("string"===a.outputMode)return b.output();if("base64"===a.outputMode)return L(b.output());if("window"===a.outputMode)window.URL=window.URL||window.webkitURL,window.open(window.URL.createObjectURL(b.output("blob")));else try{var e=b.output("blob");saveAs(e,a.fileName+".pdf")}catch(q){ka(a.fileName+".pdf","data:application/pdf"+(c?"":";base64")+",",c?b.output("blob"):b.output())}}function wa(b,a,e){var c=0;"undefined"!==typeof e&&(c=e.colspan);if(0<=c){for(var f=b.width,d=b.textPos.x, |
| | | n=a.table.columns.indexOf(a.column),l=1;l<c;l++)f+=a.table.columns[n+l].width;1<c&&("right"===b.styles.halign?d=b.textPos.x+f-b.width:"center"===b.styles.halign&&(d=b.textPos.x+(f-b.width)/2));b.width=f;b.textPos.x=d;"undefined"!==typeof e&&1<e.rowspan&&(b.height*=e.rowspan);if("middle"===b.styles.valign||"bottom"===b.styles.valign)e=("string"===typeof b.text?b.text.split(/\r\n|\r|\n/g):b.text).length||1,2<e&&(b.textPos.y-=(2-1.15)/2*a.row.styles.fontSize*(e-2)/3);return!0}return!1}function xa(b, |
| | | a,e){"undefined"!==typeof b&&null!==b&&(b.hasAttribute("data-tableexport-canvas")?(a=(new Date).getTime(),d(b).attr("data-tableexport-canvas",a),e.images[a]={url:'[data-tableexport-canvas="'+a+'"]',src:null}):"undefined"!==a&&null!=a&&a.each(function(){if(d(this).is("img")){var a=ya(this.src);e.images[a]={url:this.src,src:this.src}}xa(b,d(this).children(),e)}))}function Ka(b,a){function c(b){if(b.url)if(b.src){var c=new Image;q=++f;c.crossOrigin="Anonymous";c.onerror=c.onload=function(){if(c.complete&& |
| | | (0===c.src.indexOf("data:image/")&&(c.width=b.width||c.width||0,c.height=b.height||c.height||0),c.width+c.height)){var e=document.createElement("canvas"),d=e.getContext("2d");e.width=c.width;e.height=c.height;d.drawImage(c,0,0);b.src=e.toDataURL("image/png")}--f||a(q)};c.src=b.url}else{var e=d(b.url);e.length&&(q=++f,html2canvas(e[0]).then(function(c){b.src=c.toDataURL("image/png");--f||a(q)}))}}var q=0,f=0;if("undefined"!==typeof b.images)for(var h in b.images)b.images.hasOwnProperty(h)&&c(b.images[h]); |
| | | (b=f)||(a(q),b=void 0);return b}function za(b,c,e){c.each(function(){if(d(this).is("div")){var c=fa(M(this,"background-color"),[255,255,255]),f=fa(M(this,"border-top-color"),[0,0,0]),h=ha(this,"border-top-width",a.jspdf.unit),n=this.getBoundingClientRect(),l=this.offsetLeft*e.wScaleFactor,u=this.offsetTop*e.hScaleFactor,g=n.width*e.wScaleFactor;n=n.height*e.hScaleFactor;e.doc.setDrawColor.apply(void 0,f);e.doc.setFillColor.apply(void 0,c);e.doc.setLineWidth(h);e.doc.rect(b.x+l,b.y+u,g,n,h?"FD":"F")}else d(this).is("img")&& |
| | | (c=ya(this.src),ua(b,this,c,e));za(b,d(this).children(),e)})}function Aa(b,c,e){if("function"===typeof e.onAutotableText)e.onAutotableText(e.doc,b,c);else{var q=b.textPos.x,f=b.textPos.y,h={halign:b.styles.halign,valign:b.styles.valign};if(c.length){for(c=c[0];c.previousSibling;)c=c.previousSibling;for(var n=!1,l=!1;c;){var u=c.innerText||c.textContent||"",g=u.length&&" "===u[0]?" ":"",k=1<u.length&&" "===u[u.length-1]?" ":"";!0!==a.preserve.leadingWS&&(u=g+la(u));!0!==a.preserve.trailingWS&&(u=ma(u)+ |
| | | k);d(c).is("br")&&(q=b.textPos.x,f+=e.doc.internal.getFontSize());d(c).is("b")?n=!0:d(c).is("i")&&(l=!0);(n||l)&&e.doc.setFontType(n&&l?"bolditalic":n?"bold":"italic");if(g=e.doc.getStringUnitWidth(u)*e.doc.internal.getFontSize()){"linebreak"===b.styles.overflow&&q>b.textPos.x&&q+g>b.textPos.x+b.width&&(0<=".,!%*;:=-".indexOf(u.charAt(0))&&(k=u.charAt(0),g=e.doc.getStringUnitWidth(k)*e.doc.internal.getFontSize(),q+g<=b.textPos.x+b.width&&(e.doc.autoTableText(k,q,f,h),u=u.substring(1,u.length)),g= |
| | | e.doc.getStringUnitWidth(u)*e.doc.internal.getFontSize()),q=b.textPos.x,f+=e.doc.internal.getFontSize());if("visible"!==b.styles.overflow)for(;u.length&&q+g>b.textPos.x+b.width;)u=u.substring(0,u.length-1),g=e.doc.getStringUnitWidth(u)*e.doc.internal.getFontSize();e.doc.autoTableText(u,q,f,h);q+=g}if(n||l)d(c).is("b")?n=!1:d(c).is("i")&&(l=!1),e.doc.setFontType(n||l?n?"bold":"italic":"normal");c=c.nextSibling}b.textPos.x=q;b.textPos.y=f}else e.doc.autoTableText(b.text,b.textPos.x,b.textPos.y,h)}} |
| | | function W(b,a,e){return null==b?"":b.toString().replace(new RegExp(null==a?"":a.toString().replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),e)}function la(b){return null==b?"":b.toString().replace(/^\s+/,"")}function ma(b){return null==b?"":b.toString().replace(/\s+$/,"")}function La(b){if(0===a.date.html.length)return!1;a.date.pattern.lastIndex=0;var c=a.date.pattern.exec(b);if(null==c)return!1;b=+c[a.date.match_y];if(0>b||8099<b)return!1;var e=1*c[a.date.match_m];c=1*c[a.date.match_d];if(!isFinite(c))return!1; |
| | | var d=new Date(b,e-1,c,0,0,0);return d.getFullYear()===b&&d.getMonth()===e-1&&d.getDate()===c?new Date(Date.UTC(b,e-1,c,0,0,0)):!1}function na(b){b=b||"0";""!==a.numbers.html.thousandsSeparator&&(b=W(b,a.numbers.html.thousandsSeparator,""));"."!==a.numbers.html.decimalMark&&(b=W(b,a.numbers.html.decimalMark,"."));return"number"===typeof b||!1!==jQuery.isNumeric(b)?b:!1}function Ma(b){-1<b.indexOf("%")?(b=na(b.replace(/%/g,"")),!1!==b&&(b/=100)):b=!1;return b}function D(b,c,e,q){var f="",h="text"; |
| | | if(null!==b){var n=d(b);n.removeData("teUserDefText");if(n[0].hasAttribute("data-tableexport-canvas"))var l="";else if(n[0].hasAttribute("data-tableexport-value"))l=(l=n.attr("data-tableexport-value"))?l+"":"",n.data("teUserDefText",1);else if(l=n.html(),"function"===typeof a.onCellHtmlData)l=a.onCellHtmlData(n,c,e,l),n.data("teUserDefText",1);else if(""!==l){b=d.parseHTML(l);var g=0,k=0;l="";d.each(b,function(){if(d(this).is("input"))l+=n.find("input").eq(g++).val();else if(d(this).is("select"))l+= |
| | | n.find("select option:selected").eq(k++).text();else if(d(this).is("br"))l+="<br>";else{if("undefined"===typeof d(this).html())l+=d(this).text();else if(void 0===jQuery().bootstrapTable||!1===d(this).hasClass("fht-cell")&&!1===d(this).hasClass("filterControl")&&0===n.parents(".detail-view").length)l+=d(this).html();if(d(this).is("a")){var b=n.find("a").attr("href")||"";f="function"===typeof a.onCellHtmlHyperlink?f+a.onCellHtmlHyperlink(n,c,e,b,l):"href"===a.htmlHyperlink?f+b:f+l;l=""}}})}if(l&&""!== |
| | | l&&!0===a.htmlContent)f=d.trim(l);else if(l&&""!==l)if(""!==n.attr("data-tableexport-cellformat")){var m=l.replace(/\n/g,"\u2028").replace(/(<\s*br([^>]*)>)/gi,"\u2060"),p=d("<div/>").html(m).contents();b=!1;m="";d.each(p.text().split("\u2028"),function(b,c){0<b&&(m+=" ");!0!==a.preserve.leadingWS&&(c=la(c));m+=!0!==a.preserve.trailingWS?ma(c):c});d.each(m.split("\u2060"),function(b,c){0<b&&(f+="\n");!0!==a.preserve.leadingWS&&(c=la(c));!0!==a.preserve.trailingWS&&(c=ma(c));f+=c.replace(/\u00AD/g, |
| | | "")});f=f.replace(/\u00A0/g," ");if("json"===a.type||"excel"===a.type&&"xmlss"===a.mso.fileFormat||!1===a.numbers.output)b=na(f),!1!==b&&(h="number",f=Number(b));else if(a.numbers.html.decimalMark!==a.numbers.output.decimalMark||a.numbers.html.thousandsSeparator!==a.numbers.output.thousandsSeparator)if(b=na(f),!1!==b){p=(""+b.substr(0>b?1:0)).split(".");1===p.length&&(p[1]="");var t=3<p[0].length?p[0].length%3:0;h="number";f=(0>b?"-":"")+(a.numbers.output.thousandsSeparator?(t?p[0].substr(0,t)+a.numbers.output.thousandsSeparator: |
| | | "")+p[0].substr(t).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):p[0])+(p[1].length?a.numbers.output.decimalMark+p[1]:"")}}else f=l;!0===a.escape&&(f=escape(f));"function"===typeof a.onCellData&&(f=a.onCellData(n,c,e,f,h),n.data("teUserDefText",1))}void 0!==q&&(q.type=h);return f}function Ba(b){return 0<b.length&&!0===a.preventInjection&&0<="=+-@".indexOf(b.charAt(0))?"'"+b:b}function Na(b,a,e){return a+"-"+e.toLowerCase()}function fa(b,a){(b=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(b))&& |
| | | (a=[parseInt(b[1]),parseInt(b[2]),parseInt(b[3])]);return a}function Ca(b){var a=M(b,"text-align"),e=M(b,"font-weight"),d=M(b,"font-style"),f="";"start"===a&&(a="rtl"===M(b,"direction")?"right":"left");700<=e&&(f="bold");"italic"===d&&(f+=d);""===f&&(f="normal");a={style:{align:a,bcolor:fa(M(b,"background-color"),[255,255,255]),color:fa(M(b,"color"),[0,0,0]),fstyle:f},colspan:J(b),rowspan:T(b)};null!==b&&(b=b.getBoundingClientRect(),a.rect={width:b.width,height:b.height});return a}function J(b){var a= |
| | | d(b).attr("data-tableexport-colspan");"undefined"===typeof a&&d(b).is("[colspan]")&&(a=d(b).attr("colspan"));return parseInt(a)||0}function T(b){var a=d(b).attr("data-tableexport-rowspan");"undefined"===typeof a&&d(b).is("[rowspan]")&&(a=d(b).attr("rowspan"));return parseInt(a)||0}function M(a,c){try{return window.getComputedStyle?(c=c.replace(/([a-z])([A-Z])/,Na),window.getComputedStyle(a,null).getPropertyValue(c)):a.currentStyle?a.currentStyle[c]:a.style[c]}catch(e){}return""}function ha(a,c,e){c= |
| | | M(a,c).match(/\d+/);if(null!==c){c=c[0];a=a.parentElement;var b=document.createElement("div");b.style.overflow="hidden";b.style.visibility="hidden";a.appendChild(b);b.style.width=100+e;e=100/b.offsetWidth;a.removeChild(b);return c*e}return 0}function Oa(a){for(var b=new ArrayBuffer(a.length),e=new Uint8Array(b),d=0;d!==a.length;++d)e[d]=a.charCodeAt(d)&255;return b}function oa(a){var b=a.c,e="";for(++b;b;b=Math.floor((b-1)/26))e=String.fromCharCode((b-1)%26+65)+e;return e+(""+(a.r+1))}function pa(a, |
| | | c){if("undefined"===typeof c||"number"===typeof c)return pa(a.s,a.e);"string"!==typeof a&&(a=oa(a));"string"!==typeof c&&(c=oa(c));return a===c?a:a+":"+c}function Da(a,c){var b=Number(a);if(isFinite(b))return b;var d=1;""!==c.thousandsSeparator&&(a=a.replace(new RegExp("([\\d])"+c.thousandsSeparator+"([\\d])","g"),"$1$2"));"."!==c.decimalMark&&(a=a.replace(new RegExp("([\\d])"+c.decimalMark+"([\\d])","g"),"$1.$2"));a=a.replace(/[$]/g,"").replace(/[%]/g,function(){d*=100;return""});if(isFinite(b=Number(a)))return b/ |
| | | d;a=a.replace(/[(](.*)[)]/,function(a,b){d=-d;return b});return isFinite(b=Number(a))?b/d:b}function ya(a){var b=0,d;if(0===a.length)return b;var q=0;for(d=a.length;q<d;q++){var f=a.charCodeAt(q);b=(b<<5)-b+f;b|=0}return b}function N(b,c,d,q,f,h){var e=!0;"function"===typeof a.onBeforeSaveToFile&&(e=a.onBeforeSaveToFile(b,c,d,q,f),"boolean"!==typeof e&&(e=!0));if(e)try{if(Ea=new Blob([b],{type:d+";charset="+q}),saveAs(Ea,c,!1===h),"function"===typeof a.onAfterSaveToFile)a.onAfterSaveToFile(b,c)}catch(l){ka(c, |
| | | "data:"+d+(q.length?";charset="+q:"")+(f.length?";"+f:"")+",",h?"\ufeff"+b:b)}}function ka(b,c,d){var e=window.navigator.userAgent;if(!1!==b&&window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(new Blob([d]),b);else if(!1!==b&&(0<e.indexOf("MSIE ")||e.match(/Trident.*rv\:11\./))){if(c=document.createElement("iframe")){document.body.appendChild(c);c.setAttribute("style","display:none");c.contentDocument.open("txt/plain","replace");c.contentDocument.write(d);c.contentDocument.close(); |
| | | c.contentWindow.focus();switch(b.substr(b.lastIndexOf(".")+1)){case "doc":case "json":case "png":case "pdf":case "xls":case "xlsx":b+=".txt"}c.contentDocument.execCommand("SaveAs",!0,b);document.body.removeChild(c)}}else{var f=document.createElement("a");if(f){var h=null;f.style.display="none";!1!==b?f.download=b:f.target="_blank";"object"===typeof d?(window.URL=window.URL||window.webkitURL,e=[],e.push(d),h=window.URL.createObjectURL(new Blob(e,{type:c})),f.href=h):0<=c.toLowerCase().indexOf("base64,")? |
| | | f.href=c+L(d):f.href=c+encodeURIComponent(d);document.body.appendChild(f);if(document.createEvent)null===ia&&(ia=document.createEvent("MouseEvents")),ia.initEvent("click",!0,!1),f.dispatchEvent(ia);else if(document.createEventObject)f.fireEvent("onclick");else if("function"===typeof f.onclick)f.onclick();setTimeout(function(){h&&window.URL.revokeObjectURL(h);document.body.removeChild(f);if("function"===typeof a.onAfterSaveToFile)a.onAfterSaveToFile(d,b)},100)}}}function L(a){var b,d="",q=0;if("string"=== |
| | | typeof a){a=a.replace(/\x0d\x0a/g,"\n");var f="";for(b=0;b<a.length;b++){var h=a.charCodeAt(b);128>h?f+=String.fromCharCode(h):(127<h&&2048>h?f+=String.fromCharCode(h>>6|192):(f+=String.fromCharCode(h>>12|224),f+=String.fromCharCode(h>>6&63|128)),f+=String.fromCharCode(h&63|128))}a=f}for(;q<a.length;){var n=a.charCodeAt(q++);f=a.charCodeAt(q++);b=a.charCodeAt(q++);h=n>>2;n=(n&3)<<4|f>>4;var l=(f&15)<<2|b>>6;var g=b&63;isNaN(f)?l=g=64:isNaN(b)&&(g=64);d=d+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h)+ |
| | | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(n)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(l)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g)}return d}var a={csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,date:{html:"dd/mm/yyyy"},displayTableName:!1,escape:!1,exportHiddenCells:!1,fileName:"tableExport",htmlContent:!1,htmlHyperlink:"content",ignoreColumn:[],ignoreRow:[],jsonScope:"all",jspdf:{orientation:"p", |
| | | unit:"pt",format:"a4",margins:{left:20,right:10,top:10,bottom:10},onDocCreated:null,autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize",halign:"inherit",valign:"middle"},headerStyles:{fillColor:[52,73,94],textColor:255,fontStyle:"bold",halign:"inherit",valign:"middle"},alternateRowStyles:{fillColor:245},tableExport:{doc:null,onAfterAutotable:null,onBeforeAutotable:null,onAutotableText:null,onTable:null,outputImages:!0}}},mso:{fileFormat:"xlshtml", |
| | | onMsoNumberFormat:null,pageFormat:"a4",pageOrientation:"portrait",rtl:!1,styles:[],worksheetName:"",xslx:{formatId:{date:14,numbers:2}}},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onAfterSaveToFile:null,onBeforeSaveToFile:null,onCellData:null,onCellHtmlData:null,onCellHtmlHyperlink:null,onIgnoreRow:null,onTableExportBegin:null,onTableExportEnd:null,outputMode:"file",pdfmake:{enabled:!1,docDefinition:{pageSize:"A4",pageOrientation:"portrait", |
| | | styles:{header:{background:"#34495E",color:"#FFFFFF",bold:!0,alignment:"center",fillColor:"#34495E"},alternateRow:{fillColor:"#f5f5f5"}},defaultStyle:{color:"#000000",fontSize:8,font:"Roboto"}},fonts:{}},preserve:{leadingWS:!1,trailingWS:!1},preventInjection:!0,sql:{tableEnclosure:"`",columnEnclosure:"`"},tbodySelector:"tr",tfootSelector:"tr",theadSelector:"tr",tableName:"Table",type:"csv"},O={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53, |
| | | 595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39, |
| | | 161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]},B=this,ia=null,r=[],w=[],p=0,t="",S=[],G=[],Ea,K=[],V=!1;d.extend(!0,a,k);"xlsx"===a.type&&(a.mso.fileFormat=a.type,a.type="excel");"undefined"!==typeof a.excelFileFormat&&"undefined"===a.mso.fileFormat&&(a.mso.fileFormat=a.excelFileFormat);"undefined"!==typeof a.excelPageFormat&&"undefined"===a.mso.pageFormat&& |
| | | (a.mso.pageFormat=a.excelPageFormat);"undefined"!==typeof a.excelPageOrientation&&"undefined"===a.mso.pageOrientation&&(a.mso.pageOrientation=a.excelPageOrientation);"undefined"!==typeof a.excelRTL&&"undefined"===a.mso.rtl&&(a.mso.rtl=a.excelRTL);"undefined"!==typeof a.excelstyles&&"undefined"===a.mso.styles&&(a.mso.styles=a.excelstyles);"undefined"!==typeof a.onMsoNumberFormat&&"undefined"===a.mso.onMsoNumberFormat&&(a.mso.onMsoNumberFormat=a.onMsoNumberFormat);"undefined"!==typeof a.worksheetName&& |
| | | "undefined"===a.mso.worksheetName&&(a.mso.worksheetName=a.worksheetName);a.mso.pageOrientation="l"===a.mso.pageOrientation.substr(0,1)?"landscape":"portrait";a.date.html=a.date.html||"";if(a.date.html.length){k=[];k.dd="(3[01]|[12][0-9]|0?[1-9])";k.mm="(1[012]|0?[1-9])";k.yyyy="((?:1[6-9]|2[0-2])\\d{2})";k.yy="(\\d{2})";var z=a.date.html.match(/[^a-zA-Z0-9]/)[0];z=a.date.html.toLowerCase().split(z);a.date.regex="^\\s*";a.date.regex+=k[z[0]];a.date.regex+="(.)";a.date.regex+=k[z[1]];a.date.regex+= |
| | | "\\2";a.date.regex+=k[z[2]];a.date.regex+="\\s*$";a.date.pattern=new RegExp(a.date.regex,"g");k=z.indexOf("dd")+1;a.date.match_d=k+(1<k?1:0);k=z.indexOf("mm")+1;a.date.match_m=k+(1<k?1:0);k=(0<=z.indexOf("yyyy")?z.indexOf("yyyy"):z.indexOf("yy"))+1;a.date.match_y=k+(1<k?1:0)}S=R(B);if("function"===typeof a.onTableExportBegin)a.onTableExportBegin();if("csv"===a.type||"tsv"===a.type||"txt"===a.type){var P="",Z=0;G=[];p=0;var qa=function(b,c,e){b.each(function(){t="";E(this,c,p,e+b.length,function(b, |
| | | c,d){var e=t,f="";if(null!==b)if(b=D(b,c,d),c=null===b||""===b?"":b.toString(),"tsv"===a.type)b instanceof Date&&b.toLocaleString(),f=W(c,"\t"," ");else if(b instanceof Date)f=a.csvEnclosure+b.toLocaleString()+a.csvEnclosure;else if(f=Ba(c),f=W(f,a.csvEnclosure,a.csvEnclosure+a.csvEnclosure),0<=f.indexOf(a.csvSeparator)||/[\r\n ]/g.test(f))f=a.csvEnclosure+f+a.csvEnclosure;t=e+(f+("tsv"===a.type?"\t":a.csvSeparator))});t=d.trim(t).substring(0,t.length-1);0<t.length&&(0<P.length&&(P+="\n"),P+=t);p++}); |
| | | return b.length};Z+=qa(d(B).find("thead").first().find(a.theadSelector),"th,td",Z);v(d(B),"tbody").each(function(){Z+=qa(v(d(this),a.tbodySelector),"td,th",Z)});a.tfootSelector.length&&qa(d(B).find("tfoot").first().find(a.tfootSelector),"td,th",Z);P+="\n";if("string"===a.outputMode)return P;if("base64"===a.outputMode)return L(P);if("window"===a.outputMode){ka(!1,"data:text/"+("csv"===a.type?"csv":"plain")+";charset=utf-8,",P);return}N(P,a.fileName+"."+a.type,"text/"+("csv"===a.type?"csv":"plain"), |
| | | "utf-8","","csv"===a.type&&a.csvUseBOM)}else if("sql"===a.type){p=0;G=[];var A="INSERT INTO "+a.sql.tableEnclosure+a.tableName+a.sql.tableEnclosure+" (";r=y(d(B));d(r).each(function(){E(this,"th,td",p,r.length,function(b,c,d){b=D(b,c,d)||"";-1<b.indexOf(a.sql.columnEnclosure)&&(b=W(b.toString(),a.sql.columnEnclosure,a.sql.columnEnclosure+a.sql.columnEnclosure));A+=a.sql.columnEnclosure+b+a.sql.columnEnclosure+","});p++;A=d.trim(A).substring(0,A.length-1)});A+=") VALUES ";w=C(d(B));d(w).each(function(){t= |
| | | "";E(this,"td,th",p,r.length+w.length,function(a,c,d){a=D(a,c,d)||"";-1<a.indexOf("'")&&(a=W(a.toString(),"'","''"));t+="'"+a+"',"});3<t.length&&(A+="("+t,A=d.trim(A).substring(0,A.length-1),A+="),");p++});A=d.trim(A).substring(0,A.length-1);A+=";";if("string"===a.outputMode)return A;if("base64"===a.outputMode)return L(A);N(A,a.fileName+".sql","application/sql","utf-8","",!1)}else if("json"===a.type){var X=[];G=[];r=y(d(B));d(r).each(function(){var a=[];E(this,"th,td",p,r.length,function(b,d,g){a.push(D(b, |
| | | d,g))});X.push(a)});var ra=[];w=C(d(B));d(w).each(function(){var a={},c=0;E(this,"td,th",p,r.length+w.length,function(b,d,f){X.length?a[X[X.length-1][c]]=D(b,d,f):a[c]=D(b,d,f);c++});!1===d.isEmptyObject(a)&&ra.push(a);p++});k="head"===a.jsonScope?JSON.stringify(X):"data"===a.jsonScope?JSON.stringify(ra):JSON.stringify({header:X,data:ra});if("string"===a.outputMode)return k;if("base64"===a.outputMode)return L(k);N(k,a.fileName+".json","application/json","utf-8","base64",!1)}else if("xml"===a.type){p= |
| | | 0;G=[];var Q='<?xml version="1.0" encoding="utf-8"?>';Q+="<tabledata><fields>";r=y(d(B));d(r).each(function(){E(this,"th,td",p,r.length,function(a,d,e){Q+="<field>"+D(a,d,e)+"</field>"});p++});Q+="</fields><data>";var Fa=1;w=C(d(B));d(w).each(function(){var a=1;t="";E(this,"td,th",p,r.length+w.length,function(b,d,g){t+="<column-"+a+">"+D(b,d,g)+"</column-"+a+">";a++});0<t.length&&"<column-1></column-1>"!==t&&(Q+='<row id="'+Fa+'">'+t+"</row>",Fa++);p++});Q+="</data></tabledata>";if("string"===a.outputMode)return Q; |
| | | if("base64"===a.outputMode)return L(Q);N(Q,a.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"===a.type&&"xmlss"===a.mso.fileFormat){var sa=[],F=[];d(B).filter(function(){return I(d(this))}).each(function(){function b(a,b,c){var f=[];d(a).each(function(){var b=0,e=0;t="";E(this,"td,th",p,c+a.length,function(a,c,h){if(null!==a){var l="";c=D(a,c,h);h="String";if(!1!==jQuery.isNumeric(c))h="Number";else{var n=Ma(c);!1!==n&&(c=n,h="Number",l+=' ss:StyleID="pct1"')}"Number"!==h&&(c= |
| | | c.replace(/\n/g,"<br>"));n=J(a);a=T(a);d.each(f,function(){if(p>=this.s.r&&p<=this.e.r&&e>=this.s.c&&e<=this.e.c)for(var a=0;a<=this.e.c-this.s.c;++a)e++,b++});if(a||n)a=a||1,n=n||1,f.push({s:{r:p,c:e},e:{r:p+a-1,c:e+n-1}});1<n&&(l+=' ss:MergeAcross="'+(n-1)+'"',e+=n-1);1<a&&(l+=' ss:MergeDown="'+(a-1)+'" ss:StyleID="rsp1"');0<b&&(l+=' ss:Index="'+(e+1)+'"',b=0);t+="<Cell"+l+'><Data ss:Type="'+h+'">'+d("<div />").text(c).html()+"</Data></Cell>\r";e++}});0<t.length&&(H+='<Row ss:AutoFitHeight="0">\r'+ |
| | | t+"</Row>\r");p++});return a.length}var c=d(this),e="";"string"===typeof a.mso.worksheetName&&a.mso.worksheetName.length?e=a.mso.worksheetName+" "+(F.length+1):"undefined"!==typeof a.mso.worksheetName[F.length]&&(e=a.mso.worksheetName[F.length]);e.length||(e=c.find("caption").text()||"");e.length||(e="Table "+(F.length+1));e=d.trim(e.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));F.push(d("<div />").text(e).html());!1===a.exportHiddenCells&&(K=c.find("tr, th, td").filter(":hidden"),V=0<K.length); |
| | | p=0;S=R(this);H="<Table>\r";e=b(y(c),"th,td",0);b(C(c),"td,th",e);H+="</Table>\r";sa.push(H)});k={};z={};for(var m,aa,Y=0,ea=F.length;Y<ea;Y++)m=F[Y],aa=k[m],aa=k[m]=null==aa?1:aa+1,2===aa&&(F[z[m]]=F[z[m]].substring(0,29)+"-1"),1<k[m]?F[Y]=F[Y].substring(0,29)+"-"+k[m]:z[m]=Y;k='<?xml version="1.0" encoding="UTF-8"?>\r<?mso-application progid="Excel.Sheet"?>\r<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:o="urn:schemas-microsoft-com:office:office"\r xmlns:x="urn:schemas-microsoft-com:office:excel"\r xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:html="http://www.w3.org/TR/REC-html40">\r<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">\r <Created>'+ |
| | | (new Date).toISOString()+'</Created>\r</DocumentProperties>\r<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">\r <AllowPNG/>\r</OfficeDocumentSettings>\r<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">\r <WindowHeight>9000</WindowHeight>\r <WindowWidth>13860</WindowWidth>\r <WindowTopX>0</WindowTopX>\r <WindowTopY>0</WindowTopY>\r <ProtectStructure>False</ProtectStructure>\r <ProtectWindows>False</ProtectWindows>\r</ExcelWorkbook>\r<Styles>\r <Style ss:ID="Default" ss:Name="Normal">\r <Alignment ss:Vertical="Bottom"/>\r <Borders/>\r <Font/>\r <Interior/>\r <NumberFormat/>\r <Protection/>\r </Style>\r <Style ss:ID="rsp1">\r <Alignment ss:Vertical="Center"/>\r </Style>\r <Style ss:ID="pct1">\r <NumberFormat ss:Format="Percent"/>\r </Style>\r</Styles>\r'; |
| | | for(z=0;z<sa.length;z++)k+='<Worksheet ss:Name="'+F[z]+'" ss:RightToLeft="'+(a.mso.rtl?"1":"0")+'">\r'+sa[z],k=a.mso.rtl?k+'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">\r<DisplayRightToLeft/>\r</WorksheetOptions>\r':k+'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"/>\r',k+="</Worksheet>\r";k+="</Workbook>\r";if("string"===a.outputMode)return k;if("base64"===a.outputMode)return L(k);N(k,a.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"=== |
| | | a.type&&"xlsx"===a.mso.fileFormat){var ba=[],Ga=XLSX.utils.book_new();d(B).filter(function(){return I(d(this))}).each(function(){for(var b=d(this),c={},e=this.getElementsByTagName("tr"),g={s:{r:0,c:0},e:{r:0,c:0}},f=[],h,n=[],l=0,u=0,k,m,p,t,r,w=XLSX.SSF.get_table();l<e.length&&1E7>u;++l)if(k=e[l],m=!1,"function"===typeof a.onIgnoreRow&&(m=a.onIgnoreRow(d(k),l)),!0!==m&&(0===a.ignoreRow.length||-1===d.inArray(l,a.ignoreRow)&&-1===d.inArray(l-e.length,a.ignoreRow))&&!1!==I(d(k))){var y=k.children, |
| | | B=0;for(k=0;k<y.length;++k)r=y[k],t=+J(r)||1,B+=t;var z=0;for(k=m=0;k<y.length;++k)if(r=y[k],t=+J(r)||1,h=k+z,!ta(d(r),B,h+(h<m?m-h:0))){z+=t-1;for(h=0;h<f.length;++h){var v=f[h];v.s.c==m&&v.s.r<=u&&u<=v.e.r&&(m=v.e.c+1,h=-1)}(0<(p=+T(r))||1<t)&&f.push({s:{r:u,c:m},e:{r:u+(p||1)-1,c:m+t-1}});var C={type:""};h=D(r,l,k+z,C);v={t:"s",v:h};var A="";if(""!==(d(r).attr("data-tableexport-cellformat")||"")){var x=parseInt(d(r).attr("data-tableexport-xlsxformatid")||0);0===x&&"function"===typeof a.mso.xslx.formatId.numbers&& |
| | | (x=a.mso.xslx.formatId.numbers(d(r),l,k+z));0===x&&"function"===typeof a.mso.xslx.formatId.date&&(x=a.mso.xslx.formatId.date(d(r),l,k+z));if(49===x||"@"===x)A="s";else if("number"===C.type||0<x&&14>x||36<x&&41>x||48===x)A="n";else if("date"===C.type||13<x&&37>x||44<x&&48>x||56===x)A="d"}else A="s";if(null!=h)if(0===h.length)v.t="z";else if(0!==h.trim().length)if("s"===A)d(r).find("a").length&&(h="href"!==a.htmlHyperlink?h:"",v={f:'=HYPERLINK("'+d(r).find("a").attr("href")+(h.length?'","'+h:"")+'")'}); |
| | | else if("function"===C.type)v={f:h};else if("TRUE"===h)v={t:"b",v:!0};else if("FALSE"===h)v={t:"b",v:!1};else if("n"===A||isFinite(Da(h,a.numbers.output))){if(r=Da(h,a.numbers.output),0===x&&"function"!==typeof a.mso.xslx.formatId.numbers&&(x=a.mso.xslx.formatId.numbers),isFinite(r)||isFinite(h))v={t:"n",v:isFinite(r)?r:h,z:"string"===typeof x?x:x in w?w[x]:"0.00"}}else if(!1!==(r=La(h))||"d"===A)0===x&&"function"!==typeof a.mso.xslx.formatId.date&&(x=a.mso.xslx.formatId.date),v={t:"d",v:!1!==r?r: |
| | | h,z:"string"===typeof x?x:x in w?w[x]:"m/d/yy"};c[oa({c:m,r:u})]=v;g.e.c<m&&(g.e.c=m);m+=t}++u}f.length&&(c["!merges"]=f);n.length&&(c["!rows"]=n);g.e.r=u-1;c["!ref"]=pa(g);1E7<=u&&(c["!fullref"]=pa((g.e.r=e.length-l+u-1,g)));e="";"string"===typeof a.mso.worksheetName&&a.mso.worksheetName.length?e=a.mso.worksheetName+" "+(ba.length+1):"undefined"!==typeof a.mso.worksheetName[ba.length]&&(e=a.mso.worksheetName[ba.length]);e.length||(e=b.find("caption").text()||"");e.length||(e="Table "+(ba.length+ |
| | | 1));e=d.trim(e.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));ba.push(e);XLSX.utils.book_append_sheet(Ga,c,e)});k=XLSX.write(Ga,{type:"binary",bookType:a.mso.fileFormat,bookSST:!1});N(Oa(k),a.fileName+"."+a.mso.fileFormat,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","UTF-8","",!1)}else if("excel"===a.type||"xls"===a.type||"word"===a.type||"doc"===a.type){k="excel"===a.type||"xls"===a.type?"excel":"word";z="excel"===k?"xls":"doc";m='xmlns:x="urn:schemas-microsoft-com:office:'+ |
| | | k+'"';var H="",ca="";d(B).filter(function(){return I(d(this))}).each(function(){var b=d(this);""===ca&&(ca=a.mso.worksheetName||b.find("caption").text()||"Table",ca=d.trim(ca.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31)));!1===a.exportHiddenCells&&(K=b.find("tr, th, td").filter(":hidden"),V=0<K.length);p=0;G=[];S=R(this);H+="<table><thead>";r=y(b);d(r).each(function(){var b=d(this);t="";E(this,"th,td",p,r.length,function(d,c,f){if(null!==d){var e="";t+="<th";if(a.mso.styles.length){var n=document.defaultView.getComputedStyle(d, |
| | | null),l=document.defaultView.getComputedStyle(b[0],null),g;for(g in a.mso.styles){var k=n[a.mso.styles[g]];""===k&&(k=l[a.mso.styles[g]]);""!==k&&"0px none rgb(0, 0, 0)"!==k&&"rgba(0, 0, 0, 0)"!==k&&(e+=""===e?'style="':";",e+=a.mso.styles[g]+":"+k)}}""!==e&&(t+=" "+e+'"');e=J(d);0<e&&(t+=' colspan="'+e+'"');e=T(d);0<e&&(t+=' rowspan="'+e+'"');t+=">"+D(d,c,f)+"</th>"}});0<t.length&&(H+="<tr>"+t+"</tr>");p++});H+="</thead><tbody>";w=C(b);d(w).each(function(){var b=d(this);t="";E(this,"td,th",p,r.length+ |
| | | w.length,function(c,g,f){if(null!==c){var e=D(c,g,f),n="",l=d(c).attr("data-tableexport-msonumberformat");"undefined"===typeof l&&"function"===typeof a.mso.onMsoNumberFormat&&(l=a.mso.onMsoNumberFormat(c,g,f));"undefined"!==typeof l&&""!==l&&(n="style=\"mso-number-format:'"+l+"'");if(a.mso.styles.length){g=document.defaultView.getComputedStyle(c,null);f=document.defaultView.getComputedStyle(b[0],null);for(var k in a.mso.styles)l=g[a.mso.styles[k]],""===l&&(l=f[a.mso.styles[k]]),""!==l&&"0px none rgb(0, 0, 0)"!== |
| | | l&&"rgba(0, 0, 0, 0)"!==l&&(n+=""===n?'style="':";",n+=a.mso.styles[k]+":"+l)}t+="<td";""!==n&&(t+=" "+n+'"');n=J(c);0<n&&(t+=' colspan="'+n+'"');c=T(c);0<c&&(t+=' rowspan="'+c+'"');"string"===typeof e&&""!==e&&(e=Ba(e),e=e.replace(/\n/g,"<br>"));t+=">"+e+"</td>"}});0<t.length&&(H+="<tr>"+t+"</tr>");p++});a.displayTableName&&(H+="<tr><td></td></tr><tr><td></td></tr><tr><td>"+D(d("<p>"+a.tableName+"</p>"))+"</td></tr>");H+="</tbody></table>"});m='<html xmlns:o="urn:schemas-microsoft-com:office:office" '+ |
| | | m+' xmlns="http://www.w3.org/TR/REC-html40">'+('<meta http-equiv="content-type" content="application/vnd.ms-'+k+'; charset=UTF-8">')+"<head>";"excel"===k&&(m+="\x3c!--[if gte mso 9]>",m+="<xml>",m+="<x:ExcelWorkbook>",m+="<x:ExcelWorksheets>",m+="<x:ExcelWorksheet>",m+="<x:Name>",m+=ca,m+="</x:Name>",m+="<x:WorksheetOptions>",m+="<x:DisplayGridlines/>",a.mso.rtl&&(m+="<x:DisplayRightToLeft/>"),m+="</x:WorksheetOptions>",m+="</x:ExcelWorksheet>",m+="</x:ExcelWorksheets>",m+="</x:ExcelWorkbook>",m+= |
| | | "</xml>",m+="<![endif]--\x3e");m+="<style>";m+="@page { size:"+a.mso.pageOrientation+"; mso-page-orientation:"+a.mso.pageOrientation+"; }";m+="@page Section1 {size:"+O[a.mso.pageFormat][0]+"pt "+O[a.mso.pageFormat][1]+"pt";m+="; margin:1.0in 1.25in 1.0in 1.25in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}";m+="div.Section1 {page:Section1;}";m+="@page Section2 {size:"+O[a.mso.pageFormat][1]+"pt "+O[a.mso.pageFormat][0]+"pt";m+=";mso-page-orientation:"+a.mso.pageOrientation+";margin:1.25in 1.0in 1.25in 1.0in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}"; |
| | | m+="div.Section2 {page:Section2;}";m+="br {mso-data-placement:same-cell;}";m+="</style>";m+="</head>";m+="<body>";m+='<div class="Section'+("landscape"===a.mso.pageOrientation?"2":"1")+'">';m+=H;m+="</div>";m+="</body>";m+="</html>";if("string"===a.outputMode)return m;if("base64"===a.outputMode)return L(m);N(m,a.fileName+"."+z,"application/vnd.ms-"+k,"","base64",!1)}else if("png"===a.type)html2canvas(d(B)[0]).then(function(b){b=b.toDataURL();for(var c=atob(b.substring(22)),d=new ArrayBuffer(c.length), |
| | | g=new Uint8Array(d),f=0;f<c.length;f++)g[f]=c.charCodeAt(f);if("string"===a.outputMode)return c;if("base64"===a.outputMode)return L(b);"window"===a.outputMode?window.open(b):N(d,a.fileName+".png","image/png","","",!1)});else if("pdf"===a.type)if(!0===a.pdfmake.enabled){var U={content:[]};d.extend(!0,U,a.pdfmake.docDefinition);G=[];d(B).filter(function(){return I(d(this))}).each(function(){var b=d(this),c=[],e=[];p=0;var g=function(a,b,c){var f=0;d(a).each(function(){var a=[];E(this,b,p,c,function(c, |
| | | d,f){if("undefined"!==typeof c&&null!==c){var e=J(c),h=T(c);c={text:D(c,d,f)||" "};if(1<e||1<h)c.colSpan=e||1,c.rowSpan=h||1}else c={text:" "};0<=b.indexOf("th")&&(c.style="header");a.push(c)});for(var d=a.length;d<c;d++)a.push("");a.length&&e.push(a);f<a.length&&(f=a.length);p++});return f};r=y(b);for(var f=g(r,"th,td",r.length),h=c.length;h<f;h++)c.push("*");w=C(b);f=g(w,"td",r.length+w.length);for(h=c.length;h<f;h++)c.push("*");U.content.push({table:{headerRows:r.length?r.length:null,widths:c, |
| | | body:e},layout:{layout:"noBorders",hLineStyle:function(a,b){return 0},vLineWidth:function(a,b){return 0},hLineColor:function(b,c){return b<c.table.headerRows?a.pdfmake.docDefinition.styles.header.background:a.pdfmake.docDefinition.styles.alternateRow.fillColor},vLineColor:function(b,c){return b<c.table.headerRows?a.pdfmake.docDefinition.styles.header.background:a.pdfmake.docDefinition.styles.alternateRow.fillColor},fillColor:function(b,c,d){return 0===b%2?a.pdfmake.docDefinition.styles.alternateRow.fillColor: |
| | | null}},pageBreak:U.content.length?"before":void 0})});"undefined"!==typeof pdfMake&&"undefined"!==typeof pdfMake.createPdf&&(pdfMake.fonts={Roboto:{normal:"Roboto-Regular.ttf",bold:"Roboto-Medium.ttf",italics:"Roboto-Italic.ttf",bolditalics:"Roboto-MediumItalic.ttf"}},pdfMake.vfs.hasOwnProperty("Mirza-Regular.ttf")?(U.defaultStyle.font="Mirza",d.extend(!0,pdfMake.fonts,{Mirza:{normal:"Mirza-Regular.ttf",bold:"Mirza-Bold.ttf",italics:"Mirza-Medium.ttf",bolditalics:"Mirza-SemiBold.ttf"}})):pdfMake.vfs.hasOwnProperty("gbsn00lp.ttf")? |
| | | (U.defaultStyle.font="gbsn00lp",d.extend(!0,pdfMake.fonts,{gbsn00lp:{normal:"gbsn00lp.ttf",bold:"gbsn00lp.ttf",italics:"gbsn00lp.ttf",bolditalics:"gbsn00lp.ttf"}})):pdfMake.vfs.hasOwnProperty("ZCOOLXiaoWei-Regular.ttf")&&(U.defaultStyle.font="ZCOOLXiaoWei",d.extend(!0,pdfMake.fonts,{ZCOOLXiaoWei:{normal:"ZCOOLXiaoWei-Regular.ttf",bold:"ZCOOLXiaoWei-Regular.ttf",italics:"ZCOOLXiaoWei-Regular.ttf",bolditalics:"ZCOOLXiaoWei-Regular.ttf"}})),d.extend(!0,pdfMake.fonts,a.pdfmake.fonts),pdfMake.createPdf(U).getBuffer(function(b){N(b, |
| | | a.fileName+".pdf","application/pdf","","",!1)}))}else if(!1===a.jspdf.autotable){k={dim:{w:ha(d(B).first().get(0),"width","mm"),h:ha(d(B).first().get(0),"height","mm")},pagesplit:!1};var Ha=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);Ha.addHTML(d(B).first(),a.jspdf.margins.left,a.jspdf.margins.top,k,function(){va(Ha,!1)})}else{var g=a.jspdf.autotable.tableExport;if("string"===typeof a.jspdf.format&&"bestfit"===a.jspdf.format.toLowerCase()){var ja="",da="",Ia=0;d(B).each(function(){if(I(d(this))){var a= |
| | | ha(d(this).get(0),"width","pt");if(a>Ia){a>O.a0[0]&&(ja="a0",da="l");for(var c in O)O.hasOwnProperty(c)&&O[c][1]>a&&(ja=c,da="l",O[c][0]>a&&(da="p"));Ia=a}}});a.jspdf.format=""===ja?"a4":ja;a.jspdf.orientation=""===da?"w":da}if(null==g.doc&&(g.doc=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format),g.wScaleFactor=1,g.hScaleFactor=1,"function"===typeof a.jspdf.onDocCreated))a.jspdf.onDocCreated(g.doc);!0===g.outputImages&&(g.images={});"undefined"!==typeof g.images&&(d(B).filter(function(){return I(d(this))}).each(function(){var b= |
| | | 0;G=[];!1===a.exportHiddenCells&&(K=d(this).find("tr, th, td").filter(":hidden"),V=0<K.length);r=y(d(this));w=C(d(this));d(w).each(function(){E(this,"td,th",r.length+b,r.length+w.length,function(a){xa(a,d(a).children(),g)});b++})}),r=[],w=[]);Ka(g,function(){d(B).filter(function(){return I(d(this))}).each(function(){var b;p=0;G=[];!1===a.exportHiddenCells&&(K=d(this).find("tr, th, td").filter(":hidden"),V=0<K.length);S=R(this);g.columns=[];g.rows=[];g.teCells={};if("function"===typeof g.onTable&& |
| | | !1===g.onTable(d(this),a))return!0;a.jspdf.autotable.tableExport=null;var c=d.extend(!0,{},a.jspdf.autotable);a.jspdf.autotable.tableExport=g;c.margin={};d.extend(!0,c.margin,a.jspdf.margins);c.tableExport=g;"function"!==typeof c.beforePageContent&&(c.beforePageContent=function(a){if(1===a.pageCount){var b=a.table.rows.concat(a.table.headerRow);d.each(b,function(){0<this.height&&(this.height+=(2-1.15)/2*this.styles.fontSize,a.table.height+=(2-1.15)/2*this.styles.fontSize)})}});"function"!==typeof c.createdHeaderCell&& |
| | | (c.createdHeaderCell=function(a,b){a.styles=d.extend({},b.row.styles);if("undefined"!==typeof g.columns[b.column.dataKey]){var e=g.columns[b.column.dataKey];if("undefined"!==typeof e.rect){a.contentWidth=e.rect.width;if("undefined"===typeof g.heightRatio||0===g.heightRatio){var f=b.row.raw[b.column.dataKey].rowspan?b.row.raw[b.column.dataKey].rect.height/b.row.raw[b.column.dataKey].rowspan:b.row.raw[b.column.dataKey].rect.height;g.heightRatio=a.styles.rowHeight/f}f=b.row.raw[b.column.dataKey].rect.height* |
| | | g.heightRatio;f>a.styles.rowHeight&&(a.styles.rowHeight=f)}a.styles.halign="inherit"===c.headerStyles.halign?"center":c.headerStyles.halign;a.styles.valign=c.headerStyles.valign;"undefined"!==typeof e.style&&!0!==e.style.hidden&&("inherit"===c.headerStyles.halign&&(a.styles.halign=e.style.align),"inherit"===c.styles.fillColor&&(a.styles.fillColor=e.style.bcolor),"inherit"===c.styles.textColor&&(a.styles.textColor=e.style.color),"inherit"===c.styles.fontStyle&&(a.styles.fontStyle=e.style.fstyle))}}); |
| | | "function"!==typeof c.createdCell&&(c.createdCell=function(a,b){b=g.teCells[b.row.index+":"+b.column.dataKey];a.styles.halign="inherit"===c.styles.halign?"center":c.styles.halign;a.styles.valign=c.styles.valign;"undefined"!==typeof b&&"undefined"!==typeof b.style&&!0!==b.style.hidden&&("inherit"===c.styles.halign&&(a.styles.halign=b.style.align),"inherit"===c.styles.fillColor&&(a.styles.fillColor=b.style.bcolor),"inherit"===c.styles.textColor&&(a.styles.textColor=b.style.color),"inherit"===c.styles.fontStyle&& |
| | | (a.styles.fontStyle=b.style.fstyle))});"function"!==typeof c.drawHeaderCell&&(c.drawHeaderCell=function(a,b){var c=g.columns[b.column.dataKey];return(!0!==c.style.hasOwnProperty("hidden")||!0!==c.style.hidden)&&0<=c.rowIndex?wa(a,b,c):!1});"function"!==typeof c.drawCell&&(c.drawCell=function(a,b){var c=g.teCells[b.row.index+":"+b.column.dataKey];if(!0!==("undefined"!==typeof c&&c.isCanvas))wa(a,b,c)&&(g.doc.rect(a.x,a.y,a.width,a.height,a.styles.fillStyle),"undefined"===typeof c||"undefined"!==typeof c.hasUserDefText&& |
| | | !0===c.hasUserDefText||"undefined"===typeof c.elements||!c.elements.length?Aa(a,{},g):(b=a.height/c.rect.height,b>g.hScaleFactor&&(g.hScaleFactor=b),g.wScaleFactor=a.width/c.rect.width,b=a.textPos.y,za(a,c.elements,g),a.textPos.y=b,Aa(a,c.elements,g)));else{c=c.elements[0];var e=d(c).attr("data-tableexport-canvas"),f=c.getBoundingClientRect();a.width=f.width*g.wScaleFactor;a.height=f.height*g.hScaleFactor;b.row.height=a.height;ua(a,c,e,g)}return!1});g.headerrows=[];r=y(d(this));d(r).each(function(){b= |
| | | 0;g.headerrows[p]=[];E(this,"th,td",p,r.length,function(a,c,d){var e=Ca(a);e.title=D(a,c,d);e.key=b++;e.rowIndex=p;g.headerrows[p].push(e)});p++});if(0<p)for(var e=p-1;0<=e;)d.each(g.headerrows[e],function(){var a=this;0<e&&null===this.rect&&(a=g.headerrows[e-1][this.key]);null!==a&&0<=a.rowIndex&&(!0!==a.style.hasOwnProperty("hidden")||!0!==a.style.hidden)&&g.columns.push(a)}),e=0<g.columns.length?-1:e-1;var k=0;w=[];w=C(d(this));d(w).each(function(){var a=[];b=0;E(this,"td,th",p,r.length+w.length, |
| | | function(c,e,f){if("undefined"===typeof g.columns[b]){var h={title:"",key:b,style:{hidden:!0}};g.columns.push(h)}a.push(D(c,e,f));"undefined"!==typeof c&&null!==c?(h=Ca(c),h.isCanvas=c.hasAttribute("data-tableexport-canvas"),h.elements=h.isCanvas?d(c):d(c).children(),"undefined"!==typeof d(c).data("teUserDefText")&&(h.hasUserDefText=!0)):(h=d.extend(!0,{},g.teCells[k+":"+(b-1)]),h.colspan=-1);g.teCells[k+":"+b++]=h});a.length&&(g.rows.push(a),k++);p++});if("function"===typeof g.onBeforeAutotable)g.onBeforeAutotable(d(this), |
| | | g.columns,g.rows,c);g.doc.autoTable(g.columns,g.rows,c);if("function"===typeof g.onAfterAutotable)g.onAfterAutotable(d(this),c);a.jspdf.autotable.startY=g.doc.autoTableEndPosY()+c.margin.top});va(g.doc,"undefined"!==typeof g.images&&!1===jQuery.isEmptyObject(g.images));"undefined"!==typeof g.headerrows&&(g.headerrows.length=0);"undefined"!==typeof g.columns&&(g.columns.length=0);"undefined"!==typeof g.rows&&(g.rows.length=0);delete g.doc;g.doc=null})}if("function"===typeof a.onTableExportEnd)a.onTableExportEnd(); |
| | | return this}})(jQuery); |
New file |
| | |
| | | /** |
| | | * @author: Dennis Hernández |
| | | * @update zhixin wen <wenzhixin2010@gmail.com> |
| | | */ |
| | | |
| | | const debounce = (func, wait) => { |
| | | let timeout = 0 |
| | | |
| | | return (...args) => { |
| | | const later = () => { |
| | | timeout = 0 |
| | | func(...args) |
| | | } |
| | | |
| | | clearTimeout(timeout) |
| | | timeout = setTimeout(later, wait) |
| | | } |
| | | } |
| | | |
| | | Object.assign($.fn.bootstrapTable.defaults, { |
| | | mobileResponsive: false, |
| | | minWidth: 562, |
| | | minHeight: undefined, |
| | | heightThreshold: 100, // just slightly larger than mobile chrome's auto-hiding toolbar |
| | | checkOnInit: true, |
| | | columnsHidden: [] |
| | | }) |
| | | |
| | | $.BootstrapTable = class extends $.BootstrapTable { |
| | | init (...args) { |
| | | super.init(...args) |
| | | |
| | | if (!this.options.mobileResponsive || !this.options.minWidth) { |
| | | return |
| | | } |
| | | |
| | | if (this.options.minWidth < 100 && this.options.resizable) { |
| | | console.warn('The minWidth when the resizable extension is active should be greater or equal than 100') |
| | | this.options.minWidth = 100 |
| | | } |
| | | |
| | | let old = { |
| | | width: $(window).width(), |
| | | height: $(window).height() |
| | | } |
| | | |
| | | $(window).on('resize orientationchange', debounce(() => { |
| | | // reset view if height has only changed by at least the threshold. |
| | | const width = $(window).width() |
| | | const height = $(window).height() |
| | | const $activeElement = $(document.activeElement) |
| | | |
| | | if ($activeElement.length && ['INPUT', 'SELECT', 'TEXTAREA'].includes($activeElement.prop('nodeName'))) { |
| | | return |
| | | } |
| | | |
| | | if ( |
| | | Math.abs(old.height - height) > this.options.heightThreshold || |
| | | old.width !== width |
| | | ) { |
| | | this.changeView(width, height) |
| | | old = { |
| | | width, |
| | | height |
| | | } |
| | | } |
| | | }, 200)) |
| | | |
| | | if (this.options.checkOnInit) { |
| | | const width = $(window).width() |
| | | const height = $(window).height() |
| | | |
| | | this.changeView(width, height) |
| | | old = { |
| | | width, |
| | | height |
| | | } |
| | | } |
| | | } |
| | | |
| | | conditionCardView () { |
| | | this.changeTableView(false) |
| | | this.showHideColumns(false) |
| | | } |
| | | |
| | | conditionFullView () { |
| | | this.changeTableView(true) |
| | | this.showHideColumns(true) |
| | | } |
| | | |
| | | changeTableView (cardViewState) { |
| | | this.options.cardView = cardViewState |
| | | this.toggleView() |
| | | } |
| | | |
| | | showHideColumns (checked) { |
| | | if (this.options.columnsHidden.length > 0) { |
| | | this.columns.forEach(column => { |
| | | if (this.options.columnsHidden.includes(column.field)) { |
| | | if (column.visible !== checked) { |
| | | this._toggleColumn(this.fieldsColumnsIndex[column.field], checked, true) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | changeView (width, height) { |
| | | if (this.options.minHeight) { |
| | | if (width <= this.options.minWidth && height <= this.options.minHeight) { |
| | | this.conditionCardView() |
| | | } else if (width > this.options.minWidth && height > this.options.minHeight) { |
| | | this.conditionFullView() |
| | | } |
| | | } else if (width <= this.options.minWidth) { |
| | | this.conditionCardView() |
| | | } else if (width > this.options.minWidth) { |
| | | this.conditionFullView() |
| | | } |
| | | |
| | | this.resetView() |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * @update zhixin wen <wenzhixin2010@gmail.com> |
| | | */ |
| | | |
| | | var Utils = $.fn.bootstrapTable.utils |
| | | |
| | | function printPageBuilderDefault (table, styles) { |
| | | return ` |
| | | <html> |
| | | <head> |
| | | ${styles} |
| | | <style type="text/css" media="print"> |
| | | @page { |
| | | size: auto; |
| | | margin: 25px 0 25px 0; |
| | | } |
| | | </style> |
| | | <style type="text/css" media="all"> |
| | | table { |
| | | border-collapse: collapse; |
| | | font-size: 12px; |
| | | } |
| | | table, th, td { |
| | | border: 1px solid grey; |
| | | } |
| | | th, td { |
| | | text-align: center; |
| | | vertical-align: middle; |
| | | } |
| | | p { |
| | | font-weight: bold; |
| | | margin-left:20px; |
| | | } |
| | | table { |
| | | width: 94%; |
| | | margin-left: 3%; |
| | | margin-right: 3%; |
| | | } |
| | | div.bs-table-print { |
| | | text-align: center; |
| | | } |
| | | </style> |
| | | </head> |
| | | <title>Print Table</title> |
| | | <body> |
| | | <p>Printed on: ${new Date} </p> |
| | | <div class="bs-table-print">${table}</div> |
| | | </body> |
| | | </html> |
| | | ` |
| | | } |
| | | |
| | | Object.assign($.fn.bootstrapTable.locales, { |
| | | formatPrint () { |
| | | return 'Print' |
| | | } |
| | | }) |
| | | Object.assign($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales) |
| | | |
| | | Object.assign($.fn.bootstrapTable.defaults, { |
| | | showPrint: false, |
| | | printAsFilteredAndSortedOnUI: true, |
| | | printSortColumn: undefined, |
| | | printSortOrder: 'asc', |
| | | printStyles: [], |
| | | printPageBuilder (table, styles) { |
| | | return printPageBuilderDefault(table, styles) |
| | | } |
| | | }) |
| | | |
| | | Object.assign($.fn.bootstrapTable.columnDefaults, { |
| | | printFilter: undefined, |
| | | printIgnore: false, |
| | | printFormatter: undefined |
| | | }) |
| | | |
| | | Object.assign($.fn.bootstrapTable.defaults.icons, { |
| | | print: { |
| | | bootstrap3: 'glyphicon-print icon-share', |
| | | bootstrap5: 'bi-printer', |
| | | 'bootstrap-table': 'icon-printer' |
| | | }[$.fn.bootstrapTable.theme] || 'fa-print' |
| | | }) |
| | | |
| | | $.BootstrapTable = class extends $.BootstrapTable { |
| | | init (...args) { |
| | | super.init(...args) |
| | | |
| | | if (!this.options.showPrint) { |
| | | return |
| | | } |
| | | |
| | | this.mergedCells = [] |
| | | } |
| | | |
| | | initToolbar (...args) { |
| | | this.showToolbar = this.showToolbar || this.options.showPrint |
| | | |
| | | if (this.options.showPrint) { |
| | | this.buttons = Object.assign(this.buttons, { |
| | | print: { |
| | | text: this.options.formatPrint(), |
| | | icon: this.options.icons.print, |
| | | event: () => { |
| | | this.doPrint(this.options.printAsFilteredAndSortedOnUI ? this.getData() : this.options.data.slice(0)) |
| | | }, |
| | | attributes: { |
| | | 'aria-label': this.options.formatPrint(), |
| | | title: this.options.formatPrint() |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | super.initToolbar(...args) |
| | | } |
| | | |
| | | mergeCells (options) { |
| | | super.mergeCells(options) |
| | | |
| | | if (!this.options.showPrint) { |
| | | return |
| | | } |
| | | |
| | | let col = this.getVisibleFields().indexOf(options.field) |
| | | |
| | | if (Utils.hasDetailViewIcon(this.options)) { |
| | | col += 1 |
| | | } |
| | | |
| | | this.mergedCells.push({ |
| | | row: options.index, |
| | | col, |
| | | rowspan: options.rowspan || 1, |
| | | colspan: options.colspan || 1 |
| | | }) |
| | | } |
| | | |
| | | doPrint (data) { |
| | | const canPrint = column => { |
| | | return !column.printIgnore && column.visible |
| | | } |
| | | |
| | | const formatValue = (row, i, column) => { |
| | | const value_ = Utils.getItemField(row, column.field, this.options.escape, column.escape) |
| | | const value = Utils.calculateObjectValue(column, |
| | | column.printFormatter || column.formatter, |
| | | [value_, row, i], value_) |
| | | |
| | | return typeof value === 'undefined' || value === null ? |
| | | this.options.undefinedText : value |
| | | } |
| | | |
| | | const buildTable = (data, columnsArray) => { |
| | | const dir = this.$el.attr('dir') || 'ltr' |
| | | const html = [`<table dir="${dir}"><thead>`] |
| | | |
| | | for (const columns of columnsArray) { |
| | | html.push('<tr>') |
| | | for (let h = 0; h < columns.length; h++) { |
| | | if (canPrint(columns[h])) { |
| | | html.push( |
| | | `<th |
| | | ${Utils.sprintf(' rowspan="%s"', columns[h].rowspan)} |
| | | ${Utils.sprintf(' colspan="%s"', columns[h].colspan)} |
| | | >${columns[h].title}</th>`) |
| | | } |
| | | } |
| | | html.push('</tr>') |
| | | } |
| | | |
| | | html.push('</thead><tbody>') |
| | | |
| | | const notRender = [] |
| | | |
| | | if (this.mergedCells) { |
| | | for (let mc = 0; mc < this.mergedCells.length; mc++) { |
| | | const currentMergedCell = this.mergedCells[mc] |
| | | |
| | | for (let rs = 0; rs < currentMergedCell.rowspan; rs++) { |
| | | const row = currentMergedCell.row + rs |
| | | |
| | | for (let cs = 0; cs < currentMergedCell.colspan; cs++) { |
| | | const col = currentMergedCell.col + cs |
| | | |
| | | notRender.push(`${row},${col}`) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (let i = 0; i < data.length; i++) { |
| | | html.push('<tr>') |
| | | |
| | | const columns = columnsArray.flat(1) |
| | | |
| | | columns.sort((c1, c2) => { |
| | | return c1.colspanIndex - c2.colspanIndex |
| | | }) |
| | | |
| | | for (let j = 0; j < columns.length; j++) { |
| | | if (columns[j].colspanGroup > 0) continue |
| | | |
| | | let rowspan = 0 |
| | | let colspan = 0 |
| | | |
| | | if (this.mergedCells) { |
| | | for (let mc = 0; mc < this.mergedCells.length; mc++) { |
| | | const currentMergedCell = this.mergedCells[mc] |
| | | |
| | | if (currentMergedCell.col === j && currentMergedCell.row === i) { |
| | | rowspan = currentMergedCell.rowspan |
| | | colspan = currentMergedCell.colspan |
| | | } |
| | | } |
| | | } |
| | | |
| | | if ( |
| | | canPrint(columns[j]) && |
| | | ( |
| | | !notRender.includes(`${i},${j}`) || |
| | | rowspan > 0 && colspan > 0 |
| | | ) |
| | | ) { |
| | | if (rowspan > 0 && colspan > 0) { |
| | | html.push(`<td ${Utils.sprintf(' rowspan="%s"', rowspan)} ${Utils.sprintf(' colspan="%s"', colspan)}>`, formatValue(data[i], i, columns[j]), '</td>') |
| | | } else { |
| | | html.push('<td>', formatValue(data[i], i, columns[j]), '</td>') |
| | | } |
| | | } |
| | | } |
| | | |
| | | html.push('</tr>') |
| | | } |
| | | |
| | | html.push('</tbody>') |
| | | if (this.options.showFooter) { |
| | | html.push('<footer><tr>') |
| | | |
| | | for (const columns of columnsArray) { |
| | | for (let h = 0; h < columns.length; h++) { |
| | | if (canPrint(columns)) { |
| | | const footerData = Utils.trToData(columns, this.$el.find('>tfoot>tr')) |
| | | const footerValue = Utils.calculateObjectValue(columns[h], columns[h].footerFormatter, [data], footerData[0] && footerData[0][columns[h].field] || '') |
| | | |
| | | html.push(`<th>${footerValue}</th>`) |
| | | } |
| | | } |
| | | } |
| | | |
| | | html.push('</tr></footer>') |
| | | } |
| | | html.push('</table>') |
| | | return html.join('') |
| | | } |
| | | |
| | | const sortRows = (data, colName, sortOrder) => { |
| | | if (!colName) { |
| | | return data |
| | | } |
| | | let reverse = sortOrder !== 'asc' |
| | | |
| | | reverse = -(+reverse || -1) |
| | | return data.sort((a, b) => reverse * a[colName].localeCompare(b[colName])) |
| | | } |
| | | |
| | | const filterRow = (row, filters) => { |
| | | for (let index = 0; index < filters.length; ++index) { |
| | | if (row[filters[index].colName] !== filters[index].value) { |
| | | return false |
| | | } |
| | | } |
| | | return true |
| | | } |
| | | |
| | | const filterRows = (data, filters) => data.filter(row => filterRow(row, filters)) |
| | | const getColumnFilters = columns => !columns || !columns[0] ? [] : columns[0].filter(col => col.printFilter).map(col => ({ |
| | | colName: col.field, |
| | | value: col.printFilter |
| | | })) |
| | | |
| | | data = filterRows(data, getColumnFilters(this.options.columns)) |
| | | data = sortRows(data, this.options.printSortColumn, this.options.printSortOrder) |
| | | const table = buildTable(data, this.options.columns) |
| | | const newWin = window.open('') |
| | | const printStyles = typeof this.options.printStyles === 'string' ? |
| | | this.options.printStyles.replace(/\[|\]| /g, '').toLowerCase().split(',') : |
| | | this.options.printStyles |
| | | const styles = printStyles.map(it => |
| | | `<link rel="stylesheet" href="${it}" />`).join('') |
| | | |
| | | const calculatedPrintPage = Utils.calculateObjectValue(this, this.options.printPageBuilder, |
| | | [table, styles], printPageBuilderDefault(table, styles)) |
| | | const startPrint = () => { |
| | | newWin.focus() |
| | | newWin.print() |
| | | newWin.close() |
| | | } |
| | | |
| | | newWin.document.write(calculatedPrintPage) |
| | | newWin.document.close() |
| | | |
| | | if (printStyles.length) { |
| | | const links = document.getElementsByTagName('link') |
| | | const lastLink = links[links.length - 1] |
| | | |
| | | lastLink.onload = startPrint |
| | | } else { |
| | | startPrint() |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * @author: Dennis Hernández |
| | | * @update: https://github.com/wenzhixin |
| | | * @version: v1.2.0 |
| | | */ |
| | | |
| | | $.akottr.dragtable.prototype._restoreState = function (persistObj) { |
| | | let i = 0 |
| | | |
| | | for (const [field, value] of Object.entries(persistObj)) { |
| | | const $th = this.originalTable.el.find(`th[data-field="${field}"]`) |
| | | |
| | | if (!$th.length) { |
| | | i++ |
| | | continue |
| | | } |
| | | |
| | | this.originalTable.startIndex = $th.prevAll().length + 1 |
| | | this.originalTable.endIndex = parseInt(value, 10) + 1 - i |
| | | this._bubbleCols() |
| | | } |
| | | } |
| | | |
| | | // From MDN site, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter |
| | | const filterFn = () => { |
| | | if (!Array.prototype.filter) { |
| | | Array.prototype.filter = function (fun/* , thisArg*/) { |
| | | if (this === undefined || this === null) { |
| | | throw new TypeError() |
| | | } |
| | | |
| | | const t = Object(this) |
| | | const len = t.length >>> 0 |
| | | |
| | | if (typeof fun !== 'function') { |
| | | throw new TypeError() |
| | | } |
| | | |
| | | const res = [] |
| | | const thisArg = arguments.length >= 2 ? arguments[1] : undefined |
| | | |
| | | for (let i = 0; i < len; i++) { |
| | | if (i in t) { |
| | | const val = t[i] |
| | | |
| | | // NOTE: Technically this should Object.defineProperty at |
| | | // the next index, as push can be affected by |
| | | // properties on Object.prototype and Array.prototype. |
| | | // But this method's new, and collisions should be |
| | | // rare, so use the more-compatible alternative. |
| | | if (fun.call(thisArg, val, i, t)) { |
| | | res.push(val) |
| | | } |
| | | } |
| | | } |
| | | |
| | | return res |
| | | } |
| | | } |
| | | } |
| | | |
| | | Object.assign($.fn.bootstrapTable.defaults, { |
| | | reorderableColumns: false, |
| | | maxMovingRows: 10, |
| | | // eslint-disable-next-line no-unused-vars |
| | | onReorderColumn (headerFields) { |
| | | return false |
| | | }, |
| | | dragaccept: null |
| | | }) |
| | | |
| | | Object.assign($.fn.bootstrapTable.events, { |
| | | 'reorder-column.bs.table': 'onReorderColumn' |
| | | }) |
| | | |
| | | $.fn.bootstrapTable.methods.push('orderColumns') |
| | | |
| | | $.BootstrapTable = class extends $.BootstrapTable { |
| | | initHeader (...args) { |
| | | super.initHeader(...args) |
| | | |
| | | if (!this.options.reorderableColumns) { |
| | | return |
| | | } |
| | | |
| | | this.makeColumnsReorderable() |
| | | } |
| | | |
| | | _toggleColumn (...args) { |
| | | super._toggleColumn(...args) |
| | | |
| | | if (!this.options.reorderableColumns) { |
| | | return |
| | | } |
| | | |
| | | this.makeColumnsReorderable() |
| | | } |
| | | |
| | | toggleView (...args) { |
| | | super.toggleView(...args) |
| | | |
| | | if (!this.options.reorderableColumns) { |
| | | return |
| | | } |
| | | |
| | | if (this.options.cardView) { |
| | | return |
| | | } |
| | | |
| | | this.makeColumnsReorderable() |
| | | } |
| | | |
| | | resetView (...args) { |
| | | super.resetView(...args) |
| | | |
| | | if (!this.options.reorderableColumns) { |
| | | return |
| | | } |
| | | |
| | | this.makeColumnsReorderable() |
| | | } |
| | | |
| | | makeColumnsReorderable (order = null) { |
| | | try { |
| | | $(this.$el).dragtable('destroy') |
| | | } catch (e) { |
| | | // do nothing |
| | | } |
| | | $(this.$el).dragtable({ |
| | | maxMovingRows: this.options.maxMovingRows, |
| | | dragaccept: this.options.dragaccept, |
| | | clickDelay: 200, |
| | | dragHandle: '.th-inner', |
| | | restoreState: order ? order : this.columnsSortOrder, |
| | | beforeStop: table => { |
| | | const sortOrder = {} |
| | | |
| | | table.el.find('th').each((i, el) => { |
| | | sortOrder[$(el).data('field')] = i |
| | | }) |
| | | |
| | | this.columnsSortOrder = sortOrder |
| | | if (this.options.cookie) { |
| | | this.persistReorderColumnsState(this) |
| | | } |
| | | |
| | | const ths = [] |
| | | const formatters = [] |
| | | const columns = [] |
| | | let columnsHidden = [] |
| | | let columnIndex = -1 |
| | | const optionsColumns = [] |
| | | |
| | | this.$header.find('th:not(.detail)').each((i, el) => { |
| | | ths.push($(el).data('field')) |
| | | formatters.push($(el).data('formatter')) |
| | | }) |
| | | |
| | | // Exist columns not shown |
| | | if (ths.length < this.columns.length) { |
| | | columnsHidden = this.columns.filter(column => !column.visible) |
| | | for (let i = 0; i < columnsHidden.length; i++) { |
| | | ths.push(columnsHidden[i].field) |
| | | formatters.push(columnsHidden[i].formatter) |
| | | } |
| | | } |
| | | |
| | | for (let i = 0; i < ths.length; i++) { |
| | | columnIndex = this.fieldsColumnsIndex[ths[i]] |
| | | if (columnIndex !== -1) { |
| | | this.fieldsColumnsIndex[ths[i]] = i |
| | | this.columns[columnIndex].fieldIndex = i |
| | | columns.push(this.columns[columnIndex]) |
| | | } |
| | | } |
| | | |
| | | this.columns = columns |
| | | |
| | | filterFn() // Support <IE9 |
| | | $.each(this.columns, (i, column) => { |
| | | let found = false |
| | | const field = column.field |
| | | |
| | | this.options.columns[0].filter(item => { |
| | | if (!found && item['field'] === field) { |
| | | optionsColumns.push(item) |
| | | found = true |
| | | return false |
| | | } |
| | | return true |
| | | }) |
| | | }) |
| | | |
| | | this.options.columns[0] = optionsColumns |
| | | |
| | | this.header.fields = ths |
| | | this.header.formatters = formatters |
| | | this.initHeader() |
| | | this.initToolbar() |
| | | this.initSearchText() |
| | | this.initBody() |
| | | this.resetView() |
| | | this.trigger('reorder-column', ths) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | orderColumns (order) { |
| | | this.columnsSortOrder = order |
| | | this.makeColumnsReorderable() |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * Minified by jsDelivr using Terser v5.3.5. |
| | | * Original file: /gh/akottr/dragtable@master/jquery.dragtable.js |
| | | * |
| | | * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files |
| | | */ |
| | | /*! |
| | | * dragtable |
| | | * |
| | | * @Version 2.0.15 |
| | | * |
| | | * Copyright (c) 2010-2013, Andres akottr@gmail.com |
| | | * Dual licensed under the MIT (MIT-LICENSE.txt) |
| | | * and GPL (GPL-LICENSE.txt) licenses. |
| | | * |
| | | * Inspired by the the dragtable from Dan Vanderkam (danvk.org/dragtable/) |
| | | * Thanks to the jquery and jqueryui comitters |
| | | * |
| | | * Any comment, bug report, feature-request is welcome |
| | | * Feel free to contact me. |
| | | */ |
| | | !function(e){e.widget("akottr.dragtable",{options:{revert:!1,dragHandle:".table-handle",maxMovingRows:40,excludeFooter:!1,onlyHeaderThreshold:100,dragaccept:null,persistState:null,restoreState:null,exact:!0,clickDelay:10,containment:null,cursor:"move",cursorAt:!1,distance:0,tolerance:"pointer",axis:"x",beforeStart:e.noop,beforeMoving:e.noop,beforeReorganize:e.noop,beforeStop:e.noop},originalTable:{el:null,selectedHandle:null,sortOrder:null,startIndex:0,endIndex:0},sortableTable:{el:e(),selectedHandle:e(),movingRow:e()},persistState:function(){var t=this;this.originalTable.el.find("th").each((function(e){""!==this.id&&(t.originalTable.sortOrder[this.id]=e)})),e.ajax({url:this.options.persistState,data:this.originalTable.sortOrder})},_restoreState:function(t){for(var i in t)this.originalTable.startIndex=e("#"+i).closest("th").prevAll().length+1,this.originalTable.endIndex=parseInt(t[i],10)+1,this._bubbleCols()},_bubbleCols:function(){var e,t,i,o,a=this.originalTable.startIndex,l=this.originalTable.endIndex,s=this.originalTable.el.children();if(this.options.excludeFooter&&(s=s.not("tfoot")),a<l)for(e=a;e<l;e++)for(i=s.find("> tr > td:nth-child("+e+")").add(s.find("> tr > th:nth-child("+e+")")),o=s.find("> tr > td:nth-child("+(e+1)+")").add(s.find("> tr > th:nth-child("+(e+1)+")")),t=0;t<i.length;t++)n(i[t],o[t]);else for(e=a;e>l;e--)for(i=s.find("> tr > td:nth-child("+e+")").add(s.find("> tr > th:nth-child("+e+")")),o=s.find("> tr > td:nth-child("+(e-1)+")").add(s.find("> tr > th:nth-child("+(e-1)+")")),t=0;t<i.length;t++)n(i[t],o[t])},_rearrangeTableBackroundProcessing:function(){var n=this;return function(){n._bubbleCols(),n.options.beforeStop(n.originalTable),n.sortableTable.el.remove(),function(){e("#__dragtable_disable_text_selection__").remove(),t?e(document.body).attr("onselectstart",t):e(document.body).removeAttr("onselectstart");i?e(document.body).attr("unselectable",i):e(document.body).removeAttr("unselectable")}(),null!==n.options.persistState&&(e.isFunction(n.options.persistState)?n.options.persistState(n.originalTable):n.persistState())}},_rearrangeTable:function(){var e=this;return function(){e.originalTable.selectedHandle.removeClass("dragtable-handle-selected"),e.sortableTable.el.sortable("disable"),e.sortableTable.el.addClass("dragtable-disabled"),e.options.beforeReorganize(e.originalTable,e.sortableTable),e.originalTable.endIndex=e.sortableTable.movingRow.prevAll().length+1,setTimeout(e._rearrangeTableBackroundProcessing(),50)}},_generateSortable:function(t){!t.cancelBubble&&(t.cancelBubble=!0);for(var i=this,n=this.originalTable.el[0].attributes,o="",a=0;a<n.length;a++)n[a].nodeValue&&"id"!=n[a].nodeName&&"width"!=n[a].nodeName&&(o+=n[a].nodeName+'="'+n[a].nodeValue+'" ');var l=[],s=[];this.originalTable.el.find("tr").slice(0,this.options.maxMovingRows).each((function(t,i){for(var n=this.attributes,o="",a=0;a<n.length;a++)n[a].nodeValue&&"id"!=n[a].nodeName&&(o+=" "+n[a].nodeName+'="'+n[a].nodeValue+'"');l.push(o),s.push(e(this).height())}));var r=[],d=0,h=i.originalTable.el.children();if(this.options.excludeFooter&&(h=h.not("tfoot")),h.find("> tr > th").each((function(t,i){var n=e(this).is(":visible")?e(this).outerWidth():0;r.push(n),d+=n})),i.options.exact){var c=d-i.originalTable.el.outerWidth();r[0]-=c}var b='<ul class="dragtable-sortable" style="position:absolute; width:'+(d+=2)+'px;">';h.find("> tr > th").each((function(t,n){var a=e(this).is(":visible")?e(this).outerWidth():0;b+='<li style="width:'+a+'px;">',b+="<table "+o+">";var r=h.find("> tr > th:nth-child("+(t+1)+")");i.options.maxMovingRows>1&&(r=r.add(h.find("> tr > td:nth-child("+(t+1)+")").slice(0,i.options.maxMovingRows-1))),r.each((function(t){var i=e(this).clone().wrap("<div></div>").parent().html();0===i.toLowerCase().indexOf("<th")&&(b+="<thead>"),b+="<tr "+l[t]+'" style="height:'+s[t]+'px;">',b+=i,0===i.toLowerCase().indexOf("<th")&&(b+="</thead>"),b+="</tr>"})),b+="</table>",b+="</li>"})),b+="</ul>",this.sortableTable.el=this.originalTable.el.before(b).prev(),this.sortableTable.el.find("> li > table").each((function(t,i){e(this).css("width",r[t]+"px")})),this.sortableTable.selectedHandle=this.sortableTable.el.find("th .dragtable-handle-selected");var u,g=this.options.dragaccept?"li:has("+this.options.dragaccept+")":"li";this.sortableTable.el.sortable({items:g,stop:this._rearrangeTable(),revert:this.options.revert,tolerance:this.options.tolerance,containment:this.options.containment,cursor:this.options.cursor,cursorAt:this.options.cursorAt,distance:this.options.distance,axis:this.options.axis}),this.originalTable.startIndex=e(t.target).closest("th").prevAll().length+1,this.options.beforeMoving(this.originalTable,this.sortableTable),this.sortableTable.movingRow=this.sortableTable.el.find("> li:nth-child("+this.originalTable.startIndex+")"),u=e('<style id="__dragtable_disable_text_selection__" type="text/css">body { -ms-user-select:none;-moz-user-select:-moz-none;-khtml-user-select:none;-webkit-user-select:none;user-select:none; }</style>'),e(document.head).append(u),e(document.body).attr("onselectstart","return false;").attr("unselectable","on"),window.getSelection?window.getSelection().removeAllRanges():document.selection.empty(),this.sortableTable.movingRow.trigger(e.extend(e.Event(t.type),{which:1,clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY,screenX:t.screenX,screenY:t.screenY}));var p=this.sortableTable.el.find(".ui-sortable-placeholder");!p.height()<=0&&p.css("height",this.sortableTable.el.find(".ui-sortable-helper").height()),p.html('<div class="outer" style="height:100%;"><div class="inner" style="height:100%;"></div></div>')},bindTo:{},_create:function(){this.originalTable={el:this.element,selectedHandle:e(),sortOrder:{},startIndex:0,endIndex:0},this.bindTo=this.originalTable.el.find("th"),this.options.dragaccept&&(this.bindTo=this.bindTo.filter(this.options.dragaccept)),this.bindTo.find(this.options.dragHandle).length>0&&(this.bindTo=this.bindTo.find(this.options.dragHandle)),null!==this.options.restoreState&&(e.isFunction(this.options.restoreState)?this.options.restoreState(this.originalTable):this._restoreState(this.options.restoreState));var t=this;this.bindTo.mousedown((function(i){1===i.which&&!1!==t.options.beforeStart(t.originalTable)&&(clearTimeout(this.downTimer),this.downTimer=setTimeout((function(){t.originalTable.selectedHandle=e(this),t.originalTable.selectedHandle.addClass("dragtable-handle-selected"),t._generateSortable(i)}),t.options.clickDelay))})).mouseup((function(e){clearTimeout(this.downTimer)}))},redraw:function(){this.destroy(),this._create()},destroy:function(){this.bindTo.unbind("mousedown"),e.Widget.prototype.destroy.apply(this,arguments)}});var t=e(document.body).attr("onselectstart"),i=e(document.body).attr("unselectable");function n(e,t){var i=e.parentNode,n=e.nextSibling===t?e:e.nextSibling;t.parentNode.insertBefore(e,t),i.insertBefore(t,n)}}(jQuery); |
New file |
| | |
| | | /** |
| | | * @author: Dennis Hernández |
| | | * @update zhixin wen <wenzhixin2010@gmail.com> |
| | | */ |
| | | |
| | | const rowAttr = (row, index) => ({ |
| | | id: `customId_${index}` |
| | | }) |
| | | |
| | | Object.assign($.fn.bootstrapTable.defaults, { |
| | | reorderableRows: false, |
| | | onDragStyle: null, |
| | | onDropStyle: null, |
| | | onDragClass: 'reorder-rows-on-drag-class', |
| | | dragHandle: '>tbody>tr>td:not(.bs-checkbox)', |
| | | useRowAttrFunc: false, |
| | | // eslint-disable-next-line no-unused-vars |
| | | onReorderRowsDrag (row) { |
| | | return false |
| | | }, |
| | | // eslint-disable-next-line no-unused-vars |
| | | onReorderRowsDrop (row) { |
| | | return false |
| | | }, |
| | | // eslint-disable-next-line no-unused-vars |
| | | onReorderRow (newData) { |
| | | return false |
| | | }, |
| | | onDragStop () {}, |
| | | onAllowDrop () { |
| | | return true |
| | | } |
| | | }) |
| | | |
| | | Object.assign($.fn.bootstrapTable.events, { |
| | | 'reorder-row.bs.table': 'onReorderRow' |
| | | }) |
| | | |
| | | $.BootstrapTable = class extends $.BootstrapTable { |
| | | init (...args) { |
| | | if (!this.options.reorderableRows) { |
| | | super.init(...args) |
| | | return |
| | | } |
| | | |
| | | if (this.options.useRowAttrFunc) { |
| | | this.options.rowAttributes = rowAttr |
| | | } |
| | | |
| | | const onPostBody = this.options.onPostBody |
| | | |
| | | this.options.onPostBody = () => { |
| | | setTimeout(() => { |
| | | this.makeRowsReorderable() |
| | | onPostBody.call(this.options, this.options.data) |
| | | }, 1) |
| | | } |
| | | |
| | | super.init(...args) |
| | | } |
| | | |
| | | makeRowsReorderable () { |
| | | this.$el.tableDnD({ |
| | | onDragStyle: this.options.onDragStyle, |
| | | onDropStyle: this.options.onDropStyle, |
| | | onDragClass: this.options.onDragClass, |
| | | onAllowDrop: (hoveredRow, draggedRow) => this.onAllowDrop(hoveredRow, draggedRow), |
| | | onDragStop: (table, draggedRow) => this.onDragStop(table, draggedRow), |
| | | onDragStart: (table, droppedRow) => this.onDropStart(table, droppedRow), |
| | | onDrop: (table, droppedRow) => this.onDrop(table, droppedRow), |
| | | dragHandle: this.options.dragHandle |
| | | }) |
| | | } |
| | | |
| | | onDropStart (table, draggingTd) { |
| | | this.$draggingTd = $(draggingTd).css('cursor', 'move') |
| | | this.draggingIndex = $(this.$draggingTd.parent()).data('index') |
| | | // Call the user defined function |
| | | this.options.onReorderRowsDrag(this.data[this.draggingIndex]) |
| | | } |
| | | |
| | | onDragStop (table, draggedRow) { |
| | | const rowIndexDraggedRow = $(draggedRow).data('index') |
| | | const draggedRowItem = this.data[rowIndexDraggedRow] |
| | | |
| | | this.options.onDragStop(table, draggedRowItem, draggedRow) |
| | | } |
| | | |
| | | onAllowDrop (hoveredRow, draggedRow) { |
| | | const rowIndexDraggedRow = $(draggedRow).data('index') |
| | | const rowIndexHoveredRow = $(hoveredRow).data('index') |
| | | const draggedRowItem = this.data[rowIndexDraggedRow] |
| | | const hoveredRowItem = this.data[rowIndexHoveredRow] |
| | | |
| | | return this.options.onAllowDrop(hoveredRowItem, draggedRowItem, hoveredRow, draggedRow) |
| | | } |
| | | |
| | | onDrop (table) { |
| | | this.$draggingTd.css('cursor', '') |
| | | const pageNum = this.options.pageNumber |
| | | const pageSize = this.options.pageSize |
| | | const newData = [] |
| | | |
| | | for (let i = 0; i < table.tBodies[0].rows.length; i++) { |
| | | const $tr = $(table.tBodies[0].rows[i]) |
| | | |
| | | newData.push(this.data[$tr.data('index')]) |
| | | $tr.data('index', i) |
| | | } |
| | | |
| | | const draggingRow = this.data[this.draggingIndex] |
| | | const droppedIndex = newData.indexOf(this.data[this.draggingIndex]) |
| | | const droppedRow = this.data[droppedIndex] |
| | | const index = (pageNum - 1) * pageSize + this.options.data.indexOf(this.data[droppedIndex]) |
| | | |
| | | this.options.data.splice(this.options.data.indexOf(draggingRow), 1) |
| | | this.options.data.splice(index, 0, draggingRow) |
| | | |
| | | this.initSearch() |
| | | |
| | | if (this.options.sidePagination === 'server') { |
| | | this.data = [...this.options.data] |
| | | } |
| | | |
| | | // Call the user defined function |
| | | this.options.onReorderRowsDrop(droppedRow) |
| | | |
| | | // Call the event reorder-row |
| | | this.trigger('reorder-row', newData, draggingRow, droppedRow) |
| | | } |
| | | |
| | | initSearch () { |
| | | this.ignoreInitSort = true |
| | | super.initSearch() |
| | | } |
| | | |
| | | initSort () { |
| | | if (this.ignoreInitSort) { |
| | | this.ignoreInitSort = false |
| | | return |
| | | } |
| | | |
| | | super.initSort() |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * TableDnD plug-in for JQuery, allows you to drag and drop table rows |
| | | * You can set up various options to control how the system will work |
| | | * Copyright (c) Denis Howlett <denish@isocra.com> |
| | | * License: MIT. |
| | | * See https://github.com/isocra/TableDnD |
| | | */ |
| | | !function ($, window, document, undefined) { |
| | | |
| | | var startEvent = 'touchstart mousedown', |
| | | moveEvent = 'touchmove mousemove', |
| | | endEvent = 'touchend mouseup'; |
| | | |
| | | $(document).ready(function () { |
| | | function parseStyle(css) { |
| | | var objMap = {}, |
| | | parts = css.match(/([^;:]+)/g) || []; |
| | | while (parts.length) |
| | | objMap[parts.shift()] = parts.shift().trim(); |
| | | |
| | | return objMap; |
| | | } |
| | | $('table').each(function () { |
| | | if ($(this).data('table') === 'dnd') { |
| | | |
| | | $(this).tableDnD({ |
| | | onDragStyle: $(this).data('ondragstyle') && parseStyle($(this).data('ondragstyle')) || null, |
| | | onDropStyle: $(this).data('ondropstyle') && parseStyle($(this).data('ondropstyle')) || null, |
| | | onDragClass: $(this).data('ondragclass') === undefined && "tDnD_whileDrag" || $(this).data('ondragclass'), |
| | | onDrop: $(this).data('ondrop') && new Function('table', 'row', $(this).data('ondrop')), // 'return eval("'+$(this).data('ondrop')+'");') || null, |
| | | onDragStart: $(this).data('ondragstart') && new Function('table', 'row' ,$(this).data('ondragstart')), // 'return eval("'+$(this).data('ondragstart')+'");') || null, |
| | | onDragStop: $(this).data('ondragstop') && new Function('table', 'row' ,$(this).data('ondragstop')), |
| | | scrollAmount: $(this).data('scrollamount') || 5, |
| | | sensitivity: $(this).data('sensitivity') || 10, |
| | | hierarchyLevel: $(this).data('hierarchylevel') || 0, |
| | | indentArtifact: $(this).data('indentartifact') || '<div class="indent"> </div>', |
| | | autoWidthAdjust: $(this).data('autowidthadjust') || true, |
| | | autoCleanRelations: $(this).data('autocleanrelations') || true, |
| | | jsonPretifySeparator: $(this).data('jsonpretifyseparator') || '\t', |
| | | serializeRegexp: $(this).data('serializeregexp') && new RegExp($(this).data('serializeregexp')) || /[^\-]*$/, |
| | | serializeParamName: $(this).data('serializeparamname') || false, |
| | | dragHandle: $(this).data('draghandle') || null |
| | | }); |
| | | } |
| | | |
| | | |
| | | }); |
| | | }); |
| | | |
| | | jQuery.tableDnD = { |
| | | /** Keep hold of the current table being dragged */ |
| | | currentTable: null, |
| | | /** Keep hold of the current drag object if any */ |
| | | dragObject: null, |
| | | /** The current mouse offset */ |
| | | mouseOffset: null, |
| | | /** Remember the old value of X and Y so that we don't do too much processing */ |
| | | oldX: 0, |
| | | oldY: 0, |
| | | |
| | | /** Actually build the structure */ |
| | | build: function(options) { |
| | | // Set up the defaults if any |
| | | |
| | | this.each(function() { |
| | | // This is bound to each matching table, set up the defaults and override with user options |
| | | this.tableDnDConfig = $.extend({ |
| | | onDragStyle: null, |
| | | onDropStyle: null, |
| | | // Add in the default class for whileDragging |
| | | onDragClass: "tDnD_whileDrag", |
| | | onDrop: null, |
| | | onDragStart: null, |
| | | onDragStop: null, |
| | | scrollAmount: 5, |
| | | /** Sensitivity setting will throttle the trigger rate for movement detection */ |
| | | sensitivity: 10, |
| | | /** Hierarchy level to support parent child. 0 switches this functionality off */ |
| | | hierarchyLevel: 0, |
| | | /** The html artifact to prepend the first cell with as indentation */ |
| | | indentArtifact: '<div class="indent"> </div>', |
| | | /** Automatically adjust width of first cell */ |
| | | autoWidthAdjust: true, |
| | | /** Automatic clean-up to ensure relationship integrity */ |
| | | autoCleanRelations: true, |
| | | /** Specify a number (4) as number of spaces or any indent string for JSON.stringify */ |
| | | jsonPretifySeparator: '\t', |
| | | /** The regular expression to use to trim row IDs */ |
| | | serializeRegexp: /[^\-]*$/, |
| | | /** If you want to specify another parameter name instead of the table ID */ |
| | | serializeParamName: false, |
| | | /** If you give the name of a class here, then only Cells with this class will be draggable */ |
| | | dragHandle: null |
| | | }, options || {}); |
| | | |
| | | // Now make the rows draggable |
| | | $.tableDnD.makeDraggable(this); |
| | | // Prepare hierarchy support |
| | | this.tableDnDConfig.hierarchyLevel |
| | | && $.tableDnD.makeIndented(this); |
| | | }); |
| | | |
| | | // Don't break the chain |
| | | return this; |
| | | }, |
| | | makeIndented: function (table) { |
| | | var config = table.tableDnDConfig, |
| | | rows = table.rows, |
| | | firstCell = $(rows).first().find('td:first')[0], |
| | | indentLevel = 0, |
| | | cellWidth = 0, |
| | | longestCell, |
| | | tableStyle; |
| | | |
| | | if ($(table).hasClass('indtd')) |
| | | return null; |
| | | |
| | | tableStyle = $(table).addClass('indtd').attr('style'); |
| | | $(table).css({whiteSpace: "nowrap"}); |
| | | |
| | | for (var w = 0; w < rows.length; w++) { |
| | | if (cellWidth < $(rows[w]).find('td:first').text().length) { |
| | | cellWidth = $(rows[w]).find('td:first').text().length; |
| | | longestCell = w; |
| | | } |
| | | } |
| | | $(firstCell).css({width: 'auto'}); |
| | | for (w = 0; w < config.hierarchyLevel; w++) |
| | | $(rows[longestCell]).find('td:first').prepend(config.indentArtifact); |
| | | firstCell && $(firstCell).css({width: firstCell.offsetWidth}); |
| | | tableStyle && $(table).css(tableStyle); |
| | | |
| | | for (w = 0; w < config.hierarchyLevel; w++) |
| | | $(rows[longestCell]).find('td:first').children(':first').remove(); |
| | | |
| | | config.hierarchyLevel |
| | | && $(rows).each(function () { |
| | | indentLevel = $(this).data('level') || 0; |
| | | indentLevel <= config.hierarchyLevel |
| | | && $(this).data('level', indentLevel) |
| | | || $(this).data('level', 0); |
| | | for (var i = 0; i < $(this).data('level'); i++) |
| | | $(this).find('td:first').prepend(config.indentArtifact); |
| | | }); |
| | | |
| | | return this; |
| | | }, |
| | | /** This function makes all the rows on the table draggable apart from those marked as "NoDrag" */ |
| | | makeDraggable: function(table) { |
| | | var config = table.tableDnDConfig; |
| | | |
| | | config.dragHandle |
| | | // We only need to add the event to the specified cells |
| | | && $(config.dragHandle, table).each(function() { |
| | | if (! $(this).hasClass("nodrag")) { |
| | | // The cell is bound to "this" |
| | | $(this).bind(startEvent, function(e) { |
| | | if (e.target.tagName === "TD" && event.target.className !== "nodrag") { |
| | | $.tableDnD.initialiseDrag($(this).parents('tr')[0], table, this, e, config); |
| | | return false; |
| | | } |
| | | return true; |
| | | }); |
| | | } |
| | | }) |
| | | // For backwards compatibility, we add the event to the whole row |
| | | // get all the rows as a wrapped set |
| | | || $(table.rows).each(function() { |
| | | // Iterate through each row, the row is bound to "this" |
| | | if (! $(this).hasClass("nodrag")) { |
| | | $(this).bind(startEvent, function(e) { |
| | | if (e.target.tagName === "TD" && event.target.className !== "nodrag") { |
| | | $.tableDnD.initialiseDrag(this, table, this, e, config); |
| | | return false; |
| | | } |
| | | }).css("cursor", "move"); // Store the tableDnD object |
| | | } else { |
| | | $(this).css("cursor", ""); // Remove the cursor if we don't have the nodrag class |
| | | } |
| | | }); |
| | | }, |
| | | currentOrder: function() { |
| | | var rows = this.currentTable.rows; |
| | | return $.map(rows, function (val) { |
| | | return ($(val).data('level') + val.id).replace(/\s/g, ''); |
| | | }).join(''); |
| | | }, |
| | | initialiseDrag: function(dragObject, table, target, e, config) { |
| | | this.dragObject = dragObject; |
| | | this.currentTable = table; |
| | | this.mouseOffset = this.getMouseOffset(target, e); |
| | | this.originalOrder = this.currentOrder(); |
| | | |
| | | // Now we need to capture the mouse up and mouse move event |
| | | // We can use bind so that we don't interfere with other event handlers |
| | | $(document) |
| | | .bind(moveEvent, this.mousemove) |
| | | .bind(endEvent, this.mouseup); |
| | | |
| | | // Call the onDragStart method if there is one |
| | | config.onDragStart |
| | | && config.onDragStart(table, target); |
| | | }, |
| | | updateTables: function() { |
| | | this.each(function() { |
| | | // this is now bound to each matching table |
| | | if (this.tableDnDConfig) |
| | | $.tableDnD.makeDraggable(this); |
| | | }); |
| | | }, |
| | | /** Get the mouse coordinates from the event (allowing for browser differences) */ |
| | | mouseCoords: function(e) { |
| | | if (e.originalEvent.changedTouches) |
| | | return { |
| | | x: e.originalEvent.changedTouches[0].clientX, |
| | | y: e.originalEvent.changedTouches[0].clientY |
| | | }; |
| | | |
| | | if(e.pageX || e.pageY) |
| | | return { |
| | | x: e.pageX, |
| | | y: e.pageY |
| | | }; |
| | | |
| | | return { |
| | | x: e.clientX + document.body.scrollLeft - document.body.clientLeft, |
| | | y: e.clientY + document.body.scrollTop - document.body.clientTop |
| | | }; |
| | | }, |
| | | /** Given a target element and a mouse eent, get the mouse offset from that element. |
| | | To do this we need the element's position and the mouse position */ |
| | | getMouseOffset: function(target, e) { |
| | | var mousePos, |
| | | docPos; |
| | | |
| | | e = e || window.event; |
| | | |
| | | docPos = this.getPosition(target); |
| | | mousePos = this.mouseCoords(e); |
| | | |
| | | return { |
| | | x: mousePos.x - docPos.x, |
| | | y: mousePos.y - docPos.y |
| | | }; |
| | | }, |
| | | /** Get the position of an element by going up the DOM tree and adding up all the offsets */ |
| | | getPosition: function(element) { |
| | | var left = 0, |
| | | top = 0; |
| | | |
| | | // Safari fix -- thanks to Luis Chato for this! |
| | | // Safari 2 doesn't correctly grab the offsetTop of a table row |
| | | // this is detailed here: |
| | | // http://jacob.peargrove.com/blog/2006/technical/table-row-offsettop-bug-in-safari/ |
| | | // the solution is likewise noted there, grab the offset of a table cell in the row - the firstChild. |
| | | // note that firefox will return a text node as a first child, so designing a more thorough |
| | | // solution may need to take that into account, for now this seems to work in firefox, safari, ie |
| | | if (element.offsetHeight === 0) |
| | | element = element.firstChild; // a table cell |
| | | |
| | | while (element.offsetParent) { |
| | | left += element.offsetLeft; |
| | | top += element.offsetTop; |
| | | element = element.offsetParent; |
| | | } |
| | | |
| | | left += element.offsetLeft; |
| | | top += element.offsetTop; |
| | | |
| | | return { |
| | | x: left, |
| | | y: top |
| | | }; |
| | | }, |
| | | autoScroll: function (mousePos) { |
| | | var config = this.currentTable.tableDnDConfig, |
| | | yOffset = window.pageYOffset, |
| | | windowHeight = window.innerHeight |
| | | ? window.innerHeight |
| | | : document.documentElement.clientHeight |
| | | ? document.documentElement.clientHeight |
| | | : document.body.clientHeight; |
| | | |
| | | // Windows version |
| | | // yOffset=document.body.scrollTop; |
| | | if (document.all) |
| | | if (typeof document.compatMode !== 'undefined' |
| | | && document.compatMode !== 'BackCompat') |
| | | yOffset = document.documentElement.scrollTop; |
| | | else if (typeof document.body !== 'undefined') |
| | | yOffset = document.body.scrollTop; |
| | | |
| | | mousePos.y - yOffset < config.scrollAmount |
| | | && window.scrollBy(0, - config.scrollAmount) |
| | | || windowHeight - (mousePos.y - yOffset) < config.scrollAmount |
| | | && window.scrollBy(0, config.scrollAmount); |
| | | |
| | | }, |
| | | moveVerticle: function (moving, currentRow) { |
| | | |
| | | if (0 !== moving.vertical |
| | | // If we're over a row then move the dragged row to there so that the user sees the |
| | | // effect dynamically |
| | | && currentRow |
| | | && this.dragObject !== currentRow |
| | | && this.dragObject.parentNode === currentRow.parentNode) |
| | | 0 > moving.vertical |
| | | && this.dragObject.parentNode.insertBefore(this.dragObject, currentRow.nextSibling) |
| | | || 0 < moving.vertical |
| | | && this.dragObject.parentNode.insertBefore(this.dragObject, currentRow); |
| | | |
| | | }, |
| | | moveHorizontal: function (moving, currentRow) { |
| | | var config = this.currentTable.tableDnDConfig, |
| | | currentLevel; |
| | | |
| | | if (!config.hierarchyLevel |
| | | || 0 === moving.horizontal |
| | | // We only care if moving left or right on the current row |
| | | || !currentRow |
| | | || this.dragObject !== currentRow) |
| | | return null; |
| | | |
| | | currentLevel = $(currentRow).data('level'); |
| | | |
| | | 0 < moving.horizontal |
| | | && currentLevel > 0 |
| | | && $(currentRow).find('td:first').children(':first').remove() |
| | | && $(currentRow).data('level', --currentLevel); |
| | | |
| | | 0 > moving.horizontal |
| | | && currentLevel < config.hierarchyLevel |
| | | && $(currentRow).prev().data('level') >= currentLevel |
| | | && $(currentRow).children(':first').prepend(config.indentArtifact) |
| | | && $(currentRow).data('level', ++currentLevel); |
| | | |
| | | }, |
| | | mousemove: function(e) { |
| | | var dragObj = $($.tableDnD.dragObject), |
| | | config = $.tableDnD.currentTable.tableDnDConfig, |
| | | currentRow, |
| | | mousePos, |
| | | moving, |
| | | x, |
| | | y; |
| | | |
| | | e && e.preventDefault(); |
| | | |
| | | if (!$.tableDnD.dragObject) |
| | | return false; |
| | | |
| | | // prevent touch device screen scrolling |
| | | e.type === 'touchmove' |
| | | && event.preventDefault(); // TODO verify this is event and not really e |
| | | |
| | | // update the style to show we're dragging |
| | | config.onDragClass |
| | | && dragObj.addClass(config.onDragClass) |
| | | || dragObj.css(config.onDragStyle); |
| | | |
| | | mousePos = $.tableDnD.mouseCoords(e); |
| | | x = mousePos.x - $.tableDnD.mouseOffset.x; |
| | | y = mousePos.y - $.tableDnD.mouseOffset.y; |
| | | |
| | | // auto scroll the window |
| | | $.tableDnD.autoScroll(mousePos); |
| | | |
| | | currentRow = $.tableDnD.findDropTargetRow(dragObj, y); |
| | | moving = $.tableDnD.findDragDirection(x, y); |
| | | |
| | | $.tableDnD.moveVerticle(moving, currentRow); |
| | | $.tableDnD.moveHorizontal(moving, currentRow); |
| | | |
| | | return false; |
| | | }, |
| | | findDragDirection: function (x,y) { |
| | | var sensitivity = this.currentTable.tableDnDConfig.sensitivity, |
| | | oldX = this.oldX, |
| | | oldY = this.oldY, |
| | | xMin = oldX - sensitivity, |
| | | xMax = oldX + sensitivity, |
| | | yMin = oldY - sensitivity, |
| | | yMax = oldY + sensitivity, |
| | | moving = { |
| | | horizontal: x >= xMin && x <= xMax ? 0 : x > oldX ? -1 : 1, |
| | | vertical : y >= yMin && y <= yMax ? 0 : y > oldY ? -1 : 1 |
| | | }; |
| | | |
| | | // update the old value |
| | | if (moving.horizontal !== 0) |
| | | this.oldX = x; |
| | | if (moving.vertical !== 0) |
| | | this.oldY = y; |
| | | |
| | | return moving; |
| | | }, |
| | | /** We're only worried about the y position really, because we can only move rows up and down */ |
| | | findDropTargetRow: function(draggedRow, y) { |
| | | var rowHeight = 0, |
| | | rows = this.currentTable.rows, |
| | | config = this.currentTable.tableDnDConfig, |
| | | rowY = 0, |
| | | row = null; |
| | | |
| | | for (var i = 0; i < rows.length; i++) { |
| | | row = rows[i]; |
| | | rowY = this.getPosition(row).y; |
| | | rowHeight = parseInt(row.offsetHeight) / 2; |
| | | if (row.offsetHeight === 0) { |
| | | rowY = this.getPosition(row.firstChild).y; |
| | | rowHeight = parseInt(row.firstChild.offsetHeight) / 2; |
| | | } |
| | | // Because we always have to insert before, we need to offset the height a bit |
| | | if (y > (rowY - rowHeight) && y < (rowY + rowHeight)) |
| | | // that's the row we're over |
| | | // If it's the same as the current row, ignore it |
| | | if (draggedRow.is(row) |
| | | || (config.onAllowDrop |
| | | && !config.onAllowDrop(draggedRow, row)) |
| | | // If a row has nodrop class, then don't allow dropping (inspired by John Tarr and Famic) |
| | | || $(row).hasClass("nodrop")) |
| | | return null; |
| | | else |
| | | return row; |
| | | } |
| | | return null; |
| | | }, |
| | | processMouseup: function() { |
| | | if (!this.currentTable || !this.dragObject) |
| | | return null; |
| | | |
| | | var config = this.currentTable.tableDnDConfig, |
| | | droppedRow = this.dragObject, |
| | | parentLevel = 0, |
| | | myLevel = 0; |
| | | |
| | | // Unbind the event handlers |
| | | $(document) |
| | | .unbind(moveEvent, this.mousemove) |
| | | .unbind(endEvent, this.mouseup); |
| | | |
| | | config.hierarchyLevel |
| | | && config.autoCleanRelations |
| | | && $(this.currentTable.rows).first().find('td:first').children().each(function () { |
| | | myLevel = $(this).parents('tr:first').data('level'); |
| | | myLevel |
| | | && $(this).parents('tr:first').data('level', --myLevel) |
| | | && $(this).remove(); |
| | | }) |
| | | && config.hierarchyLevel > 1 |
| | | && $(this.currentTable.rows).each(function () { |
| | | myLevel = $(this).data('level'); |
| | | if (myLevel > 1) { |
| | | parentLevel = $(this).prev().data('level'); |
| | | while (myLevel > parentLevel + 1) { |
| | | $(this).find('td:first').children(':first').remove(); |
| | | $(this).data('level', --myLevel); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // If we have a dragObject, then we need to release it, |
| | | // The row will already have been moved to the right place so we just reset stuff |
| | | config.onDragClass |
| | | && $(droppedRow).removeClass(config.onDragClass) |
| | | || $(droppedRow).css(config.onDropStyle); |
| | | |
| | | this.dragObject = null; |
| | | // Call the onDrop method if there is one |
| | | config.onDrop |
| | | && this.originalOrder !== this.currentOrder() |
| | | && $(droppedRow).hide().fadeIn('fast') |
| | | && config.onDrop(this.currentTable, droppedRow); |
| | | |
| | | // Call the onDragStop method if there is one |
| | | config.onDragStop |
| | | && config.onDragStop(this.currentTable, droppedRow); |
| | | |
| | | this.currentTable = null; // let go of the table too |
| | | }, |
| | | mouseup: function(e) { |
| | | e && e.preventDefault(); |
| | | $.tableDnD.processMouseup(); |
| | | return false; |
| | | }, |
| | | jsonize: function(pretify) { |
| | | var table = this.currentTable; |
| | | if (pretify) |
| | | return JSON.stringify( |
| | | this.tableData(table), |
| | | null, |
| | | table.tableDnDConfig.jsonPretifySeparator |
| | | ); |
| | | return JSON.stringify(this.tableData(table)); |
| | | }, |
| | | serialize: function() { |
| | | return $.param(this.tableData(this.currentTable)); |
| | | }, |
| | | serializeTable: function(table) { |
| | | var result = ""; |
| | | var paramName = table.tableDnDConfig.serializeParamName || table.id; |
| | | var rows = table.rows; |
| | | for (var i=0; i<rows.length; i++) { |
| | | if (result.length > 0) result += "&"; |
| | | var rowId = rows[i].id; |
| | | if (rowId && table.tableDnDConfig && table.tableDnDConfig.serializeRegexp) { |
| | | rowId = rowId.match(table.tableDnDConfig.serializeRegexp)[0]; |
| | | result += paramName + '[]=' + rowId; |
| | | } |
| | | } |
| | | return result; |
| | | }, |
| | | serializeTables: function() { |
| | | var result = []; |
| | | $('table').each(function() { |
| | | this.id && result.push($.param($.tableDnD.tableData(this))); |
| | | }); |
| | | return result.join('&'); |
| | | }, |
| | | tableData: function (table) { |
| | | var config = table.tableDnDConfig, |
| | | previousIDs = [], |
| | | currentLevel = 0, |
| | | indentLevel = 0, |
| | | rowID = null, |
| | | data = {}, |
| | | getSerializeRegexp, |
| | | paramName, |
| | | currentID, |
| | | rows; |
| | | |
| | | if (!table) |
| | | table = this.currentTable; |
| | | if (!table || !table.rows || !table.rows.length) |
| | | return {error: { code: 500, message: "Not a valid table."}}; |
| | | if (!table.id && !config.serializeParamName) |
| | | return {error: { code: 500, message: "No serializable unique id provided."}}; |
| | | |
| | | rows = config.autoCleanRelations |
| | | && table.rows |
| | | || $.makeArray(table.rows); |
| | | paramName = config.serializeParamName || table.id; |
| | | currentID = paramName; |
| | | |
| | | getSerializeRegexp = function (rowId) { |
| | | if (rowId && config && config.serializeRegexp) |
| | | return rowId.match(config.serializeRegexp)[0]; |
| | | return rowId; |
| | | }; |
| | | |
| | | data[currentID] = []; |
| | | !config.autoCleanRelations |
| | | && $(rows[0]).data('level') |
| | | && rows.unshift({id: 'undefined'}); |
| | | |
| | | |
| | | |
| | | for (var i=0; i < rows.length; i++) { |
| | | if (config.hierarchyLevel) { |
| | | indentLevel = $(rows[i]).data('level') || 0; |
| | | if (indentLevel === 0) { |
| | | currentID = paramName; |
| | | previousIDs = []; |
| | | } |
| | | else if (indentLevel > currentLevel) { |
| | | previousIDs.push([currentID, currentLevel]); |
| | | currentID = getSerializeRegexp(rows[i-1].id); |
| | | } |
| | | else if (indentLevel < currentLevel) { |
| | | for (var h = 0; h < previousIDs.length; h++) { |
| | | if (previousIDs[h][1] === indentLevel) |
| | | currentID = previousIDs[h][0]; |
| | | if (previousIDs[h][1] >= currentLevel) |
| | | previousIDs[h][1] = 0; |
| | | } |
| | | } |
| | | currentLevel = indentLevel; |
| | | |
| | | if (!$.isArray(data[currentID])) |
| | | data[currentID] = []; |
| | | rowID = getSerializeRegexp(rows[i].id); |
| | | rowID && data[currentID].push(rowID); |
| | | } |
| | | else { |
| | | rowID = getSerializeRegexp(rows[i].id); |
| | | rowID && data[currentID].push(rowID); |
| | | } |
| | | } |
| | | return data; |
| | | } |
| | | }; |
| | | |
| | | jQuery.fn.extend( |
| | | { |
| | | tableDnD : $.tableDnD.build, |
| | | tableDnDUpdate : $.tableDnD.updateTables, |
| | | tableDnDSerialize : $.proxy($.tableDnD.serialize, $.tableDnD), |
| | | tableDnDSerializeAll : $.tableDnD.serializeTables, |
| | | tableDnDData : $.proxy($.tableDnD.tableData, $.tableDnD) |
| | | } |
| | | ); |
| | | |
| | | }(jQuery, window, window.document); |
New file |
| | |
| | | /** |
| | | * @author: Dennis Hernández |
| | | * @version: v2.0.0 |
| | | */ |
| | | |
| | | const isInit = that => that.$el.data('resizableColumns') !== undefined |
| | | |
| | | const initResizable = that => { |
| | | if ( |
| | | that.options.resizable && |
| | | !that.options.cardView && |
| | | !isInit(that) && |
| | | that.$el.is(':visible') |
| | | ) { |
| | | that.$el.resizableColumns({ |
| | | store: window.store |
| | | }) |
| | | } |
| | | } |
| | | |
| | | const destroy = that => { |
| | | if (isInit(that)) { |
| | | that.$el.data('resizableColumns').destroy() |
| | | } |
| | | } |
| | | |
| | | const reInitResizable = that => { |
| | | destroy(that) |
| | | initResizable(that) |
| | | } |
| | | |
| | | Object.assign($.fn.bootstrapTable.defaults, { |
| | | resizable: false |
| | | }) |
| | | |
| | | $.BootstrapTable = class extends $.BootstrapTable { |
| | | |
| | | initBody (...args) { |
| | | super.initBody(...args) |
| | | |
| | | this.$el.off('column-switch.bs.table page-change.bs.table') |
| | | .on('column-switch.bs.table page-change.bs.table', () => { |
| | | reInitResizable(this) |
| | | }) |
| | | |
| | | reInitResizable(this) |
| | | } |
| | | |
| | | toggleView (...args) { |
| | | super.toggleView(...args) |
| | | |
| | | if (this.options.resizable && this.options.cardView) { |
| | | // Destroy the plugin |
| | | destroy(this) |
| | | } |
| | | } |
| | | |
| | | resetView (...args) { |
| | | super.resetView(...args) |
| | | |
| | | if (this.options.resizable) { |
| | | // because in fitHeader function, we use setTimeout(func, 100); |
| | | setTimeout(() => { |
| | | initResizable(this) |
| | | }, 100) |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * jquery-resizable-columns - Resizable table columns for jQuery |
| | | * @date Sat May 16 2015 19:03:57 GMT+0100 (BST) |
| | | * @version v0.1.0 |
| | | * @link http://dobtco.github.io/jquery-resizable-columns/ |
| | | * @license MIT |
| | | */ |
| | | !function t(e,i,n){function s(a,o){if(!i[a]){if(!e[a]){var h="function"==typeof require&&require;if(!o&&h)return h(a,!0);if(r)return r(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var d=i[a]={exports:{}};e[a][0].call(d.exports,function(t){var i=e[a][1][t];return s(i?i:t)},d,d.exports,t,e,i,n)}return i[a].exports}for(var r="function"==typeof require&&require,a=0;a<n.length;a++)s(n[a]);return s}({1:[function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}var s=t("./class"),r=n(s),a=t("./constants");$.fn.resizableColumns=function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),n=1;e>n;n++)i[n-1]=arguments[n];return this.each(function(){var e=$(this),n=e.data(a.DATA_API);if(n){if("string"==typeof t)return n[t].apply(n,i)}else n=new r["default"](e,t),e.data(a.DATA_API,n)})},$.resizableColumns=r["default"]},{"./class":2,"./constants":3}],2:[function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var s=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),r=t("./constants"),a=function(){function t(e,i){n(this,t),this.ns=".rc"+this.count++,this.options=$.extend({},t.defaults,i),this.$window=$(window),this.$ownerDocument=$(e[0].ownerDocument),this.$table=e,this.refreshHeaders(),this.restoreColumnWidths(),this.syncHandleWidths(),this.bindEvents(this.$window,"resize",this.syncHandleWidths.bind(this)),this.options.start&&this.bindEvents(this.$table,r.EVENT_RESIZE_START,this.options.start),this.options.resize&&this.bindEvents(this.$table,r.EVENT_RESIZE,this.options.resize),this.options.stop&&this.bindEvents(this.$table,r.EVENT_RESIZE_STOP,this.options.stop)}return s(t,[{key:"refreshHeaders",value:function(){var t=this.options.selector;"function"==typeof t&&(t=t.call(this,this.$table)),this.$tableHeaders=this.$table.find(t),this.assignPercentageWidths(),this.createHandles()}},{key:"createHandles",value:function(){var t=this,e=this.$handleContainer;null!=e&&e.remove(),this.$handleContainer=$("<div class='"+r.CLASS_HANDLE_CONTAINER+"' />"),this.$table.before(this.$handleContainer),this.$tableHeaders.each(function(e,i){var n=t.$tableHeaders.eq(e),s=t.$tableHeaders.eq(e+1);if(0!==s.length&&!n.is(r.SELECTOR_UNRESIZABLE)&&!s.is(r.SELECTOR_UNRESIZABLE)){$("<div class='"+r.CLASS_HANDLE+"' />").data(r.DATA_TH,$(i)).appendTo(t.$handleContainer)}}),this.bindEvents(this.$handleContainer,["mousedown","touchstart"],"."+r.CLASS_HANDLE,this.onPointerDown.bind(this))}},{key:"assignPercentageWidths",value:function(){var t=this;this.$tableHeaders.each(function(e,i){var n=$(i);t.setWidth(n[0],n.outerWidth()/t.$table.width()*100)})}},{key:"syncHandleWidths",value:function(){var t=this,e=this.$handleContainer;e.width(this.$table.width()),e.find("."+r.CLASS_HANDLE).each(function(e,i){var n=$(i),s=t.options.resizeFromBody?t.$table.height():t.$table.find("thead").height(),a=n.data(r.DATA_TH).outerWidth()+(n.data(r.DATA_TH).offset().left-t.$handleContainer.offset().left);n.css({left:a,height:s})})}},{key:"saveColumnWidths",value:function(){var t=this;this.$tableHeaders.each(function(e,i){var n=$(i);t.options.store&&!n.is(r.SELECTOR_UNRESIZABLE)&&t.options.store.set(t.generateColumnId(n),t.parseWidth(i))})}},{key:"restoreColumnWidths",value:function(){var t=this;this.$tableHeaders.each(function(e,i){var n=$(i);if(t.options.store&&!n.is(r.SELECTOR_UNRESIZABLE)){var s=t.options.store.get(t.generateColumnId(n));null!=s&&t.setWidth(i,s)}})}},{key:"onPointerDown",value:function(t){if(1===t.which){this.operation&&this.onPointerUp(t);var e=$(t.currentTarget);if(!e.is(r.SELECTOR_UNRESIZABLE)){var i=e.index(),n=this.$tableHeaders.eq(i).not(r.SELECTOR_UNRESIZABLE),s=this.$tableHeaders.eq(i+1).not(r.SELECTOR_UNRESIZABLE),a=this.parseWidth(n[0]),o=this.parseWidth(s[0]);this.operation={$leftColumn:n,$rightColumn:s,$currentGrip:e,startX:this.getPointerX(t),widths:{left:a,right:o},newWidths:{left:a,right:o}},this.bindEvents(this.$ownerDocument,["mousemove","touchmove"],this.onPointerMove.bind(this)),this.bindEvents(this.$ownerDocument,["mouseup","touchend"],this.onPointerUp.bind(this)),this.$handleContainer.add(this.$table).addClass(r.CLASS_TABLE_RESIZING),n.add(s).add(e).addClass(r.CLASS_COLUMN_RESIZING),this.triggerEvent(r.EVENT_RESIZE_START,[n,s,a,o],t),t.preventDefault()}}}},{key:"onPointerMove",value:function(t){var e=this.operation;if(this.operation){var i=(this.getPointerX(t)-e.startX)/this.$table.width()*100;if(0!==i){var n=e.$leftColumn[0],s=e.$rightColumn[0],a=void 0,o=void 0;return i>0?(a=this.constrainWidth(e.widths.left+(e.widths.right-e.newWidths.right)),o=this.constrainWidth(e.widths.right-i)):0>i&&(a=this.constrainWidth(e.widths.left+i),o=this.constrainWidth(e.widths.right+(e.widths.left-e.newWidths.left))),n&&this.setWidth(n,a),s&&this.setWidth(s,o),e.newWidths.left=a,e.newWidths.right=o,this.triggerEvent(r.EVENT_RESIZE,[e.$leftColumn,e.$rightColumn,a,o],t)}}}},{key:"onPointerUp",value:function(t){var e=this.operation;if(this.operation)return this.unbindEvents(this.$ownerDocument,["mouseup","touchend","mousemove","touchmove"]),this.$handleContainer.add(this.$table).removeClass(r.CLASS_TABLE_RESIZING),e.$leftColumn.add(e.$rightColumn).add(e.$currentGrip).removeClass(r.CLASS_COLUMN_RESIZING),this.syncHandleWidths(),this.saveColumnWidths(),this.operation=null,this.triggerEvent(r.EVENT_RESIZE_STOP,[e.$leftColumn,e.$rightColumn,e.newWidths.left,e.newWidths.right],t)}},{key:"destroy",value:function(){var t=this.$table,e=this.$handleContainer.find("."+r.CLASS_HANDLE);return this.unbindEvents(this.$window.add(this.$ownerDocument).add(this.$table).add(e)),e.removeData(r.DATA_TH),t.removeData(r.DATA_API),this.$handleContainer.remove(),this.$handleContainer=null,this.$tableHeaders=null,this.$table=null,t}},{key:"bindEvents",value:function(t,e,i,n){"string"==typeof e?e+=this.ns:e=e.join(this.ns+" ")+this.ns,arguments.length>3?t.on(e,i,n):t.on(e,i)}},{key:"unbindEvents",value:function(t,e){"string"==typeof e?e+=this.ns:e=null!=e?e.join(this.ns+" ")+this.ns:this.ns,t.off(e)}},{key:"triggerEvent",value:function(t,e,i){var n=$.Event(t);return n.originalEvent&&(n.originalEvent=$.extend({},i)),this.$table.trigger(n,[this].concat(e||[]))}},{key:"generateColumnId",value:function(t){return this.$table.data(r.DATA_COLUMNS_ID)+"-"+t.data(r.DATA_COLUMN_ID)}},{key:"parseWidth",value:function(t){return t?parseFloat(t.style.width.replace("%","")):0}},{key:"setWidth",value:function(t,e){e=e.toFixed(2),e=e>0?e:0,t.style.width=e+"%"}},{key:"constrainWidth",value:function(t){return void 0!=this.options.minWidth&&(t=Math.max(this.options.minWidth,t)),void 0!=this.options.maxWidth&&(t=Math.min(this.options.maxWidth,t)),t}},{key:"getPointerX",value:function(t){return 0===t.type.indexOf("touch")?(t.originalEvent.touches[0]||t.originalEvent.changedTouches[0]).pageX:t.pageX}}]),t}();i["default"]=a,a.defaults={selector:function(t){return t.find("thead").length?r.SELECTOR_TH:r.SELECTOR_TD},store:window.store,syncHandlers:!0,resizeFromBody:!0,maxWidth:null,minWidth:.01},a.count=0,e.exports=i["default"]},{"./constants":3}],3:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n="resizableColumns";i.DATA_API=n;var s="resizable-columns-id";i.DATA_COLUMNS_ID=s;var r="resizable-column-id";i.DATA_COLUMN_ID=r;var a="th";i.DATA_TH=a;var o="rc-table-resizing";i.CLASS_TABLE_RESIZING=o;var h="rc-column-resizing";i.CLASS_COLUMN_RESIZING=h;var l="rc-handle";i.CLASS_HANDLE=l;var d="rc-handle-container";i.CLASS_HANDLE_CONTAINER=d;var u="column:resize:start";i.EVENT_RESIZE_START=u;var c="column:resize";i.EVENT_RESIZE=c;var f="column:resize:stop";i.EVENT_RESIZE_STOP=f;var E="tr:first > th:visible";i.SELECTOR_TH=E;var v="tr:first > td:visible";i.SELECTOR_TD=v;var $="[data-noresize]";i.SELECTOR_UNRESIZABLE=$},{}],4:[function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(i,"__esModule",{value:!0});{var s=t("./class"),r=n(s),a=t("./adapter");n(a)}i["default"]=r["default"],e.exports=i["default"]},{"./adapter":1,"./class":2}]},{},[4]); |
New file |
| | |
| | | /** |
| | | * 基于bootstrapTreeTable/bootstrap-table-treegrid修改 |
| | | * Copyright (c) 2019 ruoyi |
| | | */ |
| | | (function($) { |
| | | "use strict"; |
| | | |
| | | $.fn.bootstrapTreeTable = function(options, param) { |
| | | var target = $(this).data('bootstrap.tree.table'); |
| | | target = target ? target : $(this); |
| | | // 如果是调用方法 |
| | | if (typeof options == 'string') { |
| | | return $.fn.bootstrapTreeTable.methods[options](target, param); |
| | | } |
| | | // 如果是初始化组件 |
| | | options = $.extend({}, $.fn.bootstrapTreeTable.defaults, options || {}); |
| | | target.hasSelectItem = false; // 是否有radio或checkbox |
| | | target.data_list = null; // 用于缓存格式化后的数据-按父分组 |
| | | target.data_obj = null; // 用于缓存格式化后的数据-按id存对象 |
| | | target.hiddenColumns = []; // 用于存放被隐藏列的field |
| | | target.lastAjaxParams; // 用户最后一次请求的参数 |
| | | target.isFixWidth=false; // 是否有固定宽度 |
| | | target.totalRows = 0; // 记录总数 |
| | | target.totalPages = 0; // 总页数 |
| | | // 初始化 |
| | | var init = function() { |
| | | // 初始化容器 |
| | | initContainer(); |
| | | // 初始化工具栏 |
| | | initToolbar(); |
| | | // 初始化表头 |
| | | initHeader(); |
| | | // 初始化表体 |
| | | initBody(); |
| | | // 初始化数据服务 |
| | | initServer(); |
| | | // 动态设置表头宽度 |
| | | autoTheadWidth(true); |
| | | // 缓存target对象 |
| | | target.data('bootstrap.tree.table', target); |
| | | } |
| | | // 初始化容器 |
| | | var initContainer = function() { |
| | | // 在外层包装一下div,样式用的bootstrap-table的 |
| | | var $main_div = $("<div class='bootstrap-tree-table'></div>"); |
| | | var $treetable = $("<div class='treetable-table'></div>"); |
| | | target.before($main_div); |
| | | $main_div.append($treetable); |
| | | $treetable.append(target); |
| | | target.addClass("table"); |
| | | if (options.striped) { |
| | | target.addClass('table-striped'); |
| | | } |
| | | if (options.bordered) { |
| | | target.addClass('table-bordered'); |
| | | } |
| | | if (options.hover) { |
| | | target.addClass('table-hover'); |
| | | } |
| | | if (options.condensed) { |
| | | target.addClass('table-condensed'); |
| | | } |
| | | target.html(""); |
| | | } |
| | | // 初始化工具栏 |
| | | var initToolbar = function() { |
| | | var $toolbar = $("<div class='treetable-bars'></div>"); |
| | | if (options.toolbar) { |
| | | $(options.toolbar).addClass('tool-left'); |
| | | $toolbar.append($(options.toolbar)); |
| | | } |
| | | var $rightToolbar = $('<div class="btn-group tool-right">'); |
| | | $toolbar.append($rightToolbar); |
| | | target.parent().before($toolbar); |
| | | // ruoyi 是否显示检索信息 |
| | | if (options.showSearch) { |
| | | var $searchBtn = $('<button class="btn btn-default btn-outline" type="button" aria-label="search" title="搜索"><i class="glyphicon glyphicon-search"></i></button>'); |
| | | $rightToolbar.append($searchBtn); |
| | | registerSearchBtnClickEvent($searchBtn); |
| | | } |
| | | // 是否显示刷新按钮 |
| | | if (options.showRefresh) { |
| | | var $refreshBtn = $('<button class="btn btn-default btn-outline" type="button" aria-label="refresh" title="刷新"><i class="glyphicon glyphicon-repeat"></i></button>'); |
| | | $rightToolbar.append($refreshBtn); |
| | | registerRefreshBtnClickEvent($refreshBtn); |
| | | } |
| | | // 是否显示列选项 |
| | | if (options.showColumns) { |
| | | var $columns_div = $('<div class="btn-group pull-right" title="列"><button type="button" aria-label="columns" class="btn btn-default btn-outline dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><i class="glyphicon glyphicon-list"></i> <span class="caret"></span></button></div>'); |
| | | var $columns_ul = $('<ul class="dropdown-menu columns" role="menu"></ul>'); |
| | | $.each(options.columns, function(i, column) { |
| | | if (column.field != 'selectItem') { |
| | | var _li = null; |
| | | if(typeof column.visible == "undefined"||column.visible==true){ |
| | | _li = $('<li role="menuitem"><label><input type="checkbox" checked="checked" data-field="'+column.field+'" value="'+column.field+'" > '+column.title+'</label></li>'); |
| | | }else{ |
| | | _li = $('<li role="menuitem"><label><input type="checkbox" data-field="'+column.field+'" value="'+column.field+'" > '+column.title+'</label></li>'); |
| | | target.hiddenColumns.push(column.field); |
| | | } |
| | | $columns_ul.append(_li); |
| | | } |
| | | }); |
| | | $columns_div.append($columns_ul); |
| | | $rightToolbar.append($columns_div); |
| | | // 注册列选项事件 |
| | | registerColumnClickEvent(); |
| | | }else{ |
| | | $.each(options.columns, function(i, column) { |
| | | if (column.field != 'selectItem') { |
| | | if(!(typeof column.visible == "undefined"||column.visible==true)){ |
| | | target.hiddenColumns.push(column.field); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | // 初始化隐藏列 |
| | | var initHiddenColumns = function(){ |
| | | $.each(target.hiddenColumns, function(i, field) { |
| | | target.find("."+field+"_cls").hide(); |
| | | }); |
| | | } |
| | | // 初始化表头 |
| | | var initHeader = function() { |
| | | var $thr = $('<tr></tr>'); |
| | | $.each(options.columns, function(i, column) { |
| | | var $th = null; |
| | | // 判断有没有选择列 |
| | | if (i == 0 && column.field == 'selectItem') { |
| | | target.hasSelectItem = true; |
| | | $th = $('<th style="width:36px"></th>'); |
| | | } else { |
| | | $th = $('<th style="' + ((column.width) ? ('width:' + column.width + ((column.widthUnit) ? column.widthUnit : 'px')) : '') + '" class="' + column.field + '_cls"></th>'); |
| | | if (column.align) { |
| | | $th.css("text-align", column.align); |
| | | } |
| | | } |
| | | if((!target.isFixWidth)&& column.width){ |
| | | target.isFixWidth = column.width.indexOf("px")>-1?true:false; |
| | | } |
| | | $th.html(column.title); |
| | | $thr.append($th); |
| | | }); |
| | | var $thead = $('<thead class="treetable-thead"></thead>'); |
| | | $thead.append($thr); |
| | | target.append($thead); |
| | | } |
| | | // 初始化表体 |
| | | var initBody = function() { |
| | | var $tbody = $('<tbody class="treetable-tbody"></tbody>'); |
| | | target.append($tbody); |
| | | // 默认高度 |
| | | if (options.height) { |
| | | $tbody.css("height", options.height); |
| | | } |
| | | if (options.pagination) { |
| | | var $pagination = $('<div class="fixed-table-pagination"></div>'); |
| | | target.append($pagination); |
| | | } |
| | | } |
| | | // 初始化数据服务 |
| | | var initServer = function(parms) { |
| | | if (options.pagination) { |
| | | if(parms == undefined || parms == null) { |
| | | parms = {}; |
| | | } |
| | | parms[options.parentCode] = options.rootIdValue; |
| | | } |
| | | // 加载数据前先清空 |
| | | target.data_list = {}; |
| | | target.data_obj = {}; |
| | | // 设置请求分页参数 |
| | | if (options.pagination) { |
| | | var params = {}; |
| | | params.offset = options.pageSize * (options.pageNumber - 1); |
| | | params.limit = options.pageSize; |
| | | var curParams = { pageSize: params.limit, pageNum: params.offset / params.limit + 1 }; |
| | | parms = $.extend(curParams, parms); |
| | | } |
| | | var $tbody = target.find("tbody"); |
| | | // 添加加载loading |
| | | var $loading = '<tr><td colspan="' + options.columns.length + '"><div style="display: block;text-align: center;">正在努力地加载数据中,请稍候……</div></td></tr>' |
| | | $tbody.html($loading); |
| | | if (options.url) { |
| | | $.ajax({ |
| | | type: options.type, |
| | | url: options.url, |
| | | data: $.extend(parms, options.ajaxParams), |
| | | dataType: "json", |
| | | success: function(data, textStatus, jqXHR) { |
| | | data = calculateObjectValue(options, options.responseHandler, [data], data); |
| | | renderTable(data); |
| | | calculateObjectValue(options, options.onLoadSuccess, [data], data); |
| | | }, |
| | | error: function(xhr, textStatus) { |
| | | var _errorMsg = '<tr><td colspan="' + options.columns.length + '"><div style="display: block;text-align: center;">' + xhr.responseText + '</div></td></tr>' |
| | | $tbody.html(_errorMsg); |
| | | } |
| | | }); |
| | | } else { |
| | | renderTable(options.data); |
| | | } |
| | | } |
| | | // 加载完数据后渲染表格 |
| | | var renderTable = function(data) { |
| | | var list, totalPage = 0, currPage = 0; |
| | | if (options.pagination) { |
| | | list = data.rows; // 数据 |
| | | currPage = options.pageNumber; // 当前页 |
| | | totalPage = ~~((data.total - 1) / options.pageSize) + 1 // 总页数 |
| | | target.totalPages = totalPage; |
| | | target.totalRows = data.total; // 总记录数 |
| | | } else { |
| | | list = data; |
| | | } |
| | | data = list; |
| | | var $tbody = target.find("tbody"); |
| | | // 先清空 |
| | | $tbody.html(""); |
| | | if (!data || data.length <= 0) { |
| | | var _empty = '<tr><td colspan="' + options.columns.length + '"><div style="display: block;text-align: center;">没有找到匹配的记录</div></td></tr>' |
| | | $tbody.html(_empty); |
| | | options.pageNumber = 1; |
| | | initPagination(0, 0); |
| | | return; |
| | | } |
| | | // 缓存并格式化数据 |
| | | formatData(data); |
| | | // 获取所有根节点 |
| | | var rootNode = target.data_list["_root_"]; |
| | | // 开始绘制 |
| | | if (rootNode) { |
| | | $.each(rootNode, function(i, item) { |
| | | var _child_row_id = "row_id_" + i |
| | | recursionNode(item, 1, _child_row_id, "row_root", item[options.code]); |
| | | }); |
| | | } |
| | | // 下边的操作主要是为了查询时让一些没有根节点的节点显示 |
| | | $.each(data, function(i, item) { |
| | | if (!item.isShow) { |
| | | var tr = renderRow(item, false, 1, "", "", options.pagination, item[options.code]); |
| | | $tbody.append(tr); |
| | | } |
| | | }); |
| | | registerExpanderEvent(); |
| | | registerRowClickEvent(); |
| | | initHiddenColumns(); |
| | | // 动态设置表头宽度 |
| | | autoTheadWidth(); |
| | | if (options.pagination) { |
| | | initPagination(totalPage, currPage); |
| | | } |
| | | // 移动端适配 |
| | | var treetableTable = $(target).parent('.treetable-table'); |
| | | var availableHeight = treetableTable.outerWidth(); |
| | | if($.common.isMobile() || availableHeight < 769){ |
| | | var tableStyle = "width: " + availableHeight + "px;overflow: auto;position: relative;"; |
| | | treetableTable.attr('style', tableStyle); |
| | | var w = 0; |
| | | $.each(options.columns, function(i, column) { |
| | | if (i == 0 && column.field == 'selectItem') { |
| | | w += 36; |
| | | } else { |
| | | w += 200; |
| | | } |
| | | }); |
| | | $(target).attr('style','width:' + w +'px'); |
| | | } |
| | | } |
| | | // 初始化分页 |
| | | var initPagination = function (totalPage,currPage) { |
| | | var $pagination = target.find(".fixed-table-pagination"); |
| | | $pagination.empty(); |
| | | var html = []; |
| | | var pageFrom = (options.pageNumber - 1) * options.pageSize + 1; |
| | | var pageTo = options.pageNumber * options.pageSize; |
| | | if (pageTo > target.totalRows) { |
| | | pageTo = target.totalRows; |
| | | } |
| | | if (pageFrom > pageTo) { |
| | | pageFrom = pageTo; |
| | | } |
| | | html.push('<div class="pull-left pagination-detail">'); |
| | | html.push('<span class="pagination-info">' + formatShowingRows(pageFrom, pageTo, target.totalRows) + '</span>'); |
| | | var pageList = false; |
| | | $.each(options.pageList, function (i, page) { |
| | | if(target.totalRows > page){ |
| | | pageList = true; |
| | | } |
| | | }) |
| | | if(pageList){ |
| | | var _page_list = []; |
| | | _page_list.push('<span class="page-list">'); |
| | | _page_list.push('<span class="btn-group dropup">'); |
| | | _page_list.push('<button type="button" class="btn btn-default btn-outline dropdown-toggle" data-toggle="dropdown">'); |
| | | _page_list.push('<span class="page-size">' + options.pageSize + '</span>'); |
| | | _page_list.push('<span class="caret"></span>'); |
| | | _page_list.push('</button>'); |
| | | _page_list.push('<ul class="dropdown-menu" role="menu">'); |
| | | $.each(options.pageList, function (i, page) { |
| | | if(page == options.pageSize){ |
| | | _page_list.push('<li class="active"><a href="javascript:void(0)">' + page + '</a></li>'); |
| | | } |
| | | else if(page >= target.totalRows && i === 1){ |
| | | _page_list.push('<li><a href="javascript:void(0)">' + page + '</a></li>'); |
| | | } |
| | | else if(page <= target.totalRows){ |
| | | _page_list.push('<li><a href="javascript:void(0)">' + page + '</a></li>'); |
| | | } |
| | | }) |
| | | _page_list.push('</ul>'); |
| | | _page_list.push('</span>'); |
| | | html.push(formatRecordsPerPage(_page_list.join(''))) |
| | | html.push('</span>'); |
| | | } |
| | | html.push('</div>'); |
| | | |
| | | if(totalPage > 1){ |
| | | html.push('<div class="pull-right pagination">'); |
| | | html.push('<ul class="pagination pagination-outline">'); |
| | | html.push('<li class="page-pre"><a href="javascript:void(0)">' + options.paginationPreText + '</a></li>'); |
| | | var from, to; |
| | | if (totalPage < 5) { |
| | | from = 1; |
| | | to = totalPage; |
| | | } else { |
| | | from = currPage - 2; |
| | | to = from + 4; |
| | | if (from < 1) { |
| | | from = 1; |
| | | to = 5; |
| | | } |
| | | if (to > totalPage) { |
| | | to = totalPage; |
| | | from = to - 4; |
| | | } |
| | | } |
| | | |
| | | if (totalPage >= 6) { |
| | | if (currPage >= 3) { |
| | | html.push('<li class="page-first' + (1 == currPage ? ' active' : '') + '">', '<a href="javascript:void(0)">', 1, '</a>', '</li>'); |
| | | from++; |
| | | } |
| | | if (currPage >= 4) { |
| | | if (currPage == 4 || totalPage == 6 || totalPage == 7) { |
| | | from--; |
| | | } else { |
| | | html.push('<li class="page-first-separator disabled">', '<a href="javascript:void(0)">...</a>', '</li>'); |
| | | } |
| | | to--; |
| | | } |
| | | } |
| | | |
| | | if (totalPage >= 7) { |
| | | if (currPage >= (totalPage - 2)) { |
| | | from--; |
| | | } |
| | | } |
| | | if (totalPage == 6) { |
| | | if (currPage >= (totalPage - 2)) { |
| | | to++; |
| | | } |
| | | } else if (totalPage >= 7) { |
| | | if (totalPage == 7 || currPage >= (totalPage - 3)) { |
| | | to++; |
| | | } |
| | | } |
| | | |
| | | for (var i = from; i <= to; i++) { |
| | | html.push('<li class="page-number' + (i == currPage ? ' active' : '') + '">', '<a href="javascript:void(0)">', i, '</a>', '</li>'); |
| | | } |
| | | |
| | | if (totalPage >= 8) { |
| | | if (currPage <= (totalPage - 4)) { |
| | | html.push('<li class="page-last-separator disabled">', '<a href="javascript:void(0)">...</a>', '</li>'); |
| | | } |
| | | } |
| | | |
| | | if (totalPage >= 6) { |
| | | if (currPage <= (totalPage - 3)) { |
| | | html.push('<li class="page-last' + (totalPage === currPage ? ' active' : '') + '">', '<a href="javascript:void(0)">', totalPage, '</a>', '</li>'); |
| | | } |
| | | } |
| | | |
| | | html.push('<li class="page-next"><a href="javascript:void(0)">' + options.paginationNextText + '</a></li>'); |
| | | html.push('</ul></div>'); |
| | | } |
| | | |
| | | $pagination.append(html.join('')); |
| | | |
| | | var $pageList = $pagination.find('.page-list a'); |
| | | var $pre = $pagination.find('.page-pre'); |
| | | var $next = $pagination.find('.page-next'); |
| | | var $number = $pagination.find('.page-number'); |
| | | var $first = $pagination.find('.page-first'); |
| | | var $last = $pagination.find('.page-last'); |
| | | $pre.off('click').on('click', $.proxy(onPagePre, this)); |
| | | $pageList.off('click').on('click', $.proxy(onPageListChange, this)); |
| | | $number.off('click').on('click', $.proxy(onPageNumber, this)); |
| | | $first.off('click').on('click', $.proxy(onPageFirst, this)); |
| | | $last.off('click').on('click', $.proxy(onPageLast, this)); |
| | | $next.off('click').on('click', $.proxy(onPageNext, this)); |
| | | } |
| | | var onPageListChange = function(event){ |
| | | var $this = $(event.currentTarget); |
| | | $this.parent().addClass('active').siblings().removeClass('active'); |
| | | var $pagination = target.find(".fixed-table-pagination"); |
| | | options.pageSize = $this.text().toUpperCase() === target.totalRows ? target.totalRows : + $this.text(); |
| | | |
| | | if(target.totalRows < options.pageSize * options.pageNumber){ |
| | | options.pageNumber = 1; |
| | | } |
| | | $pagination.find('.page-size').text(options.pageSize); |
| | | initServer(); |
| | | } |
| | | var onPagePre = function(event){ |
| | | if ((options.pageNumber - 1) === 0) { |
| | | options.pageNumber = target.totalPages; |
| | | } else { |
| | | options.pageNumber--; |
| | | } |
| | | initServer(); |
| | | } |
| | | var onPageNumber = function(event){ |
| | | if (options.pageNumber == $(event.currentTarget).text()) { |
| | | return; |
| | | } |
| | | options.pageNumber = $(event.currentTarget).text(); |
| | | initServer(); |
| | | } |
| | | var onPageFirst = function(event){ |
| | | options.pageNumber = 1; |
| | | initServer(); |
| | | } |
| | | var onPageLast = function (event) { |
| | | options.pageNumber = target.totalPages; |
| | | initServer(); |
| | | } |
| | | var onPageNext = function(event){ |
| | | if ((options.pageNumber + 1) > target.totalPages) { |
| | | options.pageNumber = 1; |
| | | } else { |
| | | options.pageNumber++; |
| | | } |
| | | initServer(); |
| | | } |
| | | // 动态设置表头宽度 |
| | | var autoTheadWidth = function(initFlag) { |
| | | if(options.height>0){ |
| | | var $thead = target.find("thead"); |
| | | var $tbody = target.find("tbody"); |
| | | var borderWidth = parseInt(target.css("border-left-width")) + parseInt(target.css("border-right-width")) |
| | | |
| | | $thead.css("width", $tbody.children(":first").width()); |
| | | if(initFlag){ |
| | | var resizeWaiter = false; |
| | | $(window).resize(function() { |
| | | if(!resizeWaiter){ |
| | | resizeWaiter = true; |
| | | setTimeout(function(){ |
| | | if(!target.isFixWidth){ |
| | | $tbody.css("width", target.parent().width()-borderWidth); |
| | | } |
| | | $thead.css("width", $tbody.children(":first").width()); |
| | | resizeWaiter = false; |
| | | }, 300); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | } |
| | | // 缓存并格式化数据 |
| | | var formatData = function(data) { |
| | | var _root = options.rootIdValue ? options.rootIdValue : null; |
| | | // 父节点属性列表 |
| | | var parentCodes = []; |
| | | var rootFlag = false; |
| | | $.each(data, function(index, item) { |
| | | if($.inArray(item[options.parentCode], parentCodes) == -1){ |
| | | parentCodes.push(item[options.parentCode]); |
| | | } |
| | | }); |
| | | $.each(data, function(index, item) { |
| | | // 添加一个默认属性,用来判断当前节点有没有被显示 |
| | | item.isShow = false; |
| | | // 是否分页 |
| | | if (options.pagination) { |
| | | if (item.isTreeLeaf == undefined || item.isTreeLeaf == null) { |
| | | item.isTreeLeaf = false; |
| | | } else { |
| | | item.isTreeLeaf = (item["isTreeLeaf"] == 1 ? true: false) || ((item["isTreeLeaf"] == 'true' || item["isTreeLeaf"] == true) ? true: false); |
| | | } |
| | | } |
| | | // 顶级节点校验判断,兼容0,'0','',null |
| | | var _defaultRootFlag = item[options.parentCode] == '0' || |
| | | item[options.parentCode] == 0 || |
| | | item[options.parentCode] == null || |
| | | item[options.parentCode] == '' || |
| | | $.inArray(item[options.code], parentCodes) > 0 && !rootFlag; |
| | | if (!item[options.parentCode] || (_root ? (item[options.parentCode] == options.rootIdValue) : _defaultRootFlag)) { |
| | | rootFlag = true; |
| | | if (!target.data_list["_root_"]) { |
| | | target.data_list["_root_"] = []; |
| | | } |
| | | if (!target.data_obj["id_" + item[options.code]]) { |
| | | target.data_list["_root_"].push(item); |
| | | } |
| | | } else { |
| | | if (!target.data_list["_n_" + item[options.parentCode]]) { |
| | | target.data_list["_n_" + item[options.parentCode]] = []; |
| | | } |
| | | if (!target.data_obj["id_" + item[options.code]]) { |
| | | target.data_list["_n_" + item[options.parentCode]].push(item); |
| | | } |
| | | } |
| | | target.data_obj["id_" + item[options.code]] = item; |
| | | }); |
| | | } |
| | | // 递归获取子节点并且设置子节点 |
| | | var recursionNode = function(parentNode, lv, row_id, p_id, k) { |
| | | var $tbody = target.find("tbody"); |
| | | var _ls = target.data_list["_n_" + parentNode[options.code]]; |
| | | var $tr = renderRow(parentNode, _ls ? true : false, lv, row_id, p_id, options.pagination, k); |
| | | $tbody.append($tr); |
| | | if (_ls) { |
| | | $.each(_ls, function(i, item) { |
| | | var _child_row_id = row_id + "_" + i |
| | | recursionNode(item, (lv + 1), _child_row_id, row_id, item[options.code]) |
| | | }); |
| | | } |
| | | }; |
| | | // 绘制行 |
| | | var renderRow = function(item, isP, lv, row_id, p_id, _pagination, k) { |
| | | // 标记已显示 |
| | | item.isShow = true; |
| | | item.row_id = row_id; |
| | | item.p_id = p_id; |
| | | item.lv = lv; |
| | | var $tr = $('<tr id="' + row_id + '" data-id="' + k + '"pid="' + p_id + '"></tr>'); |
| | | var _icon = options.expanderCollapsedClass; |
| | | if (options.expandAll) { |
| | | $tr.css("display", "table"); |
| | | _icon = options.expanderExpandedClass; |
| | | } else if (lv == 1) { |
| | | $tr.css("display", "table"); |
| | | _icon = (options.expandFirst) ? options.expanderExpandedClass : options.expanderCollapsedClass; |
| | | } else if (lv == 2) { |
| | | if (options.expandFirst) { |
| | | $tr.css("display", "table"); |
| | | } else { |
| | | $tr.css("display", "none"); |
| | | } |
| | | _icon = options.expanderCollapsedClass; |
| | | } else if (_pagination) { |
| | | if (item.isTreeLeaf) { |
| | | _icon = options.expanderCollapsedClass; |
| | | } |
| | | } else { |
| | | $tr.css("display", "none"); |
| | | _icon = options.expanderCollapsedClass; |
| | | } |
| | | $.each(options.columns, function(index, column) { |
| | | // 判断有没有选择列 |
| | | if (column.field == 'selectItem') { |
| | | target.hasSelectItem = true; |
| | | var $td = $('<td style="text-align:center;width:36px"></td>'); |
| | | if (column.radio) { |
| | | var _ipt = $('<input name="select_item" type="radio" value="' + item[options.code] + '"></input>'); |
| | | $td.append(_ipt); |
| | | } |
| | | if (column.checkbox) { |
| | | var _ipt = $('<input name="select_item" type="checkbox" value="' + item[options.code] + '"></input>'); |
| | | $td.append(_ipt); |
| | | } |
| | | $tr.append($td); |
| | | } else { |
| | | var $td = $('<td name="' + column.field + '" class="' + column.field + '_cls"></td>'); |
| | | if(column.width){ |
| | | $td.css("width",column.width + (column.widthUnit ? column.widthUnit : 'px')); |
| | | } |
| | | if(column.align){ |
| | | $td.css("text-align",column.align); |
| | | } |
| | | if(options.expandColumn == index){ |
| | | $td.css("text-align","left"); |
| | | } |
| | | if(column.valign){ |
| | | $td.css("vertical-align",column.valign); |
| | | } |
| | | if(options.showTitle){ |
| | | $td.addClass("ellipsis"); |
| | | } |
| | | // 增加formatter渲染 |
| | | if (column.formatter) { |
| | | $td.html(column.formatter.call(this, getItemField(item, column.field), item, index)); |
| | | } else { |
| | | if(options.showTitle){ |
| | | // 只在字段没有formatter时才添加title属性 |
| | | $td.attr("title",item[column.field]); |
| | | } |
| | | $td.text(getItemField(item, column.field)); |
| | | } |
| | | if (options.expandColumn == index) { |
| | | if (_pagination) { |
| | | if (item["isTreeLeaf"]) { |
| | | $td.prepend('<span class="treetable-expander ' + _icon + '"></span>'); |
| | | } else { |
| | | $td.prepend('<span class="treetable-expander"></span>') |
| | | } |
| | | } else { |
| | | if (!isP) { |
| | | $td.prepend('<span class="treetable-expander"></span>') |
| | | } else { |
| | | $td.prepend('<span class="treetable-expander ' + _icon + '"></span>'); |
| | | } |
| | | } |
| | | for (var int = 0; int < (lv - options.expandColumn); int++) { |
| | | $td.prepend('<span class="treetable-indent"></span>') |
| | | } |
| | | } |
| | | $tr.append($td); |
| | | } |
| | | }); |
| | | return $tr; |
| | | } |
| | | // 检索信息按钮点击事件 |
| | | var registerSearchBtnClickEvent = function(btn) { |
| | | $(btn).off('click').on('click', function () { |
| | | $(".search-collapse").slideToggle(); |
| | | }); |
| | | } |
| | | // 注册刷新按钮点击事件 |
| | | var registerRefreshBtnClickEvent = function(btn) { |
| | | $(btn).off('click').on('click', function () { |
| | | target.refresh(); |
| | | }); |
| | | } |
| | | // 注册列选项事件 |
| | | var registerColumnClickEvent = function() { |
| | | $(".bootstrap-tree-table .treetable-bars .columns label input").off('click').on('click', function () { |
| | | var $this = $(this); |
| | | if($this.prop('checked')){ |
| | | target.showColumn($(this).val()); |
| | | }else{ |
| | | target.hideColumn($(this).val()); |
| | | } |
| | | }); |
| | | } |
| | | // 注册行点击选中事件 |
| | | var registerRowClickEvent = function() { |
| | | target.find("tbody").find("tr").unbind(); |
| | | target.find("tbody").find("tr").click(function() { |
| | | if (target.hasSelectItem) { |
| | | var _ipt = $(this).find("input[name='select_item']"); |
| | | if (_ipt.attr("type") == "radio") { |
| | | _ipt.prop('checked', true); |
| | | target.find("tbody").find("tr").removeClass("treetable-selected"); |
| | | $(this).addClass("treetable-selected"); |
| | | } else if (_ipt.attr("type") == "checkbox") { |
| | | if (_ipt.prop('checked')) { |
| | | _ipt.prop('checked', true); |
| | | target.find("tbody").find("tr").removeClass("treetable-selected"); |
| | | $(this).addClass("treetable-selected"); |
| | | } else { |
| | | _ipt.prop('checked', false); |
| | | target.find("tbody").find("tr").removeClass("treetable-selected"); |
| | | } |
| | | } else { |
| | | if (_ipt.prop('checked')) { |
| | | _ipt.prop('checked', false); |
| | | $(this).removeClass("treetable-selected"); |
| | | } else { |
| | | _ipt.prop('checked', true); |
| | | $(this).addClass("treetable-selected"); |
| | | } |
| | | } |
| | | var _rowData = target.data_obj["id_" + $(this).data('id')]; |
| | | calculateObjectValue(options, options.onClickRow, [_rowData], _rowData); |
| | | } |
| | | }); |
| | | } |
| | | // 注册小图标点击事件--展开缩起 |
| | | var registerExpanderEvent = function() { |
| | | target.find("tbody").find("tr").find(".treetable-expander").unbind(); |
| | | target.find("tbody").find("tr").find(".treetable-expander").click(function() { |
| | | var _isExpanded = $(this).hasClass(options.expanderExpandedClass); |
| | | var _isCollapsed = $(this).hasClass(options.expanderCollapsedClass); |
| | | if (_isExpanded || _isCollapsed) { |
| | | var tr = $(this).parent().parent(); |
| | | var row_id = tr.attr("id"); |
| | | var row_pid = tr.attr("pid"); |
| | | var _id = tr.attr("data-id"); |
| | | var _ls = target.find("tbody").find("tr[id^='" + row_id + "_']"); |
| | | if (!options.pagination) { |
| | | if (_isExpanded) { |
| | | $(this).removeClass(options.expanderExpandedClass); |
| | | $(this).addClass(options.expanderCollapsedClass); |
| | | if (_ls && _ls.length > 0) { |
| | | $.each(_ls, function(index, item) { |
| | | $(item).css("display", "none"); |
| | | }); |
| | | } |
| | | } else { |
| | | $(this).removeClass(options.expanderCollapsedClass); |
| | | $(this).addClass(options.expanderExpandedClass); |
| | | if (_ls && _ls.length > 0) { |
| | | $.each(_ls, function(index, item) { |
| | | var _p_icon = $("#" + $(item).attr("pid")).children().eq(options.expandColumn).find(".treetable-expander"); |
| | | var _p_display = $("#" + $(item).attr("pid")).css('display'); |
| | | if (_p_icon.hasClass(options.expanderExpandedClass) && _p_display == 'table') { |
| | | $(item).css("display", "table"); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } else { |
| | | var _ls = target.find("tbody").find("tr[id^='" + row_id + "_']"); |
| | | if (_ls && _ls.length > 0) { |
| | | if (_isExpanded) { |
| | | if (row_pid == "row_root") { |
| | | $('table tr[id^="' + row_id + '_"]').css("display", "none"); |
| | | $('table tr[id^="' + row_id + '_"]').each(function(i,n) { |
| | | var _isExpanded = $(n).find(".treetable-expander").hasClass(options.expanderExpandedClass); |
| | | if (_isExpanded) { |
| | | $(n).find(".treetable-expander").trigger("click"); |
| | | } |
| | | }) |
| | | } else { |
| | | $.each(_ls, function(index, item) { |
| | | $(item).css("display", "none"); |
| | | var _isExpanded = $(item).find(".treetable-expander").hasClass(options.expanderExpandedClass); |
| | | if (_isExpanded) { |
| | | $(item).find(".treetable-expander").trigger("click"); |
| | | } |
| | | }); |
| | | } |
| | | } else { |
| | | if (row_pid == "row_root") { |
| | | $('table tr[pid="' + row_id + '"]').css("display", "table"); |
| | | } else { |
| | | $.each(_ls, function(index, item) { |
| | | var _p_icon = $("#" + $(item).attr("pid")).children().eq(options.expandColumn).find(".treetable-expander"); |
| | | var _isExpanded = _p_icon.hasClass(options.expanderExpandedClass); |
| | | var _isCollapsed = _p_icon.hasClass(options.expanderCollapsedClass); |
| | | if (row_id == $(item).attr("pid")) { |
| | | $(item).css("display", "table"); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } else { |
| | | if (options.pagination) { |
| | | var parms = {}; |
| | | parms[options.parentCode] = _id; |
| | | if (options.dataUrl) { |
| | | $.ajax({ |
| | | type: options.type, |
| | | url: options.dataUrl, |
| | | data: parms, |
| | | dataType: "json", |
| | | success: function(data, textStatus, jqXHR) { |
| | | $("#" + row_id + "_load").remove(); |
| | | var list = data; |
| | | data = list; |
| | | target.appendData(data) |
| | | }, |
| | | error: function(xhr, textStatus) { |
| | | var _errorMsg = '<tr><td colspan="' + options.columns.length + '"><div style="display: block;text-align: center;">' + xhr.responseText + '</div></td></tr>' |
| | | $("#" + row_id).after(_errorMsg); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | if (_isExpanded) { |
| | | $(this).removeClass(options.expanderExpandedClass); |
| | | $(this).addClass(options.expanderCollapsedClass); |
| | | } else { |
| | | $(this).removeClass(options.expanderCollapsedClass); |
| | | $(this).addClass(options.expanderExpandedClass); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | // 刷新数据 |
| | | target.refresh = function(parms) { |
| | | if(parms){ |
| | | target.lastAjaxParams=parms; |
| | | } |
| | | initServer(target.lastAjaxParams); |
| | | } |
| | | // 添加数据刷新表格 |
| | | target.appendData = function(data) { |
| | | data.reverse() |
| | | // 下边的操作主要是为了查询时让一些没有根节点的节点显示 |
| | | $.each(data, function(i, item) { |
| | | if (options.pagination) { |
| | | item.__nodes = (item["nodes"] == 1 ? true: false) || ((item["nodes"] == 'true' || item["nodes"] == true) ? true: false); |
| | | } |
| | | var _data = target.data_obj["id_" + item[options.code]]; |
| | | var _p_data = target.data_obj["id_" + item[options.parentCode]]; |
| | | var _c_list = target.data_list["_n_" + item[options.parentCode]]; |
| | | var row_id = ""; //行id |
| | | var p_id = ""; //父行id |
| | | var _lv = 1; //如果没有父就是1默认显示 |
| | | var tr; //要添加行的对象 |
| | | if (_data && _data.row_id && _data.row_id != "") { |
| | | row_id = _data.row_id; // 如果已经存在了,就直接引用原来的 |
| | | } |
| | | if (_p_data) { |
| | | p_id = _p_data.row_id; |
| | | if (row_id == "") { |
| | | var _tmp = 0 |
| | | if (_c_list && _c_list.length > 0) { |
| | | _tmp = _c_list.length; |
| | | } |
| | | row_id = _p_data.row_id + "_" + _tmp; |
| | | } |
| | | _lv = _p_data.lv + 1; //如果有父 |
| | | // 绘制行 |
| | | tr = renderRow(item, true, _lv, row_id, p_id, options.pagination, item[options.code]); |
| | | |
| | | var _p_icon = $("#" + _p_data.row_id).children().eq(options.expandColumn).find(".treetable-expander"); |
| | | var _isExpanded = _p_icon.hasClass(options.expanderExpandedClass); |
| | | var _isCollapsed = _p_icon.hasClass(options.expanderCollapsedClass); |
| | | // 父节点有没有展开收缩按钮 |
| | | if (_isExpanded || _isCollapsed) { |
| | | // 父节点展开状态显示新加行 |
| | | if (_isExpanded) { |
| | | tr.css("display", "table"); |
| | | } |
| | | } else { |
| | | // 父节点没有展开收缩按钮则添加 |
| | | _p_icon.addClass(options.expanderCollapsedClass); |
| | | } |
| | | |
| | | if (_data) { |
| | | $("#" + _data.row_id).before(tr); |
| | | $("#" + _data.row_id).remove(); |
| | | } else { |
| | | // 计算父的同级下一行 |
| | | var _tmp_ls = _p_data.row_id.split("_"); |
| | | var _p_next = _p_data.row_id.substring(0, _p_data.row_id.length - (_tmp_ls[_tmp_ls.length - 1] + "").length) + (parseInt(_tmp_ls[_tmp_ls.length - 1]) + 1); |
| | | $("#" + _p_data.row_id).after(tr); |
| | | } |
| | | } else { |
| | | tr = renderRow(item, false, _lv, row_id, p_id, options.pagination, item[options.code]); |
| | | if (_data) { |
| | | $("#" + _data.row_id).before(tr); |
| | | $("#" + _data.row_id).remove(); |
| | | } else { |
| | | // 画上 |
| | | var tbody = target.find("tbody"); |
| | | tbody.append(tr); |
| | | } |
| | | } |
| | | item.isShow = true; |
| | | // 缓存并格式化数据 |
| | | formatData([item]); |
| | | }); |
| | | registerExpanderEvent(); |
| | | registerRowClickEvent(); |
| | | initHiddenColumns(); |
| | | } |
| | | |
| | | // 展开/折叠指定的行 |
| | | target.toggleRow=function(id) { |
| | | var _rowData = target.data_obj["id_" + id]; |
| | | var $row_expander = $("#"+_rowData.row_id).find(".treetable-expander"); |
| | | $row_expander.trigger("click"); |
| | | } |
| | | // 展开指定的行 |
| | | target.expandRow=function(id) { |
| | | var _rowData = target.data_obj["id_" + id]; |
| | | var $row_expander = $("#"+_rowData.row_id).find(".treetable-expander"); |
| | | var _isCollapsed = $row_expander.hasClass(target.options.expanderCollapsedClass); |
| | | if (_isCollapsed) { |
| | | $row_expander.trigger("click"); |
| | | } |
| | | } |
| | | // 折叠 指定的行 |
| | | target.collapseRow=function(id) { |
| | | var _rowData = target.data_obj["id_" + id]; |
| | | var $row_expander = $("#"+_rowData.row_id).find(".treetable-expander"); |
| | | var _isExpanded = $row_expander.hasClass(target.options.expanderExpandedClass); |
| | | if (_isExpanded) { |
| | | $row_expander.trigger("click"); |
| | | } |
| | | } |
| | | // 展开所有的行 |
| | | target.expandAll=function() { |
| | | target.find("tbody").find("tr").find(".treetable-expander").each(function(i,n){ |
| | | var _isCollapsed = $(n).hasClass(options.expanderCollapsedClass); |
| | | if (_isCollapsed) { |
| | | $(n).trigger("click"); |
| | | } |
| | | }) |
| | | } |
| | | // 折叠所有的行 |
| | | target.collapseAll=function() { |
| | | target.find("tbody").find("tr").find(".treetable-expander").each(function(i,n){ |
| | | var _isExpanded = $(n).hasClass(options.expanderExpandedClass); |
| | | if (_isExpanded) { |
| | | $(n).trigger("click"); |
| | | } |
| | | }) |
| | | } |
| | | // 显示指定列 |
| | | target.showColumn=function(field,flag) { |
| | | var _index = $.inArray(field, target.hiddenColumns); |
| | | if (_index > -1) { |
| | | target.hiddenColumns.splice(_index, 1); |
| | | } |
| | | target.find("."+field+"_cls").show(); |
| | | //是否更新列选项状态 |
| | | if(flag&&options.showColumns){ |
| | | var $input = $(".bootstrap-tree-table .treetable-bars .columns label").find("input[value='"+field+"']") |
| | | $input.prop("checked", 'checked'); |
| | | } |
| | | } |
| | | // 隐藏指定列 |
| | | target.hideColumn=function(field,flag) { |
| | | target.hiddenColumns.push(field); |
| | | target.find("."+field+"_cls").hide(); |
| | | //是否更新列选项状态 |
| | | if(flag&&options.showColumns){ |
| | | var $input = $(".bootstrap-tree-table .treetable-bars .columns label").find("input[value='"+field+"']") |
| | | $input.prop("checked", ''); |
| | | } |
| | | } |
| | | // ruoyi 解析数据,支持多层级访问 |
| | | var getItemField = function (item, field) { |
| | | var value = item; |
| | | |
| | | if (typeof field !== 'string' || item.hasOwnProperty(field)) { |
| | | return item[field]; |
| | | } |
| | | var props = field.split('.'); |
| | | for (var p in props) { |
| | | value = value && value[props[p]]; |
| | | } |
| | | return value; |
| | | }; |
| | | // ruoyi 发起对目标(target)函数的调用 |
| | | var calculateObjectValue = function (self, name, args, defaultValue) { |
| | | var func = name; |
| | | |
| | | if (typeof name === 'string') { |
| | | var names = name.split('.'); |
| | | |
| | | if (names.length > 1) { |
| | | func = window; |
| | | $.each(names, function (i, f) { |
| | | func = func[f]; |
| | | }); |
| | | } else { |
| | | func = window[name]; |
| | | } |
| | | } |
| | | if (typeof func === 'object') { |
| | | return func; |
| | | } |
| | | if (typeof func === 'function') { |
| | | return func.apply(self, args); |
| | | } |
| | | if (!func && typeof name === 'string' && sprintf.apply(this, [name].concat(args))) { |
| | | return sprintf.apply(this, [name].concat(args)); |
| | | } |
| | | return defaultValue; |
| | | }; |
| | | var formatRecordsPerPage = function (pageNumber) { |
| | | return '每页显示 ' + pageNumber + ' 条记录'; |
| | | }; |
| | | var formatShowingRows = function (pageFrom, pageTo, totalRows) { |
| | | return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录。'; |
| | | }; |
| | | // 初始化 |
| | | init(); |
| | | return target; |
| | | }; |
| | | |
| | | // 组件方法封装........ |
| | | $.fn.bootstrapTreeTable.methods = { |
| | | // 为了兼容bootstrap-table的写法,统一返回数组,这里返回了表格显示列的数据 |
| | | getSelections: function(target, data) { |
| | | // 所有被选中的记录input |
| | | var _ipt = target.find("tbody").find("tr").find("input[name='select_item']:checked"); |
| | | var chk_value = []; |
| | | // 如果是radio |
| | | if (_ipt.attr("type") == "radio") { |
| | | var _data = target.data_obj["id_" + _ipt.val()]; |
| | | chk_value.push(_data); |
| | | } else { |
| | | _ipt.each(function(_i, _item) { |
| | | var _data = target.data_obj["id_" + $(_item).val()]; |
| | | chk_value.push(_data); |
| | | }); |
| | | } |
| | | return chk_value; |
| | | }, |
| | | // 刷新记录 |
| | | refresh: function(target, parms) { |
| | | if (parms) { |
| | | target.refresh(parms); |
| | | } else { |
| | | target.refresh(); |
| | | } |
| | | }, |
| | | // 添加数据到表格 |
| | | appendData: function(target, data) { |
| | | if (data) { |
| | | target.appendData(data); |
| | | } |
| | | }, |
| | | // 展开/折叠指定的行 |
| | | toggleRow: function(target, id) { |
| | | target.toggleRow(id); |
| | | }, |
| | | // 展开指定的行 |
| | | expandRow: function(target, id) { |
| | | target.expandRow(id); |
| | | }, |
| | | // 折叠 指定的行 |
| | | collapseRow: function(target, id) { |
| | | target.collapseRow(id); |
| | | }, |
| | | // 展开所有的行 |
| | | expandAll: function(target) { |
| | | target.expandAll(); |
| | | }, |
| | | // 折叠所有的行 |
| | | collapseAll: function(target) { |
| | | target.collapseAll(); |
| | | }, |
| | | // 显示指定列 |
| | | showColumn: function(target,field) { |
| | | target.showColumn(field,true); |
| | | }, |
| | | // 隐藏指定列 |
| | | hideColumn: function(target,field) { |
| | | target.hideColumn(field,true); |
| | | } |
| | | // 组件的其他方法也可以进行类似封装........ |
| | | }; |
| | | |
| | | $.fn.bootstrapTreeTable.defaults = { |
| | | code: 'code', // 选取记录返回的值,用于设置父子关系 |
| | | parentCode: 'parentCode', // 用于设置父子关系 |
| | | rootIdValue: 0, // 设置根节点id值----可指定根节点,默认为null,"",0,"0" |
| | | data: null, // 构造table的数据集合 |
| | | type: "GET", // 请求数据的ajax类型 |
| | | url: null, // 请求数据的ajax的url |
| | | ajaxParams: {}, // 请求数据的ajax的data属性 |
| | | expandColumn: 1, // 在哪一列上面显示展开按钮 |
| | | expandAll: false, // 是否全部展开 |
| | | expandFirst: true, // 是否默认第一级展开--expandAll为false时生效 |
| | | striped: false, // 是否各行渐变色 |
| | | bordered: false, // 是否显示边框 |
| | | hover: true, // 是否鼠标悬停 |
| | | condensed: false, // 是否紧缩表格 |
| | | columns: [], // 列 |
| | | toolbar: null, // 顶部工具条 |
| | | height: 0, // 表格高度 |
| | | pagination: false, // 是否显示分页 |
| | | dataUrl: null, // 加载子节点异步请求数据url |
| | | pageNumber: 1, // 当前页条数 |
| | | pageSize: 10, // 每页的记录行数 |
| | | onClickRow: null, // 单击某行事件 |
| | | pageList: [10, 25, 50], // 可供选择的每页的行数 |
| | | showTitle: true, // 是否采用title属性显示字段内容(被formatter格式化的字段不会显示) |
| | | showSearch: true, // 是否显示检索信息 |
| | | showColumns: true, // 是否显示内容列下拉框 |
| | | showRefresh: true, // 是否显示刷新按钮 |
| | | paginationPreText: '‹', |
| | | paginationNextText: '›', |
| | | expanderExpandedClass: 'glyphicon glyphicon-chevron-down', // 展开的按钮的图标 |
| | | expanderCollapsedClass: 'glyphicon glyphicon-chevron-right', // 缩起的按钮的图标 |
| | | responseHandler: function(res) { |
| | | return false; |
| | | }, |
| | | onLoadSuccess: function(res) { |
| | | return false; |
| | | } |
| | | }; |
| | | })(jQuery); |
New file |
| | |
| | | /** |
| | | * 基于bootstrapTreeTable/bootstrap-table-treegrid修改 |
| | | * Copyright (c) 2019 ruoyi |
| | | */ |
| | | !function(e){e.fn.bootstrapTreeTable=function(a,t){var n=e(this).data("bootstrap.tree.table");if(n=n?n:e(this),"string"==typeof a){return e.fn.bootstrapTreeTable.methods[a](n,t)}a=e.extend({},e.fn.bootstrapTreeTable.defaults,a||{}),n.hasSelectItem=!1,n.data_list=null,n.data_obj=null,n.hiddenColumns=[],n.lastAjaxParams,n.isFixWidth=!1,n.totalRows=0,n.totalPages=0;var i=function(){s(),l(),o(),r(),p(),C(!0),n.data("bootstrap.tree.table",n)},s=function(){var t=e("<div class='bootstrap-tree-table'></div>"),i=e("<div class='treetable-table'></div>");n.before(t),t.append(i),i.append(n),n.addClass("table"),a.striped&&n.addClass("table-striped"),a.bordered&&n.addClass("table-bordered"),a.hover&&n.addClass("table-hover"),a.condensed&&n.addClass("table-condensed"),n.html("")},l=function(){var t=e("<div class='treetable-bars'></div>");a.toolbar&&(e(a.toolbar).addClass("tool-left"),t.append(e(a.toolbar)));var i=e('<div class="btn-group tool-right">');if(t.append(i),n.parent().before(t),a.showSearch){var s=e('<button class="btn btn-default btn-outline" type="button" aria-label="search" title="搜索"><i class="glyphicon glyphicon-search"></i></button>');i.append(s),y(s)}if(a.showRefresh){var l=e('<button class="btn btn-default btn-outline" type="button" aria-label="refresh" title="刷新"><i class="glyphicon glyphicon-repeat"></i></button>');i.append(l),k(l)}if(a.showColumns){var d=e('<div class="btn-group pull-right" title="列"><button type="button" aria-label="columns" class="btn btn-default btn-outline dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><i class="glyphicon glyphicon-list"></i> <span class="caret"></span></button></div>'),o=e('<ul class="dropdown-menu columns" role="menu"></ul>');e.each(a.columns,function(a,t){if("selectItem"!=t.field){var i=null;void 0===t.visible||1==t.visible?i=e('<li role="menuitem"><label><input type="checkbox" checked="checked" data-field="'+t.field+'" value="'+t.field+'" > '+t.title+"</label></li>"):(i=e('<li role="menuitem"><label><input type="checkbox" data-field="'+t.field+'" value="'+t.field+'" > '+t.title+"</label></li>"),n.hiddenColumns.push(t.field)),o.append(i)}}),d.append(o),i.append(d),j()}else{e.each(a.columns,function(e,a){"selectItem"!=a.field&&void 0!==a.visible&&1!=a.visible&&n.hiddenColumns.push(a.field)})}},d=function(){e.each(n.hiddenColumns,function(e,a){n.find("."+a+"_cls").hide()})},o=function(){var t=e("<tr></tr>");e.each(a.columns,function(a,i){var s=null;0==a&&"selectItem"==i.field?(n.hasSelectItem=!0,s=e('<th style="width:36px"></th>')):(s=e('<th style="'+(i.width?"width:"+i.width+(i.widthUnit?i.widthUnit:"px"):"")+'" class="'+i.field+'_cls"></th>'),i.align&&s.css("text-align",i.align)),!n.isFixWidth&&i.width&&(n.isFixWidth=i.width.indexOf("px")>-1?!0:!1),s.html(i.title),t.append(s)});var i=e('<thead class="treetable-thead"></thead>');i.append(t),n.append(i)},r=function(){var t=e('<tbody class="treetable-tbody"></tbody>');if(n.append(t),a.height&&t.css("height",a.height),a.pagination){var i=e('<div class="fixed-table-pagination"></div>');n.append(i)}},p=function(t){if(a.pagination&&((void 0==t||null==t)&&(t={}),t[a.parentCode]=a.rootIdValue),n.data_list={},n.data_obj={},a.pagination){var i={};i.offset=a.pageSize*(a.pageNumber-1),i.limit=a.pageSize;var s={pageSize:i.limit,pageNum:i.offset/i.limit+1};t=e.extend(s,t)}var l=n.find("tbody"),d='<tr><td colspan="'+a.columns.length+'"><div style="display: block;text-align: center;">正在努力地加载数据中,请稍候……</div></td></tr>';l.html(d),a.url?e.ajax({type:a.type,url:a.url,data:e.extend(t,a.ajaxParams),dataType:"json",success:function(e,t,n){e=N(a,a.responseHandler,[e],e),c(e),N(a,a.onLoadSuccess,[e],e)},error:function(e,t){var n='<tr><td colspan="'+a.columns.length+'"><div style="display: block;text-align: center;">'+e.responseText+"</div></td></tr>";l.html(n)}}):c(a.data)},c=function(t){var i,s=0,l=0;a.pagination?(i=t.rows,l=a.pageNumber,s=~~((t.total-1)/a.pageSize)+1,n.totalPages=s,n.totalRows=t.total):i=t,t=i;var o=n.find("tbody");if(o.html(""),!t||t.length<=0){var r='<tr><td colspan="'+a.columns.length+'"><div style="display: block;text-align: center;">没有找到匹配的记录</div></td></tr>';return o.html(r),a.pageNumber=1,void u(0,0)}m(t);var p=n.data_list._root_;p&&e.each(p,function(e,t){var n="row_id_"+e;w(t,1,n,"row_root",t[a.code])}),e.each(t,function(e,t){if(!t.isShow){var n=_(t,!1,1,"","",a.pagination,t[a.code]);o.append(n)}}),S(),T(),d(),C(),a.pagination&&u(s,l);var c=e(n).parent(".treetable-table"),f=c.outerWidth();if(e.common.isMobile()||769>f){var h="width: "+f+"px;overflow: auto;position: relative;";c.attr("style",h);var b=0;e.each(a.columns,function(e,a){b+=0==e&&"selectItem"==a.field?36:200}),e(n).attr("style","width:"+b+"px")}},u=function(t,i){var s=n.find(".fixed-table-pagination");s.empty();var l=[],d=(a.pageNumber-1)*a.pageSize+1,o=a.pageNumber*a.pageSize;o>n.totalRows&&(o=n.totalRows),d>o&&(d=o),l.push('<div class="pull-left pagination-detail">'),l.push('<span class="pagination-info">'+E(d,o,n.totalRows)+"</span>");var r=!1;if(e.each(a.pageList,function(e,a){n.totalRows>a&&(r=!0)}),r){var p=[];p.push('<span class="page-list">'),p.push('<span class="btn-group dropup">'),p.push('<button type="button" class="btn btn-default btn-outline dropdown-toggle" data-toggle="dropdown">'),p.push('<span class="page-size">'+a.pageSize+"</span>"),p.push('<span class="caret"></span>'),p.push("</button>"),p.push('<ul class="dropdown-menu" role="menu">'),e.each(a.pageList,function(e,t){t==a.pageSize?p.push('<li class="active"><a href="javascript:void(0)">'+t+"</a></li>"):t>=n.totalRows&&1===e?p.push('<li><a href="javascript:void(0)">'+t+"</a></li>"):t<=n.totalRows&&p.push('<li><a href="javascript:void(0)">'+t+"</a></li>")}),p.push("</ul>"),p.push("</span>"),l.push(I(p.join(""))),l.push("</span>")}if(l.push("</div>"),t>1){l.push('<div class="pull-right pagination">'),l.push('<ul class="pagination pagination-outline">'),l.push('<li class="page-pre"><a href="javascript:void(0)">'+a.paginationPreText+"</a></li>");var c,u;5>t?(c=1,u=t):(c=i-2,u=c+4,1>c&&(c=1,u=5),u>t&&(u=t,c=u-4)),t>=6&&(i>=3&&(l.push('<li class="page-first'+(1==i?" active":"")+'">','<a href="javascript:void(0)">',1,"</a>","</li>"),c++),i>=4&&(4==i||6==t||7==t?c--:l.push('<li class="page-first-separator disabled">','<a href="javascript:void(0)">...</a>',"</li>"),u--)),t>=7&&i>=t-2&&c--,6==t?i>=t-2&&u++:t>=7&&(7==t||i>=t-3)&&u++;for(var C=c;u>=C;C++){l.push('<li class="page-number'+(C==i?" active":"")+'">','<a href="javascript:void(0)">',C,"</a>","</li>")}t>=8&&t-4>=i&&l.push('<li class="page-last-separator disabled">','<a href="javascript:void(0)">...</a>',"</li>"),t>=6&&t-3>=i&&l.push('<li class="page-last'+(t===i?" active":"")+'">','<a href="javascript:void(0)">',t,"</a>","</li>"),l.push('<li class="page-next"><a href="javascript:void(0)">'+a.paginationNextText+"</a></li>"),l.push("</ul></div>")}s.append(l.join(""));var m=s.find(".page-list a"),w=s.find(".page-pre"),_=s.find(".page-next"),y=s.find(".page-number"),k=s.find(".page-first"),j=s.find(".page-last");w.off("click").on("click",e.proxy(h,this)),m.off("click").on("click",e.proxy(f,this)),y.off("click").on("click",e.proxy(b,this)),k.off("click").on("click",e.proxy(v,this)),j.off("click").on("click",e.proxy(g,this)),_.off("click").on("click",e.proxy(x,this))},f=function(t){var i=e(t.currentTarget);i.parent().addClass("active").siblings().removeClass("active");var s=n.find(".fixed-table-pagination");a.pageSize=i.text().toUpperCase()===n.totalRows?n.totalRows:+i.text(),n.totalRows<a.pageSize*a.pageNumber&&(a.pageNumber=1),s.find(".page-size").text(a.pageSize),p()},h=function(e){a.pageNumber-1===0?a.pageNumber=n.totalPages:a.pageNumber--,p()},b=function(t){a.pageNumber!=e(t.currentTarget).text()&&(a.pageNumber=e(t.currentTarget).text(),p())},v=function(e){a.pageNumber=1,p()},g=function(e){a.pageNumber=n.totalPages,p()},x=function(e){a.pageNumber+1>n.totalPages?a.pageNumber=1:a.pageNumber++,p()},C=function(t){if(a.height>0){var i=n.find("thead"),s=n.find("tbody"),l=parseInt(n.css("border-left-width"))+parseInt(n.css("border-right-width"));if(i.css("width",s.children(":first").width()),t){var d=!1;e(window).resize(function(){d||(d=!0,setTimeout(function(){n.isFixWidth||s.css("width",n.parent().width()-l),i.css("width",s.children(":first").width()),d=!1},300))})}}},m=function(t){var i=a.rootIdValue?a.rootIdValue:null,s=[],l=!1;e.each(t,function(t,n){-1==e.inArray(n[a.parentCode],s)&&s.push(n[a.parentCode])}),e.each(t,function(t,d){d.isShow=!1,a.pagination&&(void 0==d.isTreeLeaf||null==d.isTreeLeaf?d.isTreeLeaf=!1:d.isTreeLeaf=!((1==d.isTreeLeaf?0:1)&&("true"==d.isTreeLeaf||1==d.isTreeLeaf?0:1)));var o="0"==d[a.parentCode]||0==d[a.parentCode]||null==d[a.parentCode]||""==d[a.parentCode]||e.inArray(d[a.code],s)>0&&!l;!d[a.parentCode]||(i?d[a.parentCode]==a.rootIdValue:o)?(l=!0,n.data_list._root_||(n.data_list._root_=[]),n.data_obj["id_"+d[a.code]]||n.data_list._root_.push(d)):(n.data_list["_n_"+d[a.parentCode]]||(n.data_list["_n_"+d[a.parentCode]]=[]),n.data_obj["id_"+d[a.code]]||n.data_list["_n_"+d[a.parentCode]].push(d)),n.data_obj["id_"+d[a.code]]=d})},w=function(t,i,s,l,d){var o=n.find("tbody"),r=n.data_list["_n_"+t[a.code]],p=_(t,r?!0:!1,i,s,l,a.pagination,d);o.append(p),r&&e.each(r,function(e,t){var n=s+"_"+e;w(t,i+1,n,s,t[a.code])})},_=function(t,i,s,l,d,o,r){t.isShow=!0,t.row_id=l,t.p_id=d,t.lv=s;var p=e('<tr id="'+l+'" data-id="'+r+'"pid="'+d+'"></tr>'),c=a.expanderCollapsedClass;return a.expandAll?(p.css("display","table"),c=a.expanderExpandedClass):1==s?(p.css("display","table"),c=a.expandFirst?a.expanderExpandedClass:a.expanderCollapsedClass):2==s?(a.expandFirst?p.css("display","table"):p.css("display","none"),c=a.expanderCollapsedClass):o?t.isTreeLeaf&&(c=a.expanderCollapsedClass):(p.css("display","none"),c=a.expanderCollapsedClass),e.each(a.columns,function(l,d){if("selectItem"==d.field){n.hasSelectItem=!0;var r=e('<td style="text-align:center;width:36px"></td>');if(d.radio){var u=e('<input name="select_item" type="radio" value="'+t[a.code]+'"></input>');r.append(u)}if(d.checkbox){var u=e('<input name="select_item" type="checkbox" value="'+t[a.code]+'"></input>');r.append(u)}p.append(r)}else{var r=e('<td name="'+d.field+'" class="'+d.field+'_cls"></td>');if(d.width&&r.css("width",d.width+(d.widthUnit?d.widthUnit:"px")),d.align&&r.css("text-align",d.align),a.expandColumn==l&&r.css("text-align","left"),d.valign&&r.css("vertical-align",d.valign),a.showTitle&&r.addClass("ellipsis"),d.formatter?r.html(d.formatter.call(this,R(t,d.field),t,l)):(a.showTitle&&r.attr("title",t[d.field]),r.text(R(t,d.field))),a.expandColumn==l){o?t.isTreeLeaf?r.prepend('<span class="treetable-expander '+c+'"></span>'):r.prepend('<span class="treetable-expander"></span>'):i?r.prepend('<span class="treetable-expander '+c+'"></span>'):r.prepend('<span class="treetable-expander"></span>');for(var f=0;f<s-a.expandColumn;f++){r.prepend('<span class="treetable-indent"></span>')}}p.append(r)}}),p},y=function(a){e(a).off("click").on("click",function(){e(".search-collapse").slideToggle()})},k=function(a){e(a).off("click").on("click",function(){n.refresh()})},j=function(){e(".bootstrap-tree-table .treetable-bars .columns label input").off("click").on("click",function(){var a=e(this);a.prop("checked")?n.showColumn(e(this).val()):n.hideColumn(e(this).val())})},T=function(){n.find("tbody").find("tr").unbind(),n.find("tbody").find("tr").click(function(){if(n.hasSelectItem){var t=e(this).find("input[name='select_item']");"radio"==t.attr("type")?(t.prop("checked",!0),n.find("tbody").find("tr").removeClass("treetable-selected"),e(this).addClass("treetable-selected")):"checkbox"==t.attr("type")?t.prop("checked")?(t.prop("checked",!0),n.find("tbody").find("tr").removeClass("treetable-selected"),e(this).addClass("treetable-selected")):(t.prop("checked",!1),n.find("tbody").find("tr").removeClass("treetable-selected")):t.prop("checked")?(t.prop("checked",!1),e(this).removeClass("treetable-selected")):(t.prop("checked",!0),e(this).addClass("treetable-selected"));var i=n.data_obj["id_"+e(this).data("id")];N(a,a.onClickRow,[i],i)}})},S=function(){n.find("tbody").find("tr").find(".treetable-expander").unbind(),n.find("tbody").find("tr").find(".treetable-expander").click(function(){var t=e(this).hasClass(a.expanderExpandedClass),i=e(this).hasClass(a.expanderCollapsedClass);if(t||i){var s=e(this).parent().parent(),l=s.attr("id"),d=s.attr("pid"),o=s.attr("data-id"),r=n.find("tbody").find("tr[id^='"+l+"_']");if(a.pagination){var r=n.find("tbody").find("tr[id^='"+l+"_']");if(r&&r.length>0){t?"row_root"==d?(e('table tr[id^="'+l+'_"]').css("display","none"),e('table tr[id^="'+l+'_"]').each(function(t,n){var i=e(n).find(".treetable-expander").hasClass(a.expanderExpandedClass);i&&e(n).find(".treetable-expander").trigger("click")})):e.each(r,function(t,n){e(n).css("display","none");var i=e(n).find(".treetable-expander").hasClass(a.expanderExpandedClass);i&&e(n).find(".treetable-expander").trigger("click")}):"row_root"==d?e('table tr[pid="'+l+'"]').css("display","table"):e.each(r,function(t,n){var i=e("#"+e(n).attr("pid")).children().eq(a.expandColumn).find(".treetable-expander");i.hasClass(a.expanderExpandedClass),i.hasClass(a.expanderCollapsedClass);l==e(n).attr("pid")&&e(n).css("display","table")})}else{if(a.pagination){var p={};p[a.parentCode]=o,a.dataUrl&&e.ajax({type:a.type,url:a.dataUrl,data:p,dataType:"json",success:function(a,t,i){e("#"+l+"_load").remove();var s=a;a=s,n.appendData(a)},error:function(t,n){var i='<tr><td colspan="'+a.columns.length+'"><div style="display: block;text-align: center;">'+t.responseText+"</div></td></tr>";e("#"+l).after(i)}})}}t?(e(this).removeClass(a.expanderExpandedClass),e(this).addClass(a.expanderCollapsedClass)):(e(this).removeClass(a.expanderCollapsedClass),e(this).addClass(a.expanderExpandedClass))}else{t?(e(this).removeClass(a.expanderExpandedClass),e(this).addClass(a.expanderCollapsedClass),r&&r.length>0&&e.each(r,function(a,t){e(t).css("display","none")})):(e(this).removeClass(a.expanderCollapsedClass),e(this).addClass(a.expanderExpandedClass),r&&r.length>0&&e.each(r,function(t,n){var i=e("#"+e(n).attr("pid")).children().eq(a.expandColumn).find(".treetable-expander"),s=e("#"+e(n).attr("pid")).css("display");i.hasClass(a.expanderExpandedClass)&&"table"==s&&e(n).css("display","table")}))}}})};n.refresh=function(e){e&&(n.lastAjaxParams=e),p(n.lastAjaxParams)},n.appendData=function(t){t.reverse(),e.each(t,function(t,i){a.pagination&&(i.__nodes=!((1==i.nodes?0:1)&&("true"==i.nodes||1==i.nodes?0:1)));var s,l=n.data_obj["id_"+i[a.code]],d=n.data_obj["id_"+i[a.parentCode]],o=n.data_list["_n_"+i[a.parentCode]],r="",p="",c=1;if(l&&l.row_id&&""!=l.row_id&&(r=l.row_id),d){if(p=d.row_id,""==r){var u=0;o&&o.length>0&&(u=o.length),r=d.row_id+"_"+u}c=d.lv+1,s=_(i,!0,c,r,p,a.pagination,i[a.code]);var f=e("#"+d.row_id).children().eq(a.expandColumn).find(".treetable-expander"),h=f.hasClass(a.expanderExpandedClass),b=f.hasClass(a.expanderCollapsedClass);if(h||b?h&&s.css("display","table"):f.addClass(a.expanderCollapsedClass),l){e("#"+l.row_id).before(s),e("#"+l.row_id).remove()}else{var v=d.row_id.split("_");d.row_id.substring(0,d.row_id.length-(v[v.length-1]+"").length)+(parseInt(v[v.length-1])+1);e("#"+d.row_id).after(s)}}else{if(s=_(i,!1,c,r,p,a.pagination,i[a.code]),l){e("#"+l.row_id).before(s),e("#"+l.row_id).remove()}else{var g=n.find("tbody");g.append(s)}}i.isShow=!0,m([i])}),S(),T(),d()},n.toggleRow=function(a){var t=n.data_obj["id_"+a],i=e("#"+t.row_id).find(".treetable-expander");i.trigger("click")},n.expandRow=function(a){var t=n.data_obj["id_"+a],i=e("#"+t.row_id).find(".treetable-expander"),s=i.hasClass(n.options.expanderCollapsedClass);s&&i.trigger("click")},n.collapseRow=function(a){var t=n.data_obj["id_"+a],i=e("#"+t.row_id).find(".treetable-expander"),s=i.hasClass(n.options.expanderExpandedClass);s&&i.trigger("click")},n.expandAll=function(){n.find("tbody").find("tr").find(".treetable-expander").each(function(t,n){var i=e(n).hasClass(a.expanderCollapsedClass);i&&e(n).trigger("click")})},n.collapseAll=function(){n.find("tbody").find("tr").find(".treetable-expander").each(function(t,n){var i=e(n).hasClass(a.expanderExpandedClass);i&&e(n).trigger("click")})},n.showColumn=function(t,i){var s=e.inArray(t,n.hiddenColumns);if(s>-1&&n.hiddenColumns.splice(s,1),n.find("."+t+"_cls").show(),i&&a.showColumns){var l=e(".bootstrap-tree-table .treetable-bars .columns label").find("input[value='"+t+"']");l.prop("checked","checked")}},n.hideColumn=function(t,i){if(n.hiddenColumns.push(t),n.find("."+t+"_cls").hide(),i&&a.showColumns){var s=e(".bootstrap-tree-table .treetable-bars .columns label").find("input[value='"+t+"']");s.prop("checked","")}};var R=function(e,a){var t=e;if("string"!=typeof a||e.hasOwnProperty(a)){return e[a]}var n=a.split(".");for(var i in n){t=t&&t[n[i]]}return t},N=function(a,t,n,i){var s=t;if("string"==typeof t){var l=t.split(".");l.length>1?(s=window,e.each(l,function(e,a){s=s[a]})):s=window[t]}return"object"==typeof s?s:"function"==typeof s?s.apply(a,n):!s&&"string"==typeof t&&sprintf.apply(this,[t].concat(n))?sprintf.apply(this,[t].concat(n)):i},I=function(e){return"每页显示 "+e+" 条记录"},E=function(e,a,t){return"显示第 "+e+" 到第 "+a+" 条记录,总共 "+t+" 条记录。"};return i(),n},e.fn.bootstrapTreeTable.methods={getSelections:function(a,t){var n=a.find("tbody").find("tr").find("input[name='select_item']:checked"),i=[];if("radio"==n.attr("type")){var s=a.data_obj["id_"+n.val()];i.push(s)}else{n.each(function(t,n){var s=a.data_obj["id_"+e(n).val()];i.push(s)})}return i},refresh:function(e,a){a?e.refresh(a):e.refresh()},appendData:function(e,a){a&&e.appendData(a)},toggleRow:function(e,a){e.toggleRow(a)},expandRow:function(e,a){e.expandRow(a)},collapseRow:function(e,a){e.collapseRow(a)},expandAll:function(e){e.expandAll()},collapseAll:function(e){e.collapseAll()},showColumn:function(e,a){e.showColumn(a,!0)},hideColumn:function(e,a){e.hideColumn(a,!0)}},e.fn.bootstrapTreeTable.defaults={code:"code",parentCode:"parentCode",rootIdValue:0,data:null,type:"GET",url:null,ajaxParams:{},expandColumn:1,expandAll:!1,expandFirst:!0,striped:!1,bordered:!1,hover:!0,condensed:!1,columns:[],toolbar:null,height:0,pagination:!1,dataUrl:null,pageNumber:1,pageSize:10,onClickRow:null,pageList:[10,25,50],showTitle:!0,showSearch:!0,showColumns:!0,showRefresh:!0,paginationPreText:"‹",paginationNextText:"›",expanderExpandedClass:"glyphicon glyphicon-chevron-down",expanderCollapsedClass:"glyphicon glyphicon-chevron-right",responseHandler:function(e){return !1},onLoadSuccess:function(e){return !1}}}(jQuery); |
New file |
| | |
| | | /** |
| | | * Bootstrap Table Chinese translation |
| | | * Author: Zhixin Wen<wenzhixin2010@gmail.com> |
| | | */ |
| | | $.fn.bootstrapTable.locales['zh-CN'] = { |
| | | formatShowSearch: function formatShowSearch() { |
| | | return '隐藏/显示搜索'; |
| | | }, |
| | | formatPageGo: function formatPageGo() { |
| | | return '跳转'; |
| | | }, |
| | | formatCopyRows: function formatCopyRows() { |
| | | return '复制行'; |
| | | }, |
| | | formatPrint: function formatPrint() { |
| | | return '打印'; |
| | | }, |
| | | formatLoadingMessage: function formatLoadingMessage() { |
| | | return '正在努力地加载数据中,请稍候'; |
| | | }, |
| | | formatRecordsPerPage: function formatRecordsPerPage(pageNumber) { |
| | | return "每页显示 ".concat(pageNumber, " 条记录"); |
| | | }, |
| | | formatShowingRows: function formatShowingRows(pageFrom, pageTo, totalRows, totalNotFiltered) { |
| | | if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) { |
| | | return "显示第 ".concat(pageFrom, " 到第 ").concat(pageTo, " 条记录,总共 ").concat(totalRows, " 条记录(从 ").concat(totalNotFiltered, " 总记录中过滤)"); |
| | | } |
| | | return "显示第 ".concat(pageFrom, " 到第 ").concat(pageTo, " 条记录,总共 ").concat(totalRows, " 条记录"); |
| | | }, |
| | | formatSRPaginationPreText: function formatSRPaginationPreText() { |
| | | return '上一页'; |
| | | }, |
| | | formatSRPaginationPageText: function formatSRPaginationPageText(page) { |
| | | return "第".concat(page, "页"); |
| | | }, |
| | | formatSRPaginationNextText: function formatSRPaginationNextText() { |
| | | return '下一页'; |
| | | }, |
| | | formatDetailPagination: function formatDetailPagination(totalRows) { |
| | | return "总共 ".concat(totalRows, " 条记录"); |
| | | }, |
| | | formatClearSearch: function formatClearSearch() { |
| | | return '清空过滤'; |
| | | }, |
| | | formatSearch: function formatSearch() { |
| | | return '搜索'; |
| | | }, |
| | | formatNoMatches: function formatNoMatches() { |
| | | return '没有找到匹配的记录'; |
| | | }, |
| | | formatPaginationSwitch: function formatPaginationSwitch() { |
| | | return '隐藏/显示分页'; |
| | | }, |
| | | formatPaginationSwitchDown: function formatPaginationSwitchDown() { |
| | | return '显示分页'; |
| | | }, |
| | | formatPaginationSwitchUp: function formatPaginationSwitchUp() { |
| | | return '隐藏分页'; |
| | | }, |
| | | formatRefresh: function formatRefresh() { |
| | | return '刷新'; |
| | | }, |
| | | formatToggle: function formatToggle() { |
| | | return '切换'; |
| | | }, |
| | | formatToggleOn: function formatToggleOn() { |
| | | return '显示卡片视图'; |
| | | }, |
| | | formatToggleOff: function formatToggleOff() { |
| | | return '隐藏卡片视图'; |
| | | }, |
| | | formatColumns: function formatColumns() { |
| | | return '列'; |
| | | }, |
| | | formatColumnsToggleAll: function formatColumnsToggleAll() { |
| | | return '切换所有'; |
| | | }, |
| | | formatFullscreen: function formatFullscreen() { |
| | | return '全屏'; |
| | | }, |
| | | formatAllRows: function formatAllRows() { |
| | | return '所有'; |
| | | }, |
| | | formatAutoRefresh: function formatAutoRefresh() { |
| | | return '自动刷新'; |
| | | }, |
| | | formatExport: function formatExport() { |
| | | return '导出数据'; |
| | | }, |
| | | formatJumpTo: function formatJumpTo() { |
| | | return '跳转'; |
| | | }, |
| | | formatAdvancedSearch: function formatAdvancedSearch() { |
| | | return '高级搜索'; |
| | | }, |
| | | formatAdvancedCloseButton: function formatAdvancedCloseButton() { |
| | | return '关闭'; |
| | | }, |
| | | formatFilterControlSwitch: function formatFilterControlSwitch() { |
| | | return '隐藏/显示过滤控制'; |
| | | }, |
| | | formatFilterControlSwitchHide: function formatFilterControlSwitchHide() { |
| | | return '隐藏过滤控制'; |
| | | }, |
| | | formatFilterControlSwitchShow: function formatFilterControlSwitchShow() { |
| | | return '显示过滤控制'; |
| | | } |
| | | }; |
| | | $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']); |
New file |
| | |
| | | $.fn.bootstrapTable.locales["zh-CN"]={formatShowSearch:function formatShowSearch(){return"隐藏/显示搜索"},formatPageGo:function formatPageGo(){return"跳转"},formatCopyRows:function formatCopyRows(){return"复制行"},formatPrint:function formatPrint(){return"打印"},formatLoadingMessage:function formatLoadingMessage(){return"正在努力地加载数据中,请稍候"},formatRecordsPerPage:function formatRecordsPerPage(pageNumber){return"每页显示 ".concat(pageNumber," 条记录")},formatShowingRows:function formatShowingRows(pageFrom,pageTo,totalRows,totalNotFiltered){if(totalNotFiltered!==undefined&&totalNotFiltered>0&&totalNotFiltered>totalRows){return"显示第 ".concat(pageFrom," 到第 ").concat(pageTo," 条记录,总共 ").concat(totalRows," 条记录(从 ").concat(totalNotFiltered," 总记录中过滤)")}return"显示第 ".concat(pageFrom," 到第 ").concat(pageTo," 条记录,总共 ").concat(totalRows," 条记录")},formatSRPaginationPreText:function formatSRPaginationPreText(){return"上一页"},formatSRPaginationPageText:function formatSRPaginationPageText(page){return"第".concat(page,"页")},formatSRPaginationNextText:function formatSRPaginationNextText(){return"下一页"},formatDetailPagination:function formatDetailPagination(totalRows){return"总共 ".concat(totalRows," 条记录")},formatClearSearch:function formatClearSearch(){return"清空过滤"},formatSearch:function formatSearch(){return"搜索"},formatNoMatches:function formatNoMatches(){return"没有找到匹配的记录"},formatPaginationSwitch:function formatPaginationSwitch(){return"隐藏/显示分页"},formatPaginationSwitchDown:function formatPaginationSwitchDown(){return"显示分页"},formatPaginationSwitchUp:function formatPaginationSwitchUp(){return"隐藏分页"},formatRefresh:function formatRefresh(){return"刷新"},formatToggle:function formatToggle(){return"切换"},formatToggleOn:function formatToggleOn(){return"显示卡片视图"},formatToggleOff:function formatToggleOff(){return"隐藏卡片视图"},formatColumns:function formatColumns(){return"列"},formatColumnsToggleAll:function formatColumnsToggleAll(){return"切换所有"},formatFullscreen:function formatFullscreen(){return"全屏"},formatAllRows:function formatAllRows(){return"所有"},formatAutoRefresh:function formatAutoRefresh(){return"自动刷新"},formatExport:function formatExport(){return"导出数据"},formatJumpTo:function formatJumpTo(){return"跳转"},formatAdvancedSearch:function formatAdvancedSearch(){return"高级搜索"},formatAdvancedCloseButton:function formatAdvancedCloseButton(){return"关闭"},formatFilterControlSwitch:function formatFilterControlSwitch(){return"隐藏/显示过滤控制"},formatFilterControlSwitchHide:function formatFilterControlSwitchHide(){return"隐藏过滤控制"},formatFilterControlSwitchShow:function formatFilterControlSwitchShow(){return"显示过滤控制"}};$.extend($.fn.bootstrapTable.defaults,$.fn.bootstrapTable.locales["zh-CN"]); |
New file |
| | |
| | | /*! |
| | | * Cropper.js v1.5.12 |
| | | * https://fengyuanchen.github.io/cropperjs |
| | | * |
| | | * Copyright 2015-present Chen Fengyuan |
| | | * Released under the MIT license |
| | | * |
| | | * Date: 2021-06-12T08:00:11.623Z |
| | | */ |
| | | |
| | | .cropper-container { |
| | | direction: ltr; |
| | | font-size: 0; |
| | | line-height: 0; |
| | | position: relative; |
| | | -ms-touch-action: none; |
| | | touch-action: none; |
| | | -webkit-user-select: none; |
| | | -moz-user-select: none; |
| | | -ms-user-select: none; |
| | | user-select: none; |
| | | } |
| | | |
| | | .cropper-container img { |
| | | display: block; |
| | | height: 100%; |
| | | image-orientation: 0deg; |
| | | max-height: none !important; |
| | | max-width: none !important; |
| | | min-height: 0 !important; |
| | | min-width: 0 !important; |
| | | width: 100%; |
| | | } |
| | | |
| | | .cropper-wrap-box, |
| | | .cropper-canvas, |
| | | .cropper-drag-box, |
| | | .cropper-crop-box, |
| | | .cropper-modal { |
| | | bottom: 0; |
| | | left: 0; |
| | | position: absolute; |
| | | right: 0; |
| | | top: 0; |
| | | } |
| | | |
| | | .cropper-wrap-box, |
| | | .cropper-canvas { |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .cropper-drag-box { |
| | | background-color: #fff; |
| | | opacity: 0; |
| | | } |
| | | |
| | | .cropper-modal { |
| | | background-color: #000; |
| | | opacity: 0.5; |
| | | } |
| | | |
| | | .cropper-view-box { |
| | | display: block; |
| | | height: 100%; |
| | | outline: 1px solid #39f; |
| | | outline-color: rgba(51, 153, 255, 0.75); |
| | | overflow: hidden; |
| | | width: 100%; |
| | | } |
| | | |
| | | .cropper-dashed { |
| | | border: 0 dashed #eee; |
| | | display: block; |
| | | opacity: 0.5; |
| | | position: absolute; |
| | | } |
| | | |
| | | .cropper-dashed.dashed-h { |
| | | border-bottom-width: 1px; |
| | | border-top-width: 1px; |
| | | height: calc(100% / 3); |
| | | left: 0; |
| | | top: calc(100% / 3); |
| | | width: 100%; |
| | | } |
| | | |
| | | .cropper-dashed.dashed-v { |
| | | border-left-width: 1px; |
| | | border-right-width: 1px; |
| | | height: 100%; |
| | | left: calc(100% / 3); |
| | | top: 0; |
| | | width: calc(100% / 3); |
| | | } |
| | | |
| | | .cropper-center { |
| | | display: block; |
| | | height: 0; |
| | | left: 50%; |
| | | opacity: 0.75; |
| | | position: absolute; |
| | | top: 50%; |
| | | width: 0; |
| | | } |
| | | |
| | | .cropper-center::before, |
| | | .cropper-center::after { |
| | | background-color: #eee; |
| | | content: ' '; |
| | | display: block; |
| | | position: absolute; |
| | | } |
| | | |
| | | .cropper-center::before { |
| | | height: 1px; |
| | | left: -3px; |
| | | top: 0; |
| | | width: 7px; |
| | | } |
| | | |
| | | .cropper-center::after { |
| | | height: 7px; |
| | | left: 0; |
| | | top: -3px; |
| | | width: 1px; |
| | | } |
| | | |
| | | .cropper-face, |
| | | .cropper-line, |
| | | .cropper-point { |
| | | display: block; |
| | | height: 100%; |
| | | opacity: 0.1; |
| | | position: absolute; |
| | | width: 100%; |
| | | } |
| | | |
| | | .cropper-face { |
| | | background-color: #fff; |
| | | left: 0; |
| | | top: 0; |
| | | } |
| | | |
| | | .cropper-line { |
| | | background-color: #39f; |
| | | } |
| | | |
| | | .cropper-line.line-e { |
| | | cursor: ew-resize; |
| | | right: -3px; |
| | | top: 0; |
| | | width: 5px; |
| | | } |
| | | |
| | | .cropper-line.line-n { |
| | | cursor: ns-resize; |
| | | height: 5px; |
| | | left: 0; |
| | | top: -3px; |
| | | } |
| | | |
| | | .cropper-line.line-w { |
| | | cursor: ew-resize; |
| | | left: -3px; |
| | | top: 0; |
| | | width: 5px; |
| | | } |
| | | |
| | | .cropper-line.line-s { |
| | | bottom: -3px; |
| | | cursor: ns-resize; |
| | | height: 5px; |
| | | left: 0; |
| | | } |
| | | |
| | | .cropper-point { |
| | | background-color: #39f; |
| | | height: 5px; |
| | | opacity: 0.75; |
| | | width: 5px; |
| | | } |
| | | |
| | | .cropper-point.point-e { |
| | | cursor: ew-resize; |
| | | margin-top: -3px; |
| | | right: -3px; |
| | | top: 50%; |
| | | } |
| | | |
| | | .cropper-point.point-n { |
| | | cursor: ns-resize; |
| | | left: 50%; |
| | | margin-left: -3px; |
| | | top: -3px; |
| | | } |
| | | |
| | | .cropper-point.point-w { |
| | | cursor: ew-resize; |
| | | left: -3px; |
| | | margin-top: -3px; |
| | | top: 50%; |
| | | } |
| | | |
| | | .cropper-point.point-s { |
| | | bottom: -3px; |
| | | cursor: s-resize; |
| | | left: 50%; |
| | | margin-left: -3px; |
| | | } |
| | | |
| | | .cropper-point.point-ne { |
| | | cursor: nesw-resize; |
| | | right: -3px; |
| | | top: -3px; |
| | | } |
| | | |
| | | .cropper-point.point-nw { |
| | | cursor: nwse-resize; |
| | | left: -3px; |
| | | top: -3px; |
| | | } |
| | | |
| | | .cropper-point.point-sw { |
| | | bottom: -3px; |
| | | cursor: nesw-resize; |
| | | left: -3px; |
| | | } |
| | | |
| | | .cropper-point.point-se { |
| | | bottom: -3px; |
| | | cursor: nwse-resize; |
| | | height: 20px; |
| | | opacity: 1; |
| | | right: -3px; |
| | | width: 20px; |
| | | } |
| | | |
| | | @media (min-width: 768px) { |
| | | .cropper-point.point-se { |
| | | height: 15px; |
| | | width: 15px; |
| | | } |
| | | } |
| | | |
| | | @media (min-width: 992px) { |
| | | .cropper-point.point-se { |
| | | height: 10px; |
| | | width: 10px; |
| | | } |
| | | } |
| | | |
| | | @media (min-width: 1200px) { |
| | | .cropper-point.point-se { |
| | | height: 5px; |
| | | opacity: 0.75; |
| | | width: 5px; |
| | | } |
| | | } |
| | | |
| | | .cropper-point.point-se::before { |
| | | background-color: #39f; |
| | | bottom: -50%; |
| | | content: ' '; |
| | | display: block; |
| | | height: 200%; |
| | | opacity: 0; |
| | | position: absolute; |
| | | right: -50%; |
| | | width: 200%; |
| | | } |
| | | |
| | | .cropper-invisible { |
| | | opacity: 0; |
| | | } |
| | | |
| | | .cropper-bg { |
| | | background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC'); |
| | | } |
| | | |
| | | .cropper-hide { |
| | | display: block; |
| | | height: 0; |
| | | position: absolute; |
| | | width: 0; |
| | | } |
| | | |
| | | .cropper-hidden { |
| | | display: none !important; |
| | | } |
| | | |
| | | .cropper-move { |
| | | cursor: move; |
| | | } |
| | | |
| | | .cropper-crop { |
| | | cursor: crosshair; |
| | | } |
| | | |
| | | .cropper-disabled .cropper-drag-box, |
| | | .cropper-disabled .cropper-face, |
| | | .cropper-disabled .cropper-line, |
| | | .cropper-disabled .cropper-point { |
| | | cursor: not-allowed; |
| | | } |
New file |
| | |
| | | /*! |
| | | * Cropper.js v1.5.12 |
| | | * https://fengyuanchen.github.io/cropperjs |
| | | * |
| | | * Copyright 2015-present Chen Fengyuan |
| | | * Released under the MIT license |
| | | * |
| | | * Date: 2021-06-12T08:00:17.411Z |
| | | */ |
| | | |
| | | (function (global, factory) { |
| | | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : |
| | | typeof define === 'function' && define.amd ? define(factory) : |
| | | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Cropper = factory()); |
| | | }(this, (function () { 'use strict'; |
| | | |
| | | function ownKeys(object, enumerableOnly) { |
| | | var keys = Object.keys(object); |
| | | |
| | | if (Object.getOwnPropertySymbols) { |
| | | var symbols = Object.getOwnPropertySymbols(object); |
| | | |
| | | if (enumerableOnly) { |
| | | symbols = symbols.filter(function (sym) { |
| | | return Object.getOwnPropertyDescriptor(object, sym).enumerable; |
| | | }); |
| | | } |
| | | |
| | | keys.push.apply(keys, symbols); |
| | | } |
| | | |
| | | return keys; |
| | | } |
| | | |
| | | function _objectSpread2(target) { |
| | | for (var i = 1; i < arguments.length; i++) { |
| | | var source = arguments[i] != null ? arguments[i] : {}; |
| | | |
| | | if (i % 2) { |
| | | ownKeys(Object(source), true).forEach(function (key) { |
| | | _defineProperty(target, key, source[key]); |
| | | }); |
| | | } else if (Object.getOwnPropertyDescriptors) { |
| | | Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); |
| | | } else { |
| | | ownKeys(Object(source)).forEach(function (key) { |
| | | Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | return target; |
| | | } |
| | | |
| | | function _typeof(obj) { |
| | | "@babel/helpers - typeof"; |
| | | |
| | | if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { |
| | | _typeof = function (obj) { |
| | | return typeof obj; |
| | | }; |
| | | } else { |
| | | _typeof = function (obj) { |
| | | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; |
| | | }; |
| | | } |
| | | |
| | | return _typeof(obj); |
| | | } |
| | | |
| | | function _classCallCheck(instance, Constructor) { |
| | | if (!(instance instanceof Constructor)) { |
| | | throw new TypeError("Cannot call a class as a function"); |
| | | } |
| | | } |
| | | |
| | | function _defineProperties(target, props) { |
| | | for (var i = 0; i < props.length; i++) { |
| | | var descriptor = props[i]; |
| | | descriptor.enumerable = descriptor.enumerable || false; |
| | | descriptor.configurable = true; |
| | | if ("value" in descriptor) descriptor.writable = true; |
| | | Object.defineProperty(target, descriptor.key, descriptor); |
| | | } |
| | | } |
| | | |
| | | function _createClass(Constructor, protoProps, staticProps) { |
| | | if (protoProps) _defineProperties(Constructor.prototype, protoProps); |
| | | if (staticProps) _defineProperties(Constructor, staticProps); |
| | | return Constructor; |
| | | } |
| | | |
| | | function _defineProperty(obj, key, value) { |
| | | if (key in obj) { |
| | | Object.defineProperty(obj, key, { |
| | | value: value, |
| | | enumerable: true, |
| | | configurable: true, |
| | | writable: true |
| | | }); |
| | | } else { |
| | | obj[key] = value; |
| | | } |
| | | |
| | | return obj; |
| | | } |
| | | |
| | | function _toConsumableArray(arr) { |
| | | return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); |
| | | } |
| | | |
| | | function _arrayWithoutHoles(arr) { |
| | | if (Array.isArray(arr)) return _arrayLikeToArray(arr); |
| | | } |
| | | |
| | | function _iterableToArray(iter) { |
| | | if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); |
| | | } |
| | | |
| | | function _unsupportedIterableToArray(o, minLen) { |
| | | if (!o) return; |
| | | if (typeof o === "string") return _arrayLikeToArray(o, minLen); |
| | | var n = Object.prototype.toString.call(o).slice(8, -1); |
| | | if (n === "Object" && o.constructor) n = o.constructor.name; |
| | | if (n === "Map" || n === "Set") return Array.from(o); |
| | | if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); |
| | | } |
| | | |
| | | function _arrayLikeToArray(arr, len) { |
| | | if (len == null || len > arr.length) len = arr.length; |
| | | |
| | | for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; |
| | | |
| | | return arr2; |
| | | } |
| | | |
| | | function _nonIterableSpread() { |
| | | throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
| | | } |
| | | |
| | | var IS_BROWSER = typeof window !== 'undefined' && typeof window.document !== 'undefined'; |
| | | var WINDOW = IS_BROWSER ? window : {}; |
| | | var IS_TOUCH_DEVICE = IS_BROWSER && WINDOW.document.documentElement ? 'ontouchstart' in WINDOW.document.documentElement : false; |
| | | var HAS_POINTER_EVENT = IS_BROWSER ? 'PointerEvent' in WINDOW : false; |
| | | var NAMESPACE = 'cropper'; // Actions |
| | | |
| | | var ACTION_ALL = 'all'; |
| | | var ACTION_CROP = 'crop'; |
| | | var ACTION_MOVE = 'move'; |
| | | var ACTION_ZOOM = 'zoom'; |
| | | var ACTION_EAST = 'e'; |
| | | var ACTION_WEST = 'w'; |
| | | var ACTION_SOUTH = 's'; |
| | | var ACTION_NORTH = 'n'; |
| | | var ACTION_NORTH_EAST = 'ne'; |
| | | var ACTION_NORTH_WEST = 'nw'; |
| | | var ACTION_SOUTH_EAST = 'se'; |
| | | var ACTION_SOUTH_WEST = 'sw'; // Classes |
| | | |
| | | var CLASS_CROP = "".concat(NAMESPACE, "-crop"); |
| | | var CLASS_DISABLED = "".concat(NAMESPACE, "-disabled"); |
| | | var CLASS_HIDDEN = "".concat(NAMESPACE, "-hidden"); |
| | | var CLASS_HIDE = "".concat(NAMESPACE, "-hide"); |
| | | var CLASS_INVISIBLE = "".concat(NAMESPACE, "-invisible"); |
| | | var CLASS_MODAL = "".concat(NAMESPACE, "-modal"); |
| | | var CLASS_MOVE = "".concat(NAMESPACE, "-move"); // Data keys |
| | | |
| | | var DATA_ACTION = "".concat(NAMESPACE, "Action"); |
| | | var DATA_PREVIEW = "".concat(NAMESPACE, "Preview"); // Drag modes |
| | | |
| | | var DRAG_MODE_CROP = 'crop'; |
| | | var DRAG_MODE_MOVE = 'move'; |
| | | var DRAG_MODE_NONE = 'none'; // Events |
| | | |
| | | var EVENT_CROP = 'crop'; |
| | | var EVENT_CROP_END = 'cropend'; |
| | | var EVENT_CROP_MOVE = 'cropmove'; |
| | | var EVENT_CROP_START = 'cropstart'; |
| | | var EVENT_DBLCLICK = 'dblclick'; |
| | | var EVENT_TOUCH_START = IS_TOUCH_DEVICE ? 'touchstart' : 'mousedown'; |
| | | var EVENT_TOUCH_MOVE = IS_TOUCH_DEVICE ? 'touchmove' : 'mousemove'; |
| | | var EVENT_TOUCH_END = IS_TOUCH_DEVICE ? 'touchend touchcancel' : 'mouseup'; |
| | | var EVENT_POINTER_DOWN = HAS_POINTER_EVENT ? 'pointerdown' : EVENT_TOUCH_START; |
| | | var EVENT_POINTER_MOVE = HAS_POINTER_EVENT ? 'pointermove' : EVENT_TOUCH_MOVE; |
| | | var EVENT_POINTER_UP = HAS_POINTER_EVENT ? 'pointerup pointercancel' : EVENT_TOUCH_END; |
| | | var EVENT_READY = 'ready'; |
| | | var EVENT_RESIZE = 'resize'; |
| | | var EVENT_WHEEL = 'wheel'; |
| | | var EVENT_ZOOM = 'zoom'; // Mime types |
| | | |
| | | var MIME_TYPE_JPEG = 'image/jpeg'; // RegExps |
| | | |
| | | var REGEXP_ACTIONS = /^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/; |
| | | var REGEXP_DATA_URL = /^data:/; |
| | | var REGEXP_DATA_URL_JPEG = /^data:image\/jpeg;base64,/; |
| | | var REGEXP_TAG_NAME = /^img|canvas$/i; // Misc |
| | | // Inspired by the default width and height of a canvas element. |
| | | |
| | | var MIN_CONTAINER_WIDTH = 200; |
| | | var MIN_CONTAINER_HEIGHT = 100; |
| | | |
| | | var DEFAULTS = { |
| | | // Define the view mode of the cropper |
| | | viewMode: 0, |
| | | // 0, 1, 2, 3 |
| | | // Define the dragging mode of the cropper |
| | | dragMode: DRAG_MODE_CROP, |
| | | // 'crop', 'move' or 'none' |
| | | // Define the initial aspect ratio of the crop box |
| | | initialAspectRatio: NaN, |
| | | // Define the aspect ratio of the crop box |
| | | aspectRatio: NaN, |
| | | // An object with the previous cropping result data |
| | | data: null, |
| | | // A selector for adding extra containers to preview |
| | | preview: '', |
| | | // Re-render the cropper when resize the window |
| | | responsive: true, |
| | | // Restore the cropped area after resize the window |
| | | restore: true, |
| | | // Check if the current image is a cross-origin image |
| | | checkCrossOrigin: true, |
| | | // Check the current image's Exif Orientation information |
| | | checkOrientation: true, |
| | | // Show the black modal |
| | | modal: true, |
| | | // Show the dashed lines for guiding |
| | | guides: true, |
| | | // Show the center indicator for guiding |
| | | center: true, |
| | | // Show the white modal to highlight the crop box |
| | | highlight: true, |
| | | // Show the grid background |
| | | background: true, |
| | | // Enable to crop the image automatically when initialize |
| | | autoCrop: true, |
| | | // Define the percentage of automatic cropping area when initializes |
| | | autoCropArea: 0.8, |
| | | // Enable to move the image |
| | | movable: true, |
| | | // Enable to rotate the image |
| | | rotatable: true, |
| | | // Enable to scale the image |
| | | scalable: true, |
| | | // Enable to zoom the image |
| | | zoomable: true, |
| | | // Enable to zoom the image by dragging touch |
| | | zoomOnTouch: true, |
| | | // Enable to zoom the image by wheeling mouse |
| | | zoomOnWheel: true, |
| | | // Define zoom ratio when zoom the image by wheeling mouse |
| | | wheelZoomRatio: 0.1, |
| | | // Enable to move the crop box |
| | | cropBoxMovable: true, |
| | | // Enable to resize the crop box |
| | | cropBoxResizable: true, |
| | | // Toggle drag mode between "crop" and "move" when click twice on the cropper |
| | | toggleDragModeOnDblclick: true, |
| | | // Size limitation |
| | | minCanvasWidth: 0, |
| | | minCanvasHeight: 0, |
| | | minCropBoxWidth: 0, |
| | | minCropBoxHeight: 0, |
| | | minContainerWidth: MIN_CONTAINER_WIDTH, |
| | | minContainerHeight: MIN_CONTAINER_HEIGHT, |
| | | // Shortcuts of events |
| | | ready: null, |
| | | cropstart: null, |
| | | cropmove: null, |
| | | cropend: null, |
| | | crop: null, |
| | | zoom: null |
| | | }; |
| | | |
| | | var TEMPLATE = '<div class="cropper-container" touch-action="none">' + '<div class="cropper-wrap-box">' + '<div class="cropper-canvas"></div>' + '</div>' + '<div class="cropper-drag-box"></div>' + '<div class="cropper-crop-box">' + '<span class="cropper-view-box"></span>' + '<span class="cropper-dashed dashed-h"></span>' + '<span class="cropper-dashed dashed-v"></span>' + '<span class="cropper-center"></span>' + '<span class="cropper-face"></span>' + '<span class="cropper-line line-e" data-cropper-action="e"></span>' + '<span class="cropper-line line-n" data-cropper-action="n"></span>' + '<span class="cropper-line line-w" data-cropper-action="w"></span>' + '<span class="cropper-line line-s" data-cropper-action="s"></span>' + '<span class="cropper-point point-e" data-cropper-action="e"></span>' + '<span class="cropper-point point-n" data-cropper-action="n"></span>' + '<span class="cropper-point point-w" data-cropper-action="w"></span>' + '<span class="cropper-point point-s" data-cropper-action="s"></span>' + '<span class="cropper-point point-ne" data-cropper-action="ne"></span>' + '<span class="cropper-point point-nw" data-cropper-action="nw"></span>' + '<span class="cropper-point point-sw" data-cropper-action="sw"></span>' + '<span class="cropper-point point-se" data-cropper-action="se"></span>' + '</div>' + '</div>'; |
| | | |
| | | /** |
| | | * Check if the given value is not a number. |
| | | */ |
| | | |
| | | var isNaN = Number.isNaN || WINDOW.isNaN; |
| | | /** |
| | | * Check if the given value is a number. |
| | | * @param {*} value - The value to check. |
| | | * @returns {boolean} Returns `true` if the given value is a number, else `false`. |
| | | */ |
| | | |
| | | function isNumber(value) { |
| | | return typeof value === 'number' && !isNaN(value); |
| | | } |
| | | /** |
| | | * Check if the given value is a positive number. |
| | | * @param {*} value - The value to check. |
| | | * @returns {boolean} Returns `true` if the given value is a positive number, else `false`. |
| | | */ |
| | | |
| | | var isPositiveNumber = function isPositiveNumber(value) { |
| | | return value > 0 && value < Infinity; |
| | | }; |
| | | /** |
| | | * Check if the given value is undefined. |
| | | * @param {*} value - The value to check. |
| | | * @returns {boolean} Returns `true` if the given value is undefined, else `false`. |
| | | */ |
| | | |
| | | function isUndefined(value) { |
| | | return typeof value === 'undefined'; |
| | | } |
| | | /** |
| | | * Check if the given value is an object. |
| | | * @param {*} value - The value to check. |
| | | * @returns {boolean} Returns `true` if the given value is an object, else `false`. |
| | | */ |
| | | |
| | | function isObject(value) { |
| | | return _typeof(value) === 'object' && value !== null; |
| | | } |
| | | var hasOwnProperty = Object.prototype.hasOwnProperty; |
| | | /** |
| | | * Check if the given value is a plain object. |
| | | * @param {*} value - The value to check. |
| | | * @returns {boolean} Returns `true` if the given value is a plain object, else `false`. |
| | | */ |
| | | |
| | | function isPlainObject(value) { |
| | | if (!isObject(value)) { |
| | | return false; |
| | | } |
| | | |
| | | try { |
| | | var _constructor = value.constructor; |
| | | var prototype = _constructor.prototype; |
| | | return _constructor && prototype && hasOwnProperty.call(prototype, 'isPrototypeOf'); |
| | | } catch (error) { |
| | | return false; |
| | | } |
| | | } |
| | | /** |
| | | * Check if the given value is a function. |
| | | * @param {*} value - The value to check. |
| | | * @returns {boolean} Returns `true` if the given value is a function, else `false`. |
| | | */ |
| | | |
| | | function isFunction(value) { |
| | | return typeof value === 'function'; |
| | | } |
| | | var slice = Array.prototype.slice; |
| | | /** |
| | | * Convert array-like or iterable object to an array. |
| | | * @param {*} value - The value to convert. |
| | | * @returns {Array} Returns a new array. |
| | | */ |
| | | |
| | | function toArray(value) { |
| | | return Array.from ? Array.from(value) : slice.call(value); |
| | | } |
| | | /** |
| | | * Iterate the given data. |
| | | * @param {*} data - The data to iterate. |
| | | * @param {Function} callback - The process function for each element. |
| | | * @returns {*} The original data. |
| | | */ |
| | | |
| | | function forEach(data, callback) { |
| | | if (data && isFunction(callback)) { |
| | | if (Array.isArray(data) || isNumber(data.length) |
| | | /* array-like */ |
| | | ) { |
| | | toArray(data).forEach(function (value, key) { |
| | | callback.call(data, value, key, data); |
| | | }); |
| | | } else if (isObject(data)) { |
| | | Object.keys(data).forEach(function (key) { |
| | | callback.call(data, data[key], key, data); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | return data; |
| | | } |
| | | /** |
| | | * Extend the given object. |
| | | * @param {*} target - The target object to extend. |
| | | * @param {*} args - The rest objects for merging to the target object. |
| | | * @returns {Object} The extended object. |
| | | */ |
| | | |
| | | var assign = Object.assign || function assign(target) { |
| | | for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { |
| | | args[_key - 1] = arguments[_key]; |
| | | } |
| | | |
| | | if (isObject(target) && args.length > 0) { |
| | | args.forEach(function (arg) { |
| | | if (isObject(arg)) { |
| | | Object.keys(arg).forEach(function (key) { |
| | | target[key] = arg[key]; |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | return target; |
| | | }; |
| | | var REGEXP_DECIMALS = /\.\d*(?:0|9){12}\d*$/; |
| | | /** |
| | | * Normalize decimal number. |
| | | * Check out {@link https://0.30000000000000004.com/} |
| | | * @param {number} value - The value to normalize. |
| | | * @param {number} [times=100000000000] - The times for normalizing. |
| | | * @returns {number} Returns the normalized number. |
| | | */ |
| | | |
| | | function normalizeDecimalNumber(value) { |
| | | var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100000000000; |
| | | return REGEXP_DECIMALS.test(value) ? Math.round(value * times) / times : value; |
| | | } |
| | | var REGEXP_SUFFIX = /^width|height|left|top|marginLeft|marginTop$/; |
| | | /** |
| | | * Apply styles to the given element. |
| | | * @param {Element} element - The target element. |
| | | * @param {Object} styles - The styles for applying. |
| | | */ |
| | | |
| | | function setStyle(element, styles) { |
| | | var style = element.style; |
| | | forEach(styles, function (value, property) { |
| | | if (REGEXP_SUFFIX.test(property) && isNumber(value)) { |
| | | value = "".concat(value, "px"); |
| | | } |
| | | |
| | | style[property] = value; |
| | | }); |
| | | } |
| | | /** |
| | | * Check if the given element has a special class. |
| | | * @param {Element} element - The element to check. |
| | | * @param {string} value - The class to search. |
| | | * @returns {boolean} Returns `true` if the special class was found. |
| | | */ |
| | | |
| | | function hasClass(element, value) { |
| | | return element.classList ? element.classList.contains(value) : element.className.indexOf(value) > -1; |
| | | } |
| | | /** |
| | | * Add classes to the given element. |
| | | * @param {Element} element - The target element. |
| | | * @param {string} value - The classes to be added. |
| | | */ |
| | | |
| | | function addClass(element, value) { |
| | | if (!value) { |
| | | return; |
| | | } |
| | | |
| | | if (isNumber(element.length)) { |
| | | forEach(element, function (elem) { |
| | | addClass(elem, value); |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | if (element.classList) { |
| | | element.classList.add(value); |
| | | return; |
| | | } |
| | | |
| | | var className = element.className.trim(); |
| | | |
| | | if (!className) { |
| | | element.className = value; |
| | | } else if (className.indexOf(value) < 0) { |
| | | element.className = "".concat(className, " ").concat(value); |
| | | } |
| | | } |
| | | /** |
| | | * Remove classes from the given element. |
| | | * @param {Element} element - The target element. |
| | | * @param {string} value - The classes to be removed. |
| | | */ |
| | | |
| | | function removeClass(element, value) { |
| | | if (!value) { |
| | | return; |
| | | } |
| | | |
| | | if (isNumber(element.length)) { |
| | | forEach(element, function (elem) { |
| | | removeClass(elem, value); |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | if (element.classList) { |
| | | element.classList.remove(value); |
| | | return; |
| | | } |
| | | |
| | | if (element.className.indexOf(value) >= 0) { |
| | | element.className = element.className.replace(value, ''); |
| | | } |
| | | } |
| | | /** |
| | | * Add or remove classes from the given element. |
| | | * @param {Element} element - The target element. |
| | | * @param {string} value - The classes to be toggled. |
| | | * @param {boolean} added - Add only. |
| | | */ |
| | | |
| | | function toggleClass(element, value, added) { |
| | | if (!value) { |
| | | return; |
| | | } |
| | | |
| | | if (isNumber(element.length)) { |
| | | forEach(element, function (elem) { |
| | | toggleClass(elem, value, added); |
| | | }); |
| | | return; |
| | | } // IE10-11 doesn't support the second parameter of `classList.toggle` |
| | | |
| | | |
| | | if (added) { |
| | | addClass(element, value); |
| | | } else { |
| | | removeClass(element, value); |
| | | } |
| | | } |
| | | var REGEXP_CAMEL_CASE = /([a-z\d])([A-Z])/g; |
| | | /** |
| | | * Transform the given string from camelCase to kebab-case |
| | | * @param {string} value - The value to transform. |
| | | * @returns {string} The transformed value. |
| | | */ |
| | | |
| | | function toParamCase(value) { |
| | | return value.replace(REGEXP_CAMEL_CASE, '$1-$2').toLowerCase(); |
| | | } |
| | | /** |
| | | * Get data from the given element. |
| | | * @param {Element} element - The target element. |
| | | * @param {string} name - The data key to get. |
| | | * @returns {string} The data value. |
| | | */ |
| | | |
| | | function getData(element, name) { |
| | | if (isObject(element[name])) { |
| | | return element[name]; |
| | | } |
| | | |
| | | if (element.dataset) { |
| | | return element.dataset[name]; |
| | | } |
| | | |
| | | return element.getAttribute("data-".concat(toParamCase(name))); |
| | | } |
| | | /** |
| | | * Set data to the given element. |
| | | * @param {Element} element - The target element. |
| | | * @param {string} name - The data key to set. |
| | | * @param {string} data - The data value. |
| | | */ |
| | | |
| | | function setData(element, name, data) { |
| | | if (isObject(data)) { |
| | | element[name] = data; |
| | | } else if (element.dataset) { |
| | | element.dataset[name] = data; |
| | | } else { |
| | | element.setAttribute("data-".concat(toParamCase(name)), data); |
| | | } |
| | | } |
| | | /** |
| | | * Remove data from the given element. |
| | | * @param {Element} element - The target element. |
| | | * @param {string} name - The data key to remove. |
| | | */ |
| | | |
| | | function removeData(element, name) { |
| | | if (isObject(element[name])) { |
| | | try { |
| | | delete element[name]; |
| | | } catch (error) { |
| | | element[name] = undefined; |
| | | } |
| | | } else if (element.dataset) { |
| | | // #128 Safari not allows to delete dataset property |
| | | try { |
| | | delete element.dataset[name]; |
| | | } catch (error) { |
| | | element.dataset[name] = undefined; |
| | | } |
| | | } else { |
| | | element.removeAttribute("data-".concat(toParamCase(name))); |
| | | } |
| | | } |
| | | var REGEXP_SPACES = /\s\s*/; |
| | | |
| | | var onceSupported = function () { |
| | | var supported = false; |
| | | |
| | | if (IS_BROWSER) { |
| | | var once = false; |
| | | |
| | | var listener = function listener() {}; |
| | | |
| | | var options = Object.defineProperty({}, 'once', { |
| | | get: function get() { |
| | | supported = true; |
| | | return once; |
| | | }, |
| | | |
| | | /** |
| | | * This setter can fix a `TypeError` in strict mode |
| | | * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Getter_only} |
| | | * @param {boolean} value - The value to set |
| | | */ |
| | | set: function set(value) { |
| | | once = value; |
| | | } |
| | | }); |
| | | WINDOW.addEventListener('test', listener, options); |
| | | WINDOW.removeEventListener('test', listener, options); |
| | | } |
| | | |
| | | return supported; |
| | | }(); |
| | | /** |
| | | * Remove event listener from the target element. |
| | | * @param {Element} element - The event target. |
| | | * @param {string} type - The event type(s). |
| | | * @param {Function} listener - The event listener. |
| | | * @param {Object} options - The event options. |
| | | */ |
| | | |
| | | |
| | | function removeListener(element, type, listener) { |
| | | var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; |
| | | var handler = listener; |
| | | type.trim().split(REGEXP_SPACES).forEach(function (event) { |
| | | if (!onceSupported) { |
| | | var listeners = element.listeners; |
| | | |
| | | if (listeners && listeners[event] && listeners[event][listener]) { |
| | | handler = listeners[event][listener]; |
| | | delete listeners[event][listener]; |
| | | |
| | | if (Object.keys(listeners[event]).length === 0) { |
| | | delete listeners[event]; |
| | | } |
| | | |
| | | if (Object.keys(listeners).length === 0) { |
| | | delete element.listeners; |
| | | } |
| | | } |
| | | } |
| | | |
| | | element.removeEventListener(event, handler, options); |
| | | }); |
| | | } |
| | | /** |
| | | * Add event listener to the target element. |
| | | * @param {Element} element - The event target. |
| | | * @param {string} type - The event type(s). |
| | | * @param {Function} listener - The event listener. |
| | | * @param {Object} options - The event options. |
| | | */ |
| | | |
| | | function addListener(element, type, listener) { |
| | | var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; |
| | | var _handler = listener; |
| | | type.trim().split(REGEXP_SPACES).forEach(function (event) { |
| | | if (options.once && !onceSupported) { |
| | | var _element$listeners = element.listeners, |
| | | listeners = _element$listeners === void 0 ? {} : _element$listeners; |
| | | |
| | | _handler = function handler() { |
| | | delete listeners[event][listener]; |
| | | element.removeEventListener(event, _handler, options); |
| | | |
| | | for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { |
| | | args[_key2] = arguments[_key2]; |
| | | } |
| | | |
| | | listener.apply(element, args); |
| | | }; |
| | | |
| | | if (!listeners[event]) { |
| | | listeners[event] = {}; |
| | | } |
| | | |
| | | if (listeners[event][listener]) { |
| | | element.removeEventListener(event, listeners[event][listener], options); |
| | | } |
| | | |
| | | listeners[event][listener] = _handler; |
| | | element.listeners = listeners; |
| | | } |
| | | |
| | | element.addEventListener(event, _handler, options); |
| | | }); |
| | | } |
| | | /** |
| | | * Dispatch event on the target element. |
| | | * @param {Element} element - The event target. |
| | | * @param {string} type - The event type(s). |
| | | * @param {Object} data - The additional event data. |
| | | * @returns {boolean} Indicate if the event is default prevented or not. |
| | | */ |
| | | |
| | | function dispatchEvent(element, type, data) { |
| | | var event; // Event and CustomEvent on IE9-11 are global objects, not constructors |
| | | |
| | | if (isFunction(Event) && isFunction(CustomEvent)) { |
| | | event = new CustomEvent(type, { |
| | | detail: data, |
| | | bubbles: true, |
| | | cancelable: true |
| | | }); |
| | | } else { |
| | | event = document.createEvent('CustomEvent'); |
| | | event.initCustomEvent(type, true, true, data); |
| | | } |
| | | |
| | | return element.dispatchEvent(event); |
| | | } |
| | | /** |
| | | * Get the offset base on the document. |
| | | * @param {Element} element - The target element. |
| | | * @returns {Object} The offset data. |
| | | */ |
| | | |
| | | function getOffset(element) { |
| | | var box = element.getBoundingClientRect(); |
| | | return { |
| | | left: box.left + (window.pageXOffset - document.documentElement.clientLeft), |
| | | top: box.top + (window.pageYOffset - document.documentElement.clientTop) |
| | | }; |
| | | } |
| | | var location = WINDOW.location; |
| | | var REGEXP_ORIGINS = /^(\w+:)\/\/([^:/?#]*):?(\d*)/i; |
| | | /** |
| | | * Check if the given URL is a cross origin URL. |
| | | * @param {string} url - The target URL. |
| | | * @returns {boolean} Returns `true` if the given URL is a cross origin URL, else `false`. |
| | | */ |
| | | |
| | | function isCrossOriginURL(url) { |
| | | var parts = url.match(REGEXP_ORIGINS); |
| | | return parts !== null && (parts[1] !== location.protocol || parts[2] !== location.hostname || parts[3] !== location.port); |
| | | } |
| | | /** |
| | | * Add timestamp to the given URL. |
| | | * @param {string} url - The target URL. |
| | | * @returns {string} The result URL. |
| | | */ |
| | | |
| | | function addTimestamp(url) { |
| | | var timestamp = "timestamp=".concat(new Date().getTime()); |
| | | return url + (url.indexOf('?') === -1 ? '?' : '&') + timestamp; |
| | | } |
| | | /** |
| | | * Get transforms base on the given object. |
| | | * @param {Object} obj - The target object. |
| | | * @returns {string} A string contains transform values. |
| | | */ |
| | | |
| | | function getTransforms(_ref) { |
| | | var rotate = _ref.rotate, |
| | | scaleX = _ref.scaleX, |
| | | scaleY = _ref.scaleY, |
| | | translateX = _ref.translateX, |
| | | translateY = _ref.translateY; |
| | | var values = []; |
| | | |
| | | if (isNumber(translateX) && translateX !== 0) { |
| | | values.push("translateX(".concat(translateX, "px)")); |
| | | } |
| | | |
| | | if (isNumber(translateY) && translateY !== 0) { |
| | | values.push("translateY(".concat(translateY, "px)")); |
| | | } // Rotate should come first before scale to match orientation transform |
| | | |
| | | |
| | | if (isNumber(rotate) && rotate !== 0) { |
| | | values.push("rotate(".concat(rotate, "deg)")); |
| | | } |
| | | |
| | | if (isNumber(scaleX) && scaleX !== 1) { |
| | | values.push("scaleX(".concat(scaleX, ")")); |
| | | } |
| | | |
| | | if (isNumber(scaleY) && scaleY !== 1) { |
| | | values.push("scaleY(".concat(scaleY, ")")); |
| | | } |
| | | |
| | | var transform = values.length ? values.join(' ') : 'none'; |
| | | return { |
| | | WebkitTransform: transform, |
| | | msTransform: transform, |
| | | transform: transform |
| | | }; |
| | | } |
| | | /** |
| | | * Get the max ratio of a group of pointers. |
| | | * @param {string} pointers - The target pointers. |
| | | * @returns {number} The result ratio. |
| | | */ |
| | | |
| | | function getMaxZoomRatio(pointers) { |
| | | var pointers2 = _objectSpread2({}, pointers); |
| | | |
| | | var maxRatio = 0; |
| | | forEach(pointers, function (pointer, pointerId) { |
| | | delete pointers2[pointerId]; |
| | | forEach(pointers2, function (pointer2) { |
| | | var x1 = Math.abs(pointer.startX - pointer2.startX); |
| | | var y1 = Math.abs(pointer.startY - pointer2.startY); |
| | | var x2 = Math.abs(pointer.endX - pointer2.endX); |
| | | var y2 = Math.abs(pointer.endY - pointer2.endY); |
| | | var z1 = Math.sqrt(x1 * x1 + y1 * y1); |
| | | var z2 = Math.sqrt(x2 * x2 + y2 * y2); |
| | | var ratio = (z2 - z1) / z1; |
| | | |
| | | if (Math.abs(ratio) > Math.abs(maxRatio)) { |
| | | maxRatio = ratio; |
| | | } |
| | | }); |
| | | }); |
| | | return maxRatio; |
| | | } |
| | | /** |
| | | * Get a pointer from an event object. |
| | | * @param {Object} event - The target event object. |
| | | * @param {boolean} endOnly - Indicates if only returns the end point coordinate or not. |
| | | * @returns {Object} The result pointer contains start and/or end point coordinates. |
| | | */ |
| | | |
| | | function getPointer(_ref2, endOnly) { |
| | | var pageX = _ref2.pageX, |
| | | pageY = _ref2.pageY; |
| | | var end = { |
| | | endX: pageX, |
| | | endY: pageY |
| | | }; |
| | | return endOnly ? end : _objectSpread2({ |
| | | startX: pageX, |
| | | startY: pageY |
| | | }, end); |
| | | } |
| | | /** |
| | | * Get the center point coordinate of a group of pointers. |
| | | * @param {Object} pointers - The target pointers. |
| | | * @returns {Object} The center point coordinate. |
| | | */ |
| | | |
| | | function getPointersCenter(pointers) { |
| | | var pageX = 0; |
| | | var pageY = 0; |
| | | var count = 0; |
| | | forEach(pointers, function (_ref3) { |
| | | var startX = _ref3.startX, |
| | | startY = _ref3.startY; |
| | | pageX += startX; |
| | | pageY += startY; |
| | | count += 1; |
| | | }); |
| | | pageX /= count; |
| | | pageY /= count; |
| | | return { |
| | | pageX: pageX, |
| | | pageY: pageY |
| | | }; |
| | | } |
| | | /** |
| | | * Get the max sizes in a rectangle under the given aspect ratio. |
| | | * @param {Object} data - The original sizes. |
| | | * @param {string} [type='contain'] - The adjust type. |
| | | * @returns {Object} The result sizes. |
| | | */ |
| | | |
| | | function getAdjustedSizes(_ref4) // or 'cover' |
| | | { |
| | | var aspectRatio = _ref4.aspectRatio, |
| | | height = _ref4.height, |
| | | width = _ref4.width; |
| | | var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'contain'; |
| | | var isValidWidth = isPositiveNumber(width); |
| | | var isValidHeight = isPositiveNumber(height); |
| | | |
| | | if (isValidWidth && isValidHeight) { |
| | | var adjustedWidth = height * aspectRatio; |
| | | |
| | | if (type === 'contain' && adjustedWidth > width || type === 'cover' && adjustedWidth < width) { |
| | | height = width / aspectRatio; |
| | | } else { |
| | | width = height * aspectRatio; |
| | | } |
| | | } else if (isValidWidth) { |
| | | height = width / aspectRatio; |
| | | } else if (isValidHeight) { |
| | | width = height * aspectRatio; |
| | | } |
| | | |
| | | return { |
| | | width: width, |
| | | height: height |
| | | }; |
| | | } |
| | | /** |
| | | * Get the new sizes of a rectangle after rotated. |
| | | * @param {Object} data - The original sizes. |
| | | * @returns {Object} The result sizes. |
| | | */ |
| | | |
| | | function getRotatedSizes(_ref5) { |
| | | var width = _ref5.width, |
| | | height = _ref5.height, |
| | | degree = _ref5.degree; |
| | | degree = Math.abs(degree) % 180; |
| | | |
| | | if (degree === 90) { |
| | | return { |
| | | width: height, |
| | | height: width |
| | | }; |
| | | } |
| | | |
| | | var arc = degree % 90 * Math.PI / 180; |
| | | var sinArc = Math.sin(arc); |
| | | var cosArc = Math.cos(arc); |
| | | var newWidth = width * cosArc + height * sinArc; |
| | | var newHeight = width * sinArc + height * cosArc; |
| | | return degree > 90 ? { |
| | | width: newHeight, |
| | | height: newWidth |
| | | } : { |
| | | width: newWidth, |
| | | height: newHeight |
| | | }; |
| | | } |
| | | /** |
| | | * Get a canvas which drew the given image. |
| | | * @param {HTMLImageElement} image - The image for drawing. |
| | | * @param {Object} imageData - The image data. |
| | | * @param {Object} canvasData - The canvas data. |
| | | * @param {Object} options - The options. |
| | | * @returns {HTMLCanvasElement} The result canvas. |
| | | */ |
| | | |
| | | function getSourceCanvas(image, _ref6, _ref7, _ref8) { |
| | | var imageAspectRatio = _ref6.aspectRatio, |
| | | imageNaturalWidth = _ref6.naturalWidth, |
| | | imageNaturalHeight = _ref6.naturalHeight, |
| | | _ref6$rotate = _ref6.rotate, |
| | | rotate = _ref6$rotate === void 0 ? 0 : _ref6$rotate, |
| | | _ref6$scaleX = _ref6.scaleX, |
| | | scaleX = _ref6$scaleX === void 0 ? 1 : _ref6$scaleX, |
| | | _ref6$scaleY = _ref6.scaleY, |
| | | scaleY = _ref6$scaleY === void 0 ? 1 : _ref6$scaleY; |
| | | var aspectRatio = _ref7.aspectRatio, |
| | | naturalWidth = _ref7.naturalWidth, |
| | | naturalHeight = _ref7.naturalHeight; |
| | | var _ref8$fillColor = _ref8.fillColor, |
| | | fillColor = _ref8$fillColor === void 0 ? 'transparent' : _ref8$fillColor, |
| | | _ref8$imageSmoothingE = _ref8.imageSmoothingEnabled, |
| | | imageSmoothingEnabled = _ref8$imageSmoothingE === void 0 ? true : _ref8$imageSmoothingE, |
| | | _ref8$imageSmoothingQ = _ref8.imageSmoothingQuality, |
| | | imageSmoothingQuality = _ref8$imageSmoothingQ === void 0 ? 'low' : _ref8$imageSmoothingQ, |
| | | _ref8$maxWidth = _ref8.maxWidth, |
| | | maxWidth = _ref8$maxWidth === void 0 ? Infinity : _ref8$maxWidth, |
| | | _ref8$maxHeight = _ref8.maxHeight, |
| | | maxHeight = _ref8$maxHeight === void 0 ? Infinity : _ref8$maxHeight, |
| | | _ref8$minWidth = _ref8.minWidth, |
| | | minWidth = _ref8$minWidth === void 0 ? 0 : _ref8$minWidth, |
| | | _ref8$minHeight = _ref8.minHeight, |
| | | minHeight = _ref8$minHeight === void 0 ? 0 : _ref8$minHeight; |
| | | var canvas = document.createElement('canvas'); |
| | | var context = canvas.getContext('2d'); |
| | | var maxSizes = getAdjustedSizes({ |
| | | aspectRatio: aspectRatio, |
| | | width: maxWidth, |
| | | height: maxHeight |
| | | }); |
| | | var minSizes = getAdjustedSizes({ |
| | | aspectRatio: aspectRatio, |
| | | width: minWidth, |
| | | height: minHeight |
| | | }, 'cover'); |
| | | var width = Math.min(maxSizes.width, Math.max(minSizes.width, naturalWidth)); |
| | | var height = Math.min(maxSizes.height, Math.max(minSizes.height, naturalHeight)); // Note: should always use image's natural sizes for drawing as |
| | | // imageData.naturalWidth === canvasData.naturalHeight when rotate % 180 === 90 |
| | | |
| | | var destMaxSizes = getAdjustedSizes({ |
| | | aspectRatio: imageAspectRatio, |
| | | width: maxWidth, |
| | | height: maxHeight |
| | | }); |
| | | var destMinSizes = getAdjustedSizes({ |
| | | aspectRatio: imageAspectRatio, |
| | | width: minWidth, |
| | | height: minHeight |
| | | }, 'cover'); |
| | | var destWidth = Math.min(destMaxSizes.width, Math.max(destMinSizes.width, imageNaturalWidth)); |
| | | var destHeight = Math.min(destMaxSizes.height, Math.max(destMinSizes.height, imageNaturalHeight)); |
| | | var params = [-destWidth / 2, -destHeight / 2, destWidth, destHeight]; |
| | | canvas.width = normalizeDecimalNumber(width); |
| | | canvas.height = normalizeDecimalNumber(height); |
| | | context.fillStyle = fillColor; |
| | | context.fillRect(0, 0, width, height); |
| | | context.save(); |
| | | context.translate(width / 2, height / 2); |
| | | context.rotate(rotate * Math.PI / 180); |
| | | context.scale(scaleX, scaleY); |
| | | context.imageSmoothingEnabled = imageSmoothingEnabled; |
| | | context.imageSmoothingQuality = imageSmoothingQuality; |
| | | context.drawImage.apply(context, [image].concat(_toConsumableArray(params.map(function (param) { |
| | | return Math.floor(normalizeDecimalNumber(param)); |
| | | })))); |
| | | context.restore(); |
| | | return canvas; |
| | | } |
| | | var fromCharCode = String.fromCharCode; |
| | | /** |
| | | * Get string from char code in data view. |
| | | * @param {DataView} dataView - The data view for read. |
| | | * @param {number} start - The start index. |
| | | * @param {number} length - The read length. |
| | | * @returns {string} The read result. |
| | | */ |
| | | |
| | | function getStringFromCharCode(dataView, start, length) { |
| | | var str = ''; |
| | | length += start; |
| | | |
| | | for (var i = start; i < length; i += 1) { |
| | | str += fromCharCode(dataView.getUint8(i)); |
| | | } |
| | | |
| | | return str; |
| | | } |
| | | var REGEXP_DATA_URL_HEAD = /^data:.*,/; |
| | | /** |
| | | * Transform Data URL to array buffer. |
| | | * @param {string} dataURL - The Data URL to transform. |
| | | * @returns {ArrayBuffer} The result array buffer. |
| | | */ |
| | | |
| | | function dataURLToArrayBuffer(dataURL) { |
| | | var base64 = dataURL.replace(REGEXP_DATA_URL_HEAD, ''); |
| | | var binary = atob(base64); |
| | | var arrayBuffer = new ArrayBuffer(binary.length); |
| | | var uint8 = new Uint8Array(arrayBuffer); |
| | | forEach(uint8, function (value, i) { |
| | | uint8[i] = binary.charCodeAt(i); |
| | | }); |
| | | return arrayBuffer; |
| | | } |
| | | /** |
| | | * Transform array buffer to Data URL. |
| | | * @param {ArrayBuffer} arrayBuffer - The array buffer to transform. |
| | | * @param {string} mimeType - The mime type of the Data URL. |
| | | * @returns {string} The result Data URL. |
| | | */ |
| | | |
| | | function arrayBufferToDataURL(arrayBuffer, mimeType) { |
| | | var chunks = []; // Chunk Typed Array for better performance (#435) |
| | | |
| | | var chunkSize = 8192; |
| | | var uint8 = new Uint8Array(arrayBuffer); |
| | | |
| | | while (uint8.length > 0) { |
| | | // XXX: Babel's `toConsumableArray` helper will throw error in IE or Safari 9 |
| | | // eslint-disable-next-line prefer-spread |
| | | chunks.push(fromCharCode.apply(null, toArray(uint8.subarray(0, chunkSize)))); |
| | | uint8 = uint8.subarray(chunkSize); |
| | | } |
| | | |
| | | return "data:".concat(mimeType, ";base64,").concat(btoa(chunks.join(''))); |
| | | } |
| | | /** |
| | | * Get orientation value from given array buffer. |
| | | * @param {ArrayBuffer} arrayBuffer - The array buffer to read. |
| | | * @returns {number} The read orientation value. |
| | | */ |
| | | |
| | | function resetAndGetOrientation(arrayBuffer) { |
| | | var dataView = new DataView(arrayBuffer); |
| | | var orientation; // Ignores range error when the image does not have correct Exif information |
| | | |
| | | try { |
| | | var littleEndian; |
| | | var app1Start; |
| | | var ifdStart; // Only handle JPEG image (start by 0xFFD8) |
| | | |
| | | if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) { |
| | | var length = dataView.byteLength; |
| | | var offset = 2; |
| | | |
| | | while (offset + 1 < length) { |
| | | if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) { |
| | | app1Start = offset; |
| | | break; |
| | | } |
| | | |
| | | offset += 1; |
| | | } |
| | | } |
| | | |
| | | if (app1Start) { |
| | | var exifIDCode = app1Start + 4; |
| | | var tiffOffset = app1Start + 10; |
| | | |
| | | if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') { |
| | | var endianness = dataView.getUint16(tiffOffset); |
| | | littleEndian = endianness === 0x4949; |
| | | |
| | | if (littleEndian || endianness === 0x4D4D |
| | | /* bigEndian */ |
| | | ) { |
| | | if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) { |
| | | var firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian); |
| | | |
| | | if (firstIFDOffset >= 0x00000008) { |
| | | ifdStart = tiffOffset + firstIFDOffset; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (ifdStart) { |
| | | var _length = dataView.getUint16(ifdStart, littleEndian); |
| | | |
| | | var _offset; |
| | | |
| | | var i; |
| | | |
| | | for (i = 0; i < _length; i += 1) { |
| | | _offset = ifdStart + i * 12 + 2; |
| | | |
| | | if (dataView.getUint16(_offset, littleEndian) === 0x0112 |
| | | /* Orientation */ |
| | | ) { |
| | | // 8 is the offset of the current tag's value |
| | | _offset += 8; // Get the original orientation value |
| | | |
| | | orientation = dataView.getUint16(_offset, littleEndian); // Override the orientation with its default value |
| | | |
| | | dataView.setUint16(_offset, 1, littleEndian); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } catch (error) { |
| | | orientation = 1; |
| | | } |
| | | |
| | | return orientation; |
| | | } |
| | | /** |
| | | * Parse Exif Orientation value. |
| | | * @param {number} orientation - The orientation to parse. |
| | | * @returns {Object} The parsed result. |
| | | */ |
| | | |
| | | function parseOrientation(orientation) { |
| | | var rotate = 0; |
| | | var scaleX = 1; |
| | | var scaleY = 1; |
| | | |
| | | switch (orientation) { |
| | | // Flip horizontal |
| | | case 2: |
| | | scaleX = -1; |
| | | break; |
| | | // Rotate left 180° |
| | | |
| | | case 3: |
| | | rotate = -180; |
| | | break; |
| | | // Flip vertical |
| | | |
| | | case 4: |
| | | scaleY = -1; |
| | | break; |
| | | // Flip vertical and rotate right 90° |
| | | |
| | | case 5: |
| | | rotate = 90; |
| | | scaleY = -1; |
| | | break; |
| | | // Rotate right 90° |
| | | |
| | | case 6: |
| | | rotate = 90; |
| | | break; |
| | | // Flip horizontal and rotate right 90° |
| | | |
| | | case 7: |
| | | rotate = 90; |
| | | scaleX = -1; |
| | | break; |
| | | // Rotate left 90° |
| | | |
| | | case 8: |
| | | rotate = -90; |
| | | break; |
| | | } |
| | | |
| | | return { |
| | | rotate: rotate, |
| | | scaleX: scaleX, |
| | | scaleY: scaleY |
| | | }; |
| | | } |
| | | |
| | | var render = { |
| | | render: function render() { |
| | | this.initContainer(); |
| | | this.initCanvas(); |
| | | this.initCropBox(); |
| | | this.renderCanvas(); |
| | | |
| | | if (this.cropped) { |
| | | this.renderCropBox(); |
| | | } |
| | | }, |
| | | initContainer: function initContainer() { |
| | | var element = this.element, |
| | | options = this.options, |
| | | container = this.container, |
| | | cropper = this.cropper; |
| | | var minWidth = Number(options.minContainerWidth); |
| | | var minHeight = Number(options.minContainerHeight); |
| | | addClass(cropper, CLASS_HIDDEN); |
| | | removeClass(element, CLASS_HIDDEN); |
| | | var containerData = { |
| | | width: Math.max(container.offsetWidth, minWidth >= 0 ? minWidth : MIN_CONTAINER_WIDTH), |
| | | height: Math.max(container.offsetHeight, minHeight >= 0 ? minHeight : MIN_CONTAINER_HEIGHT) |
| | | }; |
| | | this.containerData = containerData; |
| | | setStyle(cropper, { |
| | | width: containerData.width, |
| | | height: containerData.height |
| | | }); |
| | | addClass(element, CLASS_HIDDEN); |
| | | removeClass(cropper, CLASS_HIDDEN); |
| | | }, |
| | | // Canvas (image wrapper) |
| | | initCanvas: function initCanvas() { |
| | | var containerData = this.containerData, |
| | | imageData = this.imageData; |
| | | var viewMode = this.options.viewMode; |
| | | var rotated = Math.abs(imageData.rotate) % 180 === 90; |
| | | var naturalWidth = rotated ? imageData.naturalHeight : imageData.naturalWidth; |
| | | var naturalHeight = rotated ? imageData.naturalWidth : imageData.naturalHeight; |
| | | var aspectRatio = naturalWidth / naturalHeight; |
| | | var canvasWidth = containerData.width; |
| | | var canvasHeight = containerData.height; |
| | | |
| | | if (containerData.height * aspectRatio > containerData.width) { |
| | | if (viewMode === 3) { |
| | | canvasWidth = containerData.height * aspectRatio; |
| | | } else { |
| | | canvasHeight = containerData.width / aspectRatio; |
| | | } |
| | | } else if (viewMode === 3) { |
| | | canvasHeight = containerData.width / aspectRatio; |
| | | } else { |
| | | canvasWidth = containerData.height * aspectRatio; |
| | | } |
| | | |
| | | var canvasData = { |
| | | aspectRatio: aspectRatio, |
| | | naturalWidth: naturalWidth, |
| | | naturalHeight: naturalHeight, |
| | | width: canvasWidth, |
| | | height: canvasHeight |
| | | }; |
| | | this.canvasData = canvasData; |
| | | this.limited = viewMode === 1 || viewMode === 2; |
| | | this.limitCanvas(true, true); |
| | | canvasData.width = Math.min(Math.max(canvasData.width, canvasData.minWidth), canvasData.maxWidth); |
| | | canvasData.height = Math.min(Math.max(canvasData.height, canvasData.minHeight), canvasData.maxHeight); |
| | | canvasData.left = (containerData.width - canvasData.width) / 2; |
| | | canvasData.top = (containerData.height - canvasData.height) / 2; |
| | | canvasData.oldLeft = canvasData.left; |
| | | canvasData.oldTop = canvasData.top; |
| | | this.initialCanvasData = assign({}, canvasData); |
| | | }, |
| | | limitCanvas: function limitCanvas(sizeLimited, positionLimited) { |
| | | var options = this.options, |
| | | containerData = this.containerData, |
| | | canvasData = this.canvasData, |
| | | cropBoxData = this.cropBoxData; |
| | | var viewMode = options.viewMode; |
| | | var aspectRatio = canvasData.aspectRatio; |
| | | var cropped = this.cropped && cropBoxData; |
| | | |
| | | if (sizeLimited) { |
| | | var minCanvasWidth = Number(options.minCanvasWidth) || 0; |
| | | var minCanvasHeight = Number(options.minCanvasHeight) || 0; |
| | | |
| | | if (viewMode > 1) { |
| | | minCanvasWidth = Math.max(minCanvasWidth, containerData.width); |
| | | minCanvasHeight = Math.max(minCanvasHeight, containerData.height); |
| | | |
| | | if (viewMode === 3) { |
| | | if (minCanvasHeight * aspectRatio > minCanvasWidth) { |
| | | minCanvasWidth = minCanvasHeight * aspectRatio; |
| | | } else { |
| | | minCanvasHeight = minCanvasWidth / aspectRatio; |
| | | } |
| | | } |
| | | } else if (viewMode > 0) { |
| | | if (minCanvasWidth) { |
| | | minCanvasWidth = Math.max(minCanvasWidth, cropped ? cropBoxData.width : 0); |
| | | } else if (minCanvasHeight) { |
| | | minCanvasHeight = Math.max(minCanvasHeight, cropped ? cropBoxData.height : 0); |
| | | } else if (cropped) { |
| | | minCanvasWidth = cropBoxData.width; |
| | | minCanvasHeight = cropBoxData.height; |
| | | |
| | | if (minCanvasHeight * aspectRatio > minCanvasWidth) { |
| | | minCanvasWidth = minCanvasHeight * aspectRatio; |
| | | } else { |
| | | minCanvasHeight = minCanvasWidth / aspectRatio; |
| | | } |
| | | } |
| | | } |
| | | |
| | | var _getAdjustedSizes = getAdjustedSizes({ |
| | | aspectRatio: aspectRatio, |
| | | width: minCanvasWidth, |
| | | height: minCanvasHeight |
| | | }); |
| | | |
| | | minCanvasWidth = _getAdjustedSizes.width; |
| | | minCanvasHeight = _getAdjustedSizes.height; |
| | | canvasData.minWidth = minCanvasWidth; |
| | | canvasData.minHeight = minCanvasHeight; |
| | | canvasData.maxWidth = Infinity; |
| | | canvasData.maxHeight = Infinity; |
| | | } |
| | | |
| | | if (positionLimited) { |
| | | if (viewMode > (cropped ? 0 : 1)) { |
| | | var newCanvasLeft = containerData.width - canvasData.width; |
| | | var newCanvasTop = containerData.height - canvasData.height; |
| | | canvasData.minLeft = Math.min(0, newCanvasLeft); |
| | | canvasData.minTop = Math.min(0, newCanvasTop); |
| | | canvasData.maxLeft = Math.max(0, newCanvasLeft); |
| | | canvasData.maxTop = Math.max(0, newCanvasTop); |
| | | |
| | | if (cropped && this.limited) { |
| | | canvasData.minLeft = Math.min(cropBoxData.left, cropBoxData.left + (cropBoxData.width - canvasData.width)); |
| | | canvasData.minTop = Math.min(cropBoxData.top, cropBoxData.top + (cropBoxData.height - canvasData.height)); |
| | | canvasData.maxLeft = cropBoxData.left; |
| | | canvasData.maxTop = cropBoxData.top; |
| | | |
| | | if (viewMode === 2) { |
| | | if (canvasData.width >= containerData.width) { |
| | | canvasData.minLeft = Math.min(0, newCanvasLeft); |
| | | canvasData.maxLeft = Math.max(0, newCanvasLeft); |
| | | } |
| | | |
| | | if (canvasData.height >= containerData.height) { |
| | | canvasData.minTop = Math.min(0, newCanvasTop); |
| | | canvasData.maxTop = Math.max(0, newCanvasTop); |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | canvasData.minLeft = -canvasData.width; |
| | | canvasData.minTop = -canvasData.height; |
| | | canvasData.maxLeft = containerData.width; |
| | | canvasData.maxTop = containerData.height; |
| | | } |
| | | } |
| | | }, |
| | | renderCanvas: function renderCanvas(changed, transformed) { |
| | | var canvasData = this.canvasData, |
| | | imageData = this.imageData; |
| | | |
| | | if (transformed) { |
| | | var _getRotatedSizes = getRotatedSizes({ |
| | | width: imageData.naturalWidth * Math.abs(imageData.scaleX || 1), |
| | | height: imageData.naturalHeight * Math.abs(imageData.scaleY || 1), |
| | | degree: imageData.rotate || 0 |
| | | }), |
| | | naturalWidth = _getRotatedSizes.width, |
| | | naturalHeight = _getRotatedSizes.height; |
| | | |
| | | var width = canvasData.width * (naturalWidth / canvasData.naturalWidth); |
| | | var height = canvasData.height * (naturalHeight / canvasData.naturalHeight); |
| | | canvasData.left -= (width - canvasData.width) / 2; |
| | | canvasData.top -= (height - canvasData.height) / 2; |
| | | canvasData.width = width; |
| | | canvasData.height = height; |
| | | canvasData.aspectRatio = naturalWidth / naturalHeight; |
| | | canvasData.naturalWidth = naturalWidth; |
| | | canvasData.naturalHeight = naturalHeight; |
| | | this.limitCanvas(true, false); |
| | | } |
| | | |
| | | if (canvasData.width > canvasData.maxWidth || canvasData.width < canvasData.minWidth) { |
| | | canvasData.left = canvasData.oldLeft; |
| | | } |
| | | |
| | | if (canvasData.height > canvasData.maxHeight || canvasData.height < canvasData.minHeight) { |
| | | canvasData.top = canvasData.oldTop; |
| | | } |
| | | |
| | | canvasData.width = Math.min(Math.max(canvasData.width, canvasData.minWidth), canvasData.maxWidth); |
| | | canvasData.height = Math.min(Math.max(canvasData.height, canvasData.minHeight), canvasData.maxHeight); |
| | | this.limitCanvas(false, true); |
| | | canvasData.left = Math.min(Math.max(canvasData.left, canvasData.minLeft), canvasData.maxLeft); |
| | | canvasData.top = Math.min(Math.max(canvasData.top, canvasData.minTop), canvasData.maxTop); |
| | | canvasData.oldLeft = canvasData.left; |
| | | canvasData.oldTop = canvasData.top; |
| | | setStyle(this.canvas, assign({ |
| | | width: canvasData.width, |
| | | height: canvasData.height |
| | | }, getTransforms({ |
| | | translateX: canvasData.left, |
| | | translateY: canvasData.top |
| | | }))); |
| | | this.renderImage(changed); |
| | | |
| | | if (this.cropped && this.limited) { |
| | | this.limitCropBox(true, true); |
| | | } |
| | | }, |
| | | renderImage: function renderImage(changed) { |
| | | var canvasData = this.canvasData, |
| | | imageData = this.imageData; |
| | | var width = imageData.naturalWidth * (canvasData.width / canvasData.naturalWidth); |
| | | var height = imageData.naturalHeight * (canvasData.height / canvasData.naturalHeight); |
| | | assign(imageData, { |
| | | width: width, |
| | | height: height, |
| | | left: (canvasData.width - width) / 2, |
| | | top: (canvasData.height - height) / 2 |
| | | }); |
| | | setStyle(this.image, assign({ |
| | | width: imageData.width, |
| | | height: imageData.height |
| | | }, getTransforms(assign({ |
| | | translateX: imageData.left, |
| | | translateY: imageData.top |
| | | }, imageData)))); |
| | | |
| | | if (changed) { |
| | | this.output(); |
| | | } |
| | | }, |
| | | initCropBox: function initCropBox() { |
| | | var options = this.options, |
| | | canvasData = this.canvasData; |
| | | var aspectRatio = options.aspectRatio || options.initialAspectRatio; |
| | | var autoCropArea = Number(options.autoCropArea) || 0.8; |
| | | var cropBoxData = { |
| | | width: canvasData.width, |
| | | height: canvasData.height |
| | | }; |
| | | |
| | | if (aspectRatio) { |
| | | if (canvasData.height * aspectRatio > canvasData.width) { |
| | | cropBoxData.height = cropBoxData.width / aspectRatio; |
| | | } else { |
| | | cropBoxData.width = cropBoxData.height * aspectRatio; |
| | | } |
| | | } |
| | | |
| | | this.cropBoxData = cropBoxData; |
| | | this.limitCropBox(true, true); // Initialize auto crop area |
| | | |
| | | cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth); |
| | | cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight); // The width/height of auto crop area must large than "minWidth/Height" |
| | | |
| | | cropBoxData.width = Math.max(cropBoxData.minWidth, cropBoxData.width * autoCropArea); |
| | | cropBoxData.height = Math.max(cropBoxData.minHeight, cropBoxData.height * autoCropArea); |
| | | cropBoxData.left = canvasData.left + (canvasData.width - cropBoxData.width) / 2; |
| | | cropBoxData.top = canvasData.top + (canvasData.height - cropBoxData.height) / 2; |
| | | cropBoxData.oldLeft = cropBoxData.left; |
| | | cropBoxData.oldTop = cropBoxData.top; |
| | | this.initialCropBoxData = assign({}, cropBoxData); |
| | | }, |
| | | limitCropBox: function limitCropBox(sizeLimited, positionLimited) { |
| | | var options = this.options, |
| | | containerData = this.containerData, |
| | | canvasData = this.canvasData, |
| | | cropBoxData = this.cropBoxData, |
| | | limited = this.limited; |
| | | var aspectRatio = options.aspectRatio; |
| | | |
| | | if (sizeLimited) { |
| | | var minCropBoxWidth = Number(options.minCropBoxWidth) || 0; |
| | | var minCropBoxHeight = Number(options.minCropBoxHeight) || 0; |
| | | var maxCropBoxWidth = limited ? Math.min(containerData.width, canvasData.width, canvasData.width + canvasData.left, containerData.width - canvasData.left) : containerData.width; |
| | | var maxCropBoxHeight = limited ? Math.min(containerData.height, canvasData.height, canvasData.height + canvasData.top, containerData.height - canvasData.top) : containerData.height; // The min/maxCropBoxWidth/Height must be less than container's width/height |
| | | |
| | | minCropBoxWidth = Math.min(minCropBoxWidth, containerData.width); |
| | | minCropBoxHeight = Math.min(minCropBoxHeight, containerData.height); |
| | | |
| | | if (aspectRatio) { |
| | | if (minCropBoxWidth && minCropBoxHeight) { |
| | | if (minCropBoxHeight * aspectRatio > minCropBoxWidth) { |
| | | minCropBoxHeight = minCropBoxWidth / aspectRatio; |
| | | } else { |
| | | minCropBoxWidth = minCropBoxHeight * aspectRatio; |
| | | } |
| | | } else if (minCropBoxWidth) { |
| | | minCropBoxHeight = minCropBoxWidth / aspectRatio; |
| | | } else if (minCropBoxHeight) { |
| | | minCropBoxWidth = minCropBoxHeight * aspectRatio; |
| | | } |
| | | |
| | | if (maxCropBoxHeight * aspectRatio > maxCropBoxWidth) { |
| | | maxCropBoxHeight = maxCropBoxWidth / aspectRatio; |
| | | } else { |
| | | maxCropBoxWidth = maxCropBoxHeight * aspectRatio; |
| | | } |
| | | } // The minWidth/Height must be less than maxWidth/Height |
| | | |
| | | |
| | | cropBoxData.minWidth = Math.min(minCropBoxWidth, maxCropBoxWidth); |
| | | cropBoxData.minHeight = Math.min(minCropBoxHeight, maxCropBoxHeight); |
| | | cropBoxData.maxWidth = maxCropBoxWidth; |
| | | cropBoxData.maxHeight = maxCropBoxHeight; |
| | | } |
| | | |
| | | if (positionLimited) { |
| | | if (limited) { |
| | | cropBoxData.minLeft = Math.max(0, canvasData.left); |
| | | cropBoxData.minTop = Math.max(0, canvasData.top); |
| | | cropBoxData.maxLeft = Math.min(containerData.width, canvasData.left + canvasData.width) - cropBoxData.width; |
| | | cropBoxData.maxTop = Math.min(containerData.height, canvasData.top + canvasData.height) - cropBoxData.height; |
| | | } else { |
| | | cropBoxData.minLeft = 0; |
| | | cropBoxData.minTop = 0; |
| | | cropBoxData.maxLeft = containerData.width - cropBoxData.width; |
| | | cropBoxData.maxTop = containerData.height - cropBoxData.height; |
| | | } |
| | | } |
| | | }, |
| | | renderCropBox: function renderCropBox() { |
| | | var options = this.options, |
| | | containerData = this.containerData, |
| | | cropBoxData = this.cropBoxData; |
| | | |
| | | if (cropBoxData.width > cropBoxData.maxWidth || cropBoxData.width < cropBoxData.minWidth) { |
| | | cropBoxData.left = cropBoxData.oldLeft; |
| | | } |
| | | |
| | | if (cropBoxData.height > cropBoxData.maxHeight || cropBoxData.height < cropBoxData.minHeight) { |
| | | cropBoxData.top = cropBoxData.oldTop; |
| | | } |
| | | |
| | | cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth); |
| | | cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight); |
| | | this.limitCropBox(false, true); |
| | | cropBoxData.left = Math.min(Math.max(cropBoxData.left, cropBoxData.minLeft), cropBoxData.maxLeft); |
| | | cropBoxData.top = Math.min(Math.max(cropBoxData.top, cropBoxData.minTop), cropBoxData.maxTop); |
| | | cropBoxData.oldLeft = cropBoxData.left; |
| | | cropBoxData.oldTop = cropBoxData.top; |
| | | |
| | | if (options.movable && options.cropBoxMovable) { |
| | | // Turn to move the canvas when the crop box is equal to the container |
| | | setData(this.face, DATA_ACTION, cropBoxData.width >= containerData.width && cropBoxData.height >= containerData.height ? ACTION_MOVE : ACTION_ALL); |
| | | } |
| | | |
| | | setStyle(this.cropBox, assign({ |
| | | width: cropBoxData.width, |
| | | height: cropBoxData.height |
| | | }, getTransforms({ |
| | | translateX: cropBoxData.left, |
| | | translateY: cropBoxData.top |
| | | }))); |
| | | |
| | | if (this.cropped && this.limited) { |
| | | this.limitCanvas(true, true); |
| | | } |
| | | |
| | | if (!this.disabled) { |
| | | this.output(); |
| | | } |
| | | }, |
| | | output: function output() { |
| | | this.preview(); |
| | | dispatchEvent(this.element, EVENT_CROP, this.getData()); |
| | | } |
| | | }; |
| | | |
| | | var preview = { |
| | | initPreview: function initPreview() { |
| | | var element = this.element, |
| | | crossOrigin = this.crossOrigin; |
| | | var preview = this.options.preview; |
| | | var url = crossOrigin ? this.crossOriginUrl : this.url; |
| | | var alt = element.alt || 'The image to preview'; |
| | | var image = document.createElement('img'); |
| | | |
| | | if (crossOrigin) { |
| | | image.crossOrigin = crossOrigin; |
| | | } |
| | | |
| | | image.src = url; |
| | | image.alt = alt; |
| | | this.viewBox.appendChild(image); |
| | | this.viewBoxImage = image; |
| | | |
| | | if (!preview) { |
| | | return; |
| | | } |
| | | |
| | | var previews = preview; |
| | | |
| | | if (typeof preview === 'string') { |
| | | previews = element.ownerDocument.querySelectorAll(preview); |
| | | } else if (preview.querySelector) { |
| | | previews = [preview]; |
| | | } |
| | | |
| | | this.previews = previews; |
| | | forEach(previews, function (el) { |
| | | var img = document.createElement('img'); // Save the original size for recover |
| | | |
| | | setData(el, DATA_PREVIEW, { |
| | | width: el.offsetWidth, |
| | | height: el.offsetHeight, |
| | | html: el.innerHTML |
| | | }); |
| | | |
| | | if (crossOrigin) { |
| | | img.crossOrigin = crossOrigin; |
| | | } |
| | | |
| | | img.src = url; |
| | | img.alt = alt; |
| | | /** |
| | | * Override img element styles |
| | | * Add `display:block` to avoid margin top issue |
| | | * Add `height:auto` to override `height` attribute on IE8 |
| | | * (Occur only when margin-top <= -height) |
| | | */ |
| | | |
| | | img.style.cssText = 'display:block;' + 'width:100%;' + 'height:auto;' + 'min-width:0!important;' + 'min-height:0!important;' + 'max-width:none!important;' + 'max-height:none!important;' + 'image-orientation:0deg!important;"'; |
| | | el.innerHTML = ''; |
| | | el.appendChild(img); |
| | | }); |
| | | }, |
| | | resetPreview: function resetPreview() { |
| | | forEach(this.previews, function (element) { |
| | | var data = getData(element, DATA_PREVIEW); |
| | | setStyle(element, { |
| | | width: data.width, |
| | | height: data.height |
| | | }); |
| | | element.innerHTML = data.html; |
| | | removeData(element, DATA_PREVIEW); |
| | | }); |
| | | }, |
| | | preview: function preview() { |
| | | var imageData = this.imageData, |
| | | canvasData = this.canvasData, |
| | | cropBoxData = this.cropBoxData; |
| | | var cropBoxWidth = cropBoxData.width, |
| | | cropBoxHeight = cropBoxData.height; |
| | | var width = imageData.width, |
| | | height = imageData.height; |
| | | var left = cropBoxData.left - canvasData.left - imageData.left; |
| | | var top = cropBoxData.top - canvasData.top - imageData.top; |
| | | |
| | | if (!this.cropped || this.disabled) { |
| | | return; |
| | | } |
| | | |
| | | setStyle(this.viewBoxImage, assign({ |
| | | width: width, |
| | | height: height |
| | | }, getTransforms(assign({ |
| | | translateX: -left, |
| | | translateY: -top |
| | | }, imageData)))); |
| | | forEach(this.previews, function (element) { |
| | | var data = getData(element, DATA_PREVIEW); |
| | | var originalWidth = data.width; |
| | | var originalHeight = data.height; |
| | | var newWidth = originalWidth; |
| | | var newHeight = originalHeight; |
| | | var ratio = 1; |
| | | |
| | | if (cropBoxWidth) { |
| | | ratio = originalWidth / cropBoxWidth; |
| | | newHeight = cropBoxHeight * ratio; |
| | | } |
| | | |
| | | if (cropBoxHeight && newHeight > originalHeight) { |
| | | ratio = originalHeight / cropBoxHeight; |
| | | newWidth = cropBoxWidth * ratio; |
| | | newHeight = originalHeight; |
| | | } |
| | | |
| | | setStyle(element, { |
| | | width: newWidth, |
| | | height: newHeight |
| | | }); |
| | | setStyle(element.getElementsByTagName('img')[0], assign({ |
| | | width: width * ratio, |
| | | height: height * ratio |
| | | }, getTransforms(assign({ |
| | | translateX: -left * ratio, |
| | | translateY: -top * ratio |
| | | }, imageData)))); |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | var events = { |
| | | bind: function bind() { |
| | | var element = this.element, |
| | | options = this.options, |
| | | cropper = this.cropper; |
| | | |
| | | if (isFunction(options.cropstart)) { |
| | | addListener(element, EVENT_CROP_START, options.cropstart); |
| | | } |
| | | |
| | | if (isFunction(options.cropmove)) { |
| | | addListener(element, EVENT_CROP_MOVE, options.cropmove); |
| | | } |
| | | |
| | | if (isFunction(options.cropend)) { |
| | | addListener(element, EVENT_CROP_END, options.cropend); |
| | | } |
| | | |
| | | if (isFunction(options.crop)) { |
| | | addListener(element, EVENT_CROP, options.crop); |
| | | } |
| | | |
| | | if (isFunction(options.zoom)) { |
| | | addListener(element, EVENT_ZOOM, options.zoom); |
| | | } |
| | | |
| | | addListener(cropper, EVENT_POINTER_DOWN, this.onCropStart = this.cropStart.bind(this)); |
| | | |
| | | if (options.zoomable && options.zoomOnWheel) { |
| | | addListener(cropper, EVENT_WHEEL, this.onWheel = this.wheel.bind(this), { |
| | | passive: false, |
| | | capture: true |
| | | }); |
| | | } |
| | | |
| | | if (options.toggleDragModeOnDblclick) { |
| | | addListener(cropper, EVENT_DBLCLICK, this.onDblclick = this.dblclick.bind(this)); |
| | | } |
| | | |
| | | addListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove = this.cropMove.bind(this)); |
| | | addListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd = this.cropEnd.bind(this)); |
| | | |
| | | if (options.responsive) { |
| | | addListener(window, EVENT_RESIZE, this.onResize = this.resize.bind(this)); |
| | | } |
| | | }, |
| | | unbind: function unbind() { |
| | | var element = this.element, |
| | | options = this.options, |
| | | cropper = this.cropper; |
| | | |
| | | if (isFunction(options.cropstart)) { |
| | | removeListener(element, EVENT_CROP_START, options.cropstart); |
| | | } |
| | | |
| | | if (isFunction(options.cropmove)) { |
| | | removeListener(element, EVENT_CROP_MOVE, options.cropmove); |
| | | } |
| | | |
| | | if (isFunction(options.cropend)) { |
| | | removeListener(element, EVENT_CROP_END, options.cropend); |
| | | } |
| | | |
| | | if (isFunction(options.crop)) { |
| | | removeListener(element, EVENT_CROP, options.crop); |
| | | } |
| | | |
| | | if (isFunction(options.zoom)) { |
| | | removeListener(element, EVENT_ZOOM, options.zoom); |
| | | } |
| | | |
| | | removeListener(cropper, EVENT_POINTER_DOWN, this.onCropStart); |
| | | |
| | | if (options.zoomable && options.zoomOnWheel) { |
| | | removeListener(cropper, EVENT_WHEEL, this.onWheel, { |
| | | passive: false, |
| | | capture: true |
| | | }); |
| | | } |
| | | |
| | | if (options.toggleDragModeOnDblclick) { |
| | | removeListener(cropper, EVENT_DBLCLICK, this.onDblclick); |
| | | } |
| | | |
| | | removeListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove); |
| | | removeListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd); |
| | | |
| | | if (options.responsive) { |
| | | removeListener(window, EVENT_RESIZE, this.onResize); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | var handlers = { |
| | | resize: function resize() { |
| | | if (this.disabled) { |
| | | return; |
| | | } |
| | | |
| | | var options = this.options, |
| | | container = this.container, |
| | | containerData = this.containerData; |
| | | var ratioX = container.offsetWidth / containerData.width; |
| | | var ratioY = container.offsetHeight / containerData.height; |
| | | var ratio = Math.abs(ratioX - 1) > Math.abs(ratioY - 1) ? ratioX : ratioY; // Resize when width changed or height changed |
| | | |
| | | if (ratio !== 1) { |
| | | var canvasData; |
| | | var cropBoxData; |
| | | |
| | | if (options.restore) { |
| | | canvasData = this.getCanvasData(); |
| | | cropBoxData = this.getCropBoxData(); |
| | | } |
| | | |
| | | this.render(); |
| | | |
| | | if (options.restore) { |
| | | this.setCanvasData(forEach(canvasData, function (n, i) { |
| | | canvasData[i] = n * ratio; |
| | | })); |
| | | this.setCropBoxData(forEach(cropBoxData, function (n, i) { |
| | | cropBoxData[i] = n * ratio; |
| | | })); |
| | | } |
| | | } |
| | | }, |
| | | dblclick: function dblclick() { |
| | | if (this.disabled || this.options.dragMode === DRAG_MODE_NONE) { |
| | | return; |
| | | } |
| | | |
| | | this.setDragMode(hasClass(this.dragBox, CLASS_CROP) ? DRAG_MODE_MOVE : DRAG_MODE_CROP); |
| | | }, |
| | | wheel: function wheel(event) { |
| | | var _this = this; |
| | | |
| | | var ratio = Number(this.options.wheelZoomRatio) || 0.1; |
| | | var delta = 1; |
| | | |
| | | if (this.disabled) { |
| | | return; |
| | | } |
| | | |
| | | event.preventDefault(); // Limit wheel speed to prevent zoom too fast (#21) |
| | | |
| | | if (this.wheeling) { |
| | | return; |
| | | } |
| | | |
| | | this.wheeling = true; |
| | | setTimeout(function () { |
| | | _this.wheeling = false; |
| | | }, 50); |
| | | |
| | | if (event.deltaY) { |
| | | delta = event.deltaY > 0 ? 1 : -1; |
| | | } else if (event.wheelDelta) { |
| | | delta = -event.wheelDelta / 120; |
| | | } else if (event.detail) { |
| | | delta = event.detail > 0 ? 1 : -1; |
| | | } |
| | | |
| | | this.zoom(-delta * ratio, event); |
| | | }, |
| | | cropStart: function cropStart(event) { |
| | | var buttons = event.buttons, |
| | | button = event.button; |
| | | |
| | | if (this.disabled // Handle mouse event and pointer event and ignore touch event |
| | | || (event.type === 'mousedown' || event.type === 'pointerdown' && event.pointerType === 'mouse') && ( // No primary button (Usually the left button) |
| | | isNumber(buttons) && buttons !== 1 || isNumber(button) && button !== 0 // Open context menu |
| | | || event.ctrlKey)) { |
| | | return; |
| | | } |
| | | |
| | | var options = this.options, |
| | | pointers = this.pointers; |
| | | var action; |
| | | |
| | | if (event.changedTouches) { |
| | | // Handle touch event |
| | | forEach(event.changedTouches, function (touch) { |
| | | pointers[touch.identifier] = getPointer(touch); |
| | | }); |
| | | } else { |
| | | // Handle mouse event and pointer event |
| | | pointers[event.pointerId || 0] = getPointer(event); |
| | | } |
| | | |
| | | if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) { |
| | | action = ACTION_ZOOM; |
| | | } else { |
| | | action = getData(event.target, DATA_ACTION); |
| | | } |
| | | |
| | | if (!REGEXP_ACTIONS.test(action)) { |
| | | return; |
| | | } |
| | | |
| | | if (dispatchEvent(this.element, EVENT_CROP_START, { |
| | | originalEvent: event, |
| | | action: action |
| | | }) === false) { |
| | | return; |
| | | } // This line is required for preventing page zooming in iOS browsers |
| | | |
| | | |
| | | event.preventDefault(); |
| | | this.action = action; |
| | | this.cropping = false; |
| | | |
| | | if (action === ACTION_CROP) { |
| | | this.cropping = true; |
| | | addClass(this.dragBox, CLASS_MODAL); |
| | | } |
| | | }, |
| | | cropMove: function cropMove(event) { |
| | | var action = this.action; |
| | | |
| | | if (this.disabled || !action) { |
| | | return; |
| | | } |
| | | |
| | | var pointers = this.pointers; |
| | | event.preventDefault(); |
| | | |
| | | if (dispatchEvent(this.element, EVENT_CROP_MOVE, { |
| | | originalEvent: event, |
| | | action: action |
| | | }) === false) { |
| | | return; |
| | | } |
| | | |
| | | if (event.changedTouches) { |
| | | forEach(event.changedTouches, function (touch) { |
| | | // The first parameter should not be undefined (#432) |
| | | assign(pointers[touch.identifier] || {}, getPointer(touch, true)); |
| | | }); |
| | | } else { |
| | | assign(pointers[event.pointerId || 0] || {}, getPointer(event, true)); |
| | | } |
| | | |
| | | this.change(event); |
| | | }, |
| | | cropEnd: function cropEnd(event) { |
| | | if (this.disabled) { |
| | | return; |
| | | } |
| | | |
| | | var action = this.action, |
| | | pointers = this.pointers; |
| | | |
| | | if (event.changedTouches) { |
| | | forEach(event.changedTouches, function (touch) { |
| | | delete pointers[touch.identifier]; |
| | | }); |
| | | } else { |
| | | delete pointers[event.pointerId || 0]; |
| | | } |
| | | |
| | | if (!action) { |
| | | return; |
| | | } |
| | | |
| | | event.preventDefault(); |
| | | |
| | | if (!Object.keys(pointers).length) { |
| | | this.action = ''; |
| | | } |
| | | |
| | | if (this.cropping) { |
| | | this.cropping = false; |
| | | toggleClass(this.dragBox, CLASS_MODAL, this.cropped && this.options.modal); |
| | | } |
| | | |
| | | dispatchEvent(this.element, EVENT_CROP_END, { |
| | | originalEvent: event, |
| | | action: action |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | var change = { |
| | | change: function change(event) { |
| | | var options = this.options, |
| | | canvasData = this.canvasData, |
| | | containerData = this.containerData, |
| | | cropBoxData = this.cropBoxData, |
| | | pointers = this.pointers; |
| | | var action = this.action; |
| | | var aspectRatio = options.aspectRatio; |
| | | var left = cropBoxData.left, |
| | | top = cropBoxData.top, |
| | | width = cropBoxData.width, |
| | | height = cropBoxData.height; |
| | | var right = left + width; |
| | | var bottom = top + height; |
| | | var minLeft = 0; |
| | | var minTop = 0; |
| | | var maxWidth = containerData.width; |
| | | var maxHeight = containerData.height; |
| | | var renderable = true; |
| | | var offset; // Locking aspect ratio in "free mode" by holding shift key |
| | | |
| | | if (!aspectRatio && event.shiftKey) { |
| | | aspectRatio = width && height ? width / height : 1; |
| | | } |
| | | |
| | | if (this.limited) { |
| | | minLeft = cropBoxData.minLeft; |
| | | minTop = cropBoxData.minTop; |
| | | maxWidth = minLeft + Math.min(containerData.width, canvasData.width, canvasData.left + canvasData.width); |
| | | maxHeight = minTop + Math.min(containerData.height, canvasData.height, canvasData.top + canvasData.height); |
| | | } |
| | | |
| | | var pointer = pointers[Object.keys(pointers)[0]]; |
| | | var range = { |
| | | x: pointer.endX - pointer.startX, |
| | | y: pointer.endY - pointer.startY |
| | | }; |
| | | |
| | | var check = function check(side) { |
| | | switch (side) { |
| | | case ACTION_EAST: |
| | | if (right + range.x > maxWidth) { |
| | | range.x = maxWidth - right; |
| | | } |
| | | |
| | | break; |
| | | |
| | | case ACTION_WEST: |
| | | if (left + range.x < minLeft) { |
| | | range.x = minLeft - left; |
| | | } |
| | | |
| | | break; |
| | | |
| | | case ACTION_NORTH: |
| | | if (top + range.y < minTop) { |
| | | range.y = minTop - top; |
| | | } |
| | | |
| | | break; |
| | | |
| | | case ACTION_SOUTH: |
| | | if (bottom + range.y > maxHeight) { |
| | | range.y = maxHeight - bottom; |
| | | } |
| | | |
| | | break; |
| | | } |
| | | }; |
| | | |
| | | switch (action) { |
| | | // Move crop box |
| | | case ACTION_ALL: |
| | | left += range.x; |
| | | top += range.y; |
| | | break; |
| | | // Resize crop box |
| | | |
| | | case ACTION_EAST: |
| | | if (range.x >= 0 && (right >= maxWidth || aspectRatio && (top <= minTop || bottom >= maxHeight))) { |
| | | renderable = false; |
| | | break; |
| | | } |
| | | |
| | | check(ACTION_EAST); |
| | | width += range.x; |
| | | |
| | | if (width < 0) { |
| | | action = ACTION_WEST; |
| | | width = -width; |
| | | left -= width; |
| | | } |
| | | |
| | | if (aspectRatio) { |
| | | height = width / aspectRatio; |
| | | top += (cropBoxData.height - height) / 2; |
| | | } |
| | | |
| | | break; |
| | | |
| | | case ACTION_NORTH: |
| | | if (range.y <= 0 && (top <= minTop || aspectRatio && (left <= minLeft || right >= maxWidth))) { |
| | | renderable = false; |
| | | break; |
| | | } |
| | | |
| | | check(ACTION_NORTH); |
| | | height -= range.y; |
| | | top += range.y; |
| | | |
| | | if (height < 0) { |
| | | action = ACTION_SOUTH; |
| | | height = -height; |
| | | top -= height; |
| | | } |
| | | |
| | | if (aspectRatio) { |
| | | width = height * aspectRatio; |
| | | left += (cropBoxData.width - width) / 2; |
| | | } |
| | | |
| | | break; |
| | | |
| | | case ACTION_WEST: |
| | | if (range.x <= 0 && (left <= minLeft || aspectRatio && (top <= minTop || bottom >= maxHeight))) { |
| | | renderable = false; |
| | | break; |
| | | } |
| | | |
| | | check(ACTION_WEST); |
| | | width -= range.x; |
| | | left += range.x; |
| | | |
| | | if (width < 0) { |
| | | action = ACTION_EAST; |
| | | width = -width; |
| | | left -= width; |
| | | } |
| | | |
| | | if (aspectRatio) { |
| | | height = width / aspectRatio; |
| | | top += (cropBoxData.height - height) / 2; |
| | | } |
| | | |
| | | break; |
| | | |
| | | case ACTION_SOUTH: |
| | | if (range.y >= 0 && (bottom >= maxHeight || aspectRatio && (left <= minLeft || right >= maxWidth))) { |
| | | renderable = false; |
| | | break; |
| | | } |
| | | |
| | | check(ACTION_SOUTH); |
| | | height += range.y; |
| | | |
| | | if (height < 0) { |
| | | action = ACTION_NORTH; |
| | | height = -height; |
| | | top -= height; |
| | | } |
| | | |
| | | if (aspectRatio) { |
| | | width = height * aspectRatio; |
| | | left += (cropBoxData.width - width) / 2; |
| | | } |
| | | |
| | | break; |
| | | |
| | | case ACTION_NORTH_EAST: |
| | | if (aspectRatio) { |
| | | if (range.y <= 0 && (top <= minTop || right >= maxWidth)) { |
| | | renderable = false; |
| | | break; |
| | | } |
| | | |
| | | check(ACTION_NORTH); |
| | | height -= range.y; |
| | | top += range.y; |
| | | width = height * aspectRatio; |
| | | } else { |
| | | check(ACTION_NORTH); |
| | | check(ACTION_EAST); |
| | | |
| | | if (range.x >= 0) { |
| | | if (right < maxWidth) { |
| | | width += range.x; |
| | | } else if (range.y <= 0 && top <= minTop) { |
| | | renderable = false; |
| | | } |
| | | } else { |
| | | width += range.x; |
| | | } |
| | | |
| | | if (range.y <= 0) { |
| | | if (top > minTop) { |
| | | height -= range.y; |
| | | top += range.y; |
| | | } |
| | | } else { |
| | | height -= range.y; |
| | | top += range.y; |
| | | } |
| | | } |
| | | |
| | | if (width < 0 && height < 0) { |
| | | action = ACTION_SOUTH_WEST; |
| | | height = -height; |
| | | width = -width; |
| | | top -= height; |
| | | left -= width; |
| | | } else if (width < 0) { |
| | | action = ACTION_NORTH_WEST; |
| | | width = -width; |
| | | left -= width; |
| | | } else if (height < 0) { |
| | | action = ACTION_SOUTH_EAST; |
| | | height = -height; |
| | | top -= height; |
| | | } |
| | | |
| | | break; |
| | | |
| | | case ACTION_NORTH_WEST: |
| | | if (aspectRatio) { |
| | | if (range.y <= 0 && (top <= minTop || left <= minLeft)) { |
| | | renderable = false; |
| | | break; |
| | | } |
| | | |
| | | check(ACTION_NORTH); |
| | | height -= range.y; |
| | | top += range.y; |
| | | width = height * aspectRatio; |
| | | left += cropBoxData.width - width; |
| | | } else { |
| | | check(ACTION_NORTH); |
| | | check(ACTION_WEST); |
| | | |
| | | if (range.x <= 0) { |
| | | if (left > minLeft) { |
| | | width -= range.x; |
| | | left += range.x; |
| | | } else if (range.y <= 0 && top <= minTop) { |
| | | renderable = false; |
| | | } |
| | | } else { |
| | | width -= range.x; |
| | | left += range.x; |
| | | } |
| | | |
| | | if (range.y <= 0) { |
| | | if (top > minTop) { |
| | | height -= range.y; |
| | | top += range.y; |
| | | } |
| | | } else { |
| | | height -= range.y; |
| | | top += range.y; |
| | | } |
| | | } |
| | | |
| | | if (width < 0 && height < 0) { |
| | | action = ACTION_SOUTH_EAST; |
| | | height = -height; |
| | | width = -width; |
| | | top -= height; |
| | | left -= width; |
| | | } else if (width < 0) { |
| | | action = ACTION_NORTH_EAST; |
| | | width = -width; |
| | | left -= width; |
| | | } else if (height < 0) { |
| | | action = ACTION_SOUTH_WEST; |
| | | height = -height; |
| | | top -= height; |
| | | } |
| | | |
| | | break; |
| | | |
| | | case ACTION_SOUTH_WEST: |
| | | if (aspectRatio) { |
| | | if (range.x <= 0 && (left <= minLeft || bottom >= maxHeight)) { |
| | | renderable = false; |
| | | break; |
| | | } |
| | | |
| | | check(ACTION_WEST); |
| | | width -= range.x; |
| | | left += range.x; |
| | | height = width / aspectRatio; |
| | | } else { |
| | | check(ACTION_SOUTH); |
| | | check(ACTION_WEST); |
| | | |
| | | if (range.x <= 0) { |
| | | if (left > minLeft) { |
| | | width -= range.x; |
| | | left += range.x; |
| | | } else if (range.y >= 0 && bottom >= maxHeight) { |
| | | renderable = false; |
| | | } |
| | | } else { |
| | | width -= range.x; |
| | | left += range.x; |
| | | } |
| | | |
| | | if (range.y >= 0) { |
| | | if (bottom < maxHeight) { |
| | | height += range.y; |
| | | } |
| | | } else { |
| | | height += range.y; |
| | | } |
| | | } |
| | | |
| | | if (width < 0 && height < 0) { |
| | | action = ACTION_NORTH_EAST; |
| | | height = -height; |
| | | width = -width; |
| | | top -= height; |
| | | left -= width; |
| | | } else if (width < 0) { |
| | | action = ACTION_SOUTH_EAST; |
| | | width = -width; |
| | | left -= width; |
| | | } else if (height < 0) { |
| | | action = ACTION_NORTH_WEST; |
| | | height = -height; |
| | | top -= height; |
| | | } |
| | | |
| | | break; |
| | | |
| | | case ACTION_SOUTH_EAST: |
| | | if (aspectRatio) { |
| | | if (range.x >= 0 && (right >= maxWidth || bottom >= maxHeight)) { |
| | | renderable = false; |
| | | break; |
| | | } |
| | | |
| | | check(ACTION_EAST); |
| | | width += range.x; |
| | | height = width / aspectRatio; |
| | | } else { |
| | | check(ACTION_SOUTH); |
| | | check(ACTION_EAST); |
| | | |
| | | if (range.x >= 0) { |
| | | if (right < maxWidth) { |
| | | width += range.x; |
| | | } else if (range.y >= 0 && bottom >= maxHeight) { |
| | | renderable = false; |
| | | } |
| | | } else { |
| | | width += range.x; |
| | | } |
| | | |
| | | if (range.y >= 0) { |
| | | if (bottom < maxHeight) { |
| | | height += range.y; |
| | | } |
| | | } else { |
| | | height += range.y; |
| | | } |
| | | } |
| | | |
| | | if (width < 0 && height < 0) { |
| | | action = ACTION_NORTH_WEST; |
| | | height = -height; |
| | | width = -width; |
| | | top -= height; |
| | | left -= width; |
| | | } else if (width < 0) { |
| | | action = ACTION_SOUTH_WEST; |
| | | width = -width; |
| | | left -= width; |
| | | } else if (height < 0) { |
| | | action = ACTION_NORTH_EAST; |
| | | height = -height; |
| | | top -= height; |
| | | } |
| | | |
| | | break; |
| | | // Move canvas |
| | | |
| | | case ACTION_MOVE: |
| | | this.move(range.x, range.y); |
| | | renderable = false; |
| | | break; |
| | | // Zoom canvas |
| | | |
| | | case ACTION_ZOOM: |
| | | this.zoom(getMaxZoomRatio(pointers), event); |
| | | renderable = false; |
| | | break; |
| | | // Create crop box |
| | | |
| | | case ACTION_CROP: |
| | | if (!range.x || !range.y) { |
| | | renderable = false; |
| | | break; |
| | | } |
| | | |
| | | offset = getOffset(this.cropper); |
| | | left = pointer.startX - offset.left; |
| | | top = pointer.startY - offset.top; |
| | | width = cropBoxData.minWidth; |
| | | height = cropBoxData.minHeight; |
| | | |
| | | if (range.x > 0) { |
| | | action = range.y > 0 ? ACTION_SOUTH_EAST : ACTION_NORTH_EAST; |
| | | } else if (range.x < 0) { |
| | | left -= width; |
| | | action = range.y > 0 ? ACTION_SOUTH_WEST : ACTION_NORTH_WEST; |
| | | } |
| | | |
| | | if (range.y < 0) { |
| | | top -= height; |
| | | } // Show the crop box if is hidden |
| | | |
| | | |
| | | if (!this.cropped) { |
| | | removeClass(this.cropBox, CLASS_HIDDEN); |
| | | this.cropped = true; |
| | | |
| | | if (this.limited) { |
| | | this.limitCropBox(true, true); |
| | | } |
| | | } |
| | | |
| | | break; |
| | | } |
| | | |
| | | if (renderable) { |
| | | cropBoxData.width = width; |
| | | cropBoxData.height = height; |
| | | cropBoxData.left = left; |
| | | cropBoxData.top = top; |
| | | this.action = action; |
| | | this.renderCropBox(); |
| | | } // Override |
| | | |
| | | |
| | | forEach(pointers, function (p) { |
| | | p.startX = p.endX; |
| | | p.startY = p.endY; |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | var methods = { |
| | | // Show the crop box manually |
| | | crop: function crop() { |
| | | if (this.ready && !this.cropped && !this.disabled) { |
| | | this.cropped = true; |
| | | this.limitCropBox(true, true); |
| | | |
| | | if (this.options.modal) { |
| | | addClass(this.dragBox, CLASS_MODAL); |
| | | } |
| | | |
| | | removeClass(this.cropBox, CLASS_HIDDEN); |
| | | this.setCropBoxData(this.initialCropBoxData); |
| | | } |
| | | |
| | | return this; |
| | | }, |
| | | // Reset the image and crop box to their initial states |
| | | reset: function reset() { |
| | | if (this.ready && !this.disabled) { |
| | | this.imageData = assign({}, this.initialImageData); |
| | | this.canvasData = assign({}, this.initialCanvasData); |
| | | this.cropBoxData = assign({}, this.initialCropBoxData); |
| | | this.renderCanvas(); |
| | | |
| | | if (this.cropped) { |
| | | this.renderCropBox(); |
| | | } |
| | | } |
| | | |
| | | return this; |
| | | }, |
| | | // Clear the crop box |
| | | clear: function clear() { |
| | | if (this.cropped && !this.disabled) { |
| | | assign(this.cropBoxData, { |
| | | left: 0, |
| | | top: 0, |
| | | width: 0, |
| | | height: 0 |
| | | }); |
| | | this.cropped = false; |
| | | this.renderCropBox(); |
| | | this.limitCanvas(true, true); // Render canvas after crop box rendered |
| | | |
| | | this.renderCanvas(); |
| | | removeClass(this.dragBox, CLASS_MODAL); |
| | | addClass(this.cropBox, CLASS_HIDDEN); |
| | | } |
| | | |
| | | return this; |
| | | }, |
| | | |
| | | /** |
| | | * Replace the image's src and rebuild the cropper |
| | | * @param {string} url - The new URL. |
| | | * @param {boolean} [hasSameSize] - Indicate if the new image has the same size as the old one. |
| | | * @returns {Cropper} this |
| | | */ |
| | | replace: function replace(url) { |
| | | var hasSameSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; |
| | | |
| | | if (!this.disabled && url) { |
| | | if (this.isImg) { |
| | | this.element.src = url; |
| | | } |
| | | |
| | | if (hasSameSize) { |
| | | this.url = url; |
| | | this.image.src = url; |
| | | |
| | | if (this.ready) { |
| | | this.viewBoxImage.src = url; |
| | | forEach(this.previews, function (element) { |
| | | element.getElementsByTagName('img')[0].src = url; |
| | | }); |
| | | } |
| | | } else { |
| | | if (this.isImg) { |
| | | this.replaced = true; |
| | | } |
| | | |
| | | this.options.data = null; |
| | | this.uncreate(); |
| | | this.load(url); |
| | | } |
| | | } |
| | | |
| | | return this; |
| | | }, |
| | | // Enable (unfreeze) the cropper |
| | | enable: function enable() { |
| | | if (this.ready && this.disabled) { |
| | | this.disabled = false; |
| | | removeClass(this.cropper, CLASS_DISABLED); |
| | | } |
| | | |
| | | return this; |
| | | }, |
| | | // Disable (freeze) the cropper |
| | | disable: function disable() { |
| | | if (this.ready && !this.disabled) { |
| | | this.disabled = true; |
| | | addClass(this.cropper, CLASS_DISABLED); |
| | | } |
| | | |
| | | return this; |
| | | }, |
| | | |
| | | /** |
| | | * Destroy the cropper and remove the instance from the image |
| | | * @returns {Cropper} this |
| | | */ |
| | | destroy: function destroy() { |
| | | var element = this.element; |
| | | |
| | | if (!element[NAMESPACE]) { |
| | | return this; |
| | | } |
| | | |
| | | element[NAMESPACE] = undefined; |
| | | |
| | | if (this.isImg && this.replaced) { |
| | | element.src = this.originalUrl; |
| | | } |
| | | |
| | | this.uncreate(); |
| | | return this; |
| | | }, |
| | | |
| | | /** |
| | | * Move the canvas with relative offsets |
| | | * @param {number} offsetX - The relative offset distance on the x-axis. |
| | | * @param {number} [offsetY=offsetX] - The relative offset distance on the y-axis. |
| | | * @returns {Cropper} this |
| | | */ |
| | | move: function move(offsetX) { |
| | | var offsetY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : offsetX; |
| | | var _this$canvasData = this.canvasData, |
| | | left = _this$canvasData.left, |
| | | top = _this$canvasData.top; |
| | | return this.moveTo(isUndefined(offsetX) ? offsetX : left + Number(offsetX), isUndefined(offsetY) ? offsetY : top + Number(offsetY)); |
| | | }, |
| | | |
| | | /** |
| | | * Move the canvas to an absolute point |
| | | * @param {number} x - The x-axis coordinate. |
| | | * @param {number} [y=x] - The y-axis coordinate. |
| | | * @returns {Cropper} this |
| | | */ |
| | | moveTo: function moveTo(x) { |
| | | var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x; |
| | | var canvasData = this.canvasData; |
| | | var changed = false; |
| | | x = Number(x); |
| | | y = Number(y); |
| | | |
| | | if (this.ready && !this.disabled && this.options.movable) { |
| | | if (isNumber(x)) { |
| | | canvasData.left = x; |
| | | changed = true; |
| | | } |
| | | |
| | | if (isNumber(y)) { |
| | | canvasData.top = y; |
| | | changed = true; |
| | | } |
| | | |
| | | if (changed) { |
| | | this.renderCanvas(true); |
| | | } |
| | | } |
| | | |
| | | return this; |
| | | }, |
| | | |
| | | /** |
| | | * Zoom the canvas with a relative ratio |
| | | * @param {number} ratio - The target ratio. |
| | | * @param {Event} _originalEvent - The original event if any. |
| | | * @returns {Cropper} this |
| | | */ |
| | | zoom: function zoom(ratio, _originalEvent) { |
| | | var canvasData = this.canvasData; |
| | | ratio = Number(ratio); |
| | | |
| | | if (ratio < 0) { |
| | | ratio = 1 / (1 - ratio); |
| | | } else { |
| | | ratio = 1 + ratio; |
| | | } |
| | | |
| | | return this.zoomTo(canvasData.width * ratio / canvasData.naturalWidth, null, _originalEvent); |
| | | }, |
| | | |
| | | /** |
| | | * Zoom the canvas to an absolute ratio |
| | | * @param {number} ratio - The target ratio. |
| | | * @param {Object} pivot - The zoom pivot point coordinate. |
| | | * @param {Event} _originalEvent - The original event if any. |
| | | * @returns {Cropper} this |
| | | */ |
| | | zoomTo: function zoomTo(ratio, pivot, _originalEvent) { |
| | | var options = this.options, |
| | | canvasData = this.canvasData; |
| | | var width = canvasData.width, |
| | | height = canvasData.height, |
| | | naturalWidth = canvasData.naturalWidth, |
| | | naturalHeight = canvasData.naturalHeight; |
| | | ratio = Number(ratio); |
| | | |
| | | if (ratio >= 0 && this.ready && !this.disabled && options.zoomable) { |
| | | var newWidth = naturalWidth * ratio; |
| | | var newHeight = naturalHeight * ratio; |
| | | |
| | | if (dispatchEvent(this.element, EVENT_ZOOM, { |
| | | ratio: ratio, |
| | | oldRatio: width / naturalWidth, |
| | | originalEvent: _originalEvent |
| | | }) === false) { |
| | | return this; |
| | | } |
| | | |
| | | if (_originalEvent) { |
| | | var pointers = this.pointers; |
| | | var offset = getOffset(this.cropper); |
| | | var center = pointers && Object.keys(pointers).length ? getPointersCenter(pointers) : { |
| | | pageX: _originalEvent.pageX, |
| | | pageY: _originalEvent.pageY |
| | | }; // Zoom from the triggering point of the event |
| | | |
| | | canvasData.left -= (newWidth - width) * ((center.pageX - offset.left - canvasData.left) / width); |
| | | canvasData.top -= (newHeight - height) * ((center.pageY - offset.top - canvasData.top) / height); |
| | | } else if (isPlainObject(pivot) && isNumber(pivot.x) && isNumber(pivot.y)) { |
| | | canvasData.left -= (newWidth - width) * ((pivot.x - canvasData.left) / width); |
| | | canvasData.top -= (newHeight - height) * ((pivot.y - canvasData.top) / height); |
| | | } else { |
| | | // Zoom from the center of the canvas |
| | | canvasData.left -= (newWidth - width) / 2; |
| | | canvasData.top -= (newHeight - height) / 2; |
| | | } |
| | | |
| | | canvasData.width = newWidth; |
| | | canvasData.height = newHeight; |
| | | this.renderCanvas(true); |
| | | } |
| | | |
| | | return this; |
| | | }, |
| | | |
| | | /** |
| | | * Rotate the canvas with a relative degree |
| | | * @param {number} degree - The rotate degree. |
| | | * @returns {Cropper} this |
| | | */ |
| | | rotate: function rotate(degree) { |
| | | return this.rotateTo((this.imageData.rotate || 0) + Number(degree)); |
| | | }, |
| | | |
| | | /** |
| | | * Rotate the canvas to an absolute degree |
| | | * @param {number} degree - The rotate degree. |
| | | * @returns {Cropper} this |
| | | */ |
| | | rotateTo: function rotateTo(degree) { |
| | | degree = Number(degree); |
| | | |
| | | if (isNumber(degree) && this.ready && !this.disabled && this.options.rotatable) { |
| | | this.imageData.rotate = degree % 360; |
| | | this.renderCanvas(true, true); |
| | | } |
| | | |
| | | return this; |
| | | }, |
| | | |
| | | /** |
| | | * Scale the image on the x-axis. |
| | | * @param {number} scaleX - The scale ratio on the x-axis. |
| | | * @returns {Cropper} this |
| | | */ |
| | | scaleX: function scaleX(_scaleX) { |
| | | var scaleY = this.imageData.scaleY; |
| | | return this.scale(_scaleX, isNumber(scaleY) ? scaleY : 1); |
| | | }, |
| | | |
| | | /** |
| | | * Scale the image on the y-axis. |
| | | * @param {number} scaleY - The scale ratio on the y-axis. |
| | | * @returns {Cropper} this |
| | | */ |
| | | scaleY: function scaleY(_scaleY) { |
| | | var scaleX = this.imageData.scaleX; |
| | | return this.scale(isNumber(scaleX) ? scaleX : 1, _scaleY); |
| | | }, |
| | | |
| | | /** |
| | | * Scale the image |
| | | * @param {number} scaleX - The scale ratio on the x-axis. |
| | | * @param {number} [scaleY=scaleX] - The scale ratio on the y-axis. |
| | | * @returns {Cropper} this |
| | | */ |
| | | scale: function scale(scaleX) { |
| | | var scaleY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scaleX; |
| | | var imageData = this.imageData; |
| | | var transformed = false; |
| | | scaleX = Number(scaleX); |
| | | scaleY = Number(scaleY); |
| | | |
| | | if (this.ready && !this.disabled && this.options.scalable) { |
| | | if (isNumber(scaleX)) { |
| | | imageData.scaleX = scaleX; |
| | | transformed = true; |
| | | } |
| | | |
| | | if (isNumber(scaleY)) { |
| | | imageData.scaleY = scaleY; |
| | | transformed = true; |
| | | } |
| | | |
| | | if (transformed) { |
| | | this.renderCanvas(true, true); |
| | | } |
| | | } |
| | | |
| | | return this; |
| | | }, |
| | | |
| | | /** |
| | | * Get the cropped area position and size data (base on the original image) |
| | | * @param {boolean} [rounded=false] - Indicate if round the data values or not. |
| | | * @returns {Object} The result cropped data. |
| | | */ |
| | | getData: function getData() { |
| | | var rounded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; |
| | | var options = this.options, |
| | | imageData = this.imageData, |
| | | canvasData = this.canvasData, |
| | | cropBoxData = this.cropBoxData; |
| | | var data; |
| | | |
| | | if (this.ready && this.cropped) { |
| | | data = { |
| | | x: cropBoxData.left - canvasData.left, |
| | | y: cropBoxData.top - canvasData.top, |
| | | width: cropBoxData.width, |
| | | height: cropBoxData.height |
| | | }; |
| | | var ratio = imageData.width / imageData.naturalWidth; |
| | | forEach(data, function (n, i) { |
| | | data[i] = n / ratio; |
| | | }); |
| | | |
| | | if (rounded) { |
| | | // In case rounding off leads to extra 1px in right or bottom border |
| | | // we should round the top-left corner and the dimension (#343). |
| | | var bottom = Math.round(data.y + data.height); |
| | | var right = Math.round(data.x + data.width); |
| | | data.x = Math.round(data.x); |
| | | data.y = Math.round(data.y); |
| | | data.width = right - data.x; |
| | | data.height = bottom - data.y; |
| | | } |
| | | } else { |
| | | data = { |
| | | x: 0, |
| | | y: 0, |
| | | width: 0, |
| | | height: 0 |
| | | }; |
| | | } |
| | | |
| | | if (options.rotatable) { |
| | | data.rotate = imageData.rotate || 0; |
| | | } |
| | | |
| | | if (options.scalable) { |
| | | data.scaleX = imageData.scaleX || 1; |
| | | data.scaleY = imageData.scaleY || 1; |
| | | } |
| | | |
| | | return data; |
| | | }, |
| | | |
| | | /** |
| | | * Set the cropped area position and size with new data |
| | | * @param {Object} data - The new data. |
| | | * @returns {Cropper} this |
| | | */ |
| | | setData: function setData(data) { |
| | | var options = this.options, |
| | | imageData = this.imageData, |
| | | canvasData = this.canvasData; |
| | | var cropBoxData = {}; |
| | | |
| | | if (this.ready && !this.disabled && isPlainObject(data)) { |
| | | var transformed = false; |
| | | |
| | | if (options.rotatable) { |
| | | if (isNumber(data.rotate) && data.rotate !== imageData.rotate) { |
| | | imageData.rotate = data.rotate; |
| | | transformed = true; |
| | | } |
| | | } |
| | | |
| | | if (options.scalable) { |
| | | if (isNumber(data.scaleX) && data.scaleX !== imageData.scaleX) { |
| | | imageData.scaleX = data.scaleX; |
| | | transformed = true; |
| | | } |
| | | |
| | | if (isNumber(data.scaleY) && data.scaleY !== imageData.scaleY) { |
| | | imageData.scaleY = data.scaleY; |
| | | transformed = true; |
| | | } |
| | | } |
| | | |
| | | if (transformed) { |
| | | this.renderCanvas(true, true); |
| | | } |
| | | |
| | | var ratio = imageData.width / imageData.naturalWidth; |
| | | |
| | | if (isNumber(data.x)) { |
| | | cropBoxData.left = data.x * ratio + canvasData.left; |
| | | } |
| | | |
| | | if (isNumber(data.y)) { |
| | | cropBoxData.top = data.y * ratio + canvasData.top; |
| | | } |
| | | |
| | | if (isNumber(data.width)) { |
| | | cropBoxData.width = data.width * ratio; |
| | | } |
| | | |
| | | if (isNumber(data.height)) { |
| | | cropBoxData.height = data.height * ratio; |
| | | } |
| | | |
| | | this.setCropBoxData(cropBoxData); |
| | | } |
| | | |
| | | return this; |
| | | }, |
| | | |
| | | /** |
| | | * Get the container size data. |
| | | * @returns {Object} The result container data. |
| | | */ |
| | | getContainerData: function getContainerData() { |
| | | return this.ready ? assign({}, this.containerData) : {}; |
| | | }, |
| | | |
| | | /** |
| | | * Get the image position and size data. |
| | | * @returns {Object} The result image data. |
| | | */ |
| | | getImageData: function getImageData() { |
| | | return this.sized ? assign({}, this.imageData) : {}; |
| | | }, |
| | | |
| | | /** |
| | | * Get the canvas position and size data. |
| | | * @returns {Object} The result canvas data. |
| | | */ |
| | | getCanvasData: function getCanvasData() { |
| | | var canvasData = this.canvasData; |
| | | var data = {}; |
| | | |
| | | if (this.ready) { |
| | | forEach(['left', 'top', 'width', 'height', 'naturalWidth', 'naturalHeight'], function (n) { |
| | | data[n] = canvasData[n]; |
| | | }); |
| | | } |
| | | |
| | | return data; |
| | | }, |
| | | |
| | | /** |
| | | * Set the canvas position and size with new data. |
| | | * @param {Object} data - The new canvas data. |
| | | * @returns {Cropper} this |
| | | */ |
| | | setCanvasData: function setCanvasData(data) { |
| | | var canvasData = this.canvasData; |
| | | var aspectRatio = canvasData.aspectRatio; |
| | | |
| | | if (this.ready && !this.disabled && isPlainObject(data)) { |
| | | if (isNumber(data.left)) { |
| | | canvasData.left = data.left; |
| | | } |
| | | |
| | | if (isNumber(data.top)) { |
| | | canvasData.top = data.top; |
| | | } |
| | | |
| | | if (isNumber(data.width)) { |
| | | canvasData.width = data.width; |
| | | canvasData.height = data.width / aspectRatio; |
| | | } else if (isNumber(data.height)) { |
| | | canvasData.height = data.height; |
| | | canvasData.width = data.height * aspectRatio; |
| | | } |
| | | |
| | | this.renderCanvas(true); |
| | | } |
| | | |
| | | return this; |
| | | }, |
| | | |
| | | /** |
| | | * Get the crop box position and size data. |
| | | * @returns {Object} The result crop box data. |
| | | */ |
| | | getCropBoxData: function getCropBoxData() { |
| | | var cropBoxData = this.cropBoxData; |
| | | var data; |
| | | |
| | | if (this.ready && this.cropped) { |
| | | data = { |
| | | left: cropBoxData.left, |
| | | top: cropBoxData.top, |
| | | width: cropBoxData.width, |
| | | height: cropBoxData.height |
| | | }; |
| | | } |
| | | |
| | | return data || {}; |
| | | }, |
| | | |
| | | /** |
| | | * Set the crop box position and size with new data. |
| | | * @param {Object} data - The new crop box data. |
| | | * @returns {Cropper} this |
| | | */ |
| | | setCropBoxData: function setCropBoxData(data) { |
| | | var cropBoxData = this.cropBoxData; |
| | | var aspectRatio = this.options.aspectRatio; |
| | | var widthChanged; |
| | | var heightChanged; |
| | | |
| | | if (this.ready && this.cropped && !this.disabled && isPlainObject(data)) { |
| | | if (isNumber(data.left)) { |
| | | cropBoxData.left = data.left; |
| | | } |
| | | |
| | | if (isNumber(data.top)) { |
| | | cropBoxData.top = data.top; |
| | | } |
| | | |
| | | if (isNumber(data.width) && data.width !== cropBoxData.width) { |
| | | widthChanged = true; |
| | | cropBoxData.width = data.width; |
| | | } |
| | | |
| | | if (isNumber(data.height) && data.height !== cropBoxData.height) { |
| | | heightChanged = true; |
| | | cropBoxData.height = data.height; |
| | | } |
| | | |
| | | if (aspectRatio) { |
| | | if (widthChanged) { |
| | | cropBoxData.height = cropBoxData.width / aspectRatio; |
| | | } else if (heightChanged) { |
| | | cropBoxData.width = cropBoxData.height * aspectRatio; |
| | | } |
| | | } |
| | | |
| | | this.renderCropBox(); |
| | | } |
| | | |
| | | return this; |
| | | }, |
| | | |
| | | /** |
| | | * Get a canvas drawn the cropped image. |
| | | * @param {Object} [options={}] - The config options. |
| | | * @returns {HTMLCanvasElement} - The result canvas. |
| | | */ |
| | | getCroppedCanvas: function getCroppedCanvas() { |
| | | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
| | | |
| | | if (!this.ready || !window.HTMLCanvasElement) { |
| | | return null; |
| | | } |
| | | |
| | | var canvasData = this.canvasData; |
| | | var source = getSourceCanvas(this.image, this.imageData, canvasData, options); // Returns the source canvas if it is not cropped. |
| | | |
| | | if (!this.cropped) { |
| | | return source; |
| | | } |
| | | |
| | | var _this$getData = this.getData(), |
| | | initialX = _this$getData.x, |
| | | initialY = _this$getData.y, |
| | | initialWidth = _this$getData.width, |
| | | initialHeight = _this$getData.height; |
| | | |
| | | var ratio = source.width / Math.floor(canvasData.naturalWidth); |
| | | |
| | | if (ratio !== 1) { |
| | | initialX *= ratio; |
| | | initialY *= ratio; |
| | | initialWidth *= ratio; |
| | | initialHeight *= ratio; |
| | | } |
| | | |
| | | var aspectRatio = initialWidth / initialHeight; |
| | | var maxSizes = getAdjustedSizes({ |
| | | aspectRatio: aspectRatio, |
| | | width: options.maxWidth || Infinity, |
| | | height: options.maxHeight || Infinity |
| | | }); |
| | | var minSizes = getAdjustedSizes({ |
| | | aspectRatio: aspectRatio, |
| | | width: options.minWidth || 0, |
| | | height: options.minHeight || 0 |
| | | }, 'cover'); |
| | | |
| | | var _getAdjustedSizes = getAdjustedSizes({ |
| | | aspectRatio: aspectRatio, |
| | | width: options.width || (ratio !== 1 ? source.width : initialWidth), |
| | | height: options.height || (ratio !== 1 ? source.height : initialHeight) |
| | | }), |
| | | width = _getAdjustedSizes.width, |
| | | height = _getAdjustedSizes.height; |
| | | |
| | | width = Math.min(maxSizes.width, Math.max(minSizes.width, width)); |
| | | height = Math.min(maxSizes.height, Math.max(minSizes.height, height)); |
| | | var canvas = document.createElement('canvas'); |
| | | var context = canvas.getContext('2d'); |
| | | canvas.width = normalizeDecimalNumber(width); |
| | | canvas.height = normalizeDecimalNumber(height); |
| | | context.fillStyle = options.fillColor || 'transparent'; |
| | | context.fillRect(0, 0, width, height); |
| | | var _options$imageSmoothi = options.imageSmoothingEnabled, |
| | | imageSmoothingEnabled = _options$imageSmoothi === void 0 ? true : _options$imageSmoothi, |
| | | imageSmoothingQuality = options.imageSmoothingQuality; |
| | | context.imageSmoothingEnabled = imageSmoothingEnabled; |
| | | |
| | | if (imageSmoothingQuality) { |
| | | context.imageSmoothingQuality = imageSmoothingQuality; |
| | | } // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.drawImage |
| | | |
| | | |
| | | var sourceWidth = source.width; |
| | | var sourceHeight = source.height; // Source canvas parameters |
| | | |
| | | var srcX = initialX; |
| | | var srcY = initialY; |
| | | var srcWidth; |
| | | var srcHeight; // Destination canvas parameters |
| | | |
| | | var dstX; |
| | | var dstY; |
| | | var dstWidth; |
| | | var dstHeight; |
| | | |
| | | if (srcX <= -initialWidth || srcX > sourceWidth) { |
| | | srcX = 0; |
| | | srcWidth = 0; |
| | | dstX = 0; |
| | | dstWidth = 0; |
| | | } else if (srcX <= 0) { |
| | | dstX = -srcX; |
| | | srcX = 0; |
| | | srcWidth = Math.min(sourceWidth, initialWidth + srcX); |
| | | dstWidth = srcWidth; |
| | | } else if (srcX <= sourceWidth) { |
| | | dstX = 0; |
| | | srcWidth = Math.min(initialWidth, sourceWidth - srcX); |
| | | dstWidth = srcWidth; |
| | | } |
| | | |
| | | if (srcWidth <= 0 || srcY <= -initialHeight || srcY > sourceHeight) { |
| | | srcY = 0; |
| | | srcHeight = 0; |
| | | dstY = 0; |
| | | dstHeight = 0; |
| | | } else if (srcY <= 0) { |
| | | dstY = -srcY; |
| | | srcY = 0; |
| | | srcHeight = Math.min(sourceHeight, initialHeight + srcY); |
| | | dstHeight = srcHeight; |
| | | } else if (srcY <= sourceHeight) { |
| | | dstY = 0; |
| | | srcHeight = Math.min(initialHeight, sourceHeight - srcY); |
| | | dstHeight = srcHeight; |
| | | } |
| | | |
| | | var params = [srcX, srcY, srcWidth, srcHeight]; // Avoid "IndexSizeError" |
| | | |
| | | if (dstWidth > 0 && dstHeight > 0) { |
| | | var scale = width / initialWidth; |
| | | params.push(dstX * scale, dstY * scale, dstWidth * scale, dstHeight * scale); |
| | | } // All the numerical parameters should be integer for `drawImage` |
| | | // https://github.com/fengyuanchen/cropper/issues/476 |
| | | |
| | | |
| | | context.drawImage.apply(context, [source].concat(_toConsumableArray(params.map(function (param) { |
| | | return Math.floor(normalizeDecimalNumber(param)); |
| | | })))); |
| | | return canvas; |
| | | }, |
| | | |
| | | /** |
| | | * Change the aspect ratio of the crop box. |
| | | * @param {number} aspectRatio - The new aspect ratio. |
| | | * @returns {Cropper} this |
| | | */ |
| | | setAspectRatio: function setAspectRatio(aspectRatio) { |
| | | var options = this.options; |
| | | |
| | | if (!this.disabled && !isUndefined(aspectRatio)) { |
| | | // 0 -> NaN |
| | | options.aspectRatio = Math.max(0, aspectRatio) || NaN; |
| | | |
| | | if (this.ready) { |
| | | this.initCropBox(); |
| | | |
| | | if (this.cropped) { |
| | | this.renderCropBox(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return this; |
| | | }, |
| | | |
| | | /** |
| | | * Change the drag mode. |
| | | * @param {string} mode - The new drag mode. |
| | | * @returns {Cropper} this |
| | | */ |
| | | setDragMode: function setDragMode(mode) { |
| | | var options = this.options, |
| | | dragBox = this.dragBox, |
| | | face = this.face; |
| | | |
| | | if (this.ready && !this.disabled) { |
| | | var croppable = mode === DRAG_MODE_CROP; |
| | | var movable = options.movable && mode === DRAG_MODE_MOVE; |
| | | mode = croppable || movable ? mode : DRAG_MODE_NONE; |
| | | options.dragMode = mode; |
| | | setData(dragBox, DATA_ACTION, mode); |
| | | toggleClass(dragBox, CLASS_CROP, croppable); |
| | | toggleClass(dragBox, CLASS_MOVE, movable); |
| | | |
| | | if (!options.cropBoxMovable) { |
| | | // Sync drag mode to crop box when it is not movable |
| | | setData(face, DATA_ACTION, mode); |
| | | toggleClass(face, CLASS_CROP, croppable); |
| | | toggleClass(face, CLASS_MOVE, movable); |
| | | } |
| | | } |
| | | |
| | | return this; |
| | | } |
| | | }; |
| | | |
| | | var AnotherCropper = WINDOW.Cropper; |
| | | |
| | | var Cropper = /*#__PURE__*/function () { |
| | | /** |
| | | * Create a new Cropper. |
| | | * @param {Element} element - The target element for cropping. |
| | | * @param {Object} [options={}] - The configuration options. |
| | | */ |
| | | function Cropper(element) { |
| | | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; |
| | | |
| | | _classCallCheck(this, Cropper); |
| | | |
| | | if (!element || !REGEXP_TAG_NAME.test(element.tagName)) { |
| | | throw new Error('The first argument is required and must be an <img> or <canvas> element.'); |
| | | } |
| | | |
| | | this.element = element; |
| | | this.options = assign({}, DEFAULTS, isPlainObject(options) && options); |
| | | this.cropped = false; |
| | | this.disabled = false; |
| | | this.pointers = {}; |
| | | this.ready = false; |
| | | this.reloading = false; |
| | | this.replaced = false; |
| | | this.sized = false; |
| | | this.sizing = false; |
| | | this.init(); |
| | | } |
| | | |
| | | _createClass(Cropper, [{ |
| | | key: "init", |
| | | value: function init() { |
| | | var element = this.element; |
| | | var tagName = element.tagName.toLowerCase(); |
| | | var url; |
| | | |
| | | if (element[NAMESPACE]) { |
| | | return; |
| | | } |
| | | |
| | | element[NAMESPACE] = this; |
| | | |
| | | if (tagName === 'img') { |
| | | this.isImg = true; // e.g.: "img/picture.jpg" |
| | | |
| | | url = element.getAttribute('src') || ''; |
| | | this.originalUrl = url; // Stop when it's a blank image |
| | | |
| | | if (!url) { |
| | | return; |
| | | } // e.g.: "https://example.com/img/picture.jpg" |
| | | |
| | | |
| | | url = element.src; |
| | | } else if (tagName === 'canvas' && window.HTMLCanvasElement) { |
| | | url = element.toDataURL(); |
| | | } |
| | | |
| | | this.load(url); |
| | | } |
| | | }, { |
| | | key: "load", |
| | | value: function load(url) { |
| | | var _this = this; |
| | | |
| | | if (!url) { |
| | | return; |
| | | } |
| | | |
| | | this.url = url; |
| | | this.imageData = {}; |
| | | var element = this.element, |
| | | options = this.options; |
| | | |
| | | if (!options.rotatable && !options.scalable) { |
| | | options.checkOrientation = false; |
| | | } // Only IE10+ supports Typed Arrays |
| | | |
| | | |
| | | if (!options.checkOrientation || !window.ArrayBuffer) { |
| | | this.clone(); |
| | | return; |
| | | } // Detect the mime type of the image directly if it is a Data URL |
| | | |
| | | |
| | | if (REGEXP_DATA_URL.test(url)) { |
| | | // Read ArrayBuffer from Data URL of JPEG images directly for better performance |
| | | if (REGEXP_DATA_URL_JPEG.test(url)) { |
| | | this.read(dataURLToArrayBuffer(url)); |
| | | } else { |
| | | // Only a JPEG image may contains Exif Orientation information, |
| | | // the rest types of Data URLs are not necessary to check orientation at all. |
| | | this.clone(); |
| | | } |
| | | |
| | | return; |
| | | } // 1. Detect the mime type of the image by a XMLHttpRequest. |
| | | // 2. Load the image as ArrayBuffer for reading orientation if its a JPEG image. |
| | | |
| | | |
| | | var xhr = new XMLHttpRequest(); |
| | | var clone = this.clone.bind(this); |
| | | this.reloading = true; |
| | | this.xhr = xhr; // 1. Cross origin requests are only supported for protocol schemes: |
| | | // http, https, data, chrome, chrome-extension. |
| | | // 2. Access to XMLHttpRequest from a Data URL will be blocked by CORS policy |
| | | // in some browsers as IE11 and Safari. |
| | | |
| | | xhr.onabort = clone; |
| | | xhr.onerror = clone; |
| | | xhr.ontimeout = clone; |
| | | |
| | | xhr.onprogress = function () { |
| | | // Abort the request directly if it not a JPEG image for better performance |
| | | if (xhr.getResponseHeader('content-type') !== MIME_TYPE_JPEG) { |
| | | xhr.abort(); |
| | | } |
| | | }; |
| | | |
| | | xhr.onload = function () { |
| | | _this.read(xhr.response); |
| | | }; |
| | | |
| | | xhr.onloadend = function () { |
| | | _this.reloading = false; |
| | | _this.xhr = null; |
| | | }; // Bust cache when there is a "crossOrigin" property to avoid browser cache error |
| | | |
| | | |
| | | if (options.checkCrossOrigin && isCrossOriginURL(url) && element.crossOrigin) { |
| | | url = addTimestamp(url); |
| | | } // The third parameter is required for avoiding side-effect (#682) |
| | | |
| | | |
| | | xhr.open('GET', url, true); |
| | | xhr.responseType = 'arraybuffer'; |
| | | xhr.withCredentials = element.crossOrigin === 'use-credentials'; |
| | | xhr.send(); |
| | | } |
| | | }, { |
| | | key: "read", |
| | | value: function read(arrayBuffer) { |
| | | var options = this.options, |
| | | imageData = this.imageData; // Reset the orientation value to its default value 1 |
| | | // as some iOS browsers will render image with its orientation |
| | | |
| | | var orientation = resetAndGetOrientation(arrayBuffer); |
| | | var rotate = 0; |
| | | var scaleX = 1; |
| | | var scaleY = 1; |
| | | |
| | | if (orientation > 1) { |
| | | // Generate a new URL which has the default orientation value |
| | | this.url = arrayBufferToDataURL(arrayBuffer, MIME_TYPE_JPEG); |
| | | |
| | | var _parseOrientation = parseOrientation(orientation); |
| | | |
| | | rotate = _parseOrientation.rotate; |
| | | scaleX = _parseOrientation.scaleX; |
| | | scaleY = _parseOrientation.scaleY; |
| | | } |
| | | |
| | | if (options.rotatable) { |
| | | imageData.rotate = rotate; |
| | | } |
| | | |
| | | if (options.scalable) { |
| | | imageData.scaleX = scaleX; |
| | | imageData.scaleY = scaleY; |
| | | } |
| | | |
| | | this.clone(); |
| | | } |
| | | }, { |
| | | key: "clone", |
| | | value: function clone() { |
| | | var element = this.element, |
| | | url = this.url; |
| | | var crossOrigin = element.crossOrigin; |
| | | var crossOriginUrl = url; |
| | | |
| | | if (this.options.checkCrossOrigin && isCrossOriginURL(url)) { |
| | | if (!crossOrigin) { |
| | | crossOrigin = 'anonymous'; |
| | | } // Bust cache when there is not a "crossOrigin" property (#519) |
| | | |
| | | |
| | | crossOriginUrl = addTimestamp(url); |
| | | } |
| | | |
| | | this.crossOrigin = crossOrigin; |
| | | this.crossOriginUrl = crossOriginUrl; |
| | | var image = document.createElement('img'); |
| | | |
| | | if (crossOrigin) { |
| | | image.crossOrigin = crossOrigin; |
| | | } |
| | | |
| | | image.src = crossOriginUrl || url; |
| | | image.alt = element.alt || 'The image to crop'; |
| | | this.image = image; |
| | | image.onload = this.start.bind(this); |
| | | image.onerror = this.stop.bind(this); |
| | | addClass(image, CLASS_HIDE); |
| | | element.parentNode.insertBefore(image, element.nextSibling); |
| | | } |
| | | }, { |
| | | key: "start", |
| | | value: function start() { |
| | | var _this2 = this; |
| | | |
| | | var image = this.image; |
| | | image.onload = null; |
| | | image.onerror = null; |
| | | this.sizing = true; // Match all browsers that use WebKit as the layout engine in iOS devices, |
| | | // such as Safari for iOS, Chrome for iOS, and in-app browsers. |
| | | |
| | | var isIOSWebKit = WINDOW.navigator && /(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(WINDOW.navigator.userAgent); |
| | | |
| | | var done = function done(naturalWidth, naturalHeight) { |
| | | assign(_this2.imageData, { |
| | | naturalWidth: naturalWidth, |
| | | naturalHeight: naturalHeight, |
| | | aspectRatio: naturalWidth / naturalHeight |
| | | }); |
| | | _this2.initialImageData = assign({}, _this2.imageData); |
| | | _this2.sizing = false; |
| | | _this2.sized = true; |
| | | |
| | | _this2.build(); |
| | | }; // Most modern browsers (excepts iOS WebKit) |
| | | |
| | | |
| | | if (image.naturalWidth && !isIOSWebKit) { |
| | | done(image.naturalWidth, image.naturalHeight); |
| | | return; |
| | | } |
| | | |
| | | var sizingImage = document.createElement('img'); |
| | | var body = document.body || document.documentElement; |
| | | this.sizingImage = sizingImage; |
| | | |
| | | sizingImage.onload = function () { |
| | | done(sizingImage.width, sizingImage.height); |
| | | |
| | | if (!isIOSWebKit) { |
| | | body.removeChild(sizingImage); |
| | | } |
| | | }; |
| | | |
| | | sizingImage.src = image.src; // iOS WebKit will convert the image automatically |
| | | // with its orientation once append it into DOM (#279) |
| | | |
| | | if (!isIOSWebKit) { |
| | | sizingImage.style.cssText = 'left:0;' + 'max-height:none!important;' + 'max-width:none!important;' + 'min-height:0!important;' + 'min-width:0!important;' + 'opacity:0;' + 'position:absolute;' + 'top:0;' + 'z-index:-1;'; |
| | | body.appendChild(sizingImage); |
| | | } |
| | | } |
| | | }, { |
| | | key: "stop", |
| | | value: function stop() { |
| | | var image = this.image; |
| | | image.onload = null; |
| | | image.onerror = null; |
| | | image.parentNode.removeChild(image); |
| | | this.image = null; |
| | | } |
| | | }, { |
| | | key: "build", |
| | | value: function build() { |
| | | if (!this.sized || this.ready) { |
| | | return; |
| | | } |
| | | |
| | | var element = this.element, |
| | | options = this.options, |
| | | image = this.image; // Create cropper elements |
| | | |
| | | var container = element.parentNode; |
| | | var template = document.createElement('div'); |
| | | template.innerHTML = TEMPLATE; |
| | | var cropper = template.querySelector(".".concat(NAMESPACE, "-container")); |
| | | var canvas = cropper.querySelector(".".concat(NAMESPACE, "-canvas")); |
| | | var dragBox = cropper.querySelector(".".concat(NAMESPACE, "-drag-box")); |
| | | var cropBox = cropper.querySelector(".".concat(NAMESPACE, "-crop-box")); |
| | | var face = cropBox.querySelector(".".concat(NAMESPACE, "-face")); |
| | | this.container = container; |
| | | this.cropper = cropper; |
| | | this.canvas = canvas; |
| | | this.dragBox = dragBox; |
| | | this.cropBox = cropBox; |
| | | this.viewBox = cropper.querySelector(".".concat(NAMESPACE, "-view-box")); |
| | | this.face = face; |
| | | canvas.appendChild(image); // Hide the original image |
| | | |
| | | addClass(element, CLASS_HIDDEN); // Inserts the cropper after to the current image |
| | | |
| | | container.insertBefore(cropper, element.nextSibling); // Show the image if is hidden |
| | | |
| | | if (!this.isImg) { |
| | | removeClass(image, CLASS_HIDE); |
| | | } |
| | | |
| | | this.initPreview(); |
| | | this.bind(); |
| | | options.initialAspectRatio = Math.max(0, options.initialAspectRatio) || NaN; |
| | | options.aspectRatio = Math.max(0, options.aspectRatio) || NaN; |
| | | options.viewMode = Math.max(0, Math.min(3, Math.round(options.viewMode))) || 0; |
| | | addClass(cropBox, CLASS_HIDDEN); |
| | | |
| | | if (!options.guides) { |
| | | addClass(cropBox.getElementsByClassName("".concat(NAMESPACE, "-dashed")), CLASS_HIDDEN); |
| | | } |
| | | |
| | | if (!options.center) { |
| | | addClass(cropBox.getElementsByClassName("".concat(NAMESPACE, "-center")), CLASS_HIDDEN); |
| | | } |
| | | |
| | | if (options.background) { |
| | | addClass(cropper, "".concat(NAMESPACE, "-bg")); |
| | | } |
| | | |
| | | if (!options.highlight) { |
| | | addClass(face, CLASS_INVISIBLE); |
| | | } |
| | | |
| | | if (options.cropBoxMovable) { |
| | | addClass(face, CLASS_MOVE); |
| | | setData(face, DATA_ACTION, ACTION_ALL); |
| | | } |
| | | |
| | | if (!options.cropBoxResizable) { |
| | | addClass(cropBox.getElementsByClassName("".concat(NAMESPACE, "-line")), CLASS_HIDDEN); |
| | | addClass(cropBox.getElementsByClassName("".concat(NAMESPACE, "-point")), CLASS_HIDDEN); |
| | | } |
| | | |
| | | this.render(); |
| | | this.ready = true; |
| | | this.setDragMode(options.dragMode); |
| | | |
| | | if (options.autoCrop) { |
| | | this.crop(); |
| | | } |
| | | |
| | | this.setData(options.data); |
| | | |
| | | if (isFunction(options.ready)) { |
| | | addListener(element, EVENT_READY, options.ready, { |
| | | once: true |
| | | }); |
| | | } |
| | | |
| | | dispatchEvent(element, EVENT_READY); |
| | | } |
| | | }, { |
| | | key: "unbuild", |
| | | value: function unbuild() { |
| | | if (!this.ready) { |
| | | return; |
| | | } |
| | | |
| | | this.ready = false; |
| | | this.unbind(); |
| | | this.resetPreview(); |
| | | this.cropper.parentNode.removeChild(this.cropper); |
| | | removeClass(this.element, CLASS_HIDDEN); |
| | | } |
| | | }, { |
| | | key: "uncreate", |
| | | value: function uncreate() { |
| | | if (this.ready) { |
| | | this.unbuild(); |
| | | this.ready = false; |
| | | this.cropped = false; |
| | | } else if (this.sizing) { |
| | | this.sizingImage.onload = null; |
| | | this.sizing = false; |
| | | this.sized = false; |
| | | } else if (this.reloading) { |
| | | this.xhr.onabort = null; |
| | | this.xhr.abort(); |
| | | } else if (this.image) { |
| | | this.stop(); |
| | | } |
| | | } |
| | | /** |
| | | * Get the no conflict cropper class. |
| | | * @returns {Cropper} The cropper class. |
| | | */ |
| | | |
| | | }], [{ |
| | | key: "noConflict", |
| | | value: function noConflict() { |
| | | window.Cropper = AnotherCropper; |
| | | return Cropper; |
| | | } |
| | | /** |
| | | * Change the default options. |
| | | * @param {Object} options - The new default options. |
| | | */ |
| | | |
| | | }, { |
| | | key: "setDefaults", |
| | | value: function setDefaults(options) { |
| | | assign(DEFAULTS, isPlainObject(options) && options); |
| | | } |
| | | }]); |
| | | |
| | | return Cropper; |
| | | }(); |
| | | |
| | | assign(Cropper.prototype, render, preview, events, handlers, change, methods); |
| | | |
| | | return Cropper; |
| | | |
| | | }))); |
ruoyi-admin/src/main/resources/static/ajax/libs/cropper/cropper.min.css
ruoyi-admin/src/main/resources/static/ajax/libs/cropper/cropper.min.js
ruoyi-admin/src/main/resources/static/ajax/libs/cxselect/jquery.cxselect.js
ruoyi-admin/src/main/resources/static/ajax/libs/cxselect/jquery.cxselect.min.js
ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.css
ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.js
ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.min.css
ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.min.js
ruoyi-admin/src/main/resources/static/ajax/libs/duallistbox/bootstrap-duallistbox.css
ruoyi-admin/src/main/resources/static/ajax/libs/duallistbox/bootstrap-duallistbox.js
ruoyi-admin/src/main/resources/static/ajax/libs/duallistbox/bootstrap-duallistbox.min.css
ruoyi-admin/src/main/resources/static/ajax/libs/duallistbox/bootstrap-duallistbox.min.js
ruoyi-admin/src/main/resources/static/ajax/libs/flot/curvedLines.js
ruoyi-admin/src/main/resources/static/ajax/libs/flot/jquery.flot.js
ruoyi-admin/src/main/resources/static/ajax/libs/flot/jquery.flot.pie.js
ruoyi-admin/src/main/resources/static/ajax/libs/flot/jquery.flot.resize.js
ruoyi-admin/src/main/resources/static/ajax/libs/flot/jquery.flot.spline.js
ruoyi-admin/src/main/resources/static/ajax/libs/flot/jquery.flot.symbol.js
ruoyi-admin/src/main/resources/static/ajax/libs/flot/jquery.flot.tooltip.min.js
ruoyi-admin/src/main/resources/static/ajax/libs/fullscreen/jquery.fullscreen.js
ruoyi-admin/src/main/resources/static/ajax/libs/highlight/default.min.css
ruoyi-admin/src/main/resources/static/ajax/libs/highlight/highlight.min.js
ruoyi-admin/src/main/resources/static/ajax/libs/iCheck/custom.css
ruoyi-admin/src/main/resources/static/ajax/libs/iCheck/green-login.png
ruoyi-admin/src/main/resources/static/ajax/libs/iCheck/green.png
ruoyi-admin/src/main/resources/static/ajax/libs/iCheck/green@2x.png
ruoyi-admin/src/main/resources/static/ajax/libs/iCheck/icheck.min.js
ruoyi-admin/src/main/resources/static/ajax/libs/jasny/jasny-bootstrap.css
ruoyi-admin/src/main/resources/static/ajax/libs/jasny/jasny-bootstrap.js
ruoyi-admin/src/main/resources/static/ajax/libs/jasny/jasny-bootstrap.min.css
ruoyi-admin/src/main/resources/static/ajax/libs/jasny/jasny-bootstrap.min.js
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-layout/jquery.layout-latest.css
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-layout/jquery.layout-latest.js
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/diy/1_close.png
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/diy/1_open.png
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/diy/2.png
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/diy/3.png
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/diy/4.png
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/diy/5.png
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/diy/6.png
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/diy/7.png
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/diy/8.png
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/diy/9.png
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/line_conn.gif
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/loading.gif
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/zTreeStandard.gif
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/zTreeStandard.png
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/zTreeStyle.css
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/metro/img/line_conn.gif
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/metro/img/line_conn.png
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/metro/img/loading.gif
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/metro/img/metro.gif
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/metro/img/metro.png
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/simple/img/left_menu.gif
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/simple/img/left_menu.png
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/simple/img/line_conn.gif
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/simple/img/loading.gif
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/simple/img/zTreeStandard.gif
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/simple/img/zTreeStandard.png
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/simple/zTreeStyle.css
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.core-3.5.js
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.excheck-3.5.js
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.exedit-3.5.js
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.exhide-3.5.js
ruoyi-admin/src/main/resources/static/ajax/libs/jquery-ztree/3.5/log v3.x.txt
ruoyi-admin/src/main/resources/static/ajax/libs/jsonview/jquery.jsonview.css
ruoyi-admin/src/main/resources/static/ajax/libs/jsonview/jquery.jsonview.js
ruoyi-admin/src/main/resources/static/ajax/libs/layer/css/layer.css
ruoyi-admin/src/main/resources/static/ajax/libs/layer/layer.min.js
ruoyi-admin/src/main/resources/static/ajax/libs/layer/theme/moon/default.png
ruoyi-admin/src/main/resources/static/ajax/libs/layer/theme/moon/style.css
ruoyi-admin/src/main/resources/static/ajax/libs/layui/css/modules/laydate.css
ruoyi-admin/src/main/resources/static/ajax/libs/layui/layui.min.js
ruoyi-admin/src/main/resources/static/ajax/libs/layui/modules/laydate.js
ruoyi-admin/src/main/resources/static/ajax/libs/report/echarts/echarts-all.min.js
ruoyi-admin/src/main/resources/static/ajax/libs/report/peity/jquery.peity.min.js
ruoyi-admin/src/main/resources/static/ajax/libs/report/sparkline/jquery.sparkline.min.js
ruoyi-admin/src/main/resources/static/ajax/libs/select2/select2-bootstrap.min.css
ruoyi-admin/src/main/resources/static/ajax/libs/select2/select2.css
ruoyi-admin/src/main/resources/static/ajax/libs/select2/select2.js
ruoyi-admin/src/main/resources/static/ajax/libs/select2/select2.min.css
ruoyi-admin/src/main/resources/static/ajax/libs/select2/select2.min.js
ruoyi-admin/src/main/resources/static/ajax/libs/smartwizard/jquery.smartWizard.min.js
ruoyi-admin/src/main/resources/static/ajax/libs/smartwizard/smart_wizard_all.min.css
ruoyi-admin/src/main/resources/static/ajax/libs/suggest/bootstrap-suggest.js
ruoyi-admin/src/main/resources/static/ajax/libs/suggest/bootstrap-suggest.min.js
ruoyi-admin/src/main/resources/static/ajax/libs/summernote/font/summernote.eot
ruoyi-admin/src/main/resources/static/ajax/libs/summernote/font/summernote.ttf
ruoyi-admin/src/main/resources/static/ajax/libs/summernote/font/summernote.woff
ruoyi-admin/src/main/resources/static/ajax/libs/summernote/font/summernote.woff2
ruoyi-admin/src/main/resources/static/ajax/libs/summernote/summernote-zh-CN.js
ruoyi-admin/src/main/resources/static/ajax/libs/summernote/summernote.css
ruoyi-admin/src/main/resources/static/ajax/libs/summernote/summernote.js
ruoyi-admin/src/main/resources/static/ajax/libs/summernote/summernote.min.js
ruoyi-admin/src/main/resources/static/ajax/libs/typeahead/bootstrap-typeahead.js
ruoyi-admin/src/main/resources/static/ajax/libs/typeahead/bootstrap-typeahead.min.js
ruoyi-admin/src/main/resources/static/ajax/libs/validate/additional-methods.min.js
ruoyi-admin/src/main/resources/static/ajax/libs/validate/jquery.validate.extend.js
ruoyi-admin/src/main/resources/static/ajax/libs/validate/jquery.validate.min.js
ruoyi-admin/src/main/resources/static/ajax/libs/validate/messages_zh.js
ruoyi-admin/src/main/resources/static/css/animate.min.css
ruoyi-admin/src/main/resources/static/css/bootstrap.min.css
ruoyi-admin/src/main/resources/static/css/font-awesome.min.css
ruoyi-admin/src/main/resources/static/css/jquery.contextMenu.min.css
ruoyi-admin/src/main/resources/static/css/login.css
ruoyi-admin/src/main/resources/static/css/login.min.css
ruoyi-admin/src/main/resources/static/css/skins.css
ruoyi-admin/src/main/resources/static/css/style.css
ruoyi-admin/src/main/resources/static/css/style.min.css
ruoyi-admin/src/main/resources/static/css/zen-checkbox.css
ruoyi-admin/src/main/resources/static/favicon.ico
ruoyi-admin/src/main/resources/static/file/rml.txt
ruoyi-admin/src/main/resources/static/fonts/FontAwesome.otf
ruoyi-admin/src/main/resources/static/fonts/Simple-Line-Icons.woff2
ruoyi-admin/src/main/resources/static/fonts/fontawesome-webfont.eot
ruoyi-admin/src/main/resources/static/fonts/fontawesome-webfont.svg
ruoyi-admin/src/main/resources/static/fonts/fontawesome-webfont.ttf
ruoyi-admin/src/main/resources/static/fonts/fontawesome-webfont.woff
ruoyi-admin/src/main/resources/static/fonts/fontawesome-webfont.woff2
ruoyi-admin/src/main/resources/static/fonts/glyphicons-halflings-regular.eot
ruoyi-admin/src/main/resources/static/fonts/glyphicons-halflings-regular.svg
ruoyi-admin/src/main/resources/static/fonts/glyphicons-halflings-regular.ttf
ruoyi-admin/src/main/resources/static/fonts/glyphicons-halflings-regular.woff
ruoyi-admin/src/main/resources/static/fonts/glyphicons-halflings-regular.woff2
ruoyi-admin/src/main/resources/static/fonts/iconfont.eot
ruoyi-admin/src/main/resources/static/fonts/iconfont.svg
ruoyi-admin/src/main/resources/static/fonts/iconfont.ttf
ruoyi-admin/src/main/resources/static/fonts/iconfont.woff
ruoyi-admin/src/main/resources/static/fonts/zenicon.woff
ruoyi-admin/src/main/resources/static/html/ie.html
ruoyi-admin/src/main/resources/static/i18n/messages.properties
ruoyi-admin/src/main/resources/static/img/blue.png
ruoyi-admin/src/main/resources/static/img/loading-upload.gif
ruoyi-admin/src/main/resources/static/img/loading.gif
ruoyi-admin/src/main/resources/static/img/locked.png
ruoyi-admin/src/main/resources/static/img/login-background.jpg
ruoyi-admin/src/main/resources/static/img/pay.png
ruoyi-admin/src/main/resources/static/img/profile.jpg
ruoyi-admin/src/main/resources/static/img/progress.png
ruoyi-admin/src/main/resources/static/img/qr_code.png
ruoyi-admin/src/main/resources/static/img/user.png
ruoyi-admin/src/main/resources/static/js/bootstrap.min.js
ruoyi-admin/src/main/resources/static/js/cron.js
ruoyi-admin/src/main/resources/static/js/jquery-ui-1.10.4.min.js
ruoyi-admin/src/main/resources/static/js/jquery.contextMenu.min.js
ruoyi-admin/src/main/resources/static/js/jquery.i18n.properties.min.js
ruoyi-admin/src/main/resources/static/js/jquery.min.js
ruoyi-admin/src/main/resources/static/js/jquery.tmpl.js
ruoyi-admin/src/main/resources/static/js/plugins/metisMenu/jquery.metisMenu.js
ruoyi-admin/src/main/resources/static/js/plugins/slimscroll/jquery.slimscroll.min.js
ruoyi-admin/src/main/resources/static/js/resize-tabs.js
ruoyi-admin/src/main/resources/static/js/three.min.js
ruoyi-admin/src/main/resources/static/ruoyi.png
ruoyi-admin/src/main/resources/static/ruoyi/css/ry-ui.css
ruoyi-admin/src/main/resources/static/ruoyi/index.js
ruoyi-admin/src/main/resources/static/ruoyi/js/common.js
ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js
ruoyi-admin/src/main/resources/static/ruoyi/login.js
ruoyi-admin/src/main/resources/static/ruoyi/register.js
ruoyi-admin/src/main/resources/templates/demo/form/autocomplete.html
ruoyi-admin/src/main/resources/templates/demo/form/basic.html
ruoyi-admin/src/main/resources/templates/demo/form/button.html
ruoyi-admin/src/main/resources/templates/demo/form/cards.html
ruoyi-admin/src/main/resources/templates/demo/form/cxselect.html
ruoyi-admin/src/main/resources/templates/demo/form/datetime.html
ruoyi-admin/src/main/resources/templates/demo/form/duallistbox.html
ruoyi-admin/src/main/resources/templates/demo/form/grid.html
ruoyi-admin/src/main/resources/templates/demo/form/invoice.html
ruoyi-admin/src/main/resources/templates/demo/form/jasny.html
ruoyi-admin/src/main/resources/templates/demo/form/labels_tips.html
ruoyi-admin/src/main/resources/templates/demo/form/localrefresh.html
ruoyi-admin/src/main/resources/templates/demo/form/progress_bars.html
ruoyi-admin/src/main/resources/templates/demo/form/select.html
ruoyi-admin/src/main/resources/templates/demo/form/sortable.html
ruoyi-admin/src/main/resources/templates/demo/form/summernote.html
ruoyi-admin/src/main/resources/templates/demo/form/tabs_panels.html
ruoyi-admin/src/main/resources/templates/demo/form/timeline.html
ruoyi-admin/src/main/resources/templates/demo/form/upload.html
ruoyi-admin/src/main/resources/templates/demo/form/validate.html
ruoyi-admin/src/main/resources/templates/demo/form/wizard.html
ruoyi-admin/src/main/resources/templates/demo/icon/fontawesome.html
ruoyi-admin/src/main/resources/templates/demo/icon/glyphicons.html
ruoyi-admin/src/main/resources/templates/demo/modal/dialog.html
ruoyi-admin/src/main/resources/templates/demo/modal/form.html
ruoyi-admin/src/main/resources/templates/demo/modal/layer.html
ruoyi-admin/src/main/resources/templates/demo/modal/table.html
ruoyi-admin/src/main/resources/templates/demo/modal/table/check.html
ruoyi-admin/src/main/resources/templates/demo/modal/table/frame1.html
ruoyi-admin/src/main/resources/templates/demo/modal/table/frame2.html
ruoyi-admin/src/main/resources/templates/demo/modal/table/parent.html
ruoyi-admin/src/main/resources/templates/demo/modal/table/radio.html
ruoyi-admin/src/main/resources/templates/demo/operate/add.html
ruoyi-admin/src/main/resources/templates/demo/operate/detail.html
ruoyi-admin/src/main/resources/templates/demo/operate/edit.html
ruoyi-admin/src/main/resources/templates/demo/operate/other.html
ruoyi-admin/src/main/resources/templates/demo/operate/table.html
ruoyi-admin/src/main/resources/templates/demo/report/echarts.html
ruoyi-admin/src/main/resources/templates/demo/report/metrics.html
ruoyi-admin/src/main/resources/templates/demo/report/peity.html
ruoyi-admin/src/main/resources/templates/demo/report/sparkline.html
ruoyi-admin/src/main/resources/templates/demo/table/asynTree.html
ruoyi-admin/src/main/resources/templates/demo/table/button.html
ruoyi-admin/src/main/resources/templates/demo/table/child.html
ruoyi-admin/src/main/resources/templates/demo/table/cookie.html
ruoyi-admin/src/main/resources/templates/demo/table/curd.html
ruoyi-admin/src/main/resources/templates/demo/table/customView.html
ruoyi-admin/src/main/resources/templates/demo/table/data.html
ruoyi-admin/src/main/resources/templates/demo/table/detail.html
ruoyi-admin/src/main/resources/templates/demo/table/dynamicColumns.html
ruoyi-admin/src/main/resources/templates/demo/table/editable.html
ruoyi-admin/src/main/resources/templates/demo/table/event.html
ruoyi-admin/src/main/resources/templates/demo/table/export.html
ruoyi-admin/src/main/resources/templates/demo/table/exportSelected.html
ruoyi-admin/src/main/resources/templates/demo/table/fixedColumns.html
ruoyi-admin/src/main/resources/templates/demo/table/footer.html
ruoyi-admin/src/main/resources/templates/demo/table/groupHeader.html
ruoyi-admin/src/main/resources/templates/demo/table/headerStyle.html
ruoyi-admin/src/main/resources/templates/demo/table/image.html
ruoyi-admin/src/main/resources/templates/demo/table/multi.html
ruoyi-admin/src/main/resources/templates/demo/table/other.html
ruoyi-admin/src/main/resources/templates/demo/table/pageGo.html
ruoyi-admin/src/main/resources/templates/demo/table/params.html
ruoyi-admin/src/main/resources/templates/demo/table/print.html
ruoyi-admin/src/main/resources/templates/demo/table/refresh.html
ruoyi-admin/src/main/resources/templates/demo/table/remember.html
ruoyi-admin/src/main/resources/templates/demo/table/reorderColumns.html
ruoyi-admin/src/main/resources/templates/demo/table/reorderRows.html
ruoyi-admin/src/main/resources/templates/demo/table/resizable.html
ruoyi-admin/src/main/resources/templates/demo/table/search.html
ruoyi-admin/src/main/resources/templates/demo/table/subdata.html
ruoyi-admin/src/main/resources/templates/demo/table/textSearch.html
ruoyi-admin/src/main/resources/templates/demo/table/virtualScroll.html
ruoyi-admin/src/main/resources/templates/error/404.html
ruoyi-admin/src/main/resources/templates/error/500.html
ruoyi-admin/src/main/resources/templates/error/service.html
ruoyi-admin/src/main/resources/templates/error/unauth.html
ruoyi-admin/src/main/resources/templates/include.html
ruoyi-admin/src/main/resources/templates/index-topnav.html
ruoyi-admin/src/main/resources/templates/index.html
ruoyi-admin/src/main/resources/templates/lock.html
ruoyi-admin/src/main/resources/templates/login.html
ruoyi-admin/src/main/resources/templates/main.html
ruoyi-admin/src/main/resources/templates/main_v1.html
ruoyi-admin/src/main/resources/templates/monitor/cache/cache.html
ruoyi-admin/src/main/resources/templates/monitor/logininfor/logininfor.html
ruoyi-admin/src/main/resources/templates/monitor/online/online.html
ruoyi-admin/src/main/resources/templates/monitor/operlog/detail.html
ruoyi-admin/src/main/resources/templates/monitor/operlog/operlog.html
ruoyi-admin/src/main/resources/templates/monitor/server/server.html
ruoyi-admin/src/main/resources/templates/register.html
ruoyi-admin/src/main/resources/templates/skin.html
ruoyi-admin/src/main/resources/templates/system/config/add.html
ruoyi-admin/src/main/resources/templates/system/config/config.html
ruoyi-admin/src/main/resources/templates/system/config/edit.html
ruoyi-admin/src/main/resources/templates/system/dept/add.html
ruoyi-admin/src/main/resources/templates/system/dept/dept.html
ruoyi-admin/src/main/resources/templates/system/dept/edit.html
ruoyi-admin/src/main/resources/templates/system/dept/tree.html
ruoyi-admin/src/main/resources/templates/system/dict/data/add.html
ruoyi-admin/src/main/resources/templates/system/dict/data/data.html
ruoyi-admin/src/main/resources/templates/system/dict/data/edit.html
ruoyi-admin/src/main/resources/templates/system/dict/type/add.html
ruoyi-admin/src/main/resources/templates/system/dict/type/edit.html
ruoyi-admin/src/main/resources/templates/system/dict/type/tree.html
ruoyi-admin/src/main/resources/templates/system/dict/type/type.html
ruoyi-admin/src/main/resources/templates/system/menu/add.html
ruoyi-admin/src/main/resources/templates/system/menu/edit.html
ruoyi-admin/src/main/resources/templates/system/menu/icon.html
ruoyi-admin/src/main/resources/templates/system/menu/menu.html
ruoyi-admin/src/main/resources/templates/system/menu/tree.html
ruoyi-admin/src/main/resources/templates/system/notice/add.html
ruoyi-admin/src/main/resources/templates/system/notice/edit.html
ruoyi-admin/src/main/resources/templates/system/notice/notice.html
ruoyi-admin/src/main/resources/templates/system/notice/view.html
ruoyi-admin/src/main/resources/templates/system/post/add.html
ruoyi-admin/src/main/resources/templates/system/post/edit.html
ruoyi-admin/src/main/resources/templates/system/post/post.html
ruoyi-admin/src/main/resources/templates/system/role/add.html
ruoyi-admin/src/main/resources/templates/system/role/authUser.html
ruoyi-admin/src/main/resources/templates/system/role/dataScope.html
ruoyi-admin/src/main/resources/templates/system/role/edit.html
ruoyi-admin/src/main/resources/templates/system/role/role.html
ruoyi-admin/src/main/resources/templates/system/role/selectUser.html
ruoyi-admin/src/main/resources/templates/system/user/add.html
ruoyi-admin/src/main/resources/templates/system/user/authRole.html
ruoyi-admin/src/main/resources/templates/system/user/deptTree.html
ruoyi-admin/src/main/resources/templates/system/user/edit.html
ruoyi-admin/src/main/resources/templates/system/user/profile/avatar.html
ruoyi-admin/src/main/resources/templates/system/user/profile/profile.html
ruoyi-admin/src/main/resources/templates/system/user/profile/resetPwd.html
ruoyi-admin/src/main/resources/templates/system/user/resetPwd.html
ruoyi-admin/src/main/resources/templates/system/user/user.html
ruoyi-admin/src/main/resources/templates/system/user/view.html
ruoyi-admin/src/main/resources/templates/tool/build/build.html
ruoyi-common/pom.xml
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Anonymous.java
ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java
ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java
ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatSubmit.java
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Sensitive.java
ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java
ruoyi-common/src/main/java/com/ruoyi/common/config/ServerConfig.java
ruoyi-common/src/main/java/com/ruoyi/common/config/datasource/DynamicDataSourceContextHolder.java
ruoyi-common/src/main/java/com/ruoyi/common/config/serializer/SensitiveJsonSerializer.java
ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java
ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java
ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
ruoyi-common/src/main/java/com/ruoyi/common/constant/PermissionConstants.java
ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java
ruoyi-common/src/main/java/com/ruoyi/common/constant/ShiroConstants.java
ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java
ruoyi-common/src/main/java/com/ruoyi/common/core/context/PermissionContextHolder.java
ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/CxSelect.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/Ztree.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java
ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java
ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java
ruoyi-common/src/main/java/com/ruoyi/common/core/text/CharsetKit.java
ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java
ruoyi-common/src/main/java/com/ruoyi/common/core/text/StrFormatter.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessStatus.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/DesensitizedType.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/OnlineStatus.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/OperatorType.java
ruoyi-common/src/main/java/com/ruoyi/common/enums/UserStatus.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/DemoModeException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/GlobalException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/ServiceException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/UtilException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/base/BaseException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileNameLengthLimitExceededException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileSizeLimitExceededException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileUploadException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/job/TaskException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/user/BlackListException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/user/RoleBlockedException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserBlockedException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserDeleteException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserNotExistsException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordNotMatchException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitCountException.java
ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitExceedException.java
ruoyi-common/src/main/java/com/ruoyi/common/json/JSON.java
ruoyi-common/src/main/java/com/ruoyi/common/json/JSONObject.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/AddressUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/Arith.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/CacheUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/CookieUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/DesensitizedUtil.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/IpUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/LogUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/MapDataUtil.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/MessageUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/PageUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/ShiroUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/BeanUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/BeanValidators.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileTypeUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/ImageUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/html/EscapeUtil.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelHandlerAdapter.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/security/CipherUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/security/Md5Utils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/security/PermissionUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/Seq.java
ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java
ruoyi-common/src/main/java/com/ruoyi/common/xss/Xss.java
ruoyi-common/src/main/java/com/ruoyi/common/xss/XssFilter.java
ruoyi-common/src/main/java/com/ruoyi/common/xss/XssHttpServletRequestWrapper.java
ruoyi-common/src/main/java/com/ruoyi/common/xss/XssValidator.java
ruoyi-framework/pom.xml
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/PermissionsAspect.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/CaptchaConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/I18nConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/KaptchaTextCreator.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/DruidProperties.java
ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/PermitAllUrlProperties.java
ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java
ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java
ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java
ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java
ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java
ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/realm/UserRealm.java
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/rememberMe/CustomCookieRememberMeManager.java
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysLoginService.java
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysPasswordService.java
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysRegisterService.java
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysShiroService.java
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSession.java
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionDAO.java
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionFactory.java
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/util/AuthorizationUtils.java
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/CustomShiroFilterFactoryBean.java
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/LogoutFilter.java
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/captcha/CaptchaValidateFilter.java
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/kickout/KickoutSessionFilter.java
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/online/OnlineSessionFilter.java
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/sync/SyncOnlineSessionFilter.java
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/OnlineWebSessionManager.java
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/SpringSessionValidationScheduler.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/Server.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Cpu.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Jvm.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Mem.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Sys.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/SysFile.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/CacheService.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/ConfigService.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/DictService.java
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java
ruoyi-generator/pom.xml
ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java
ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java
ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java
ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java
ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java
ruoyi-generator/src/main/java/com/ruoyi/generator/service/impl/GenTableColumnServiceImpl.java
ruoyi-generator/src/main/java/com/ruoyi/generator/service/impl/GenTableServiceImpl.java
ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java
ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java
ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java
ruoyi-generator/src/main/resources/generator.yml
ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml
ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
ruoyi-generator/src/main/resources/templates/tool/gen/createTable.html
ruoyi-generator/src/main/resources/templates/tool/gen/edit.html
ruoyi-generator/src/main/resources/templates/tool/gen/gen.html
ruoyi-generator/src/main/resources/templates/tool/gen/importTable.html
ruoyi-generator/src/main/resources/vm/html/add.html.vm
ruoyi-generator/src/main/resources/vm/html/edit.html.vm
ruoyi-generator/src/main/resources/vm/html/list-tree.html.vm
ruoyi-generator/src/main/resources/vm/html/list.html.vm
ruoyi-generator/src/main/resources/vm/html/tree.html.vm
ruoyi-generator/src/main/resources/vm/java/controller.java.vm
ruoyi-generator/src/main/resources/vm/java/domain.java.vm
ruoyi-generator/src/main/resources/vm/java/mapper.java.vm
ruoyi-generator/src/main/resources/vm/java/service.java.vm
ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm
ruoyi-generator/src/main/resources/vm/java/sub-domain.java.vm
ruoyi-generator/src/main/resources/vm/sql/sql.vm
ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm
ruoyi-quartz/pom.xml
ruoyi-quartz/src/main/java/com/ruoyi/quartz/config/ScheduleConfig.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobMapper.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobLogService.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobService.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobLogServiceImpl.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/AbstractQuartzJob.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/CronUtils.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzDisallowConcurrentExecution.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzJobExecution.java
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleUtils.java
ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml
ruoyi-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml
ruoyi-quartz/src/main/resources/templates/monitor/job/add.html
ruoyi-quartz/src/main/resources/templates/monitor/job/cron.html
ruoyi-quartz/src/main/resources/templates/monitor/job/detail.html
ruoyi-quartz/src/main/resources/templates/monitor/job/edit.html
ruoyi-quartz/src/main/resources/templates/monitor/job/job.html
ruoyi-quartz/src/main/resources/templates/monitor/job/jobLog.html
ruoyi-system/pom.xml
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNotice.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleDept.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleMenu.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserPost.java
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserRole.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserOnlineMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOnlineService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysUserOnlineMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysUserPostMapper.xml
ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
ry.bat
ry.sh
sql/quartz.sql
sql/ruoyi.html
sql/ruoyi.pdm
sql/ry_20240601.sql |