Commit e5e37d28ad6540b6d9b950ca5dbe5fc3c8f1085b
Merge branch 'minhang' into pudong
Showing
28 changed files
with
4218 additions
and
41 deletions
Too many changes to show.
To preserve performance only 28 of 62 files are displayed.
src/main/java/com/bsth/controller/gps/GpsController.java
| ... | ... | @@ -8,6 +8,7 @@ import com.google.common.base.Splitter; |
| 8 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 9 | import org.springframework.web.bind.annotation.*; |
| 10 | 10 | |
| 11 | +import javax.servlet.http.HttpServletResponse; | |
| 11 | 12 | import java.util.List; |
| 12 | 13 | import java.util.Map; |
| 13 | 14 | |
| ... | ... | @@ -110,6 +111,57 @@ public class GpsController { |
| 110 | 111 | } |
| 111 | 112 | |
| 112 | 113 | /** |
| 114 | + * 历史GPS查询 ,第三版轨迹回放用 | |
| 115 | + * @param nbbm | |
| 116 | + * @param st | |
| 117 | + * @param et | |
| 118 | + * @return | |
| 119 | + */ | |
| 120 | + @RequestMapping(value = "/history_v3/{nbbm}") | |
| 121 | + public Map<String, Object> history_v3(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et){ | |
| 122 | + return gpsService.history_v3(nbbm, st, et); | |
| 123 | + } | |
| 124 | + | |
| 125 | + /** | |
| 126 | + * 轨迹导出 | |
| 127 | + * @param nbbm | |
| 128 | + * @param st | |
| 129 | + * @param et | |
| 130 | + * @return | |
| 131 | + */ | |
| 132 | + @RequestMapping(value = "/history_v3/excel/{nbbm}") | |
| 133 | + public void trailExcel(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et, HttpServletResponse resp){ | |
| 134 | + gpsService.trailExcel(nbbm, st, et, resp); | |
| 135 | + } | |
| 136 | + | |
| 137 | + /** | |
| 138 | + * 轨迹异常数据导出 | |
| 139 | + * @param nbbm | |
| 140 | + * @param st | |
| 141 | + * @param et | |
| 142 | + * @return | |
| 143 | + */ | |
| 144 | + @RequestMapping(value = "/history_v3/excel_abnormal/{nbbm}") | |
| 145 | + public void abnormalExcel(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et, HttpServletResponse resp){ | |
| 146 | + gpsService.abnormalExcel(nbbm, st, et, resp); | |
| 147 | + } | |
| 148 | + | |
| 149 | + /** | |
| 150 | + * 到离站数据导出 | |
| 151 | + * @param nbbm | |
| 152 | + * @param st | |
| 153 | + * @param et | |
| 154 | + * @return | |
| 155 | + */ | |
| 156 | + @RequestMapping(value = "/history_v3/excel_arrival/{nbbm}") | |
| 157 | + public void arrivalExcel(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et, HttpServletResponse resp){ | |
| 158 | + gpsService.arrivalExcel(nbbm, st, et, resp); | |
| 159 | + } | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + /** | |
| 113 | 165 | * 安全驾驶数据 分页查询 |
| 114 | 166 | * @param map |
| 115 | 167 | * @param page | ... | ... |
src/main/java/com/bsth/controller/realcontrol/BasicDataController.java
| ... | ... | @@ -5,12 +5,15 @@ import com.alibaba.fastjson.serializer.PropertyFilter; |
| 5 | 5 | import com.bsth.common.ResponseCode; |
| 6 | 6 | import com.bsth.data.BasicData; |
| 7 | 7 | import com.bsth.entity.Line; |
| 8 | +import com.google.common.base.Splitter; | |
| 8 | 9 | import com.google.common.collect.ArrayListMultimap; |
| 10 | +import com.google.common.collect.BiMap; | |
| 9 | 11 | import org.slf4j.Logger; |
| 10 | 12 | import org.slf4j.LoggerFactory; |
| 11 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | 14 | import org.springframework.web.bind.annotation.RequestMapping; |
| 13 | 15 | import org.springframework.web.bind.annotation.RequestMethod; |
| 16 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 14 | 17 | import org.springframework.web.bind.annotation.RestController; |
| 15 | 18 | |
| 16 | 19 | import java.util.*; |
| ... | ... | @@ -145,4 +148,36 @@ public class BasicDataController { |
| 145 | 148 | } |
| 146 | 149 | return listMultimap.asMap(); |
| 147 | 150 | } |
| 151 | + | |
| 152 | + /** | |
| 153 | + * 获取车辆信息 | |
| 154 | + * @return | |
| 155 | + */ | |
| 156 | + @RequestMapping("/ccInfo/lineArray") | |
| 157 | + public List<Map<String, String>> ccInfoByLine(@RequestParam String idx){ | |
| 158 | + List<String> lines = Splitter.on(",").splitToList(idx); | |
| 159 | + List<Map<String, String>> rs = new ArrayList<>(); | |
| 160 | + Map<String, String> map; | |
| 161 | + | |
| 162 | + //ArrayListMultimap<String, String> listMultimap = ArrayListMultimap.create(); | |
| 163 | + Set<String> ks = BasicData.nbbm2LineMap.keySet(); | |
| 164 | + BiMap<String,String> nbbm2deviceMap = BasicData.deviceId2NbbmMap.inverse(); | |
| 165 | + | |
| 166 | + Line line; | |
| 167 | + for(String nbbm : ks){ | |
| 168 | + line = BasicData.nbbm2LineMap.get(nbbm); | |
| 169 | + if(lines.contains(line.getLineCode())){ | |
| 170 | + map = new HashMap<>(); | |
| 171 | + map.put("nbbm", nbbm); | |
| 172 | + map.put("deviceId", nbbm2deviceMap.get(nbbm)); | |
| 173 | + map.put("lineName", line.getName()); | |
| 174 | + map.put("lineCode", line.getLineCode()); | |
| 175 | + rs.add(map); | |
| 176 | + } | |
| 177 | + //listMultimap.put(line.getName(), nbbm); | |
| 178 | + } | |
| 179 | + //return listMultimap.asMap(); | |
| 180 | + | |
| 181 | + return rs; | |
| 182 | + } | |
| 148 | 183 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/GeoCacheData.java
| ... | ... | @@ -36,6 +36,9 @@ public class GeoCacheData { |
| 36 | 36 | //线路路段走向 |
| 37 | 37 | private static ArrayListMultimap<String, LineString> sectionCacheMap; |
| 38 | 38 | |
| 39 | + //路段编码和名称对照 | |
| 40 | + private static Map<String, String> sectionCode2Name; | |
| 41 | + | |
| 39 | 42 | //线路站点路由 |
| 40 | 43 | private static ArrayListMultimap<String, StationRoute> stationCacheMap; |
| 41 | 44 | |
| ... | ... | @@ -44,6 +47,8 @@ public class GeoCacheData { |
| 44 | 47 | |
| 45 | 48 | //停车场 |
| 46 | 49 | public static Map<String, Polygon> tccMap; |
| 50 | + //停车场 | |
| 51 | + public static Map<String, com.bsth.util.Geo.Polygon> tccMap2; | |
| 47 | 52 | |
| 48 | 53 | //线路限速信息 |
| 49 | 54 | private static Map<String, Double> speedLimitMap; |
| ... | ... | @@ -78,6 +83,10 @@ public class GeoCacheData { |
| 78 | 83 | } |
| 79 | 84 | } |
| 80 | 85 | |
| 86 | + public static Map<String, String> sectionCode2NameMap(){ | |
| 87 | + return sectionCode2Name; | |
| 88 | + } | |
| 89 | + | |
| 81 | 90 | public static StationRoute getRouteCode(GpsEntity gps) { |
| 82 | 91 | return routeCodeMap.get(gps.getLineId() + "_" + gps.getUpDown() + "_" + gps.getStopNo()); |
| 83 | 92 | } |
| ... | ... | @@ -135,7 +144,7 @@ public class GeoCacheData { |
| 135 | 144 | } |
| 136 | 145 | |
| 137 | 146 | private void loadRoadsData() { |
| 138 | - String sql = "select r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,s.SECTION_NAME,ST_AsText(s.GSECTION_VECTOR) as GSECTION_VECTOR, r.DIRECTIONS from bsth_c_sectionroute r INNER JOIN bsth_c_section s on r.section=s.id where r.destroy=0 and GSECTION_VECTOR is not null order by line_code,directions,sectionroute_code"; | |
| 147 | + String sql = "select r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,s.SECTION_NAME,ST_AsText(s.GSECTION_VECTOR) as GSECTION_VECTOR, r.DIRECTIONS, s.CROSES_ROAD from bsth_c_sectionroute r INNER JOIN bsth_c_section s on r.section=s.id where r.destroy=0 and GSECTION_VECTOR is not null order by line_code,directions,sectionroute_code"; | |
| 139 | 148 | List<Map<String, Object>> secList = jdbcTemplate.queryForList(sql); |
| 140 | 149 | |
| 141 | 150 | String polygonStr, key; |
| ... | ... | @@ -143,9 +152,22 @@ public class GeoCacheData { |
| 143 | 152 | int i, len; |
| 144 | 153 | |
| 145 | 154 | ArrayListMultimap<String, LineString> sectionCacheTempMap = ArrayListMultimap.create(); |
| 155 | + Map<String, String> sectionCode2NameTemp = new HashMap<>(); | |
| 156 | + | |
| 146 | 157 | Coordinate[] cds; |
| 147 | 158 | String[] temps1, temps2; |
| 159 | + String name = null, code; | |
| 148 | 160 | for (Map<String, Object> tMap : secList) { |
| 161 | + //编码和名称对照 | |
| 162 | + if(tMap.get("CROSES_ROAD") != null && StringUtils.isNotEmpty(tMap.get("CROSES_ROAD").toString())) | |
| 163 | + name = tMap.get("CROSES_ROAD").toString(); | |
| 164 | + else if(tMap.get("SECTION_NAME") != null && StringUtils.isNotEmpty(tMap.get("SECTION_NAME").toString())) | |
| 165 | + name = tMap.get("SECTION_NAME").toString(); | |
| 166 | + | |
| 167 | + code = tMap.get("SECTION_CODE").toString(); | |
| 168 | + sectionCode2NameTemp.put(code, name); | |
| 169 | + | |
| 170 | + //空间数据映射 | |
| 149 | 171 | polygonStr = tMap.get("GSECTION_VECTOR").toString(); |
| 150 | 172 | key = tMap.get("LINE_CODE") + "_" + tMap.get("DIRECTIONS"); |
| 151 | 173 | |
| ... | ... | @@ -166,6 +188,8 @@ public class GeoCacheData { |
| 166 | 188 | |
| 167 | 189 | if(sectionCacheTempMap.size() > 0) |
| 168 | 190 | sectionCacheMap = sectionCacheTempMap; |
| 191 | + if(sectionCode2NameTemp.size() > 0) | |
| 192 | + sectionCode2Name = sectionCode2NameTemp; | |
| 169 | 193 | } |
| 170 | 194 | |
| 171 | 195 | private void loadTccMapData(){ |
| ... | ... | @@ -185,8 +209,31 @@ public class GeoCacheData { |
| 185 | 209 | logger.error("停车场:" + tMap.get("PARK_CODE"), e); |
| 186 | 210 | } |
| 187 | 211 | } |
| 188 | - if (tccTempMap.size() > 0) | |
| 212 | + if (tccTempMap.size() > 0){ | |
| 189 | 213 | tccMap = tccTempMap; |
| 214 | + tccMap2 = convertPolygonMap(tccMap); | |
| 215 | + } | |
| 216 | + } | |
| 217 | + | |
| 218 | + private Map<String, com.bsth.util.Geo.Polygon> convertPolygonMap(Map<String, Polygon> tccMap) { | |
| 219 | + Map<String, com.bsth.util.Geo.Polygon> rsMap = new HashMap<>(); | |
| 220 | + Set<String> ks = tccMap.keySet(); | |
| 221 | + for(String k : ks){ | |
| 222 | + rsMap.put(k, convertPolygon(tccMap.get(k))); | |
| 223 | + } | |
| 224 | + return rsMap; | |
| 225 | + } | |
| 226 | + | |
| 227 | + public static com.bsth.util.Geo.Polygon convertPolygon(Polygon polygon) { | |
| 228 | + List<com.bsth.util.Geo.Point> ps = new ArrayList<>(); | |
| 229 | + com.bsth.util.Geo.Point p; | |
| 230 | + | |
| 231 | + Coordinate[] cs = polygon.getCoordinates(); | |
| 232 | + for(int i = 0; i < cs.length;i ++){ | |
| 233 | + p = new com.bsth.util.Geo.Point(cs[i].y, cs[i].x); | |
| 234 | + ps.add(p); | |
| 235 | + } | |
| 236 | + return new com.bsth.util.Geo.Polygon(ps); | |
| 190 | 237 | } |
| 191 | 238 | |
| 192 | 239 | private void loadStationRoutesData(){ | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/utils/GeoUtils.java
| ... | ... | @@ -3,7 +3,10 @@ package com.bsth.data.gpsdata.arrival.utils; |
| 3 | 3 | import com.bsth.data.gpsdata.GpsEntity; |
| 4 | 4 | import com.bsth.data.gpsdata.arrival.GeoCacheData; |
| 5 | 5 | import com.bsth.data.gpsdata.arrival.entity.StationRoute; |
| 6 | -import com.vividsolutions.jts.geom.*; | |
| 6 | +import com.vividsolutions.jts.geom.Coordinate; | |
| 7 | +import com.vividsolutions.jts.geom.GeometryFactory; | |
| 8 | +import com.vividsolutions.jts.geom.LineString; | |
| 9 | +import com.vividsolutions.jts.geom.Point; | |
| 7 | 10 | |
| 8 | 11 | import java.util.List; |
| 9 | 12 | import java.util.Map; |
| ... | ... | @@ -26,7 +29,7 @@ public class GeoUtils { |
| 26 | 29 | */ |
| 27 | 30 | public static StationRoute gpsInStation(GpsEntity gps, List<StationRoute> srs) { |
| 28 | 31 | Point point = geometryFactory.createPoint(new Coordinate(gps.getLat(), gps.getLon())); |
| 29 | - double min = -1, distance, distance2; | |
| 32 | + double min = -1, distance; | |
| 30 | 33 | StationRoute stationRoute = null; |
| 31 | 34 | |
| 32 | 35 | for (StationRoute sr : srs) { |
| ... | ... | @@ -43,7 +46,13 @@ public class GeoUtils { |
| 43 | 46 | } |
| 44 | 47 | } else { |
| 45 | 48 | //多边形 |
| 46 | - if (sr.getPolygon().contains(point)) { | |
| 49 | + /*if (sr.getPolygon().contains(point)) { | |
| 50 | + stationRoute = sr; | |
| 51 | + break; | |
| 52 | + }*/ | |
| 53 | + com.bsth.util.Geo.Polygon polygon2 = GeoCacheData.convertPolygon(sr.getPolygon()); | |
| 54 | + com.bsth.util.Geo.Point point2 = new com.bsth.util.Geo.Point(gps.getLon(), gps.getLat()); | |
| 55 | + if(com.bsth.util.Geo.GeoUtils.isPointInPolygon(point2, polygon2)){ | |
| 47 | 56 | stationRoute = sr; |
| 48 | 57 | break; |
| 49 | 58 | } |
| ... | ... | @@ -125,7 +134,6 @@ public class GeoUtils { |
| 125 | 134 | * gps 是否在某个停车场内 |
| 126 | 135 | * @param gps |
| 127 | 136 | * @return |
| 128 | - */ | |
| 129 | 137 | public static String gpsInCarpark(GpsEntity gps){ |
| 130 | 138 | Point point = geometryFactory.createPoint(new Coordinate(gps.getLat(), gps.getLon())); |
| 131 | 139 | |
| ... | ... | @@ -139,6 +147,25 @@ public class GeoUtils { |
| 139 | 147 | } |
| 140 | 148 | } |
| 141 | 149 | return null; |
| 150 | + }*/ | |
| 151 | + | |
| 152 | + /** | |
| 153 | + * gps 是否在某个停车场内 | |
| 154 | + * @param gps | |
| 155 | + * @return | |
| 156 | + */ | |
| 157 | + public static String gpsInCarpark(GpsEntity gps){ | |
| 158 | + com.bsth.util.Geo.Point point = new com.bsth.util.Geo.Point(gps.getLon(), gps.getLat()); | |
| 159 | + Map<String, com.bsth.util.Geo.Polygon> carparkMap = GeoCacheData.tccMap2; | |
| 160 | + com.bsth.util.Geo.Polygon polygon; | |
| 161 | + Set<String> codes = carparkMap.keySet(); | |
| 162 | + for(String code : codes){ | |
| 163 | + polygon = carparkMap.get(code); | |
| 164 | + if(com.bsth.util.Geo.GeoUtils.isPointInPolygon(point, polygon)){ | |
| 165 | + return code; | |
| 166 | + } | |
| 167 | + } | |
| 168 | + return null; | |
| 142 | 169 | } |
| 143 | 170 | |
| 144 | 171 | /** | ... | ... |
src/main/java/com/bsth/data/gpsdata/recovery/GpsDataRecovery.java
| ... | ... | @@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware { |
| 84 | 84 | Calendar calendar = Calendar.getInstance(); |
| 85 | 85 | int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR); |
| 86 | 86 | |
| 87 | - String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE from bsth_c_gps_info where days_year=143";// + dayOfYear; | |
| 87 | + String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE from bsth_c_gps_info where days_year=173";// + dayOfYear; | |
| 88 | 88 | JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource()); |
| 89 | 89 | |
| 90 | 90 | List<GpsEntity> list = | ... | ... |
src/main/java/com/bsth/data/pilot80/PilotReport.java
| ... | ... | @@ -121,7 +121,7 @@ public class PilotReport { |
| 121 | 121 | String nbbm = BasicData.deviceId2NbbmMap.get(d80.getDeviceId()); |
| 122 | 122 | Short reqCode = d80.getData().getRequestCode(); |
| 123 | 123 | //默认短语回复 |
| 124 | - defaultReply(nbbm, reqCode, d80.getConfirmRs() == 0?true:false); | |
| 124 | + //defaultReply(nbbm, reqCode, d80.getConfirmRs() == 0?true:false); | |
| 125 | 125 | |
| 126 | 126 | switch (reqCode) { |
| 127 | 127 | case 0xA3: | ... | ... |
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
| ... | ... | @@ -119,7 +119,7 @@ public class SchAttrCalculator { |
| 119 | 119 | |
| 120 | 120 | if(prve.getZdzName().equals(curr.getQdzName()) |
| 121 | 121 | || prve.getZdzCode().equals(curr.getQdzCode())){ |
| 122 | - curr.setQdzArrDateJH(prve.getZdsj()); | |
| 122 | + curr.setQdzArrDatejh(prve.getZdsj()); | |
| 123 | 123 | if(StringUtils.isNotEmpty(prve.getZdsjActual())) |
| 124 | 124 | curr.setQdzArrDatesj(prve.getZdsjActual()); |
| 125 | 125 | } |
| ... | ... | @@ -147,16 +147,16 @@ public class SchAttrCalculator { |
| 147 | 147 | if(prve.getZdzName().equals(curr.getQdzName()) |
| 148 | 148 | || prve.getZdzCode().equals(curr.getQdzCode())){ |
| 149 | 149 | |
| 150 | - if(curr.getQdzArrDateJH() != null && prve.getZdsj().equals(curr.getQdzArrDateJH())){ | |
| 150 | + if(curr.getQdzArrDatejh() != null && prve.getZdsj().equals(curr.getQdzArrDatejh())){ | |
| 151 | 151 | prve = curr; |
| 152 | 152 | continue; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - curr.setQdzArrDateJH(prve.getZdsj()); | |
| 155 | + curr.setQdzArrDatejh(prve.getZdsj()); | |
| 156 | 156 | updateList.add(curr); |
| 157 | 157 | } |
| 158 | 158 | else{ |
| 159 | - curr.setQdzArrDateJH(null); | |
| 159 | + curr.setQdzArrDatejh(null); | |
| 160 | 160 | updateList.add(curr); |
| 161 | 161 | } |
| 162 | 162 | prve = curr; | ... | ... |
src/main/java/com/bsth/data/schedule/edit_logs/FormLogger.java
| ... | ... | @@ -54,8 +54,9 @@ public class FormLogger { |
| 54 | 54 | cc.setFgs(sch.getFgsBm()); |
| 55 | 55 | cc.setXl(sch.getXlBm()); |
| 56 | 56 | cc.setLp(sch.getLpName()); |
| 57 | - cc.setFssj(fmtHHmm.print(d.getTime())); | |
| 57 | + cc.setFssj(sch.getFcsj()); | |
| 58 | 58 | cc.setXgsj(fmtHHmm.print(d.getTime())); |
| 59 | + cc.setsId(sch.getId()); | |
| 59 | 60 | if(user != null) |
| 60 | 61 | cc.setXgr(user.getUserName()); |
| 61 | 62 | ... | ... |
src/main/java/com/bsth/data/schedule/late_adjust/ScheduleLateThread.java
| ... | ... | @@ -31,7 +31,7 @@ public class ScheduleLateThread extends Thread{ |
| 31 | 31 | @Autowired |
| 32 | 32 | SendUtils sendUtils; |
| 33 | 33 | |
| 34 | - private static Comparator<ScheduleRealInfo> cpm = new ScheduleComparator.FCSJ(); | |
| 34 | + private static Comparator<ScheduleRealInfo> cpm = new ScheduleComparator.DFSJ(); | |
| 35 | 35 | |
| 36 | 36 | @Override |
| 37 | 37 | public void run() { |
| ... | ... | @@ -54,7 +54,7 @@ public class ScheduleLateThread extends Thread{ |
| 54 | 54 | && StringUtils.isEmpty(sch.getFcsjActual())){ |
| 55 | 55 | |
| 56 | 56 | //检查应发未到 当前班次无起点到达时间 |
| 57 | - if(StringUtils.isEmpty(sch.getQdzArrDateSJ())){ | |
| 57 | + if(StringUtils.isEmpty(sch.getQdzArrDatesj())){ | |
| 58 | 58 | ScheduleRealInfo prev = dayOfSchedule.prev(sch); |
| 59 | 59 | //上一个班次也没有实际终点到达时间 |
| 60 | 60 | if(prev != null && StringUtils.isEmpty(prev.getZdsjActual())){ | ... | ... |
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
| ... | ... | @@ -648,22 +648,6 @@ public class ScheduleRealInfo { |
| 648 | 648 | return ("schedule_" + this.id).hashCode(); |
| 649 | 649 | } |
| 650 | 650 | |
| 651 | - public String getQdzArrDateJH() { | |
| 652 | - return qdzArrDatejh; | |
| 653 | - } | |
| 654 | - | |
| 655 | - public void setQdzArrDateJH(String qdzArrDateJH) { | |
| 656 | - this.qdzArrDatejh = qdzArrDateJH; | |
| 657 | - } | |
| 658 | - | |
| 659 | - public String getQdzArrDateSJ() { | |
| 660 | - return qdzArrDatesj; | |
| 661 | - } | |
| 662 | - | |
| 663 | - public void setQdzArrDateSJ(String qdzArrDateSJ) { | |
| 664 | - this.qdzArrDatesj = qdzArrDateSJ; | |
| 665 | - } | |
| 666 | - | |
| 667 | 651 | public boolean isSflj() { |
| 668 | 652 | return sflj; |
| 669 | 653 | } | ... | ... |
src/main/java/com/bsth/service/gps/GpsService.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.service.gps; |
| 3 | 3 | import com.bsth.service.gps.entity.GpsOutbound_DTO; |
| 4 | 4 | import com.bsth.service.gps.entity.GpsSpeed_DTO; |
| 5 | 5 | |
| 6 | +import javax.servlet.http.HttpServletResponse; | |
| 6 | 7 | import java.util.List; |
| 7 | 8 | import java.util.Map; |
| 8 | 9 | |
| ... | ... | @@ -29,4 +30,12 @@ public interface GpsService { |
| 29 | 30 | List<GpsOutbound_DTO> outbounds(String nbbm, long st, long et); |
| 30 | 31 | |
| 31 | 32 | Map<String, Object> safeDrivList(Map<String, Object> map, int page, int size, String order, String direction); |
| 33 | + | |
| 34 | + Map<String,Object> history_v3(String nbbm, long st, long et); | |
| 35 | + | |
| 36 | + void trailExcel(String nbbm, long st, long et, HttpServletResponse resp); | |
| 37 | + | |
| 38 | + void abnormalExcel(String nbbm, long st, long et, HttpServletResponse resp); | |
| 39 | + | |
| 40 | + void arrivalExcel(String nbbm, long st, long et, HttpServletResponse resp); | |
| 32 | 41 | } | ... | ... |
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
| ... | ... | @@ -5,6 +5,7 @@ import com.bsth.data.BasicData; |
| 5 | 5 | import com.bsth.data.forecast.entity.ArrivalEntity; |
| 6 | 6 | import com.bsth.data.gpsdata.GpsEntity; |
| 7 | 7 | import com.bsth.data.gpsdata.GpsRealData; |
| 8 | +import com.bsth.data.gpsdata.arrival.GeoCacheData; | |
| 8 | 9 | import com.bsth.data.gpsdata.arrival.utils.GeoUtils; |
| 9 | 10 | import com.bsth.data.safe_driv.SafeDriv; |
| 10 | 11 | import com.bsth.data.safe_driv.SafeDrivCenter; |
| ... | ... | @@ -13,15 +14,20 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 13 | 14 | import com.bsth.repository.CarParkRepository; |
| 14 | 15 | import com.bsth.repository.StationRepository; |
| 15 | 16 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 16 | -import com.bsth.service.gps.entity.GpsOutbound_DTO; | |
| 17 | -import com.bsth.service.gps.entity.GpsSpeed_DTO; | |
| 18 | -import com.bsth.service.gps.entity.HistoryGps_DTO; | |
| 19 | -import com.bsth.service.gps.entity.Road_DTO; | |
| 17 | +import com.bsth.service.gps.entity.*; | |
| 20 | 18 | import com.bsth.util.DateUtils; |
| 21 | 19 | import com.bsth.util.TransGPS; |
| 22 | 20 | import com.bsth.util.TransGPS.Location; |
| 23 | 21 | import com.bsth.util.db.DBUtils_MS; |
| 24 | 22 | import org.apache.commons.lang3.StringUtils; |
| 23 | +import org.apache.poi.hssf.usermodel.HSSFCellStyle; | |
| 24 | +import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |
| 25 | +import org.apache.poi.ss.usermodel.CellStyle; | |
| 26 | +import org.apache.poi.ss.usermodel.Row; | |
| 27 | +import org.apache.poi.ss.usermodel.Sheet; | |
| 28 | +import org.apache.poi.ss.usermodel.Workbook; | |
| 29 | +import org.joda.time.format.DateTimeFormat; | |
| 30 | +import org.joda.time.format.DateTimeFormatter; | |
| 25 | 31 | import org.slf4j.Logger; |
| 26 | 32 | import org.slf4j.LoggerFactory; |
| 27 | 33 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -29,7 +35,12 @@ import org.springframework.dao.DataAccessException; |
| 29 | 35 | import org.springframework.jdbc.core.JdbcTemplate; |
| 30 | 36 | import org.springframework.stereotype.Service; |
| 31 | 37 | |
| 38 | +import javax.servlet.http.HttpServletResponse; | |
| 39 | +import java.io.IOException; | |
| 40 | +import java.io.OutputStream; | |
| 41 | +import java.io.UnsupportedEncodingException; | |
| 32 | 42 | import java.lang.reflect.Field; |
| 43 | +import java.net.URLEncoder; | |
| 33 | 44 | import java.sql.Connection; |
| 34 | 45 | import java.sql.PreparedStatement; |
| 35 | 46 | import java.sql.ResultSet; |
| ... | ... | @@ -213,7 +224,7 @@ public class GpsServiceImpl implements GpsService { |
| 213 | 224 | // 查询到离站数据 |
| 214 | 225 | Map<String, ArrivalEntity> arrivalMap = findArrivalByTs(weekOfYear, st, et, inv); |
| 215 | 226 | |
| 216 | - String sql = "select DEVICE_ID,LON,LAT,TS,INOUT_STOP,SERVICE_STATE ,STOP_NO,DIRECTION,LINE_ID,SPEED_GPS from bsth_c_gps_info where days_year=? and device_id in (" | |
| 227 | + String sql = "select DEVICE_ID,LON,LAT,TS,INOUT_STOP,SERVICE_STATE ,STOP_NO,DIRECTION,LINE_ID,SPEED_GPS,SECTION_CODE from bsth_c_gps_info where days_year=? and device_id in (" | |
| 217 | 228 | + inv + ") and ts > ? and ts < ? ORDER BY device_id,ts,stop_no"; |
| 218 | 229 | try { |
| 219 | 230 | conn = DBUtils_MS.getConnection(); |
| ... | ... | @@ -268,6 +279,8 @@ public class GpsServiceImpl implements GpsService { |
| 268 | 279 | map.put("state", 0); |
| 269 | 280 | // 上下行 |
| 270 | 281 | map.put("upDown", upDown); |
| 282 | + //路段编码 | |
| 283 | + map.put("section_code", rs.getString("SECTION_CODE")); | |
| 271 | 284 | list.add(map); |
| 272 | 285 | } |
| 273 | 286 | } catch (Exception e) { |
| ... | ... | @@ -562,6 +575,226 @@ public class GpsServiceImpl implements GpsService { |
| 562 | 575 | return rs; |
| 563 | 576 | } |
| 564 | 577 | |
| 578 | + | |
| 579 | + @Override | |
| 580 | + public Map<String, Object> history_v3(String nbbm, long st, long et) { | |
| 581 | + Map<String, Object> rs = new HashMap<>(); | |
| 582 | + | |
| 583 | + try { | |
| 584 | + //获取历史gps 数据 | |
| 585 | + List<HistoryGps_DTOV3> list = HistoryGps_DTOV3.craete(history(new String[]{nbbm}, st, et)); | |
| 586 | + if (list != null && list.size() > 0) { | |
| 587 | + //获取路段信息 | |
| 588 | + /*String sql = "select ID, ST_AsText(GROAD_VECTOR) as GROAD_VECTOR,ROAD_CODE,ROAD_NAME,SPEED from bsth_c_road where road_code in(select section_code from bsth_c_sectionroute where line_code=? and destroy=0)"; | |
| 589 | + List<Road_DTO> roads = Road_DTO.craete(jdbcTemplate.queryForList(sql, list.get(0).getLineId())); | |
| 590 | + | |
| 591 | + //为GPS数据关联路段信息 | |
| 592 | + for (HistoryGps_DTOV3 gps : list) { | |
| 593 | + matchRoadToGps(gps, roads); | |
| 594 | + }*/ | |
| 595 | + //关联路段名称 | |
| 596 | + Map<String, String> sectionCode2Name = GeoCacheData.sectionCode2NameMap(); | |
| 597 | + for(HistoryGps_DTOV3 gps : list){ | |
| 598 | + if(StringUtils.isNotEmpty(gps.getSection_code())) | |
| 599 | + gps.setSection_name(sectionCode2Name.get(gps.getSection_code())); | |
| 600 | + else{ | |
| 601 | + gps.setSection_code("-00404"); | |
| 602 | + gps.setSection_name("未知路段"); | |
| 603 | + } | |
| 604 | + } | |
| 605 | + } | |
| 606 | + | |
| 607 | + //超速数据 | |
| 608 | + List<GpsSpeed_DTO> speedList = speeds(nbbm, st, et); | |
| 609 | + | |
| 610 | + //越界数据 | |
| 611 | + List<GpsOutbound_DTO> outboundList = outbounds(nbbm, st, et); | |
| 612 | + | |
| 613 | + //计算里程 | |
| 614 | + List<HistoryGps_DTOV3> effList = new ArrayList<>(); | |
| 615 | + for(HistoryGps_DTOV3 gps : list){ | |
| 616 | + if(gps.getLat() != 0 && gps.getLon() != 0) | |
| 617 | + effList.add(gps); | |
| 618 | + } | |
| 619 | + double sum = 0, dist; | |
| 620 | + for (int i = 0; i < effList.size() - 1; i++) { | |
| 621 | + dist = GeoUtils.getDistance(effList.get(i).getPoint(), effList.get(i + 1).getPoint()); | |
| 622 | + //点位相同时,dist会NaN | |
| 623 | + if(String.valueOf(dist).matches("^[0.0-9.0]+$")){ | |
| 624 | + if(dist > 0.8) | |
| 625 | + sum += dist; | |
| 626 | + } | |
| 627 | + } | |
| 628 | + | |
| 629 | + rs.put("status", ResponseCode.SUCCESS); | |
| 630 | + rs.put("list", removeDuplicateV3(effList)); | |
| 631 | + rs.put("speedList", speedList); | |
| 632 | + rs.put("outboundList", outboundList); | |
| 633 | + rs.put("sumMileage", new DecimalFormat(".##").format(sum / 1000)); | |
| 634 | + } catch (Exception e) { | |
| 635 | + logger.error("", e); | |
| 636 | + rs.put("status", ResponseCode.ERROR); | |
| 637 | + rs.put("msg", e.getMessage()); | |
| 638 | + } | |
| 639 | + return rs; | |
| 640 | + } | |
| 641 | + | |
| 642 | + @Override | |
| 643 | + public void trailExcel(String nbbm, long st, long et, HttpServletResponse resp) { | |
| 644 | + //获取历史gps 数据 | |
| 645 | + List<HistoryGps_DTOV3> list = HistoryGps_DTOV3.craete(history(new String[]{nbbm}, st, et)); | |
| 646 | + if (list != null && list.size() > 0) { | |
| 647 | + //关联路段名称 | |
| 648 | + Map<String, String> sectionCode2Name = GeoCacheData.sectionCode2NameMap(); | |
| 649 | + for(HistoryGps_DTOV3 gps : list){ | |
| 650 | + if(StringUtils.isNotEmpty(gps.getSection_code())) | |
| 651 | + gps.setSection_name(sectionCode2Name.get(gps.getSection_code())); | |
| 652 | + else{ | |
| 653 | + gps.setSection_code("-00404"); | |
| 654 | + gps.setSection_name("未知路段"); | |
| 655 | + } | |
| 656 | + } | |
| 657 | + } | |
| 658 | + | |
| 659 | + //创建excel工作簿 | |
| 660 | + Workbook wb = new HSSFWorkbook(); | |
| 661 | + Sheet sheet = wb.createSheet("行车轨迹"); | |
| 662 | + //表头 | |
| 663 | + Row row = sheet.createRow(0); | |
| 664 | + row.setHeight((short) (1.5 * 256)); | |
| 665 | + row.createCell(0).setCellValue("序号"); | |
| 666 | + row.createCell(1).setCellValue("车辆"); | |
| 667 | + row.createCell(2).setCellValue("所在道路"); | |
| 668 | + row.createCell(3).setCellValue("经度"); | |
| 669 | + row.createCell(4).setCellValue("纬度"); | |
| 670 | + row.createCell(5).setCellValue("时间"); | |
| 671 | + row.createCell(6).setCellValue("速度"); | |
| 672 | + //数据 | |
| 673 | + DateTimeFormatter fmtHHmmss = DateTimeFormat.forPattern("HH:mm.ss"), | |
| 674 | + fmt = DateTimeFormat.forPattern("yyyyMMddHHmm"); | |
| 675 | + HistoryGps_DTOV3 gps; | |
| 676 | + for(int i = 0; i < list.size(); i ++){ | |
| 677 | + gps = list.get(i); | |
| 678 | + row = sheet.createRow(i + 1); | |
| 679 | + row.createCell(0).setCellValue(i + 1); | |
| 680 | + row.createCell(1).setCellValue(gps.getNbbm()); | |
| 681 | + row.createCell(2).setCellValue(gps.getSection_name()); | |
| 682 | + row.createCell(3).setCellValue(gps.getLon()); | |
| 683 | + row.createCell(4).setCellValue(gps.getLat()); | |
| 684 | + row.createCell(5).setCellValue(fmtHHmmss.print(gps.getTimestamp())); | |
| 685 | + row.createCell(6).setCellValue(gps.getSpeed()); | |
| 686 | + } | |
| 687 | + | |
| 688 | + st = st * 1000; | |
| 689 | + et = et * 1000; | |
| 690 | + String filename = nbbm + "轨迹数据" + fmt.print(st) + "至" + fmt.print(et) + ".xls"; | |
| 691 | + try { | |
| 692 | + resp.setContentType("application/x-msdownload"); | |
| 693 | + resp.addHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8")); | |
| 694 | + | |
| 695 | + OutputStream out=resp.getOutputStream(); | |
| 696 | + wb.write(out); | |
| 697 | + out.flush(); | |
| 698 | + out.close(); | |
| 699 | + } catch (UnsupportedEncodingException e) { | |
| 700 | + logger.error("", e); | |
| 701 | + } catch (IOException e) { | |
| 702 | + logger.error("", e); | |
| 703 | + } | |
| 704 | + } | |
| 705 | + | |
| 706 | + @Override | |
| 707 | + public void abnormalExcel(String nbbm, long st, long et, HttpServletResponse resp) { | |
| 708 | + //超速数据 | |
| 709 | + List<GpsSpeed_DTO> speedList = speeds(nbbm, st, et); | |
| 710 | + //越界数据 | |
| 711 | + List<GpsOutbound_DTO> outboundList = outbounds(nbbm, st, et); | |
| 712 | + | |
| 713 | + //创建excel工作簿 | |
| 714 | + Workbook wb = new HSSFWorkbook(); | |
| 715 | + | |
| 716 | + DateTimeFormatter fmtHHmmss = DateTimeFormat.forPattern("HH:mm.ss"), | |
| 717 | + fmt = DateTimeFormat.forPattern("yyyyMMddHHmm"); | |
| 718 | + if(speedList.size() > 0){ | |
| 719 | + Sheet sheet = wb.createSheet("超速"); | |
| 720 | + //表头 | |
| 721 | + Row row = sheet.createRow(0); | |
| 722 | + row.setHeight((short) (1.5 * 256)); | |
| 723 | + row.createCell(0).setCellValue("异常信息"); | |
| 724 | + row.createCell(1).setCellValue("最大速度"); | |
| 725 | + row.createCell(2).setCellValue("开始时间"); | |
| 726 | + row.createCell(3).setCellValue("结束时间"); | |
| 727 | + row.createCell(4).setCellValue("持续(秒)"); | |
| 728 | + row.createCell(5).setCellValue("所在路段"); | |
| 729 | + | |
| 730 | + GpsSpeed_DTO speed; | |
| 731 | + for(int i = 0; i < speedList.size(); i++){ | |
| 732 | + speed = speedList.get(i); | |
| 733 | + row = sheet.createRow(i + 1); | |
| 734 | + row.createCell(0).setCellValue("超速"); | |
| 735 | + row.createCell(1).setCellValue(speed.getSpeed()); | |
| 736 | + row.createCell(2).setCellValue(fmtHHmmss.print(speed.getSt())); | |
| 737 | + row.createCell(3).setCellValue(fmtHHmmss.print(speed.getEt())); | |
| 738 | + if(speed.getEt() != 0) | |
| 739 | + row.createCell(4).setCellValue((speed.getEt() - speed.getSt()) / 1000); | |
| 740 | + row.createCell(5).setCellValue(""); | |
| 741 | + } | |
| 742 | + } | |
| 743 | + | |
| 744 | + if(outboundList.size() > 0){ | |
| 745 | + Sheet sheet = wb.createSheet("越界"); | |
| 746 | + //表头 | |
| 747 | + Row row = sheet.createRow(0); | |
| 748 | + row.setHeight((short) (1.5 * 256)); | |
| 749 | + row.createCell(0).setCellValue("异常信息"); | |
| 750 | + row.createCell(1).setCellValue("开始时间"); | |
| 751 | + row.createCell(2).setCellValue("结束时间"); | |
| 752 | + row.createCell(3).setCellValue("持续(秒)"); | |
| 753 | + row.createCell(4).setCellValue("所在路段"); | |
| 754 | + row.createCell(5).setCellValue("路径"); | |
| 755 | + | |
| 756 | + GpsOutbound_DTO outbound; | |
| 757 | + //设置路径单元格 水平对齐 填充 | |
| 758 | + CellStyle cs = wb.createCellStyle(); | |
| 759 | + cs.setAlignment(HSSFCellStyle.ALIGN_FILL); | |
| 760 | + for(int i = 0; i < outboundList.size(); i++){ | |
| 761 | + outbound = outboundList.get(i); | |
| 762 | + row = sheet.createRow(i + 1); | |
| 763 | + row.createCell(0).setCellValue("超速"); | |
| 764 | + row.createCell(1).setCellValue(fmtHHmmss.print(outbound.getSt())); | |
| 765 | + row.createCell(2).setCellValue(fmtHHmmss.print(outbound.getEt())); | |
| 766 | + if(outbound.getEt() != 0) | |
| 767 | + row.createCell(3).setCellValue((outbound.getEt() - outbound.getSt()) / 1000); | |
| 768 | + row.createCell(4).setCellValue(""); | |
| 769 | + row.createCell(5).setCellValue(outbound.getLocations()); | |
| 770 | + | |
| 771 | + row.getCell(5).setCellStyle(cs); | |
| 772 | + } | |
| 773 | + } | |
| 774 | + | |
| 775 | + st = st * 1000; | |
| 776 | + et = et * 1000; | |
| 777 | + String filename = nbbm + "异常信息" + fmt.print(st) + "至" + fmt.print(et) + ".xls"; | |
| 778 | + try { | |
| 779 | + resp.setContentType("application/x-msdownload"); | |
| 780 | + resp.addHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8")); | |
| 781 | + | |
| 782 | + OutputStream out=resp.getOutputStream(); | |
| 783 | + wb.write(out); | |
| 784 | + out.flush(); | |
| 785 | + out.close(); | |
| 786 | + } catch (UnsupportedEncodingException e) { | |
| 787 | + logger.error("", e); | |
| 788 | + } catch (IOException e) { | |
| 789 | + logger.error("", e); | |
| 790 | + } | |
| 791 | + } | |
| 792 | + | |
| 793 | + @Override | |
| 794 | + public void arrivalExcel(String nbbm, long st, long et, HttpServletResponse resp) { | |
| 795 | + | |
| 796 | + } | |
| 797 | + | |
| 565 | 798 | @Override |
| 566 | 799 | public List<GpsSpeed_DTO> speeds(String nbbm, long st, long et) { |
| 567 | 800 | String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); |
| ... | ... | @@ -649,6 +882,31 @@ public class GpsServiceImpl implements GpsService { |
| 649 | 882 | gps.setRoadMinDistance(min); |
| 650 | 883 | } |
| 651 | 884 | |
| 885 | + | |
| 886 | + private void matchRoadToGps(HistoryGps_DTOV3 gps, List<Road_DTO> roads) { | |
| 887 | + double min = -1, distance; | |
| 888 | + Road_DTO nearRoad = null; | |
| 889 | + for (Road_DTO road : roads) { | |
| 890 | + distance = GeoUtils.getDistanceFromLine(road.getLineStr(), gps.getPoint()); | |
| 891 | + | |
| 892 | + if (min > distance || min == -1) { | |
| 893 | + min = distance; | |
| 894 | + nearRoad = road; | |
| 895 | + } | |
| 896 | + } | |
| 897 | + | |
| 898 | + if(min < 200){ | |
| 899 | + gps.setSection_code(nearRoad.getROAD_CODE()); | |
| 900 | + gps.setSection_name(nearRoad.getROAD_NAME()); | |
| 901 | + } | |
| 902 | + else { | |
| 903 | + gps.setSection_code("-00404"); | |
| 904 | + gps.setSection_name("未知路段"); | |
| 905 | + } | |
| 906 | + //gps.setRoad(nearRoad); | |
| 907 | + //gps.setRoadMinDistance(min); | |
| 908 | + } | |
| 909 | + | |
| 652 | 910 | /** |
| 653 | 911 | * 去重复 |
| 654 | 912 | * |
| ... | ... | @@ -663,6 +921,21 @@ public class GpsServiceImpl implements GpsService { |
| 663 | 921 | return set; |
| 664 | 922 | } |
| 665 | 923 | |
| 924 | + /** | |
| 925 | + * 去重复 | |
| 926 | + * | |
| 927 | + * @param list | |
| 928 | + * @return | |
| 929 | + */ | |
| 930 | + private Set<HistoryGps_DTOV3> removeDuplicateV3(List<HistoryGps_DTOV3> list) { | |
| 931 | + Set<HistoryGps_DTOV3> set = new HashSet<>(); | |
| 932 | + for (HistoryGps_DTOV3 gps : list) { | |
| 933 | + set.add(gps); | |
| 934 | + } | |
| 935 | + return set; | |
| 936 | + } | |
| 937 | + | |
| 938 | + | |
| 666 | 939 | private void sortGpsList(final Field f, List<GpsEntity> rs) { |
| 667 | 940 | Collections.sort(rs, new Comparator<GpsEntity>() { |
| 668 | 941 | ... | ... |
src/main/java/com/bsth/service/gps/entity/GpsOutbound_DTO.java
| ... | ... | @@ -86,6 +86,11 @@ public class GpsOutbound_DTO { |
| 86 | 86 | */ |
| 87 | 87 | private String locations; |
| 88 | 88 | |
| 89 | + /** | |
| 90 | + * 所在路段 | |
| 91 | + */ | |
| 92 | + private String sectionName; | |
| 93 | + | |
| 89 | 94 | private String abnormalType = "outbound"; |
| 90 | 95 | |
| 91 | 96 | public String getDeviceId() { |
| ... | ... | @@ -135,4 +140,12 @@ public class GpsOutbound_DTO { |
| 135 | 140 | public void setAbnormalType(String abnormalType) { |
| 136 | 141 | this.abnormalType = abnormalType; |
| 137 | 142 | } |
| 143 | + | |
| 144 | + public String getSectionName() { | |
| 145 | + return sectionName; | |
| 146 | + } | |
| 147 | + | |
| 148 | + public void setSectionName(String sectionName) { | |
| 149 | + this.sectionName = sectionName; | |
| 150 | + } | |
| 138 | 151 | } | ... | ... |
src/main/java/com/bsth/service/gps/entity/GpsSpeed_DTO.java
| ... | ... | @@ -84,6 +84,11 @@ public class GpsSpeed_DTO { |
| 84 | 84 | */ |
| 85 | 85 | private float speed; |
| 86 | 86 | |
| 87 | + /** | |
| 88 | + * 所在路段 | |
| 89 | + */ | |
| 90 | + private String sectionName; | |
| 91 | + | |
| 87 | 92 | private String abnormalType = "speed"; |
| 88 | 93 | |
| 89 | 94 | public String getDeviceId() { |
| ... | ... | @@ -133,4 +138,12 @@ public class GpsSpeed_DTO { |
| 133 | 138 | public void setAbnormalType(String abnormalType) { |
| 134 | 139 | this.abnormalType = abnormalType; |
| 135 | 140 | } |
| 141 | + | |
| 142 | + public String getSectionName() { | |
| 143 | + return sectionName; | |
| 144 | + } | |
| 145 | + | |
| 146 | + public void setSectionName(String sectionName) { | |
| 147 | + this.sectionName = sectionName; | |
| 148 | + } | |
| 136 | 149 | } | ... | ... |
src/main/java/com/bsth/service/gps/entity/HistoryGps_DTOV3.java
0 → 100644
| 1 | +package com.bsth.service.gps.entity; | |
| 2 | + | |
| 3 | +import com.alibaba.fastjson.JSON; | |
| 4 | +import com.alibaba.fastjson.JSONObject; | |
| 5 | +import com.bsth.data.forecast.entity.ArrivalEntity; | |
| 6 | +import com.fasterxml.jackson.annotation.JsonIgnore; | |
| 7 | +import com.vividsolutions.jts.geom.Coordinate; | |
| 8 | +import com.vividsolutions.jts.geom.GeometryFactory; | |
| 9 | +import com.vividsolutions.jts.geom.Point; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | +import java.util.Map; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * 历史GPS DTO | |
| 16 | + * Created by panzhao on 2017/4/5. | |
| 17 | + */ | |
| 18 | +public class HistoryGps_DTOV3 { | |
| 19 | + | |
| 20 | + public static List<HistoryGps_DTOV3> craete(List<Map<String, Object>> mapList) { | |
| 21 | + List<HistoryGps_DTOV3> list = JSONObject.parseArray(JSON.toJSONString(mapList), HistoryGps_DTOV3.class); | |
| 22 | + | |
| 23 | + GeometryFactory geometryFactory = new GeometryFactory(); | |
| 24 | + Point point; | |
| 25 | + for (HistoryGps_DTOV3 gps : list) { | |
| 26 | + point = geometryFactory.createPoint(new Coordinate(gps.getLat(), gps.getLon())); | |
| 27 | + gps.setPoint(point); | |
| 28 | + } | |
| 29 | + return list; | |
| 30 | + } | |
| 31 | + | |
| 32 | + | |
| 33 | + private double bd_lon; | |
| 34 | + private double bd_lat; | |
| 35 | + | |
| 36 | + private double lon; | |
| 37 | + private double lat; | |
| 38 | + | |
| 39 | + private String deviceId; | |
| 40 | + private long ts; | |
| 41 | + private long timestamp; | |
| 42 | + private String stopNo; | |
| 43 | + private float direction; | |
| 44 | + | |
| 45 | + private String lineId; | |
| 46 | + private float speed; | |
| 47 | + private ArrivalEntity inout_stop_info; | |
| 48 | + private int inout_stop; | |
| 49 | + | |
| 50 | + private String nbbm; | |
| 51 | + private int state; | |
| 52 | + private int upDown; | |
| 53 | + | |
| 54 | + private String section_code; | |
| 55 | + private String section_name; | |
| 56 | + | |
| 57 | + @JsonIgnore | |
| 58 | + private Point point; | |
| 59 | + | |
| 60 | + @Override | |
| 61 | + public int hashCode() { | |
| 62 | + return this.toString().hashCode(); | |
| 63 | + } | |
| 64 | + | |
| 65 | + @Override | |
| 66 | + public boolean equals(Object obj) { | |
| 67 | + HistoryGps_DTOV3 g2 = (HistoryGps_DTOV3) obj; | |
| 68 | + return this.toString().equals(g2.toString()); | |
| 69 | + } | |
| 70 | + | |
| 71 | + | |
| 72 | + @Override | |
| 73 | + public String toString() { | |
| 74 | + return (this.getDeviceId() + "_" + (inout_stop_info==null?this.getStopNo():inout_stop_info.getStopName()) + "_" + this.getTs() + "_" + this.getLon() + "_" + this.getLat()); | |
| 75 | + } | |
| 76 | + | |
| 77 | + public double getBd_lon() { | |
| 78 | + return bd_lon; | |
| 79 | + } | |
| 80 | + | |
| 81 | + public void setBd_lon(double bd_lon) { | |
| 82 | + this.bd_lon = bd_lon; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public double getBd_lat() { | |
| 86 | + return bd_lat; | |
| 87 | + } | |
| 88 | + | |
| 89 | + public void setBd_lat(double bd_lat) { | |
| 90 | + this.bd_lat = bd_lat; | |
| 91 | + } | |
| 92 | + | |
| 93 | + public String getDeviceId() { | |
| 94 | + return deviceId; | |
| 95 | + } | |
| 96 | + | |
| 97 | + public void setDeviceId(String deviceId) { | |
| 98 | + this.deviceId = deviceId; | |
| 99 | + } | |
| 100 | + | |
| 101 | + public long getTs() { | |
| 102 | + return ts; | |
| 103 | + } | |
| 104 | + | |
| 105 | + public void setTs(long ts) { | |
| 106 | + this.ts = ts; | |
| 107 | + } | |
| 108 | + | |
| 109 | + public long getTimestamp() { | |
| 110 | + return timestamp; | |
| 111 | + } | |
| 112 | + | |
| 113 | + public void setTimestamp(long timestamp) { | |
| 114 | + this.timestamp = timestamp; | |
| 115 | + } | |
| 116 | + | |
| 117 | + public String getStopNo() { | |
| 118 | + return stopNo; | |
| 119 | + } | |
| 120 | + | |
| 121 | + public void setStopNo(String stopNo) { | |
| 122 | + this.stopNo = stopNo; | |
| 123 | + } | |
| 124 | + | |
| 125 | + public float getDirection() { | |
| 126 | + return direction; | |
| 127 | + } | |
| 128 | + | |
| 129 | + public void setDirection(float direction) { | |
| 130 | + this.direction = direction; | |
| 131 | + } | |
| 132 | + | |
| 133 | + public String getLineId() { | |
| 134 | + return lineId; | |
| 135 | + } | |
| 136 | + | |
| 137 | + public void setLineId(String lineId) { | |
| 138 | + this.lineId = lineId; | |
| 139 | + } | |
| 140 | + | |
| 141 | + public float getSpeed() { | |
| 142 | + return speed; | |
| 143 | + } | |
| 144 | + | |
| 145 | + public void setSpeed(float speed) { | |
| 146 | + this.speed = speed; | |
| 147 | + } | |
| 148 | + | |
| 149 | + public ArrivalEntity getInout_stop_info() { | |
| 150 | + return inout_stop_info; | |
| 151 | + } | |
| 152 | + | |
| 153 | + public void setInout_stop_info(ArrivalEntity inout_stop_info) { | |
| 154 | + this.inout_stop_info = inout_stop_info; | |
| 155 | + } | |
| 156 | + | |
| 157 | + public int getInout_stop() { | |
| 158 | + return inout_stop; | |
| 159 | + } | |
| 160 | + | |
| 161 | + public void setInout_stop(int inout_stop) { | |
| 162 | + this.inout_stop = inout_stop; | |
| 163 | + } | |
| 164 | + | |
| 165 | + public String getNbbm() { | |
| 166 | + return nbbm; | |
| 167 | + } | |
| 168 | + | |
| 169 | + public void setNbbm(String nbbm) { | |
| 170 | + this.nbbm = nbbm; | |
| 171 | + } | |
| 172 | + | |
| 173 | + public int getState() { | |
| 174 | + return state; | |
| 175 | + } | |
| 176 | + | |
| 177 | + public void setState(int state) { | |
| 178 | + this.state = state; | |
| 179 | + } | |
| 180 | + | |
| 181 | + public int getUpDown() { | |
| 182 | + return upDown; | |
| 183 | + } | |
| 184 | + | |
| 185 | + public void setUpDown(int upDown) { | |
| 186 | + this.upDown = upDown; | |
| 187 | + } | |
| 188 | + | |
| 189 | + public double getLon() { | |
| 190 | + return lon; | |
| 191 | + } | |
| 192 | + | |
| 193 | + public void setLon(double lon) { | |
| 194 | + this.lon = lon; | |
| 195 | + } | |
| 196 | + | |
| 197 | + public double getLat() { | |
| 198 | + return lat; | |
| 199 | + } | |
| 200 | + | |
| 201 | + public void setLat(double lat) { | |
| 202 | + this.lat = lat; | |
| 203 | + } | |
| 204 | + | |
| 205 | + public Point getPoint() { | |
| 206 | + return point; | |
| 207 | + } | |
| 208 | + | |
| 209 | + public void setPoint(Point point) { | |
| 210 | + this.point = point; | |
| 211 | + } | |
| 212 | + | |
| 213 | + public String getSection_code() { | |
| 214 | + return section_code; | |
| 215 | + } | |
| 216 | + | |
| 217 | + public void setSection_code(String section_code) { | |
| 218 | + this.section_code = section_code; | |
| 219 | + } | |
| 220 | + | |
| 221 | + public String getSection_name() { | |
| 222 | + return section_name; | |
| 223 | + } | |
| 224 | + | |
| 225 | + public void setSection_name(String section_name) { | |
| 226 | + this.section_name = section_name; | |
| 227 | + } | |
| 228 | +} | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -59,7 +59,6 @@ import org.apache.commons.lang3.StringEscapeUtils; |
| 59 | 59 | import org.apache.commons.lang3.StringUtils; |
| 60 | 60 | import org.joda.time.format.DateTimeFormat; |
| 61 | 61 | import org.joda.time.format.DateTimeFormatter; |
| 62 | -import org.mvel2.optimizers.impl.refl.nodes.ArrayLength; | |
| 63 | 62 | import org.slf4j.Logger; |
| 64 | 63 | import org.slf4j.LoggerFactory; |
| 65 | 64 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -238,7 +237,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 238 | 237 | schedule.calcEndTime(); |
| 239 | 238 | ScheduleRealInfo nextSch = dayOfSchedule.nextByLp(schedule); |
| 240 | 239 | if (null != nextSch) { |
| 241 | - nextSch.setQdzArrDateJH(schedule.getZdsj()); | |
| 240 | + nextSch.setQdzArrDatejh(schedule.getZdsj()); | |
| 242 | 241 | ts.add(nextSch); |
| 243 | 242 | } |
| 244 | 243 | |
| ... | ... | @@ -1381,7 +1380,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1381 | 1380 | //路牌下一班起点到达时间 |
| 1382 | 1381 | ScheduleRealInfo next = dayOfSchedule.nextByLp(sch); |
| 1383 | 1382 | if (null != next) { |
| 1384 | - next.setQdzArrDateSJ(zdsjActual); | |
| 1383 | + next.setQdzArrDatesj(zdsjActual); | |
| 1385 | 1384 | next.setLate2(false); |
| 1386 | 1385 | ts.add(next); |
| 1387 | 1386 | } |
| ... | ... | @@ -1404,7 +1403,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1404 | 1403 | //清除路牌下一班起点到达时间 |
| 1405 | 1404 | ScheduleRealInfo next = dayOfSchedule.nextByLp(sch); |
| 1406 | 1405 | if (null != next) { |
| 1407 | - next.setQdzArrDateSJ(null); | |
| 1406 | + next.setQdzArrDatesj(null); | |
| 1408 | 1407 | ts.add(next); |
| 1409 | 1408 | } |
| 1410 | 1409 | //重新计算车辆执行班次 |
| ... | ... | @@ -4794,7 +4793,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4794 | 4793 | //清除路牌下一个班的起点到达时间 |
| 4795 | 4794 | ScheduleRealInfo next = dayOfSchedule.nextByLp(sch); |
| 4796 | 4795 | if (null != next) { |
| 4797 | - next.setQdzArrDateSJ(null); | |
| 4796 | + next.setQdzArrDatesj(null); | |
| 4798 | 4797 | ts.add(next); |
| 4799 | 4798 | } |
| 4800 | 4799 | ... | ... |
src/main/resources/static/real_control_v2/assets/plugins/flatpickr/flatpickr.css
0 → 100644
| 1 | +.flatpickr-calendar { | |
| 2 | + background: transparent; | |
| 3 | + overflow: hidden; | |
| 4 | + max-height: 0; | |
| 5 | + opacity: 0; | |
| 6 | + visibility: hidden; | |
| 7 | + text-align: center; | |
| 8 | + padding: 0; | |
| 9 | + -webkit-animation: none; | |
| 10 | + animation: none; | |
| 11 | + direction: ltr; | |
| 12 | + border: 0; | |
| 13 | + font-size: 14px; | |
| 14 | + line-height: 24px; | |
| 15 | + border-radius: 5px; | |
| 16 | + position: absolute; | |
| 17 | + width: 307.875px; | |
| 18 | + -webkit-box-sizing: border-box; | |
| 19 | + box-sizing: border-box; | |
| 20 | + -ms-touch-action: manipulation; | |
| 21 | + touch-action: manipulation; | |
| 22 | + background: #fff; | |
| 23 | + -webkit-box-shadow: 1px 0 0 #e6e6e6, -1px 0 0 #e6e6e6, 0 1px 0 #e6e6e6, 0 -1px 0 #e6e6e6, 0 3px 13px rgba(0,0,0,0.08); | |
| 24 | + box-shadow: 1px 0 0 #e6e6e6, -1px 0 0 #e6e6e6, 0 1px 0 #e6e6e6, 0 -1px 0 #e6e6e6, 0 3px 13px rgba(0,0,0,0.08); | |
| 25 | +} | |
| 26 | +.flatpickr-calendar.open, | |
| 27 | +.flatpickr-calendar.inline { | |
| 28 | + opacity: 1; | |
| 29 | + visibility: visible; | |
| 30 | + overflow: visible; | |
| 31 | + max-height: 640px; | |
| 32 | +} | |
| 33 | +.flatpickr-calendar.open { | |
| 34 | + display: inline-block; | |
| 35 | + z-index: 99999; | |
| 36 | +} | |
| 37 | +.flatpickr-calendar.animate.open { | |
| 38 | + -webkit-animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1); | |
| 39 | + animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1); | |
| 40 | +} | |
| 41 | +.flatpickr-calendar.inline { | |
| 42 | + display: block; | |
| 43 | + position: relative; | |
| 44 | + top: 2px; | |
| 45 | +} | |
| 46 | +.flatpickr-calendar.static { | |
| 47 | + position: absolute; | |
| 48 | + top: calc(100% + 2px); | |
| 49 | +} | |
| 50 | +.flatpickr-calendar.static.open { | |
| 51 | + z-index: 999; | |
| 52 | + display: block; | |
| 53 | +} | |
| 54 | +.flatpickr-calendar.hasWeeks { | |
| 55 | + width: auto; | |
| 56 | +} | |
| 57 | +.flatpickr-calendar .hasWeeks .dayContainer, | |
| 58 | +.flatpickr-calendar .hasTime .dayContainer { | |
| 59 | + border-bottom: 0; | |
| 60 | + border-bottom-right-radius: 0; | |
| 61 | + border-bottom-left-radius: 0; | |
| 62 | +} | |
| 63 | +.flatpickr-calendar .hasWeeks .dayContainer { | |
| 64 | + border-left: 0; | |
| 65 | +} | |
| 66 | +.flatpickr-calendar.showTimeInput.hasTime .flatpickr-time { | |
| 67 | + height: 40px; | |
| 68 | + border-top: 1px solid #e6e6e6; | |
| 69 | +} | |
| 70 | +.flatpickr-calendar.noCalendar.hasTime .flatpickr-time { | |
| 71 | + height: auto; | |
| 72 | +} | |
| 73 | +.flatpickr-calendar:before, | |
| 74 | +.flatpickr-calendar:after { | |
| 75 | + position: absolute; | |
| 76 | + display: block; | |
| 77 | + pointer-events: none; | |
| 78 | + border: solid transparent; | |
| 79 | + content: ''; | |
| 80 | + height: 0; | |
| 81 | + width: 0; | |
| 82 | + left: 22px; | |
| 83 | +} | |
| 84 | +.flatpickr-calendar.rightMost:before, | |
| 85 | +.flatpickr-calendar.rightMost:after { | |
| 86 | + left: auto; | |
| 87 | + right: 22px; | |
| 88 | +} | |
| 89 | +.flatpickr-calendar:before { | |
| 90 | + border-width: 5px; | |
| 91 | + margin: 0 -5px; | |
| 92 | +} | |
| 93 | +.flatpickr-calendar:after { | |
| 94 | + border-width: 4px; | |
| 95 | + margin: 0 -4px; | |
| 96 | +} | |
| 97 | +.flatpickr-calendar.arrowTop:before, | |
| 98 | +.flatpickr-calendar.arrowTop:after { | |
| 99 | + bottom: 100%; | |
| 100 | +} | |
| 101 | +.flatpickr-calendar.arrowTop:before { | |
| 102 | + border-bottom-color: #e6e6e6; | |
| 103 | +} | |
| 104 | +.flatpickr-calendar.arrowTop:after { | |
| 105 | + border-bottom-color: #fff; | |
| 106 | +} | |
| 107 | +.flatpickr-calendar.arrowBottom:before, | |
| 108 | +.flatpickr-calendar.arrowBottom:after { | |
| 109 | + top: 100%; | |
| 110 | +} | |
| 111 | +.flatpickr-calendar.arrowBottom:before { | |
| 112 | + border-top-color: #e6e6e6; | |
| 113 | +} | |
| 114 | +.flatpickr-calendar.arrowBottom:after { | |
| 115 | + border-top-color: #fff; | |
| 116 | +} | |
| 117 | +.flatpickr-calendar:focus { | |
| 118 | + outline: 0; | |
| 119 | +} | |
| 120 | +.flatpickr-wrapper { | |
| 121 | + position: relative; | |
| 122 | + display: inline-block; | |
| 123 | +} | |
| 124 | +.flatpickr-month { | |
| 125 | + background: transparent; | |
| 126 | + color: rgba(0,0,0,0.9); | |
| 127 | + fill: rgba(0,0,0,0.9); | |
| 128 | + height: 28px; | |
| 129 | + line-height: 1; | |
| 130 | + text-align: center; | |
| 131 | + position: relative; | |
| 132 | + -webkit-user-select: none; | |
| 133 | + -moz-user-select: none; | |
| 134 | + -ms-user-select: none; | |
| 135 | + user-select: none; | |
| 136 | + overflow: hidden; | |
| 137 | +} | |
| 138 | +.flatpickr-prev-month, | |
| 139 | +.flatpickr-next-month { | |
| 140 | + text-decoration: none; | |
| 141 | + cursor: pointer; | |
| 142 | + position: absolute; | |
| 143 | + top: 0px; | |
| 144 | + line-height: 16px; | |
| 145 | + height: 28px; | |
| 146 | + padding: 10px calc(3.57% - 1.5px); | |
| 147 | + z-index: 3; | |
| 148 | +} | |
| 149 | +.flatpickr-prev-month i, | |
| 150 | +.flatpickr-next-month i { | |
| 151 | + position: relative; | |
| 152 | +} | |
| 153 | +.flatpickr-prev-month.flatpickr-prev-month, | |
| 154 | +.flatpickr-next-month.flatpickr-prev-month { | |
| 155 | +/* | |
| 156 | + /*rtl:begin:ignore*/ | |
| 157 | +/* | |
| 158 | + */ | |
| 159 | + left: 0; | |
| 160 | +/* | |
| 161 | + /*rtl:end:ignore*/ | |
| 162 | +/* | |
| 163 | + */ | |
| 164 | +} | |
| 165 | +/* | |
| 166 | + /*rtl:begin:ignore*/ | |
| 167 | +/* | |
| 168 | + /*rtl:end:ignore*/ | |
| 169 | +.flatpickr-prev-month.flatpickr-next-month, | |
| 170 | +.flatpickr-next-month.flatpickr-next-month { | |
| 171 | +/* | |
| 172 | + /*rtl:begin:ignore*/ | |
| 173 | +/* | |
| 174 | + */ | |
| 175 | + right: 0; | |
| 176 | +/* | |
| 177 | + /*rtl:end:ignore*/ | |
| 178 | +/* | |
| 179 | + */ | |
| 180 | +} | |
| 181 | +/* | |
| 182 | + /*rtl:begin:ignore*/ | |
| 183 | +/* | |
| 184 | + /*rtl:end:ignore*/ | |
| 185 | +.flatpickr-prev-month:hover, | |
| 186 | +.flatpickr-next-month:hover { | |
| 187 | + color: #959ea9; | |
| 188 | +} | |
| 189 | +.flatpickr-prev-month:hover svg, | |
| 190 | +.flatpickr-next-month:hover svg { | |
| 191 | + fill: #f64747; | |
| 192 | +} | |
| 193 | +.flatpickr-prev-month svg, | |
| 194 | +.flatpickr-next-month svg { | |
| 195 | + width: 14px; | |
| 196 | +} | |
| 197 | +.flatpickr-prev-month svg path, | |
| 198 | +.flatpickr-next-month svg path { | |
| 199 | + -webkit-transition: fill 0.1s; | |
| 200 | + transition: fill 0.1s; | |
| 201 | + fill: inherit; | |
| 202 | +} | |
| 203 | +.numInputWrapper { | |
| 204 | + position: relative; | |
| 205 | + height: auto; | |
| 206 | +} | |
| 207 | +.numInputWrapper input, | |
| 208 | +.numInputWrapper span { | |
| 209 | + display: inline-block; | |
| 210 | +} | |
| 211 | +.numInputWrapper input { | |
| 212 | + width: 100%; | |
| 213 | +} | |
| 214 | +.numInputWrapper span { | |
| 215 | + position: absolute; | |
| 216 | + right: 0; | |
| 217 | + width: 14px; | |
| 218 | + padding: 0 4px 0 2px; | |
| 219 | + height: 50%; | |
| 220 | + line-height: 50%; | |
| 221 | + opacity: 0; | |
| 222 | + cursor: pointer; | |
| 223 | + border: 1px solid rgba(57,57,57,0.05); | |
| 224 | + -webkit-box-sizing: border-box; | |
| 225 | + box-sizing: border-box; | |
| 226 | +} | |
| 227 | +.numInputWrapper span:hover { | |
| 228 | + background: rgba(0,0,0,0.1); | |
| 229 | +} | |
| 230 | +.numInputWrapper span:active { | |
| 231 | + background: rgba(0,0,0,0.2); | |
| 232 | +} | |
| 233 | +.numInputWrapper span:after { | |
| 234 | + display: block; | |
| 235 | + content: ""; | |
| 236 | + position: absolute; | |
| 237 | + top: 33%; | |
| 238 | +} | |
| 239 | +.numInputWrapper span.arrowUp { | |
| 240 | + top: 0; | |
| 241 | + border-bottom: 0; | |
| 242 | +} | |
| 243 | +.numInputWrapper span.arrowUp:after { | |
| 244 | + border-left: 4px solid transparent; | |
| 245 | + border-right: 4px solid transparent; | |
| 246 | + border-bottom: 4px solid rgba(57,57,57,0.6); | |
| 247 | +} | |
| 248 | +.numInputWrapper span.arrowDown { | |
| 249 | + top: 50%; | |
| 250 | +} | |
| 251 | +.numInputWrapper span.arrowDown:after { | |
| 252 | + border-left: 4px solid transparent; | |
| 253 | + border-right: 4px solid transparent; | |
| 254 | + border-top: 4px solid rgba(57,57,57,0.6); | |
| 255 | +} | |
| 256 | +.numInputWrapper span svg { | |
| 257 | + width: inherit; | |
| 258 | + height: auto; | |
| 259 | +} | |
| 260 | +.numInputWrapper span svg path { | |
| 261 | + fill: rgba(0,0,0,0.5); | |
| 262 | +} | |
| 263 | +.numInputWrapper:hover { | |
| 264 | + background: rgba(0,0,0,0.05); | |
| 265 | +} | |
| 266 | +.numInputWrapper:hover span { | |
| 267 | + opacity: 1; | |
| 268 | +} | |
| 269 | +.flatpickr-current-month { | |
| 270 | + font-size: 135%; | |
| 271 | + line-height: inherit; | |
| 272 | + font-weight: 300; | |
| 273 | + color: inherit; | |
| 274 | + position: absolute; | |
| 275 | + width: 75%; | |
| 276 | + left: 12.5%; | |
| 277 | + padding: 6.16px 0 0 0; | |
| 278 | + line-height: 1; | |
| 279 | + height: 28px; | |
| 280 | + display: inline-block; | |
| 281 | + text-align: center; | |
| 282 | + -webkit-transform: translate3d(0px, 0px, 0px); | |
| 283 | + transform: translate3d(0px, 0px, 0px); | |
| 284 | +} | |
| 285 | +.flatpickr-current-month.slideLeft { | |
| 286 | + -webkit-transform: translate3d(-100%, 0px, 0px); | |
| 287 | + transform: translate3d(-100%, 0px, 0px); | |
| 288 | + -webkit-animation: fpFadeOut 400ms ease, fpSlideLeft 400ms cubic-bezier(0.23, 1, 0.32, 1); | |
| 289 | + animation: fpFadeOut 400ms ease, fpSlideLeft 400ms cubic-bezier(0.23, 1, 0.32, 1); | |
| 290 | +} | |
| 291 | +.flatpickr-current-month.slideLeftNew { | |
| 292 | + -webkit-transform: translate3d(100%, 0px, 0px); | |
| 293 | + transform: translate3d(100%, 0px, 0px); | |
| 294 | + -webkit-animation: fpFadeIn 400ms ease, fpSlideLeftNew 400ms cubic-bezier(0.23, 1, 0.32, 1); | |
| 295 | + animation: fpFadeIn 400ms ease, fpSlideLeftNew 400ms cubic-bezier(0.23, 1, 0.32, 1); | |
| 296 | +} | |
| 297 | +.flatpickr-current-month.slideRight { | |
| 298 | + -webkit-transform: translate3d(100%, 0px, 0px); | |
| 299 | + transform: translate3d(100%, 0px, 0px); | |
| 300 | + -webkit-animation: fpFadeOut 400ms ease, fpSlideRight 400ms cubic-bezier(0.23, 1, 0.32, 1); | |
| 301 | + animation: fpFadeOut 400ms ease, fpSlideRight 400ms cubic-bezier(0.23, 1, 0.32, 1); | |
| 302 | +} | |
| 303 | +.flatpickr-current-month.slideRightNew { | |
| 304 | + -webkit-transform: translate3d(0, 0, 0px); | |
| 305 | + transform: translate3d(0, 0, 0px); | |
| 306 | + -webkit-animation: fpFadeIn 400ms ease, fpSlideRightNew 400ms cubic-bezier(0.23, 1, 0.32, 1); | |
| 307 | + animation: fpFadeIn 400ms ease, fpSlideRightNew 400ms cubic-bezier(0.23, 1, 0.32, 1); | |
| 308 | +} | |
| 309 | +.flatpickr-current-month span.cur-month { | |
| 310 | + font-family: inherit; | |
| 311 | + font-weight: 700; | |
| 312 | + color: inherit; | |
| 313 | + display: inline-block; | |
| 314 | + margin-left: 0.5ch; | |
| 315 | + padding: 0; | |
| 316 | +} | |
| 317 | +.flatpickr-current-month span.cur-month:hover { | |
| 318 | + background: rgba(0,0,0,0.05); | |
| 319 | +} | |
| 320 | +.flatpickr-current-month .numInputWrapper { | |
| 321 | + width: 6ch; | |
| 322 | + width: 7ch\0; | |
| 323 | + display: inline-block; | |
| 324 | +} | |
| 325 | +.flatpickr-current-month .numInputWrapper span.arrowUp:after { | |
| 326 | + border-bottom-color: rgba(0,0,0,0.9); | |
| 327 | +} | |
| 328 | +.flatpickr-current-month .numInputWrapper span.arrowDown:after { | |
| 329 | + border-top-color: rgba(0,0,0,0.9); | |
| 330 | +} | |
| 331 | +.flatpickr-current-month input.cur-year { | |
| 332 | + background: transparent; | |
| 333 | + -webkit-box-sizing: border-box; | |
| 334 | + box-sizing: border-box; | |
| 335 | + color: inherit; | |
| 336 | + cursor: default; | |
| 337 | + padding: 0 0 0 0.5ch; | |
| 338 | + margin: 0; | |
| 339 | + display: inline-block; | |
| 340 | + font-size: inherit; | |
| 341 | + font-family: inherit; | |
| 342 | + font-weight: 300; | |
| 343 | + line-height: inherit; | |
| 344 | + height: initial; | |
| 345 | + border: 0; | |
| 346 | + border-radius: 0; | |
| 347 | + vertical-align: initial; | |
| 348 | +} | |
| 349 | +.flatpickr-current-month input.cur-year:focus { | |
| 350 | + outline: 0; | |
| 351 | +} | |
| 352 | +.flatpickr-current-month input.cur-year[disabled], | |
| 353 | +.flatpickr-current-month input.cur-year[disabled]:hover { | |
| 354 | + font-size: 100%; | |
| 355 | + color: rgba(0,0,0,0.5); | |
| 356 | + background: transparent; | |
| 357 | + pointer-events: none; | |
| 358 | +} | |
| 359 | +.flatpickr-weekdays { | |
| 360 | + background: transparent; | |
| 361 | + text-align: center; | |
| 362 | + overflow: hidden; | |
| 363 | + width: 100%; | |
| 364 | + display: -webkit-box; | |
| 365 | + display: -webkit-flex; | |
| 366 | + display: -ms-flexbox; | |
| 367 | + display: flex; | |
| 368 | + -webkit-box-align: center; | |
| 369 | + -webkit-align-items: center; | |
| 370 | + -ms-flex-align: center; | |
| 371 | + align-items: center; | |
| 372 | + height: 28px; | |
| 373 | +} | |
| 374 | +span.flatpickr-weekday { | |
| 375 | + cursor: default; | |
| 376 | + font-size: 90%; | |
| 377 | + background: transparent; | |
| 378 | + color: rgba(0,0,0,0.54); | |
| 379 | + line-height: 1; | |
| 380 | + margin: 0; | |
| 381 | + text-align: center; | |
| 382 | + display: block; | |
| 383 | + -webkit-box-flex: 1; | |
| 384 | + -webkit-flex: 1; | |
| 385 | + -ms-flex: 1; | |
| 386 | + flex: 1; | |
| 387 | + font-weight: bolder; | |
| 388 | +} | |
| 389 | +.dayContainer, | |
| 390 | +.flatpickr-weeks { | |
| 391 | + padding: 1px 0 0 0; | |
| 392 | +} | |
| 393 | +.flatpickr-days { | |
| 394 | + position: relative; | |
| 395 | + overflow: hidden; | |
| 396 | + display: -webkit-box; | |
| 397 | + display: -webkit-flex; | |
| 398 | + display: -ms-flexbox; | |
| 399 | + display: flex; | |
| 400 | + width: 307.875px; | |
| 401 | +} | |
| 402 | +.flatpickr-days:focus { | |
| 403 | + outline: 0; | |
| 404 | +} | |
| 405 | +.dayContainer { | |
| 406 | + padding: 0; | |
| 407 | + outline: 0; | |
| 408 | + text-align: left; | |
| 409 | + width: 307.875px; | |
| 410 | + min-width: 307.875px; | |
| 411 | + max-width: 307.875px; | |
| 412 | + -webkit-box-sizing: border-box; | |
| 413 | + box-sizing: border-box; | |
| 414 | + display: inline-block; | |
| 415 | + display: -ms-flexbox; | |
| 416 | + display: -webkit-box; | |
| 417 | + display: -webkit-flex; | |
| 418 | + display: flex; | |
| 419 | + -webkit-flex-wrap: wrap; | |
| 420 | + flex-wrap: wrap; | |
| 421 | + -ms-flex-wrap: wrap; | |
| 422 | + -ms-flex-pack: justify; | |
| 423 | + -webkit-justify-content: space-around; | |
| 424 | + justify-content: space-around; | |
| 425 | + -webkit-transform: translate3d(0px, 0px, 0px); | |
| 426 | + transform: translate3d(0px, 0px, 0px); | |
| 427 | + opacity: 1; | |
| 428 | +} | |
| 429 | +.flatpickr-calendar.animate .dayContainer.slideLeft { | |
| 430 | + -webkit-animation: fpFadeOut 400ms cubic-bezier(0.23, 1, 0.32, 1), fpSlideLeft 400ms cubic-bezier(0.23, 1, 0.32, 1); | |
| 431 | + animation: fpFadeOut 400ms cubic-bezier(0.23, 1, 0.32, 1), fpSlideLeft 400ms cubic-bezier(0.23, 1, 0.32, 1); | |
| 432 | +} | |
| 433 | +.flatpickr-calendar.animate .dayContainer.slideLeft, | |
| 434 | +.flatpickr-calendar.animate .dayContainer.slideLeftNew { | |
| 435 | + -webkit-transform: translate3d(-100%, 0px, 0px); | |
| 436 | + transform: translate3d(-100%, 0px, 0px); | |
| 437 | +} | |
| 438 | +.flatpickr-calendar.animate .dayContainer.slideLeftNew { | |
| 439 | + -webkit-animation: fpFadeIn 400ms cubic-bezier(0.23, 1, 0.32, 1), fpSlideLeft 400ms cubic-bezier(0.23, 1, 0.32, 1); | |
| 440 | + animation: fpFadeIn 400ms cubic-bezier(0.23, 1, 0.32, 1), fpSlideLeft 400ms cubic-bezier(0.23, 1, 0.32, 1); | |
| 441 | +} | |
| 442 | +.flatpickr-calendar.animate .dayContainer.slideRight { | |
| 443 | + -webkit-animation: fpFadeOut 400ms cubic-bezier(0.23, 1, 0.32, 1), fpSlideRight 400ms cubic-bezier(0.23, 1, 0.32, 1); | |
| 444 | + animation: fpFadeOut 400ms cubic-bezier(0.23, 1, 0.32, 1), fpSlideRight 400ms cubic-bezier(0.23, 1, 0.32, 1); | |
| 445 | + -webkit-transform: translate3d(100%, 0px, 0px); | |
| 446 | + transform: translate3d(100%, 0px, 0px); | |
| 447 | +} | |
| 448 | +.flatpickr-calendar.animate .dayContainer.slideRightNew { | |
| 449 | + -webkit-animation: fpFadeIn 400ms cubic-bezier(0.23, 1, 0.32, 1), fpSlideRightNew 400ms cubic-bezier(0.23, 1, 0.32, 1); | |
| 450 | + animation: fpFadeIn 400ms cubic-bezier(0.23, 1, 0.32, 1), fpSlideRightNew 400ms cubic-bezier(0.23, 1, 0.32, 1); | |
| 451 | +} | |
| 452 | +.flatpickr-day { | |
| 453 | + background: none; | |
| 454 | + border: 1px solid transparent; | |
| 455 | + border-radius: 150px; | |
| 456 | + -webkit-box-sizing: border-box; | |
| 457 | + box-sizing: border-box; | |
| 458 | + color: #393939; | |
| 459 | + cursor: pointer; | |
| 460 | + font-weight: 400; | |
| 461 | + width: 14.2857143%; | |
| 462 | + -webkit-flex-basis: 14.2857143%; | |
| 463 | + -ms-flex-preferred-size: 14.2857143%; | |
| 464 | + flex-basis: 14.2857143%; | |
| 465 | + max-width: 39px; | |
| 466 | + height: 39px; | |
| 467 | + line-height: 39px; | |
| 468 | + margin: 0; | |
| 469 | + display: inline-block; | |
| 470 | + position: relative; | |
| 471 | + -webkit-box-pack: center; | |
| 472 | + -webkit-justify-content: center; | |
| 473 | + -ms-flex-pack: center; | |
| 474 | + justify-content: center; | |
| 475 | + text-align: center; | |
| 476 | +} | |
| 477 | +.flatpickr-day.inRange, | |
| 478 | +.flatpickr-day.prevMonthDay.inRange, | |
| 479 | +.flatpickr-day.nextMonthDay.inRange, | |
| 480 | +.flatpickr-day.today.inRange, | |
| 481 | +.flatpickr-day.prevMonthDay.today.inRange, | |
| 482 | +.flatpickr-day.nextMonthDay.today.inRange, | |
| 483 | +.flatpickr-day:hover, | |
| 484 | +.flatpickr-day.prevMonthDay:hover, | |
| 485 | +.flatpickr-day.nextMonthDay:hover, | |
| 486 | +.flatpickr-day:focus, | |
| 487 | +.flatpickr-day.prevMonthDay:focus, | |
| 488 | +.flatpickr-day.nextMonthDay:focus { | |
| 489 | + cursor: pointer; | |
| 490 | + outline: 0; | |
| 491 | + background: #e6e6e6; | |
| 492 | + border-color: #e6e6e6; | |
| 493 | +} | |
| 494 | +.flatpickr-day.today { | |
| 495 | + border-color: #959ea9; | |
| 496 | +} | |
| 497 | +.flatpickr-day.today:hover, | |
| 498 | +.flatpickr-day.today:focus { | |
| 499 | + border-color: #959ea9; | |
| 500 | + background: #959ea9; | |
| 501 | + color: #fff; | |
| 502 | +} | |
| 503 | +.flatpickr-day.selected, | |
| 504 | +.flatpickr-day.startRange, | |
| 505 | +.flatpickr-day.endRange, | |
| 506 | +.flatpickr-day.selected.inRange, | |
| 507 | +.flatpickr-day.startRange.inRange, | |
| 508 | +.flatpickr-day.endRange.inRange, | |
| 509 | +.flatpickr-day.selected:focus, | |
| 510 | +.flatpickr-day.startRange:focus, | |
| 511 | +.flatpickr-day.endRange:focus, | |
| 512 | +.flatpickr-day.selected:hover, | |
| 513 | +.flatpickr-day.startRange:hover, | |
| 514 | +.flatpickr-day.endRange:hover, | |
| 515 | +.flatpickr-day.selected.prevMonthDay, | |
| 516 | +.flatpickr-day.startRange.prevMonthDay, | |
| 517 | +.flatpickr-day.endRange.prevMonthDay, | |
| 518 | +.flatpickr-day.selected.nextMonthDay, | |
| 519 | +.flatpickr-day.startRange.nextMonthDay, | |
| 520 | +.flatpickr-day.endRange.nextMonthDay { | |
| 521 | + background: #569ff7; | |
| 522 | + -webkit-box-shadow: none; | |
| 523 | + box-shadow: none; | |
| 524 | + color: #fff; | |
| 525 | + border-color: #569ff7; | |
| 526 | +} | |
| 527 | +.flatpickr-day.selected.startRange, | |
| 528 | +.flatpickr-day.startRange.startRange, | |
| 529 | +.flatpickr-day.endRange.startRange { | |
| 530 | + border-radius: 50px 0 0 50px; | |
| 531 | +} | |
| 532 | +.flatpickr-day.selected.endRange, | |
| 533 | +.flatpickr-day.startRange.endRange, | |
| 534 | +.flatpickr-day.endRange.endRange { | |
| 535 | + border-radius: 0 50px 50px 0; | |
| 536 | +} | |
| 537 | +.flatpickr-day.selected.startRange + .endRange, | |
| 538 | +.flatpickr-day.startRange.startRange + .endRange, | |
| 539 | +.flatpickr-day.endRange.startRange + .endRange { | |
| 540 | + -webkit-box-shadow: -10px 0 0 #569ff7; | |
| 541 | + box-shadow: -10px 0 0 #569ff7; | |
| 542 | +} | |
| 543 | +.flatpickr-day.selected.startRange.endRange, | |
| 544 | +.flatpickr-day.startRange.startRange.endRange, | |
| 545 | +.flatpickr-day.endRange.startRange.endRange { | |
| 546 | + border-radius: 50px; | |
| 547 | +} | |
| 548 | +.flatpickr-day.inRange { | |
| 549 | + border-radius: 0; | |
| 550 | + -webkit-box-shadow: -5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6; | |
| 551 | + box-shadow: -5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6; | |
| 552 | +} | |
| 553 | +.flatpickr-day.disabled, | |
| 554 | +.flatpickr-day.disabled:hover { | |
| 555 | + pointer-events: none; | |
| 556 | +} | |
| 557 | +.flatpickr-day.disabled, | |
| 558 | +.flatpickr-day.disabled:hover, | |
| 559 | +.flatpickr-day.prevMonthDay, | |
| 560 | +.flatpickr-day.nextMonthDay, | |
| 561 | +.flatpickr-day.notAllowed, | |
| 562 | +.flatpickr-day.notAllowed.prevMonthDay, | |
| 563 | +.flatpickr-day.notAllowed.nextMonthDay { | |
| 564 | + color: rgba(57,57,57,0.3); | |
| 565 | + background: transparent; | |
| 566 | + border-color: transparent; | |
| 567 | + cursor: default; | |
| 568 | +} | |
| 569 | +.flatpickr-day.week.selected { | |
| 570 | + border-radius: 0; | |
| 571 | + -webkit-box-shadow: -5px 0 0 #569ff7, 5px 0 0 #569ff7; | |
| 572 | + box-shadow: -5px 0 0 #569ff7, 5px 0 0 #569ff7; | |
| 573 | +} | |
| 574 | +.rangeMode .flatpickr-day { | |
| 575 | + margin-top: 1px; | |
| 576 | +} | |
| 577 | +.flatpickr-weekwrapper { | |
| 578 | + display: inline-block; | |
| 579 | + float: left; | |
| 580 | +} | |
| 581 | +.flatpickr-weekwrapper .flatpickr-weeks { | |
| 582 | + padding: 0 12px; | |
| 583 | + -webkit-box-shadow: 1px 0 0 #e6e6e6; | |
| 584 | + box-shadow: 1px 0 0 #e6e6e6; | |
| 585 | +} | |
| 586 | +.flatpickr-weekwrapper .flatpickr-weekday { | |
| 587 | + float: none; | |
| 588 | + width: 100%; | |
| 589 | + line-height: 28px; | |
| 590 | +} | |
| 591 | +.flatpickr-weekwrapper span.flatpickr-day { | |
| 592 | + display: block; | |
| 593 | + width: 100%; | |
| 594 | + max-width: none; | |
| 595 | +} | |
| 596 | +.flatpickr-innerContainer { | |
| 597 | + display: block; | |
| 598 | + display: -webkit-box; | |
| 599 | + display: -webkit-flex; | |
| 600 | + display: -ms-flexbox; | |
| 601 | + display: flex; | |
| 602 | + -webkit-box-sizing: border-box; | |
| 603 | + box-sizing: border-box; | |
| 604 | + overflow: hidden; | |
| 605 | +} | |
| 606 | +.flatpickr-rContainer { | |
| 607 | + display: inline-block; | |
| 608 | + padding: 0; | |
| 609 | + -webkit-box-sizing: border-box; | |
| 610 | + box-sizing: border-box; | |
| 611 | +} | |
| 612 | +.flatpickr-time { | |
| 613 | + text-align: center; | |
| 614 | + outline: 0; | |
| 615 | + display: block; | |
| 616 | + height: 0; | |
| 617 | + line-height: 40px; | |
| 618 | + max-height: 40px; | |
| 619 | + -webkit-box-sizing: border-box; | |
| 620 | + box-sizing: border-box; | |
| 621 | + overflow: hidden; | |
| 622 | + display: -webkit-box; | |
| 623 | + display: -webkit-flex; | |
| 624 | + display: -ms-flexbox; | |
| 625 | + display: flex; | |
| 626 | +} | |
| 627 | +.flatpickr-time:after { | |
| 628 | + content: ""; | |
| 629 | + display: table; | |
| 630 | + clear: both; | |
| 631 | +} | |
| 632 | +.flatpickr-time .numInputWrapper { | |
| 633 | + -webkit-box-flex: 1; | |
| 634 | + -webkit-flex: 1; | |
| 635 | + -ms-flex: 1; | |
| 636 | + flex: 1; | |
| 637 | + width: 40%; | |
| 638 | + height: 40px; | |
| 639 | + float: left; | |
| 640 | +} | |
| 641 | +.flatpickr-time .numInputWrapper span.arrowUp:after { | |
| 642 | + border-bottom-color: #393939; | |
| 643 | +} | |
| 644 | +.flatpickr-time .numInputWrapper span.arrowDown:after { | |
| 645 | + border-top-color: #393939; | |
| 646 | +} | |
| 647 | +.flatpickr-time.hasSeconds .numInputWrapper { | |
| 648 | + width: 26%; | |
| 649 | +} | |
| 650 | +.flatpickr-time.time24hr .numInputWrapper { | |
| 651 | + width: 49%; | |
| 652 | +} | |
| 653 | +.flatpickr-time input { | |
| 654 | + background: transparent; | |
| 655 | + -webkit-box-shadow: none; | |
| 656 | + box-shadow: none; | |
| 657 | + border: 0; | |
| 658 | + border-radius: 0; | |
| 659 | + text-align: center; | |
| 660 | + margin: 0; | |
| 661 | + padding: 0; | |
| 662 | + height: inherit; | |
| 663 | + line-height: inherit; | |
| 664 | + cursor: pointer; | |
| 665 | + color: #393939; | |
| 666 | + font-size: 14px; | |
| 667 | + position: relative; | |
| 668 | + -webkit-box-sizing: border-box; | |
| 669 | + box-sizing: border-box; | |
| 670 | +} | |
| 671 | +.flatpickr-time input.flatpickr-hour { | |
| 672 | + font-weight: bold; | |
| 673 | +} | |
| 674 | +.flatpickr-time input.flatpickr-minute, | |
| 675 | +.flatpickr-time input.flatpickr-second { | |
| 676 | + font-weight: 400; | |
| 677 | +} | |
| 678 | +.flatpickr-time input:focus { | |
| 679 | + outline: 0; | |
| 680 | + border: 0; | |
| 681 | +} | |
| 682 | +.flatpickr-time .flatpickr-time-separator, | |
| 683 | +.flatpickr-time .flatpickr-am-pm { | |
| 684 | + height: inherit; | |
| 685 | + display: inline-block; | |
| 686 | + float: left; | |
| 687 | + line-height: inherit; | |
| 688 | + color: #393939; | |
| 689 | + font-weight: bold; | |
| 690 | + width: 2%; | |
| 691 | + -webkit-user-select: none; | |
| 692 | + -moz-user-select: none; | |
| 693 | + -ms-user-select: none; | |
| 694 | + user-select: none; | |
| 695 | + -webkit-align-self: center; | |
| 696 | + -ms-flex-item-align: center; | |
| 697 | + align-self: center; | |
| 698 | +} | |
| 699 | +.flatpickr-time .flatpickr-am-pm { | |
| 700 | + outline: 0; | |
| 701 | + width: 18%; | |
| 702 | + cursor: pointer; | |
| 703 | + text-align: center; | |
| 704 | + font-weight: 400; | |
| 705 | +} | |
| 706 | +.flatpickr-time .flatpickr-am-pm:hover, | |
| 707 | +.flatpickr-time .flatpickr-am-pm:focus { | |
| 708 | + background: #f0f0f0; | |
| 709 | +} | |
| 710 | +.flatpickr-input[readonly] { | |
| 711 | + cursor: pointer; | |
| 712 | +} | |
| 713 | +@-webkit-keyframes fpFadeInDown { | |
| 714 | + from { | |
| 715 | + opacity: 0; | |
| 716 | + -webkit-transform: translate3d(0, -20px, 0); | |
| 717 | + transform: translate3d(0, -20px, 0); | |
| 718 | + } | |
| 719 | + to { | |
| 720 | + opacity: 1; | |
| 721 | + -webkit-transform: translate3d(0, 0, 0); | |
| 722 | + transform: translate3d(0, 0, 0); | |
| 723 | + } | |
| 724 | +} | |
| 725 | +@keyframes fpFadeInDown { | |
| 726 | + from { | |
| 727 | + opacity: 0; | |
| 728 | + -webkit-transform: translate3d(0, -20px, 0); | |
| 729 | + transform: translate3d(0, -20px, 0); | |
| 730 | + } | |
| 731 | + to { | |
| 732 | + opacity: 1; | |
| 733 | + -webkit-transform: translate3d(0, 0, 0); | |
| 734 | + transform: translate3d(0, 0, 0); | |
| 735 | + } | |
| 736 | +} | |
| 737 | +@-webkit-keyframes fpSlideLeft { | |
| 738 | + from { | |
| 739 | + -webkit-transform: translate3d(0px, 0px, 0px); | |
| 740 | + transform: translate3d(0px, 0px, 0px); | |
| 741 | + } | |
| 742 | + to { | |
| 743 | + -webkit-transform: translate3d(-100%, 0px, 0px); | |
| 744 | + transform: translate3d(-100%, 0px, 0px); | |
| 745 | + } | |
| 746 | +} | |
| 747 | +@keyframes fpSlideLeft { | |
| 748 | + from { | |
| 749 | + -webkit-transform: translate3d(0px, 0px, 0px); | |
| 750 | + transform: translate3d(0px, 0px, 0px); | |
| 751 | + } | |
| 752 | + to { | |
| 753 | + -webkit-transform: translate3d(-100%, 0px, 0px); | |
| 754 | + transform: translate3d(-100%, 0px, 0px); | |
| 755 | + } | |
| 756 | +} | |
| 757 | +@-webkit-keyframes fpSlideLeftNew { | |
| 758 | + from { | |
| 759 | + -webkit-transform: translate3d(100%, 0px, 0px); | |
| 760 | + transform: translate3d(100%, 0px, 0px); | |
| 761 | + } | |
| 762 | + to { | |
| 763 | + -webkit-transform: translate3d(0px, 0px, 0px); | |
| 764 | + transform: translate3d(0px, 0px, 0px); | |
| 765 | + } | |
| 766 | +} | |
| 767 | +@keyframes fpSlideLeftNew { | |
| 768 | + from { | |
| 769 | + -webkit-transform: translate3d(100%, 0px, 0px); | |
| 770 | + transform: translate3d(100%, 0px, 0px); | |
| 771 | + } | |
| 772 | + to { | |
| 773 | + -webkit-transform: translate3d(0px, 0px, 0px); | |
| 774 | + transform: translate3d(0px, 0px, 0px); | |
| 775 | + } | |
| 776 | +} | |
| 777 | +@-webkit-keyframes fpSlideRight { | |
| 778 | + from { | |
| 779 | + -webkit-transform: translate3d(0, 0, 0px); | |
| 780 | + transform: translate3d(0, 0, 0px); | |
| 781 | + } | |
| 782 | + to { | |
| 783 | + -webkit-transform: translate3d(100%, 0px, 0px); | |
| 784 | + transform: translate3d(100%, 0px, 0px); | |
| 785 | + } | |
| 786 | +} | |
| 787 | +@keyframes fpSlideRight { | |
| 788 | + from { | |
| 789 | + -webkit-transform: translate3d(0, 0, 0px); | |
| 790 | + transform: translate3d(0, 0, 0px); | |
| 791 | + } | |
| 792 | + to { | |
| 793 | + -webkit-transform: translate3d(100%, 0px, 0px); | |
| 794 | + transform: translate3d(100%, 0px, 0px); | |
| 795 | + } | |
| 796 | +} | |
| 797 | +@-webkit-keyframes fpSlideRightNew { | |
| 798 | + from { | |
| 799 | + -webkit-transform: translate3d(-100%, 0, 0px); | |
| 800 | + transform: translate3d(-100%, 0, 0px); | |
| 801 | + } | |
| 802 | + to { | |
| 803 | + -webkit-transform: translate3d(0, 0, 0px); | |
| 804 | + transform: translate3d(0, 0, 0px); | |
| 805 | + } | |
| 806 | +} | |
| 807 | +@keyframes fpSlideRightNew { | |
| 808 | + from { | |
| 809 | + -webkit-transform: translate3d(-100%, 0, 0px); | |
| 810 | + transform: translate3d(-100%, 0, 0px); | |
| 811 | + } | |
| 812 | + to { | |
| 813 | + -webkit-transform: translate3d(0, 0, 0px); | |
| 814 | + transform: translate3d(0, 0, 0px); | |
| 815 | + } | |
| 816 | +} | |
| 817 | +@-webkit-keyframes fpFadeOut { | |
| 818 | + from { | |
| 819 | + opacity: 1; | |
| 820 | + } | |
| 821 | + to { | |
| 822 | + opacity: 0; | |
| 823 | + } | |
| 824 | +} | |
| 825 | +@keyframes fpFadeOut { | |
| 826 | + from { | |
| 827 | + opacity: 1; | |
| 828 | + } | |
| 829 | + to { | |
| 830 | + opacity: 0; | |
| 831 | + } | |
| 832 | +} | |
| 833 | +@-webkit-keyframes fpFadeIn { | |
| 834 | + from { | |
| 835 | + opacity: 0; | |
| 836 | + } | |
| 837 | + to { | |
| 838 | + opacity: 1; | |
| 839 | + } | |
| 840 | +} | |
| 841 | +@keyframes fpFadeIn { | |
| 842 | + from { | |
| 843 | + opacity: 0; | |
| 844 | + } | |
| 845 | + to { | |
| 846 | + opacity: 1; | |
| 847 | + } | |
| 848 | +} | ... | ... |
src/main/resources/static/real_control_v2/assets/plugins/flatpickr/flatpickr.js
0 → 100644
| 1 | +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | |
| 2 | + | |
| 3 | +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
| 4 | + | |
| 5 | +/*! flatpickr v3.0.5-1, @license MIT */ | |
| 6 | +function FlatpickrInstance(element, config) { | |
| 7 | + var self = this; | |
| 8 | + | |
| 9 | + self._ = {}; | |
| 10 | + self._.afterDayAnim = afterDayAnim; | |
| 11 | + self._bind = bind; | |
| 12 | + self._compareDates = compareDates; | |
| 13 | + self._setHoursFromDate = setHoursFromDate; | |
| 14 | + self.changeMonth = changeMonth; | |
| 15 | + self.changeYear = changeYear; | |
| 16 | + self.clear = clear; | |
| 17 | + self.close = close; | |
| 18 | + self._createElement = createElement; | |
| 19 | + self.destroy = destroy; | |
| 20 | + self.isEnabled = isEnabled; | |
| 21 | + self.jumpToDate = jumpToDate; | |
| 22 | + self.open = open; | |
| 23 | + self.redraw = redraw; | |
| 24 | + self.set = set; | |
| 25 | + self.setDate = setDate; | |
| 26 | + self.toggle = toggle; | |
| 27 | + | |
| 28 | + function init() { | |
| 29 | + self.element = self.input = element; | |
| 30 | + self.instanceConfig = config || {}; | |
| 31 | + self.parseDate = FlatpickrInstance.prototype.parseDate.bind(self); | |
| 32 | + self.formatDate = FlatpickrInstance.prototype.formatDate.bind(self); | |
| 33 | + | |
| 34 | + setupFormats(); | |
| 35 | + parseConfig(); | |
| 36 | + setupLocale(); | |
| 37 | + setupInputs(); | |
| 38 | + setupDates(); | |
| 39 | + setupHelperFunctions(); | |
| 40 | + | |
| 41 | + self.isOpen = false; | |
| 42 | + | |
| 43 | + self.isMobile = !self.config.disableMobile && !self.config.inline && self.config.mode === "single" && !self.config.disable.length && !self.config.enable.length && !self.config.weekNumbers && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); | |
| 44 | + | |
| 45 | + if (!self.isMobile) build(); | |
| 46 | + | |
| 47 | + bindEvents(); | |
| 48 | + | |
| 49 | + if (self.selectedDates.length || self.config.noCalendar) { | |
| 50 | + if (self.config.enableTime) { | |
| 51 | + setHoursFromDate(self.config.noCalendar ? self.latestSelectedDateObj || self.config.minDate : null); | |
| 52 | + } | |
| 53 | + updateValue(); | |
| 54 | + } | |
| 55 | + | |
| 56 | + self.showTimeInput = self.selectedDates.length > 0 || self.config.noCalendar; | |
| 57 | + | |
| 58 | + if (self.config.weekNumbers) { | |
| 59 | + self.calendarContainer.style.width = self.daysContainer.offsetWidth + self.weekWrapper.offsetWidth + "px"; | |
| 60 | + } | |
| 61 | + | |
| 62 | + if (!self.isMobile) positionCalendar(); | |
| 63 | + | |
| 64 | + triggerEvent("Ready"); | |
| 65 | + } | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * Binds a function to the current flatpickr instance | |
| 69 | + * @param {Function} fn the function | |
| 70 | + * @return {Function} the function bound to the instance | |
| 71 | + */ | |
| 72 | + function bindToInstance(fn) { | |
| 73 | + return fn.bind(self); | |
| 74 | + } | |
| 75 | + | |
| 76 | + /** | |
| 77 | + * The handler for all events targeting the time inputs | |
| 78 | + * @param {Event} e the event - "input", "wheel", "increment", etc | |
| 79 | + */ | |
| 80 | + function updateTime(e) { | |
| 81 | + if (self.config.noCalendar && !self.selectedDates.length) | |
| 82 | + // picking time only | |
| 83 | + self.selectedDates = [self.now]; | |
| 84 | + | |
| 85 | + timeWrapper(e); | |
| 86 | + | |
| 87 | + if (!self.selectedDates.length) return; | |
| 88 | + | |
| 89 | + if (!self.minDateHasTime || e.type !== "input" || e.target.value.length >= 2) { | |
| 90 | + setHoursFromInputs(); | |
| 91 | + updateValue(); | |
| 92 | + } else { | |
| 93 | + setTimeout(function () { | |
| 94 | + setHoursFromInputs(); | |
| 95 | + updateValue(); | |
| 96 | + }, 1000); | |
| 97 | + } | |
| 98 | + } | |
| 99 | + | |
| 100 | + /** | |
| 101 | + * Syncs the selected date object time with user's time input | |
| 102 | + */ | |
| 103 | + function setHoursFromInputs() { | |
| 104 | + if (!self.config.enableTime) return; | |
| 105 | + | |
| 106 | + var hours = (parseInt(self.hourElement.value, 10) || 0) % (self.amPM ? 12 : 24), | |
| 107 | + minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, | |
| 108 | + seconds = self.config.enableSeconds ? (parseInt(self.secondElement.value, 10) || 0) % 60 : 0; | |
| 109 | + | |
| 110 | + if (self.amPM !== undefined) hours = hours % 12 + 12 * (self.amPM.textContent === "PM"); | |
| 111 | + | |
| 112 | + if (self.minDateHasTime && compareDates(self.latestSelectedDateObj, self.config.minDate) === 0) { | |
| 113 | + | |
| 114 | + hours = Math.max(hours, self.config.minDate.getHours()); | |
| 115 | + if (hours === self.config.minDate.getHours()) minutes = Math.max(minutes, self.config.minDate.getMinutes()); | |
| 116 | + } | |
| 117 | + | |
| 118 | + if (self.maxDateHasTime && compareDates(self.latestSelectedDateObj, self.config.maxDate) === 0) { | |
| 119 | + hours = Math.min(hours, self.config.maxDate.getHours()); | |
| 120 | + if (hours === self.config.maxDate.getHours()) minutes = Math.min(minutes, self.config.maxDate.getMinutes()); | |
| 121 | + } | |
| 122 | + | |
| 123 | + setHours(hours, minutes, seconds); | |
| 124 | + } | |
| 125 | + | |
| 126 | + /** | |
| 127 | + * Syncs time input values with a date | |
| 128 | + * @param {Date} dateObj the date to sync with | |
| 129 | + */ | |
| 130 | + function setHoursFromDate(dateObj) { | |
| 131 | + var date = dateObj || self.latestSelectedDateObj; | |
| 132 | + | |
| 133 | + if (date) setHours(date.getHours(), date.getMinutes(), date.getSeconds()); | |
| 134 | + } | |
| 135 | + | |
| 136 | + /** | |
| 137 | + * Sets the hours, minutes, and optionally seconds | |
| 138 | + * of the latest selected date object and the | |
| 139 | + * corresponding time inputs | |
| 140 | + * @param {Number} hours the hour. whether its military | |
| 141 | + * or am-pm gets inferred from config | |
| 142 | + * @param {Number} minutes the minutes | |
| 143 | + * @param {Number} seconds the seconds (optional) | |
| 144 | + */ | |
| 145 | + function setHours(hours, minutes, seconds) { | |
| 146 | + if (self.selectedDates.length) { | |
| 147 | + self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0); | |
| 148 | + } | |
| 149 | + | |
| 150 | + if (!self.config.enableTime || self.isMobile) return; | |
| 151 | + | |
| 152 | + self.hourElement.value = self.pad(!self.config.time_24hr ? (12 + hours) % 12 + 12 * (hours % 12 === 0) : hours); | |
| 153 | + | |
| 154 | + self.minuteElement.value = self.pad(minutes); | |
| 155 | + | |
| 156 | + if (!self.config.time_24hr) self.amPM.textContent = hours >= 12 ? "PM" : "AM"; | |
| 157 | + | |
| 158 | + if (self.config.enableSeconds === true) self.secondElement.value = self.pad(seconds); | |
| 159 | + } | |
| 160 | + | |
| 161 | + /** | |
| 162 | + * Handles the year input and incrementing events | |
| 163 | + * @param {Event} event the keyup or increment event | |
| 164 | + */ | |
| 165 | + function onYearInput(event) { | |
| 166 | + var year = event.target.value; | |
| 167 | + if (event.delta) year = (parseInt(year) + event.delta).toString(); | |
| 168 | + | |
| 169 | + if (year.length === 4 || event.key === "Enter") { | |
| 170 | + self.currentYearElement.blur(); | |
| 171 | + if (!/[^\d]/.test(year)) changeYear(year); | |
| 172 | + } | |
| 173 | + } | |
| 174 | + | |
| 175 | + /** | |
| 176 | + * Essentially addEventListener + tracking | |
| 177 | + * @param {Element} element the element to addEventListener to | |
| 178 | + * @param {String} event the event name | |
| 179 | + * @param {Function} handler the event handler | |
| 180 | + */ | |
| 181 | + function bind(element, event, handler) { | |
| 182 | + if (event instanceof Array) return event.forEach(function (ev) { | |
| 183 | + return bind(element, ev, handler); | |
| 184 | + }); | |
| 185 | + | |
| 186 | + if (element instanceof Array) return element.forEach(function (el) { | |
| 187 | + return bind(el, event, handler); | |
| 188 | + }); | |
| 189 | + | |
| 190 | + element.addEventListener(event, handler); | |
| 191 | + self._handlers.push({ element: element, event: event, handler: handler }); | |
| 192 | + } | |
| 193 | + | |
| 194 | + /** | |
| 195 | + * A mousedown handler which mimics click. | |
| 196 | + * Minimizes latency, since we don't need to wait for mouseup in most cases. | |
| 197 | + * Also, avoids handling right clicks. | |
| 198 | + * | |
| 199 | + * @param {Function} handler the event handler | |
| 200 | + */ | |
| 201 | + function onClick(handler) { | |
| 202 | + return function (evt) { | |
| 203 | + return evt.which === 1 && handler(evt); | |
| 204 | + }; | |
| 205 | + } | |
| 206 | + | |
| 207 | + /** | |
| 208 | + * Adds all the necessary event listeners | |
| 209 | + */ | |
| 210 | + function bindEvents() { | |
| 211 | + self._handlers = []; | |
| 212 | + self._animationLoop = []; | |
| 213 | + if (self.config.wrap) { | |
| 214 | + ["open", "close", "toggle", "clear"].forEach(function (evt) { | |
| 215 | + Array.prototype.forEach.call(self.element.querySelectorAll("[data-" + evt + "]"), function (el) { | |
| 216 | + return bind(el, "mousedown", onClick(self[evt])); | |
| 217 | + }); | |
| 218 | + }); | |
| 219 | + } | |
| 220 | + | |
| 221 | + if (self.isMobile) return setupMobile(); | |
| 222 | + | |
| 223 | + self.debouncedResize = debounce(onResize, 50); | |
| 224 | + self.triggerChange = function () { | |
| 225 | + triggerEvent("Change"); | |
| 226 | + }; | |
| 227 | + self.debouncedChange = debounce(self.triggerChange, 300); | |
| 228 | + | |
| 229 | + if (self.config.mode === "range" && self.daysContainer) bind(self.daysContainer, "mouseover", function (e) { | |
| 230 | + return onMouseOver(e.target); | |
| 231 | + }); | |
| 232 | + | |
| 233 | + bind(window.document.body, "keydown", onKeyDown); | |
| 234 | + | |
| 235 | + if (!self.config.static) bind(self._input, "keydown", onKeyDown); | |
| 236 | + | |
| 237 | + if (!self.config.inline && !self.config.static) bind(window, "resize", self.debouncedResize); | |
| 238 | + | |
| 239 | + if (window.ontouchstart !== undefined) bind(window.document, "touchstart", documentClick); | |
| 240 | + | |
| 241 | + bind(window.document, "mousedown", onClick(documentClick)); | |
| 242 | + bind(self._input, "blur", documentClick); | |
| 243 | + | |
| 244 | + if (self.config.clickOpens === true) { | |
| 245 | + bind(self._input, "focus", self.open); | |
| 246 | + bind(self._input, "mousedown", onClick(self.open)); | |
| 247 | + } | |
| 248 | + | |
| 249 | + if (!self.config.noCalendar) { | |
| 250 | + self.monthNav.addEventListener("wheel", function (e) { | |
| 251 | + return e.preventDefault(); | |
| 252 | + }); | |
| 253 | + bind(self.monthNav, "wheel", debounce(onMonthNavScroll, 10)); | |
| 254 | + bind(self.monthNav, "mousedown", onClick(onMonthNavClick)); | |
| 255 | + | |
| 256 | + bind(self.monthNav, ["keyup", "increment"], onYearInput); | |
| 257 | + bind(self.daysContainer, "mousedown", onClick(selectDate)); | |
| 258 | + | |
| 259 | + if (self.config.animate) { | |
| 260 | + bind(self.daysContainer, ["webkitAnimationEnd", "animationend"], animateDays); | |
| 261 | + bind(self.monthNav, ["webkitAnimationEnd", "animationend"], animateMonths); | |
| 262 | + } | |
| 263 | + } | |
| 264 | + | |
| 265 | + if (self.config.enableTime) { | |
| 266 | + var selText = function selText(e) { | |
| 267 | + return e.target.select(); | |
| 268 | + }; | |
| 269 | + bind(self.timeContainer, ["wheel", "input", "increment"], updateTime); | |
| 270 | + bind(self.timeContainer, "mousedown", onClick(timeIncrement)); | |
| 271 | + | |
| 272 | + bind(self.timeContainer, ["wheel", "increment"], self.debouncedChange); | |
| 273 | + bind(self.timeContainer, "input", self.triggerChange); | |
| 274 | + | |
| 275 | + bind([self.hourElement, self.minuteElement], "focus", selText); | |
| 276 | + | |
| 277 | + if (self.secondElement !== undefined) bind(self.secondElement, "focus", function () { | |
| 278 | + return self.secondElement.select(); | |
| 279 | + }); | |
| 280 | + | |
| 281 | + if (self.amPM !== undefined) { | |
| 282 | + bind(self.amPM, "mousedown", onClick(function (e) { | |
| 283 | + updateTime(e); | |
| 284 | + self.triggerChange(e); | |
| 285 | + })); | |
| 286 | + } | |
| 287 | + } | |
| 288 | + } | |
| 289 | + | |
| 290 | + function processPostDayAnimation() { | |
| 291 | + for (var i = self._animationLoop.length; i--;) { | |
| 292 | + self._animationLoop[i](); | |
| 293 | + self._animationLoop.splice(i, 1); | |
| 294 | + } | |
| 295 | + } | |
| 296 | + | |
| 297 | + /** | |
| 298 | + * Removes the day container that slided out of view | |
| 299 | + * @param {Event} e the animation event | |
| 300 | + */ | |
| 301 | + function animateDays(e) { | |
| 302 | + if (self.daysContainer.childNodes.length > 1) { | |
| 303 | + switch (e.animationName) { | |
| 304 | + case "fpSlideLeft": | |
| 305 | + self.daysContainer.lastChild.classList.remove("slideLeftNew"); | |
| 306 | + self.daysContainer.removeChild(self.daysContainer.firstChild); | |
| 307 | + self.days = self.daysContainer.firstChild; | |
| 308 | + processPostDayAnimation(); | |
| 309 | + | |
| 310 | + break; | |
| 311 | + | |
| 312 | + case "fpSlideRight": | |
| 313 | + self.daysContainer.firstChild.classList.remove("slideRightNew"); | |
| 314 | + self.daysContainer.removeChild(self.daysContainer.lastChild); | |
| 315 | + self.days = self.daysContainer.firstChild; | |
| 316 | + processPostDayAnimation(); | |
| 317 | + | |
| 318 | + break; | |
| 319 | + | |
| 320 | + default: | |
| 321 | + break; | |
| 322 | + } | |
| 323 | + } | |
| 324 | + } | |
| 325 | + | |
| 326 | + /** | |
| 327 | + * Removes the month element that animated out of view | |
| 328 | + * @param {Event} e the animation event | |
| 329 | + */ | |
| 330 | + function animateMonths(e) { | |
| 331 | + switch (e.animationName) { | |
| 332 | + case "fpSlideLeftNew": | |
| 333 | + case "fpSlideRightNew": | |
| 334 | + self.navigationCurrentMonth.classList.remove("slideLeftNew"); | |
| 335 | + self.navigationCurrentMonth.classList.remove("slideRightNew"); | |
| 336 | + var nav = self.navigationCurrentMonth; | |
| 337 | + | |
| 338 | + while (nav.nextSibling && /curr/.test(nav.nextSibling.className)) { | |
| 339 | + self.monthNav.removeChild(nav.nextSibling); | |
| 340 | + }while (nav.previousSibling && /curr/.test(nav.previousSibling.className)) { | |
| 341 | + self.monthNav.removeChild(nav.previousSibling); | |
| 342 | + }self.oldCurMonth = null; | |
| 343 | + break; | |
| 344 | + } | |
| 345 | + } | |
| 346 | + | |
| 347 | + /** | |
| 348 | + * Set the calendar view to a particular date. | |
| 349 | + * @param {Date} jumpDate the date to set the view to | |
| 350 | + */ | |
| 351 | + function jumpToDate(jumpDate) { | |
| 352 | + jumpDate = jumpDate ? self.parseDate(jumpDate) : self.latestSelectedDateObj || (self.config.minDate > self.now ? self.config.minDate : self.config.maxDate && self.config.maxDate < self.now ? self.config.maxDate : self.now); | |
| 353 | + | |
| 354 | + try { | |
| 355 | + self.currentYear = jumpDate.getFullYear(); | |
| 356 | + self.currentMonth = jumpDate.getMonth(); | |
| 357 | + } catch (e) { | |
| 358 | + /* istanbul ignore next */ | |
| 359 | + console.error(e.stack); | |
| 360 | + /* istanbul ignore next */ | |
| 361 | + console.warn("Invalid date supplied: " + jumpDate); | |
| 362 | + } | |
| 363 | + | |
| 364 | + self.redraw(); | |
| 365 | + } | |
| 366 | + | |
| 367 | + /** | |
| 368 | + * The up/down arrow handler for time inputs | |
| 369 | + * @param {Event} e the click event | |
| 370 | + */ | |
| 371 | + function timeIncrement(e) { | |
| 372 | + if (~e.target.className.indexOf("arrow")) incrementNumInput(e, e.target.classList.contains("arrowUp") ? 1 : -1); | |
| 373 | + } | |
| 374 | + | |
| 375 | + /** | |
| 376 | + * Increments/decrements the value of input associ- | |
| 377 | + * ated with the up/down arrow by dispatching an | |
| 378 | + * "increment" event on the input. | |
| 379 | + * | |
| 380 | + * @param {Event} e the click event | |
| 381 | + * @param {Number} delta the diff (usually 1 or -1) | |
| 382 | + * @param {Element} inputElem the input element | |
| 383 | + */ | |
| 384 | + function incrementNumInput(e, delta, inputElem) { | |
| 385 | + var input = inputElem || e.target.parentNode.childNodes[0]; | |
| 386 | + var event = createEvent("increment"); | |
| 387 | + event.delta = delta; | |
| 388 | + input.dispatchEvent(event); | |
| 389 | + } | |
| 390 | + | |
| 391 | + function createNumberInput(inputClassName) { | |
| 392 | + var wrapper = createElement("div", "numInputWrapper"), | |
| 393 | + numInput = createElement("input", "numInput " + inputClassName), | |
| 394 | + arrowUp = createElement("span", "arrowUp"), | |
| 395 | + arrowDown = createElement("span", "arrowDown"); | |
| 396 | + | |
| 397 | + numInput.type = "text"; | |
| 398 | + numInput.pattern = "\\d*"; | |
| 399 | + | |
| 400 | + wrapper.appendChild(numInput); | |
| 401 | + wrapper.appendChild(arrowUp); | |
| 402 | + wrapper.appendChild(arrowDown); | |
| 403 | + | |
| 404 | + return wrapper; | |
| 405 | + } | |
| 406 | + | |
| 407 | + function build() { | |
| 408 | + var fragment = window.document.createDocumentFragment(); | |
| 409 | + self.calendarContainer = createElement("div", "flatpickr-calendar"); | |
| 410 | + self.calendarContainer.tabIndex = -1; | |
| 411 | + | |
| 412 | + if (!self.config.noCalendar) { | |
| 413 | + fragment.appendChild(buildMonthNav()); | |
| 414 | + self.innerContainer = createElement("div", "flatpickr-innerContainer"); | |
| 415 | + | |
| 416 | + if (self.config.weekNumbers) self.innerContainer.appendChild(buildWeeks()); | |
| 417 | + | |
| 418 | + self.rContainer = createElement("div", "flatpickr-rContainer"); | |
| 419 | + self.rContainer.appendChild(buildWeekdays()); | |
| 420 | + | |
| 421 | + if (!self.daysContainer) { | |
| 422 | + self.daysContainer = createElement("div", "flatpickr-days"); | |
| 423 | + self.daysContainer.tabIndex = -1; | |
| 424 | + } | |
| 425 | + | |
| 426 | + buildDays(); | |
| 427 | + self.rContainer.appendChild(self.daysContainer); | |
| 428 | + | |
| 429 | + self.innerContainer.appendChild(self.rContainer); | |
| 430 | + fragment.appendChild(self.innerContainer); | |
| 431 | + } | |
| 432 | + | |
| 433 | + if (self.config.enableTime) fragment.appendChild(buildTime()); | |
| 434 | + | |
| 435 | + toggleClass(self.calendarContainer, "rangeMode", self.config.mode === "range"); | |
| 436 | + toggleClass(self.calendarContainer, "animate", self.config.animate); | |
| 437 | + | |
| 438 | + self.calendarContainer.appendChild(fragment); | |
| 439 | + | |
| 440 | + var customAppend = self.config.appendTo && self.config.appendTo.nodeType; | |
| 441 | + | |
| 442 | + if (self.config.inline || self.config.static) { | |
| 443 | + self.calendarContainer.classList.add(self.config.inline ? "inline" : "static"); | |
| 444 | + | |
| 445 | + if (self.config.inline && !customAppend) { | |
| 446 | + return self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling); | |
| 447 | + } | |
| 448 | + | |
| 449 | + if (self.config.static) { | |
| 450 | + var wrapper = createElement("div", "flatpickr-wrapper"); | |
| 451 | + self.element.parentNode.insertBefore(wrapper, self.element); | |
| 452 | + wrapper.appendChild(self.element); | |
| 453 | + | |
| 454 | + if (self.altInput) wrapper.appendChild(self.altInput); | |
| 455 | + | |
| 456 | + wrapper.appendChild(self.calendarContainer); | |
| 457 | + return; | |
| 458 | + } | |
| 459 | + } | |
| 460 | + | |
| 461 | + (customAppend ? self.config.appendTo : window.document.body).appendChild(self.calendarContainer); | |
| 462 | + } | |
| 463 | + | |
| 464 | + function createDay(className, date, dayNumber, i) { | |
| 465 | + var dateIsEnabled = isEnabled(date, true), | |
| 466 | + dayElement = createElement("span", "flatpickr-day " + className, date.getDate()); | |
| 467 | + | |
| 468 | + dayElement.dateObj = date; | |
| 469 | + dayElement.$i = i; | |
| 470 | + dayElement.setAttribute("aria-label", self.formatDate(date, self.config.ariaDateFormat)); | |
| 471 | + | |
| 472 | + if (compareDates(date, self.now) === 0) { | |
| 473 | + self.todayDateElem = dayElement; | |
| 474 | + dayElement.classList.add("today"); | |
| 475 | + } | |
| 476 | + | |
| 477 | + if (dateIsEnabled) { | |
| 478 | + dayElement.tabIndex = -1; | |
| 479 | + if (isDateSelected(date)) { | |
| 480 | + dayElement.classList.add("selected"); | |
| 481 | + self.selectedDateElem = dayElement; | |
| 482 | + if (self.config.mode === "range") { | |
| 483 | + toggleClass(dayElement, "startRange", compareDates(date, self.selectedDates[0]) === 0); | |
| 484 | + | |
| 485 | + toggleClass(dayElement, "endRange", compareDates(date, self.selectedDates[1]) === 0); | |
| 486 | + } | |
| 487 | + } | |
| 488 | + } else { | |
| 489 | + dayElement.classList.add("disabled"); | |
| 490 | + if (self.selectedDates[0] && date > self.minRangeDate && date < self.selectedDates[0]) self.minRangeDate = date;else if (self.selectedDates[0] && date < self.maxRangeDate && date > self.selectedDates[0]) self.maxRangeDate = date; | |
| 491 | + } | |
| 492 | + | |
| 493 | + if (self.config.mode === "range") { | |
| 494 | + if (isDateInRange(date) && !isDateSelected(date)) dayElement.classList.add("inRange"); | |
| 495 | + | |
| 496 | + if (self.selectedDates.length === 1 && (date < self.minRangeDate || date > self.maxRangeDate)) dayElement.classList.add("notAllowed"); | |
| 497 | + } | |
| 498 | + | |
| 499 | + if (self.config.weekNumbers && className !== "prevMonthDay" && dayNumber % 7 === 1) { | |
| 500 | + self.weekNumbers.insertAdjacentHTML("beforeend", "<span class='disabled flatpickr-day'>" + self.config.getWeek(date) + "</span>"); | |
| 501 | + } | |
| 502 | + | |
| 503 | + triggerEvent("DayCreate", dayElement); | |
| 504 | + | |
| 505 | + return dayElement; | |
| 506 | + } | |
| 507 | + | |
| 508 | + function focusOnDay(currentIndex, offset) { | |
| 509 | + var newIndex = currentIndex + offset || 0, | |
| 510 | + targetNode = currentIndex !== undefined ? self.days.childNodes[newIndex] : self.selectedDateElem || self.todayDateElem || self.days.childNodes[0], | |
| 511 | + focus = function focus() { | |
| 512 | + targetNode = targetNode || self.days.childNodes[newIndex]; | |
| 513 | + targetNode.focus(); | |
| 514 | + | |
| 515 | + if (self.config.mode === "range") onMouseOver(targetNode); | |
| 516 | + }; | |
| 517 | + | |
| 518 | + if (targetNode === undefined && offset !== 0) { | |
| 519 | + if (offset > 0) { | |
| 520 | + self.changeMonth(1); | |
| 521 | + newIndex = newIndex % 42; | |
| 522 | + } else if (offset < 0) { | |
| 523 | + self.changeMonth(-1); | |
| 524 | + newIndex += 42; | |
| 525 | + } | |
| 526 | + | |
| 527 | + return afterDayAnim(focus); | |
| 528 | + } | |
| 529 | + | |
| 530 | + focus(); | |
| 531 | + } | |
| 532 | + | |
| 533 | + function afterDayAnim(fn) { | |
| 534 | + if (self.config.animate === true) return self._animationLoop.push(fn); | |
| 535 | + fn(); | |
| 536 | + } | |
| 537 | + | |
| 538 | + function buildDays(delta) { | |
| 539 | + var firstOfMonth = (new Date(self.currentYear, self.currentMonth, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7, | |
| 540 | + isRangeMode = self.config.mode === "range"; | |
| 541 | + | |
| 542 | + self.prevMonthDays = self.utils.getDaysinMonth((self.currentMonth - 1 + 12) % 12); | |
| 543 | + self.selectedDateElem = undefined; | |
| 544 | + self.todayDateElem = undefined; | |
| 545 | + | |
| 546 | + var daysInMonth = self.utils.getDaysinMonth(), | |
| 547 | + days = window.document.createDocumentFragment(); | |
| 548 | + | |
| 549 | + var dayNumber = self.prevMonthDays + 1 - firstOfMonth, | |
| 550 | + dayIndex = 0; | |
| 551 | + | |
| 552 | + if (self.config.weekNumbers && self.weekNumbers.firstChild) self.weekNumbers.textContent = ""; | |
| 553 | + | |
| 554 | + if (isRangeMode) { | |
| 555 | + // const dateLimits = self.config.enable.length || self.config.disable.length || self.config.mixDate || self.config.maxDate; | |
| 556 | + self.minRangeDate = new Date(self.currentYear, self.currentMonth - 1, dayNumber); | |
| 557 | + self.maxRangeDate = new Date(self.currentYear, self.currentMonth + 1, (42 - firstOfMonth) % daysInMonth); | |
| 558 | + } | |
| 559 | + | |
| 560 | + // prepend days from the ending of previous month | |
| 561 | + for (; dayNumber <= self.prevMonthDays; dayNumber++, dayIndex++) { | |
| 562 | + days.appendChild(createDay("prevMonthDay", new Date(self.currentYear, self.currentMonth - 1, dayNumber), dayNumber, dayIndex)); | |
| 563 | + } | |
| 564 | + | |
| 565 | + // Start at 1 since there is no 0th day | |
| 566 | + for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) { | |
| 567 | + days.appendChild(createDay("", new Date(self.currentYear, self.currentMonth, dayNumber), dayNumber, dayIndex)); | |
| 568 | + } | |
| 569 | + | |
| 570 | + // append days from the next month | |
| 571 | + for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth; dayNum++, dayIndex++) { | |
| 572 | + days.appendChild(createDay("nextMonthDay", new Date(self.currentYear, self.currentMonth + 1, dayNum % daysInMonth), dayNum, dayIndex)); | |
| 573 | + } | |
| 574 | + | |
| 575 | + if (isRangeMode && self.selectedDates.length === 1 && days.childNodes[0]) { | |
| 576 | + self._hidePrevMonthArrow = self._hidePrevMonthArrow || self.minRangeDate > days.childNodes[0].dateObj; | |
| 577 | + | |
| 578 | + self._hideNextMonthArrow = self._hideNextMonthArrow || self.maxRangeDate < new Date(self.currentYear, self.currentMonth + 1, 1); | |
| 579 | + } else updateNavigationCurrentMonth(); | |
| 580 | + | |
| 581 | + var dayContainer = createElement("div", "dayContainer"); | |
| 582 | + dayContainer.appendChild(days); | |
| 583 | + | |
| 584 | + if (!self.config.animate || delta === undefined) clearNode(self.daysContainer);else { | |
| 585 | + while (self.daysContainer.childNodes.length > 1) { | |
| 586 | + self.daysContainer.removeChild(self.daysContainer.firstChild); | |
| 587 | + } | |
| 588 | + } | |
| 589 | + | |
| 590 | + if (delta >= 0) self.daysContainer.appendChild(dayContainer);else self.daysContainer.insertBefore(dayContainer, self.daysContainer.firstChild); | |
| 591 | + | |
| 592 | + self.days = self.daysContainer.firstChild; | |
| 593 | + return self.daysContainer; | |
| 594 | + } | |
| 595 | + | |
| 596 | + function clearNode(node) { | |
| 597 | + while (node.firstChild) { | |
| 598 | + node.removeChild(node.firstChild); | |
| 599 | + } | |
| 600 | + } | |
| 601 | + | |
| 602 | + function buildMonthNav() { | |
| 603 | + var monthNavFragment = window.document.createDocumentFragment(); | |
| 604 | + self.monthNav = createElement("div", "flatpickr-month"); | |
| 605 | + | |
| 606 | + self.prevMonthNav = createElement("span", "flatpickr-prev-month"); | |
| 607 | + self.prevMonthNav.innerHTML = self.config.prevArrow; | |
| 608 | + | |
| 609 | + self.currentMonthElement = createElement("span", "cur-month"); | |
| 610 | + self.currentMonthElement.title = self.l10n.scrollTitle; | |
| 611 | + | |
| 612 | + var yearInput = createNumberInput("cur-year"); | |
| 613 | + self.currentYearElement = yearInput.childNodes[0]; | |
| 614 | + self.currentYearElement.title = self.l10n.scrollTitle; | |
| 615 | + | |
| 616 | + if (self.config.minDate) self.currentYearElement.min = self.config.minDate.getFullYear(); | |
| 617 | + | |
| 618 | + if (self.config.maxDate) { | |
| 619 | + self.currentYearElement.max = self.config.maxDate.getFullYear(); | |
| 620 | + | |
| 621 | + self.currentYearElement.disabled = self.config.minDate && self.config.minDate.getFullYear() === self.config.maxDate.getFullYear(); | |
| 622 | + } | |
| 623 | + | |
| 624 | + self.nextMonthNav = createElement("span", "flatpickr-next-month"); | |
| 625 | + self.nextMonthNav.innerHTML = self.config.nextArrow; | |
| 626 | + | |
| 627 | + self.navigationCurrentMonth = createElement("span", "flatpickr-current-month"); | |
| 628 | + self.navigationCurrentMonth.appendChild(self.currentMonthElement); | |
| 629 | + self.navigationCurrentMonth.appendChild(yearInput); | |
| 630 | + | |
| 631 | + monthNavFragment.appendChild(self.prevMonthNav); | |
| 632 | + monthNavFragment.appendChild(self.navigationCurrentMonth); | |
| 633 | + monthNavFragment.appendChild(self.nextMonthNav); | |
| 634 | + self.monthNav.appendChild(monthNavFragment); | |
| 635 | + | |
| 636 | + Object.defineProperty(self, "_hidePrevMonthArrow", { | |
| 637 | + get: function get() { | |
| 638 | + return this.__hidePrevMonthArrow; | |
| 639 | + }, | |
| 640 | + set: function set(bool) { | |
| 641 | + if (this.__hidePrevMonthArrow !== bool) self.prevMonthNav.style.display = bool ? "none" : "block"; | |
| 642 | + this.__hidePrevMonthArrow = bool; | |
| 643 | + } | |
| 644 | + }); | |
| 645 | + | |
| 646 | + Object.defineProperty(self, "_hideNextMonthArrow", { | |
| 647 | + get: function get() { | |
| 648 | + return this.__hideNextMonthArrow; | |
| 649 | + }, | |
| 650 | + set: function set(bool) { | |
| 651 | + if (this.__hideNextMonthArrow !== bool) self.nextMonthNav.style.display = bool ? "none" : "block"; | |
| 652 | + this.__hideNextMonthArrow = bool; | |
| 653 | + } | |
| 654 | + }); | |
| 655 | + | |
| 656 | + updateNavigationCurrentMonth(); | |
| 657 | + | |
| 658 | + return self.monthNav; | |
| 659 | + } | |
| 660 | + | |
| 661 | + function buildTime() { | |
| 662 | + self.calendarContainer.classList.add("hasTime"); | |
| 663 | + if (self.config.noCalendar) self.calendarContainer.classList.add("noCalendar"); | |
| 664 | + self.timeContainer = createElement("div", "flatpickr-time"); | |
| 665 | + self.timeContainer.tabIndex = -1; | |
| 666 | + var separator = createElement("span", "flatpickr-time-separator", ":"); | |
| 667 | + | |
| 668 | + var hourInput = createNumberInput("flatpickr-hour"); | |
| 669 | + self.hourElement = hourInput.childNodes[0]; | |
| 670 | + | |
| 671 | + var minuteInput = createNumberInput("flatpickr-minute"); | |
| 672 | + self.minuteElement = minuteInput.childNodes[0]; | |
| 673 | + | |
| 674 | + self.hourElement.tabIndex = self.minuteElement.tabIndex = -1; | |
| 675 | + | |
| 676 | + self.hourElement.value = self.pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getHours() : self.config.defaultHour); | |
| 677 | + | |
| 678 | + self.minuteElement.value = self.pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getMinutes() : self.config.defaultMinute); | |
| 679 | + | |
| 680 | + self.hourElement.step = self.config.hourIncrement; | |
| 681 | + self.minuteElement.step = self.config.minuteIncrement; | |
| 682 | + | |
| 683 | + self.hourElement.min = self.config.time_24hr ? 0 : 1; | |
| 684 | + self.hourElement.max = self.config.time_24hr ? 23 : 12; | |
| 685 | + | |
| 686 | + self.minuteElement.min = 0; | |
| 687 | + self.minuteElement.max = 59; | |
| 688 | + | |
| 689 | + self.hourElement.title = self.minuteElement.title = self.l10n.scrollTitle; | |
| 690 | + | |
| 691 | + self.timeContainer.appendChild(hourInput); | |
| 692 | + self.timeContainer.appendChild(separator); | |
| 693 | + self.timeContainer.appendChild(minuteInput); | |
| 694 | + | |
| 695 | + if (self.config.time_24hr) self.timeContainer.classList.add("time24hr"); | |
| 696 | + | |
| 697 | + if (self.config.enableSeconds) { | |
| 698 | + self.timeContainer.classList.add("hasSeconds"); | |
| 699 | + | |
| 700 | + var secondInput = createNumberInput("flatpickr-second"); | |
| 701 | + self.secondElement = secondInput.childNodes[0]; | |
| 702 | + | |
| 703 | + self.secondElement.value = self.latestSelectedDateObj ? self.pad(self.latestSelectedDateObj.getSeconds()) : "00"; | |
| 704 | + | |
| 705 | + self.secondElement.step = self.minuteElement.step; | |
| 706 | + self.secondElement.min = self.minuteElement.min; | |
| 707 | + self.secondElement.max = self.minuteElement.max; | |
| 708 | + | |
| 709 | + self.timeContainer.appendChild(createElement("span", "flatpickr-time-separator", ":")); | |
| 710 | + self.timeContainer.appendChild(secondInput); | |
| 711 | + } | |
| 712 | + | |
| 713 | + if (!self.config.time_24hr) { | |
| 714 | + // add self.amPM if appropriate | |
| 715 | + self.amPM = createElement("span", "flatpickr-am-pm", ["AM", "PM"][self.hourElement.value > 11 | 0]); | |
| 716 | + self.amPM.title = self.l10n.toggleTitle; | |
| 717 | + self.amPM.tabIndex = -1; | |
| 718 | + self.timeContainer.appendChild(self.amPM); | |
| 719 | + } | |
| 720 | + | |
| 721 | + return self.timeContainer; | |
| 722 | + } | |
| 723 | + | |
| 724 | + function buildWeekdays() { | |
| 725 | + if (!self.weekdayContainer) self.weekdayContainer = createElement("div", "flatpickr-weekdays"); | |
| 726 | + | |
| 727 | + var firstDayOfWeek = self.l10n.firstDayOfWeek; | |
| 728 | + var weekdays = self.l10n.weekdays.shorthand.slice(); | |
| 729 | + | |
| 730 | + if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) { | |
| 731 | + weekdays = [].concat(weekdays.splice(firstDayOfWeek, weekdays.length), weekdays.splice(0, firstDayOfWeek)); | |
| 732 | + } | |
| 733 | + | |
| 734 | + self.weekdayContainer.innerHTML = "\n\t\t<span class=flatpickr-weekday>\n\t\t\t" + weekdays.join("</span><span class=flatpickr-weekday>") + "\n\t\t</span>\n\t\t"; | |
| 735 | + | |
| 736 | + return self.weekdayContainer; | |
| 737 | + } | |
| 738 | + | |
| 739 | + /* istanbul ignore next */ | |
| 740 | + function buildWeeks() { | |
| 741 | + self.calendarContainer.classList.add("hasWeeks"); | |
| 742 | + self.weekWrapper = createElement("div", "flatpickr-weekwrapper"); | |
| 743 | + self.weekWrapper.appendChild(createElement("span", "flatpickr-weekday", self.l10n.weekAbbreviation)); | |
| 744 | + self.weekNumbers = createElement("div", "flatpickr-weeks"); | |
| 745 | + self.weekWrapper.appendChild(self.weekNumbers); | |
| 746 | + | |
| 747 | + return self.weekWrapper; | |
| 748 | + } | |
| 749 | + | |
| 750 | + function changeMonth(value, is_offset, animate) { | |
| 751 | + is_offset = is_offset === undefined || is_offset; | |
| 752 | + var delta = is_offset ? value : value - self.currentMonth; | |
| 753 | + var skipAnimations = !self.config.animate || animate === false; | |
| 754 | + | |
| 755 | + if (delta < 0 && self._hidePrevMonthArrow || delta > 0 && self._hideNextMonthArrow) return; | |
| 756 | + | |
| 757 | + self.currentMonth += delta; | |
| 758 | + | |
| 759 | + if (self.currentMonth < 0 || self.currentMonth > 11) { | |
| 760 | + self.currentYear += self.currentMonth > 11 ? 1 : -1; | |
| 761 | + self.currentMonth = (self.currentMonth + 12) % 12; | |
| 762 | + | |
| 763 | + triggerEvent("YearChange"); | |
| 764 | + } | |
| 765 | + | |
| 766 | + buildDays(!skipAnimations ? delta : undefined); | |
| 767 | + | |
| 768 | + if (skipAnimations) { | |
| 769 | + triggerEvent("MonthChange"); | |
| 770 | + return updateNavigationCurrentMonth(); | |
| 771 | + } | |
| 772 | + | |
| 773 | + // remove possible remnants from clicking too fast | |
| 774 | + var nav = self.navigationCurrentMonth; | |
| 775 | + if (delta < 0) { | |
| 776 | + while (nav.nextSibling && /curr/.test(nav.nextSibling.className)) { | |
| 777 | + self.monthNav.removeChild(nav.nextSibling); | |
| 778 | + } | |
| 779 | + } else if (delta > 0) { | |
| 780 | + while (nav.previousSibling && /curr/.test(nav.previousSibling.className)) { | |
| 781 | + self.monthNav.removeChild(nav.previousSibling); | |
| 782 | + } | |
| 783 | + } | |
| 784 | + | |
| 785 | + self.oldCurMonth = self.navigationCurrentMonth; | |
| 786 | + | |
| 787 | + self.navigationCurrentMonth = self.monthNav.insertBefore(self.oldCurMonth.cloneNode(true), delta > 0 ? self.oldCurMonth.nextSibling : self.oldCurMonth); | |
| 788 | + | |
| 789 | + if (delta > 0) { | |
| 790 | + self.daysContainer.firstChild.classList.add("slideLeft"); | |
| 791 | + self.daysContainer.lastChild.classList.add("slideLeftNew"); | |
| 792 | + | |
| 793 | + self.oldCurMonth.classList.add("slideLeft"); | |
| 794 | + self.navigationCurrentMonth.classList.add("slideLeftNew"); | |
| 795 | + } else if (delta < 0) { | |
| 796 | + self.daysContainer.firstChild.classList.add("slideRightNew"); | |
| 797 | + self.daysContainer.lastChild.classList.add("slideRight"); | |
| 798 | + | |
| 799 | + self.oldCurMonth.classList.add("slideRight"); | |
| 800 | + self.navigationCurrentMonth.classList.add("slideRightNew"); | |
| 801 | + } | |
| 802 | + | |
| 803 | + self.currentMonthElement = self.navigationCurrentMonth.firstChild; | |
| 804 | + self.currentYearElement = self.navigationCurrentMonth.lastChild.childNodes[0]; | |
| 805 | + | |
| 806 | + updateNavigationCurrentMonth(); | |
| 807 | + self.oldCurMonth.firstChild.textContent = self.utils.monthToStr(self.currentMonth - delta); | |
| 808 | + | |
| 809 | + triggerEvent("MonthChange"); | |
| 810 | + | |
| 811 | + if (document.activeElement && document.activeElement.$i) { | |
| 812 | + var index = document.activeElement.$i; | |
| 813 | + afterDayAnim(function () { | |
| 814 | + focusOnDay(index, 0); | |
| 815 | + }); | |
| 816 | + } | |
| 817 | + } | |
| 818 | + | |
| 819 | + function clear(triggerChangeEvent) { | |
| 820 | + self.input.value = ""; | |
| 821 | + | |
| 822 | + if (self.altInput) self.altInput.value = ""; | |
| 823 | + | |
| 824 | + if (self.mobileInput) self.mobileInput.value = ""; | |
| 825 | + | |
| 826 | + self.selectedDates = []; | |
| 827 | + self.latestSelectedDateObj = undefined; | |
| 828 | + self.showTimeInput = false; | |
| 829 | + | |
| 830 | + self.redraw(); | |
| 831 | + | |
| 832 | + if (triggerChangeEvent !== false) | |
| 833 | + // triggerChangeEvent is true (default) or an Event | |
| 834 | + triggerEvent("Change"); | |
| 835 | + } | |
| 836 | + | |
| 837 | + function close() { | |
| 838 | + self.isOpen = false; | |
| 839 | + | |
| 840 | + if (!self.isMobile) { | |
| 841 | + self.calendarContainer.classList.remove("open"); | |
| 842 | + self._input.classList.remove("active"); | |
| 843 | + } | |
| 844 | + | |
| 845 | + triggerEvent("Close"); | |
| 846 | + } | |
| 847 | + | |
| 848 | + function destroy() { | |
| 849 | + if (self.config !== undefined) triggerEvent("Destroy"); | |
| 850 | + | |
| 851 | + for (var i = self._handlers.length; i--;) { | |
| 852 | + var h = self._handlers[i]; | |
| 853 | + h.element.removeEventListener(h.event, h.handler); | |
| 854 | + } | |
| 855 | + | |
| 856 | + self._handlers = []; | |
| 857 | + | |
| 858 | + if (self.mobileInput) { | |
| 859 | + if (self.mobileInput.parentNode) self.mobileInput.parentNode.removeChild(self.mobileInput); | |
| 860 | + self.mobileInput = null; | |
| 861 | + } else if (self.calendarContainer && self.calendarContainer.parentNode) self.calendarContainer.parentNode.removeChild(self.calendarContainer); | |
| 862 | + | |
| 863 | + if (self.altInput) { | |
| 864 | + self.input.type = "text"; | |
| 865 | + if (self.altInput.parentNode) self.altInput.parentNode.removeChild(self.altInput); | |
| 866 | + delete self.altInput; | |
| 867 | + } | |
| 868 | + | |
| 869 | + if (self.input) { | |
| 870 | + self.input.type = self.input._type; | |
| 871 | + self.input.classList.remove("flatpickr-input"); | |
| 872 | + self.input.removeAttribute("readonly"); | |
| 873 | + self.input.value = ""; | |
| 874 | + } | |
| 875 | + | |
| 876 | + ["_showTimeInput", "latestSelectedDateObj", "_hideNextMonthArrow", "_hidePrevMonthArrow", "__hideNextMonthArrow", "__hidePrevMonthArrow", "isMobile", "isOpen", "selectedDateElem", "minDateHasTime", "maxDateHasTime", "days", "daysContainer", "_input", "_positionElement", "innerContainer", "rContainer", "monthNav", "todayDateElem", "calendarContainer", "weekdayContainer", "prevMonthNav", "nextMonthNav", "currentMonthElement", "currentYearElement", "navigationCurrentMonth", "selectedDateElem", "config"].forEach(function (k) { | |
| 877 | + return delete self[k]; | |
| 878 | + }); | |
| 879 | + } | |
| 880 | + | |
| 881 | + function isCalendarElem(elem) { | |
| 882 | + if (self.config.appendTo && self.config.appendTo.contains(elem)) return true; | |
| 883 | + | |
| 884 | + return self.calendarContainer.contains(elem); | |
| 885 | + } | |
| 886 | + | |
| 887 | + function documentClick(e) { | |
| 888 | + if (self.isOpen && !self.config.inline) { | |
| 889 | + var isCalendarElement = isCalendarElem(e.target); | |
| 890 | + var isInput = e.target === self.input || e.target === self.altInput || self.element.contains(e.target) || | |
| 891 | + // web components | |
| 892 | + e.path && e.path.indexOf && (~e.path.indexOf(self.input) || ~e.path.indexOf(self.altInput)); | |
| 893 | + | |
| 894 | + var lostFocus = e.type === "blur" ? isInput && e.relatedTarget && !isCalendarElem(e.relatedTarget) : !isInput && !isCalendarElement; | |
| 895 | + | |
| 896 | + if (lostFocus && self.config.ignoredFocusElements.indexOf(e.target) === -1) { | |
| 897 | + self.close(); | |
| 898 | + | |
| 899 | + if (self.config.mode === "range" && self.selectedDates.length === 1) { | |
| 900 | + self.clear(false); | |
| 901 | + self.redraw(); | |
| 902 | + } | |
| 903 | + } | |
| 904 | + } | |
| 905 | + } | |
| 906 | + | |
| 907 | + function changeYear(newYear) { | |
| 908 | + if (!newYear || self.currentYearElement.min && newYear < self.currentYearElement.min || self.currentYearElement.max && newYear > self.currentYearElement.max) return; | |
| 909 | + | |
| 910 | + var newYearNum = parseInt(newYear, 10), | |
| 911 | + isNewYear = self.currentYear !== newYearNum; | |
| 912 | + | |
| 913 | + self.currentYear = newYearNum || self.currentYear; | |
| 914 | + | |
| 915 | + if (self.config.maxDate && self.currentYear === self.config.maxDate.getFullYear()) { | |
| 916 | + self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth); | |
| 917 | + } else if (self.config.minDate && self.currentYear === self.config.minDate.getFullYear()) { | |
| 918 | + self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth); | |
| 919 | + } | |
| 920 | + | |
| 921 | + if (isNewYear) { | |
| 922 | + self.redraw(); | |
| 923 | + triggerEvent("YearChange"); | |
| 924 | + } | |
| 925 | + } | |
| 926 | + | |
| 927 | + function isEnabled(date, timeless) { | |
| 928 | + if (self.config.minDate && compareDates(date, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0 || self.config.maxDate && compareDates(date, self.config.maxDate, timeless !== undefined ? timeless : !self.maxDateHasTime) > 0) return false; | |
| 929 | + | |
| 930 | + if (!self.config.enable.length && !self.config.disable.length) return true; | |
| 931 | + | |
| 932 | + var dateToCheck = self.parseDate(date, null, true); // timeless | |
| 933 | + | |
| 934 | + var bool = self.config.enable.length > 0, | |
| 935 | + array = bool ? self.config.enable : self.config.disable; | |
| 936 | + | |
| 937 | + for (var i = 0, d; i < array.length; i++) { | |
| 938 | + d = array[i]; | |
| 939 | + | |
| 940 | + if (d instanceof Function && d(dateToCheck)) // disabled by function | |
| 941 | + return bool;else if (d instanceof Date && d.getTime() === dateToCheck.getTime()) | |
| 942 | + // disabled by date | |
| 943 | + return bool;else if (typeof d === "string" && self.parseDate(d, null, true).getTime() === dateToCheck.getTime()) | |
| 944 | + // disabled by date string | |
| 945 | + return bool;else if ( // disabled by range | |
| 946 | + (typeof d === "undefined" ? "undefined" : _typeof(d)) === "object" && d.from && d.to && dateToCheck >= d.from && dateToCheck <= d.to) return bool; | |
| 947 | + } | |
| 948 | + | |
| 949 | + return !bool; | |
| 950 | + } | |
| 951 | + | |
| 952 | + function onKeyDown(e) { | |
| 953 | + var isInput = e.target === self._input; | |
| 954 | + var calendarElem = isCalendarElem(e.target); | |
| 955 | + var allowInput = self.config.allowInput; | |
| 956 | + var allowKeydown = self.isOpen && (!allowInput || !isInput); | |
| 957 | + var allowInlineKeydown = self.config.inline && isInput && !allowInput; | |
| 958 | + | |
| 959 | + if (e.key === "Enter" && allowInput && isInput) { | |
| 960 | + self.setDate(self._input.value, true, e.target === self.altInput ? self.config.altFormat : self.config.dateFormat); | |
| 961 | + return e.target.blur(); | |
| 962 | + } else if (calendarElem || allowKeydown || allowInlineKeydown) { | |
| 963 | + var isTimeObj = self.timeContainer && self.timeContainer.contains(e.target); | |
| 964 | + switch (e.key) { | |
| 965 | + case "Enter": | |
| 966 | + if (isTimeObj) updateValue();else selectDate(e); | |
| 967 | + | |
| 968 | + break; | |
| 969 | + | |
| 970 | + case "Escape": | |
| 971 | + // escape | |
| 972 | + e.preventDefault(); | |
| 973 | + self.close(); | |
| 974 | + break; | |
| 975 | + | |
| 976 | + case "ArrowLeft": | |
| 977 | + case "ArrowRight": | |
| 978 | + if (!isTimeObj) { | |
| 979 | + e.preventDefault(); | |
| 980 | + | |
| 981 | + if (self.daysContainer) { | |
| 982 | + var _delta = e.key === "ArrowRight" ? 1 : -1; | |
| 983 | + | |
| 984 | + if (!e.ctrlKey) focusOnDay(e.target.$i, _delta);else changeMonth(_delta, true); | |
| 985 | + } else if (self.config.enableTime && !isTimeObj) self.hourElement.focus(); | |
| 986 | + } | |
| 987 | + | |
| 988 | + break; | |
| 989 | + | |
| 990 | + case "ArrowUp": | |
| 991 | + case "ArrowDown": | |
| 992 | + e.preventDefault(); | |
| 993 | + var delta = e.key === "ArrowDown" ? 1 : -1; | |
| 994 | + | |
| 995 | + if (self.daysContainer) { | |
| 996 | + if (e.ctrlKey) { | |
| 997 | + changeYear(self.currentYear - delta); | |
| 998 | + focusOnDay(e.target.$i, 0); | |
| 999 | + } else if (!isTimeObj) focusOnDay(e.target.$i, delta * 7); | |
| 1000 | + } else if (self.config.enableTime) { | |
| 1001 | + if (!isTimeObj) self.hourElement.focus(); | |
| 1002 | + updateTime(e); | |
| 1003 | + } | |
| 1004 | + | |
| 1005 | + break; | |
| 1006 | + | |
| 1007 | + case "Tab": | |
| 1008 | + if (e.target === self.hourElement) { | |
| 1009 | + e.preventDefault(); | |
| 1010 | + self.minuteElement.select(); | |
| 1011 | + } else if (e.target === self.minuteElement && (self.secondElement || self.amPM)) { | |
| 1012 | + e.preventDefault(); | |
| 1013 | + (self.secondElement || self.amPM).focus(); | |
| 1014 | + } else if (e.target === self.secondElement) { | |
| 1015 | + e.preventDefault(); | |
| 1016 | + self.amPM.focus(); | |
| 1017 | + } | |
| 1018 | + | |
| 1019 | + break; | |
| 1020 | + | |
| 1021 | + case "a": | |
| 1022 | + if (e.target === self.amPM) { | |
| 1023 | + self.amPM.textContent = "AM"; | |
| 1024 | + setHoursFromInputs(); | |
| 1025 | + updateValue(); | |
| 1026 | + } | |
| 1027 | + break; | |
| 1028 | + | |
| 1029 | + case "p": | |
| 1030 | + if (e.target === self.amPM) { | |
| 1031 | + self.amPM.textContent = "PM"; | |
| 1032 | + setHoursFromInputs(); | |
| 1033 | + updateValue(); | |
| 1034 | + } | |
| 1035 | + break; | |
| 1036 | + | |
| 1037 | + default: | |
| 1038 | + break; | |
| 1039 | + | |
| 1040 | + } | |
| 1041 | + | |
| 1042 | + triggerEvent("KeyDown", e); | |
| 1043 | + } | |
| 1044 | + } | |
| 1045 | + | |
| 1046 | + function onMouseOver(elem) { | |
| 1047 | + if (self.selectedDates.length !== 1 || !elem.classList.contains("flatpickr-day")) return; | |
| 1048 | + | |
| 1049 | + var hoverDate = elem.dateObj, | |
| 1050 | + initialDate = self.parseDate(self.selectedDates[0], null, true), | |
| 1051 | + rangeStartDate = Math.min(hoverDate.getTime(), self.selectedDates[0].getTime()), | |
| 1052 | + rangeEndDate = Math.max(hoverDate.getTime(), self.selectedDates[0].getTime()), | |
| 1053 | + containsDisabled = false; | |
| 1054 | + | |
| 1055 | + for (var t = rangeStartDate; t < rangeEndDate; t += self.utils.duration.DAY) { | |
| 1056 | + if (!isEnabled(new Date(t))) { | |
| 1057 | + containsDisabled = true; | |
| 1058 | + break; | |
| 1059 | + } | |
| 1060 | + } | |
| 1061 | + | |
| 1062 | + var _loop = function _loop(timestamp, i) { | |
| 1063 | + var outOfRange = timestamp < self.minRangeDate.getTime() || timestamp > self.maxRangeDate.getTime(), | |
| 1064 | + dayElem = self.days.childNodes[i]; | |
| 1065 | + | |
| 1066 | + if (outOfRange) { | |
| 1067 | + self.days.childNodes[i].classList.add("notAllowed"); | |
| 1068 | + ["inRange", "startRange", "endRange"].forEach(function (c) { | |
| 1069 | + dayElem.classList.remove(c); | |
| 1070 | + }); | |
| 1071 | + return "continue"; | |
| 1072 | + } else if (containsDisabled && !outOfRange) return "continue"; | |
| 1073 | + | |
| 1074 | + ["startRange", "inRange", "endRange", "notAllowed"].forEach(function (c) { | |
| 1075 | + dayElem.classList.remove(c); | |
| 1076 | + }); | |
| 1077 | + | |
| 1078 | + var minRangeDate = Math.max(self.minRangeDate.getTime(), rangeStartDate), | |
| 1079 | + maxRangeDate = Math.min(self.maxRangeDate.getTime(), rangeEndDate); | |
| 1080 | + | |
| 1081 | + elem.classList.add(hoverDate < self.selectedDates[0] ? "startRange" : "endRange"); | |
| 1082 | + | |
| 1083 | + if (initialDate < hoverDate && timestamp === initialDate.getTime()) dayElem.classList.add("startRange");else if (initialDate > hoverDate && timestamp === initialDate.getTime()) dayElem.classList.add("endRange"); | |
| 1084 | + | |
| 1085 | + if (timestamp >= minRangeDate && timestamp <= maxRangeDate) dayElem.classList.add("inRange"); | |
| 1086 | + }; | |
| 1087 | + | |
| 1088 | + for (var timestamp = self.days.childNodes[0].dateObj.getTime(), i = 0; i < 42; i++, timestamp += self.utils.duration.DAY) { | |
| 1089 | + var _ret = _loop(timestamp, i); | |
| 1090 | + | |
| 1091 | + if (_ret === "continue") continue; | |
| 1092 | + } | |
| 1093 | + } | |
| 1094 | + | |
| 1095 | + function onResize() { | |
| 1096 | + if (self.isOpen && !self.config.static && !self.config.inline) positionCalendar(); | |
| 1097 | + } | |
| 1098 | + | |
| 1099 | + function open(e, positionElement) { | |
| 1100 | + if (self.isMobile) { | |
| 1101 | + if (e) { | |
| 1102 | + e.preventDefault(); | |
| 1103 | + e.target.blur(); | |
| 1104 | + } | |
| 1105 | + | |
| 1106 | + setTimeout(function () { | |
| 1107 | + self.mobileInput.click(); | |
| 1108 | + }, 0); | |
| 1109 | + | |
| 1110 | + triggerEvent("Open"); | |
| 1111 | + return; | |
| 1112 | + } | |
| 1113 | + | |
| 1114 | + if (self.isOpen || self._input.disabled || self.config.inline) return; | |
| 1115 | + | |
| 1116 | + self.isOpen = true; | |
| 1117 | + self.calendarContainer.classList.add("open"); | |
| 1118 | + positionCalendar(positionElement); | |
| 1119 | + self._input.classList.add("active"); | |
| 1120 | + | |
| 1121 | + triggerEvent("Open"); | |
| 1122 | + } | |
| 1123 | + | |
| 1124 | + function minMaxDateSetter(type) { | |
| 1125 | + return function (date) { | |
| 1126 | + var dateObj = self.config["_" + type + "Date"] = self.parseDate(date); | |
| 1127 | + | |
| 1128 | + var inverseDateObj = self.config["_" + (type === "min" ? "max" : "min") + "Date"]; | |
| 1129 | + var isValidDate = date && dateObj instanceof Date; | |
| 1130 | + | |
| 1131 | + if (isValidDate) { | |
| 1132 | + self[type + "DateHasTime"] = dateObj.getHours() || dateObj.getMinutes() || dateObj.getSeconds(); | |
| 1133 | + } | |
| 1134 | + | |
| 1135 | + if (self.selectedDates) { | |
| 1136 | + self.selectedDates = self.selectedDates.filter(function (d) { | |
| 1137 | + return isEnabled(d); | |
| 1138 | + }); | |
| 1139 | + if (!self.selectedDates.length && type === "min") setHoursFromDate(dateObj); | |
| 1140 | + updateValue(); | |
| 1141 | + } | |
| 1142 | + | |
| 1143 | + if (self.daysContainer) { | |
| 1144 | + redraw(); | |
| 1145 | + | |
| 1146 | + if (isValidDate) self.currentYearElement[type] = dateObj.getFullYear();else self.currentYearElement.removeAttribute(type); | |
| 1147 | + | |
| 1148 | + self.currentYearElement.disabled = inverseDateObj && dateObj && inverseDateObj.getFullYear() === dateObj.getFullYear(); | |
| 1149 | + } | |
| 1150 | + }; | |
| 1151 | + } | |
| 1152 | + | |
| 1153 | + function parseConfig() { | |
| 1154 | + var boolOpts = ["wrap", "weekNumbers", "allowInput", "clickOpens", "time_24hr", "enableTime", "noCalendar", "altInput", "shorthandCurrentMonth", "inline", "static", "enableSeconds", "disableMobile"]; | |
| 1155 | + | |
| 1156 | + var hooks = ["onChange", "onClose", "onDayCreate", "onDestroy", "onKeyDown", "onMonthChange", "onOpen", "onParseConfig", "onReady", "onValueUpdate", "onYearChange"]; | |
| 1157 | + | |
| 1158 | + self.config = Object.create(flatpickr.defaultConfig); | |
| 1159 | + | |
| 1160 | + var userConfig = _extends({}, self.instanceConfig, JSON.parse(JSON.stringify(self.element.dataset || {}))); | |
| 1161 | + | |
| 1162 | + self.config.parseDate = userConfig.parseDate; | |
| 1163 | + self.config.formatDate = userConfig.formatDate; | |
| 1164 | + | |
| 1165 | + Object.defineProperty(self.config, "enable", { | |
| 1166 | + get: function get() { | |
| 1167 | + return self.config._enable || []; | |
| 1168 | + }, | |
| 1169 | + set: function set(dates) { | |
| 1170 | + return self.config._enable = parseDateRules(dates); | |
| 1171 | + } | |
| 1172 | + }); | |
| 1173 | + | |
| 1174 | + Object.defineProperty(self.config, "disable", { | |
| 1175 | + get: function get() { | |
| 1176 | + return self.config._disable || []; | |
| 1177 | + }, | |
| 1178 | + set: function set(dates) { | |
| 1179 | + return self.config._disable = parseDateRules(dates); | |
| 1180 | + } | |
| 1181 | + }); | |
| 1182 | + | |
| 1183 | + _extends(self.config, userConfig); | |
| 1184 | + | |
| 1185 | + if (!userConfig.dateFormat && userConfig.enableTime) { | |
| 1186 | + self.config.dateFormat = self.config.noCalendar ? "H:i" + (self.config.enableSeconds ? ":S" : "") : flatpickr.defaultConfig.dateFormat + " H:i" + (self.config.enableSeconds ? ":S" : ""); | |
| 1187 | + } | |
| 1188 | + | |
| 1189 | + if (userConfig.altInput && userConfig.enableTime && !userConfig.altFormat) { | |
| 1190 | + self.config.altFormat = self.config.noCalendar ? "h:i" + (self.config.enableSeconds ? ":S K" : " K") : flatpickr.defaultConfig.altFormat + (" h:i" + (self.config.enableSeconds ? ":S" : "") + " K"); | |
| 1191 | + } | |
| 1192 | + | |
| 1193 | + Object.defineProperty(self.config, "minDate", { | |
| 1194 | + get: function get() { | |
| 1195 | + return this._minDate; | |
| 1196 | + }, | |
| 1197 | + set: minMaxDateSetter("min") | |
| 1198 | + }); | |
| 1199 | + | |
| 1200 | + Object.defineProperty(self.config, "maxDate", { | |
| 1201 | + get: function get() { | |
| 1202 | + return this._maxDate; | |
| 1203 | + }, | |
| 1204 | + set: minMaxDateSetter("max") | |
| 1205 | + }); | |
| 1206 | + | |
| 1207 | + self.config.minDate = userConfig.minDate; | |
| 1208 | + self.config.maxDate = userConfig.maxDate; | |
| 1209 | + | |
| 1210 | + for (var i = 0; i < boolOpts.length; i++) { | |
| 1211 | + self.config[boolOpts[i]] = self.config[boolOpts[i]] === true || self.config[boolOpts[i]] === "true"; | |
| 1212 | + }for (var _i = hooks.length; _i--;) { | |
| 1213 | + if (self.config[hooks[_i]] !== undefined) { | |
| 1214 | + self.config[hooks[_i]] = arrayify(self.config[hooks[_i]] || []).map(bindToInstance); | |
| 1215 | + } | |
| 1216 | + } | |
| 1217 | + | |
| 1218 | + for (var _i2 = 0; _i2 < self.config.plugins.length; _i2++) { | |
| 1219 | + var pluginConf = self.config.plugins[_i2](self) || {}; | |
| 1220 | + for (var key in pluginConf) { | |
| 1221 | + | |
| 1222 | + if (self.config[key] instanceof Array || ~hooks.indexOf(key)) { | |
| 1223 | + self.config[key] = arrayify(pluginConf[key]).map(bindToInstance).concat(self.config[key]); | |
| 1224 | + } else if (typeof userConfig[key] === "undefined") self.config[key] = pluginConf[key]; | |
| 1225 | + } | |
| 1226 | + } | |
| 1227 | + | |
| 1228 | + triggerEvent("ParseConfig"); | |
| 1229 | + } | |
| 1230 | + | |
| 1231 | + function setupLocale() { | |
| 1232 | + if (_typeof(self.config.locale) !== "object" && typeof flatpickr.l10ns[self.config.locale] === "undefined") console.warn("flatpickr: invalid locale " + self.config.locale); | |
| 1233 | + | |
| 1234 | + self.l10n = _extends(Object.create(flatpickr.l10ns.default), _typeof(self.config.locale) === "object" ? self.config.locale : self.config.locale !== "default" ? flatpickr.l10ns[self.config.locale] || {} : {}); | |
| 1235 | + } | |
| 1236 | + | |
| 1237 | + function positionCalendar() { | |
| 1238 | + var positionElement = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : self._positionElement; | |
| 1239 | + | |
| 1240 | + if (self.calendarContainer === undefined) return; | |
| 1241 | + | |
| 1242 | + var calendarHeight = self.calendarContainer.offsetHeight, | |
| 1243 | + calendarWidth = self.calendarContainer.offsetWidth, | |
| 1244 | + configPos = self.config.position, | |
| 1245 | + inputBounds = positionElement.getBoundingClientRect(), | |
| 1246 | + distanceFromBottom = window.innerHeight - inputBounds.bottom, | |
| 1247 | + showOnTop = configPos === "above" || configPos !== "below" && distanceFromBottom < calendarHeight && inputBounds.top > calendarHeight; | |
| 1248 | + | |
| 1249 | + var top = window.pageYOffset + inputBounds.top + (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2); | |
| 1250 | + | |
| 1251 | + toggleClass(self.calendarContainer, "arrowTop", !showOnTop); | |
| 1252 | + toggleClass(self.calendarContainer, "arrowBottom", showOnTop); | |
| 1253 | + | |
| 1254 | + if (self.config.inline) return; | |
| 1255 | + | |
| 1256 | + var left = window.pageXOffset + inputBounds.left; | |
| 1257 | + var right = window.document.body.offsetWidth - inputBounds.right; | |
| 1258 | + var rightMost = left + calendarWidth > window.document.body.offsetWidth; | |
| 1259 | + | |
| 1260 | + toggleClass(self.calendarContainer, "rightMost", rightMost); | |
| 1261 | + | |
| 1262 | + if (self.config.static) return; | |
| 1263 | + | |
| 1264 | + self.calendarContainer.style.top = top + "px"; | |
| 1265 | + | |
| 1266 | + if (!rightMost) { | |
| 1267 | + self.calendarContainer.style.left = left + "px"; | |
| 1268 | + self.calendarContainer.style.right = "auto"; | |
| 1269 | + } else { | |
| 1270 | + self.calendarContainer.style.left = "auto"; | |
| 1271 | + self.calendarContainer.style.right = right + "px"; | |
| 1272 | + } | |
| 1273 | + } | |
| 1274 | + | |
| 1275 | + function redraw() { | |
| 1276 | + if (self.config.noCalendar || self.isMobile) return; | |
| 1277 | + | |
| 1278 | + buildWeekdays(); | |
| 1279 | + updateNavigationCurrentMonth(); | |
| 1280 | + buildDays(); | |
| 1281 | + } | |
| 1282 | + | |
| 1283 | + function selectDate(e) { | |
| 1284 | + e.preventDefault(); | |
| 1285 | + e.stopPropagation(); | |
| 1286 | + | |
| 1287 | + if (!e.target.classList.contains("flatpickr-day") || e.target.classList.contains("disabled") || e.target.classList.contains("notAllowed")) return; | |
| 1288 | + | |
| 1289 | + var selectedDate = self.latestSelectedDateObj = new Date(e.target.dateObj.getTime()); | |
| 1290 | + | |
| 1291 | + var shouldChangeMonth = selectedDate.getMonth() !== self.currentMonth && self.config.mode !== "range"; | |
| 1292 | + | |
| 1293 | + self.selectedDateElem = e.target; | |
| 1294 | + | |
| 1295 | + if (self.config.mode === "single") self.selectedDates = [selectedDate];else if (self.config.mode === "multiple") { | |
| 1296 | + var selectedIndex = isDateSelected(selectedDate); | |
| 1297 | + if (selectedIndex) self.selectedDates.splice(selectedIndex, 1);else self.selectedDates.push(selectedDate); | |
| 1298 | + } else if (self.config.mode === "range") { | |
| 1299 | + if (self.selectedDates.length === 2) self.clear(); | |
| 1300 | + | |
| 1301 | + self.selectedDates.push(selectedDate); | |
| 1302 | + | |
| 1303 | + // unless selecting same date twice, sort ascendingly | |
| 1304 | + if (compareDates(selectedDate, self.selectedDates[0], true) !== 0) self.selectedDates.sort(function (a, b) { | |
| 1305 | + return a.getTime() - b.getTime(); | |
| 1306 | + }); | |
| 1307 | + } | |
| 1308 | + | |
| 1309 | + setHoursFromInputs(); | |
| 1310 | + | |
| 1311 | + if (shouldChangeMonth) { | |
| 1312 | + var isNewYear = self.currentYear !== selectedDate.getFullYear(); | |
| 1313 | + self.currentYear = selectedDate.getFullYear(); | |
| 1314 | + self.currentMonth = selectedDate.getMonth(); | |
| 1315 | + | |
| 1316 | + if (isNewYear) triggerEvent("YearChange"); | |
| 1317 | + | |
| 1318 | + triggerEvent("MonthChange"); | |
| 1319 | + } | |
| 1320 | + | |
| 1321 | + buildDays(); | |
| 1322 | + | |
| 1323 | + if (self.minDateHasTime && self.config.enableTime && compareDates(selectedDate, self.config.minDate) === 0) setHoursFromDate(self.config.minDate); | |
| 1324 | + | |
| 1325 | + updateValue(); | |
| 1326 | + | |
| 1327 | + if (self.config.enableTime) setTimeout(function () { | |
| 1328 | + return self.showTimeInput = true; | |
| 1329 | + }, 50); | |
| 1330 | + | |
| 1331 | + if (self.config.mode === "range") { | |
| 1332 | + if (self.selectedDates.length === 1) { | |
| 1333 | + onMouseOver(e.target); | |
| 1334 | + | |
| 1335 | + self._hidePrevMonthArrow = self._hidePrevMonthArrow || self.minRangeDate > self.days.childNodes[0].dateObj; | |
| 1336 | + | |
| 1337 | + self._hideNextMonthArrow = self._hideNextMonthArrow || self.maxRangeDate < new Date(self.currentYear, self.currentMonth + 1, 1); | |
| 1338 | + } else updateNavigationCurrentMonth(); | |
| 1339 | + } | |
| 1340 | + | |
| 1341 | + triggerEvent("Change"); | |
| 1342 | + | |
| 1343 | + // maintain focus | |
| 1344 | + if (!shouldChangeMonth) focusOnDay(e.target.$i, 0);else afterDayAnim(function () { | |
| 1345 | + return self.selectedDateElem.focus(); | |
| 1346 | + }); | |
| 1347 | + | |
| 1348 | + if (self.config.enableTime) setTimeout(function () { | |
| 1349 | + return self.hourElement.select(); | |
| 1350 | + }, 451); | |
| 1351 | + | |
| 1352 | + if (self.config.closeOnSelect) { | |
| 1353 | + var single = self.config.mode === "single" && !self.config.enableTime; | |
| 1354 | + var range = self.config.mode === "range" && self.selectedDates.length === 2 && !self.config.enableTime; | |
| 1355 | + | |
| 1356 | + if (single || range) self.close(); | |
| 1357 | + } | |
| 1358 | + } | |
| 1359 | + | |
| 1360 | + function set(option, value) { | |
| 1361 | + self.config[option] = value; | |
| 1362 | + self.redraw(); | |
| 1363 | + jumpToDate(); | |
| 1364 | + } | |
| 1365 | + | |
| 1366 | + function setSelectedDate(inputDate, format) { | |
| 1367 | + if (inputDate instanceof Array) self.selectedDates = inputDate.map(function (d) { | |
| 1368 | + return self.parseDate(d, format); | |
| 1369 | + });else if (inputDate instanceof Date || !isNaN(inputDate)) self.selectedDates = [self.parseDate(inputDate, format)];else if (inputDate && inputDate.substring) { | |
| 1370 | + switch (self.config.mode) { | |
| 1371 | + case "single": | |
| 1372 | + self.selectedDates = [self.parseDate(inputDate, format)]; | |
| 1373 | + break; | |
| 1374 | + | |
| 1375 | + case "multiple": | |
| 1376 | + self.selectedDates = inputDate.split("; ").map(function (date) { | |
| 1377 | + return self.parseDate(date, format); | |
| 1378 | + }); | |
| 1379 | + break; | |
| 1380 | + | |
| 1381 | + case "range": | |
| 1382 | + self.selectedDates = inputDate.split(self.l10n.rangeSeparator).map(function (date) { | |
| 1383 | + return self.parseDate(date, format); | |
| 1384 | + }); | |
| 1385 | + | |
| 1386 | + break; | |
| 1387 | + | |
| 1388 | + default: | |
| 1389 | + break; | |
| 1390 | + } | |
| 1391 | + } | |
| 1392 | + | |
| 1393 | + self.selectedDates = self.selectedDates.filter(function (d) { | |
| 1394 | + return d instanceof Date && isEnabled(d, false); | |
| 1395 | + }); | |
| 1396 | + | |
| 1397 | + self.selectedDates.sort(function (a, b) { | |
| 1398 | + return a.getTime() - b.getTime(); | |
| 1399 | + }); | |
| 1400 | + } | |
| 1401 | + | |
| 1402 | + function setDate(date, triggerChange, format) { | |
| 1403 | + if (date !== 0 && !date) return self.clear(triggerChange); | |
| 1404 | + | |
| 1405 | + setSelectedDate(date, format); | |
| 1406 | + | |
| 1407 | + self.showTimeInput = self.selectedDates.length > 0; | |
| 1408 | + self.latestSelectedDateObj = self.selectedDates[0]; | |
| 1409 | + | |
| 1410 | + self.redraw(); | |
| 1411 | + jumpToDate(); | |
| 1412 | + | |
| 1413 | + setHoursFromDate(); | |
| 1414 | + updateValue(triggerChange); | |
| 1415 | + | |
| 1416 | + if (triggerChange) triggerEvent("Change"); | |
| 1417 | + } | |
| 1418 | + | |
| 1419 | + function parseDateRules(arr) { | |
| 1420 | + for (var i = arr.length; i--;) { | |
| 1421 | + if (typeof arr[i] === "string" || +arr[i]) arr[i] = self.parseDate(arr[i], null, true);else if (arr[i] && arr[i].from && arr[i].to) { | |
| 1422 | + arr[i].from = self.parseDate(arr[i].from); | |
| 1423 | + arr[i].to = self.parseDate(arr[i].to); | |
| 1424 | + } | |
| 1425 | + } | |
| 1426 | + | |
| 1427 | + return arr.filter(function (x) { | |
| 1428 | + return x; | |
| 1429 | + }); // remove falsy values | |
| 1430 | + } | |
| 1431 | + | |
| 1432 | + function setupDates() { | |
| 1433 | + self.selectedDates = []; | |
| 1434 | + self.now = new Date(); | |
| 1435 | + | |
| 1436 | + var preloadedDate = self.config.defaultDate || self.input.value; | |
| 1437 | + if (preloadedDate) setSelectedDate(preloadedDate, self.config.dateFormat); | |
| 1438 | + | |
| 1439 | + var initialDate = self.selectedDates.length ? self.selectedDates[0] : self.config.minDate && self.config.minDate.getTime() > self.now ? self.config.minDate : self.config.maxDate && self.config.maxDate.getTime() < self.now ? self.config.maxDate : self.now; | |
| 1440 | + | |
| 1441 | + self.currentYear = initialDate.getFullYear(); | |
| 1442 | + self.currentMonth = initialDate.getMonth(); | |
| 1443 | + | |
| 1444 | + if (self.selectedDates.length) self.latestSelectedDateObj = self.selectedDates[0]; | |
| 1445 | + | |
| 1446 | + self.minDateHasTime = self.config.minDate && (self.config.minDate.getHours() || self.config.minDate.getMinutes() || self.config.minDate.getSeconds()); | |
| 1447 | + | |
| 1448 | + self.maxDateHasTime = self.config.maxDate && (self.config.maxDate.getHours() || self.config.maxDate.getMinutes() || self.config.maxDate.getSeconds()); | |
| 1449 | + | |
| 1450 | + Object.defineProperty(self, "latestSelectedDateObj", { | |
| 1451 | + get: function get() { | |
| 1452 | + return self._selectedDateObj || self.selectedDates[self.selectedDates.length - 1]; | |
| 1453 | + }, | |
| 1454 | + set: function set(date) { | |
| 1455 | + self._selectedDateObj = date; | |
| 1456 | + } | |
| 1457 | + }); | |
| 1458 | + | |
| 1459 | + if (!self.isMobile) { | |
| 1460 | + Object.defineProperty(self, "showTimeInput", { | |
| 1461 | + get: function get() { | |
| 1462 | + return self._showTimeInput; | |
| 1463 | + }, | |
| 1464 | + set: function set(bool) { | |
| 1465 | + self._showTimeInput = bool; | |
| 1466 | + if (self.calendarContainer) toggleClass(self.calendarContainer, "showTimeInput", bool); | |
| 1467 | + positionCalendar(); | |
| 1468 | + } | |
| 1469 | + }); | |
| 1470 | + } | |
| 1471 | + } | |
| 1472 | + | |
| 1473 | + function setupHelperFunctions() { | |
| 1474 | + self.utils = { | |
| 1475 | + duration: { | |
| 1476 | + DAY: 86400000 | |
| 1477 | + }, | |
| 1478 | + getDaysinMonth: function getDaysinMonth(month, yr) { | |
| 1479 | + month = typeof month === "undefined" ? self.currentMonth : month; | |
| 1480 | + | |
| 1481 | + yr = typeof yr === "undefined" ? self.currentYear : yr; | |
| 1482 | + | |
| 1483 | + if (month === 1 && (yr % 4 === 0 && yr % 100 !== 0 || yr % 400 === 0)) return 29; | |
| 1484 | + | |
| 1485 | + return self.l10n.daysInMonth[month]; | |
| 1486 | + }, | |
| 1487 | + monthToStr: function monthToStr(monthNumber, shorthand) { | |
| 1488 | + shorthand = typeof shorthand === "undefined" ? self.config.shorthandCurrentMonth : shorthand; | |
| 1489 | + | |
| 1490 | + return self.l10n.months[(shorthand ? "short" : "long") + "hand"][monthNumber]; | |
| 1491 | + } | |
| 1492 | + }; | |
| 1493 | + } | |
| 1494 | + | |
| 1495 | + /* istanbul ignore next */ | |
| 1496 | + function setupFormats() { | |
| 1497 | + self.formats = Object.create(FlatpickrInstance.prototype.formats); | |
| 1498 | + ["D", "F", "J", "M", "W", "l"].forEach(function (f) { | |
| 1499 | + self.formats[f] = FlatpickrInstance.prototype.formats[f].bind(self); | |
| 1500 | + }); | |
| 1501 | + | |
| 1502 | + self.revFormat.F = FlatpickrInstance.prototype.revFormat.F.bind(self); | |
| 1503 | + self.revFormat.M = FlatpickrInstance.prototype.revFormat.M.bind(self); | |
| 1504 | + } | |
| 1505 | + | |
| 1506 | + function setupInputs() { | |
| 1507 | + self.input = self.config.wrap ? self.element.querySelector("[data-input]") : self.element; | |
| 1508 | + | |
| 1509 | + /* istanbul ignore next */ | |
| 1510 | + if (!self.input) return console.warn("Error: invalid input element specified", self.input); | |
| 1511 | + | |
| 1512 | + self.input._type = self.input.type; | |
| 1513 | + self.input.type = "text"; | |
| 1514 | + | |
| 1515 | + self.input.classList.add("flatpickr-input"); | |
| 1516 | + self._input = self.input; | |
| 1517 | + | |
| 1518 | + if (self.config.altInput) { | |
| 1519 | + // replicate self.element | |
| 1520 | + self.altInput = createElement(self.input.nodeName, self.input.className + " " + self.config.altInputClass); | |
| 1521 | + self._input = self.altInput; | |
| 1522 | + self.altInput.placeholder = self.input.placeholder; | |
| 1523 | + self.altInput.disabled = self.input.disabled; | |
| 1524 | + self.altInput.required = self.input.required; | |
| 1525 | + self.altInput.type = "text"; | |
| 1526 | + self.input.type = "hidden"; | |
| 1527 | + | |
| 1528 | + if (!self.config.static && self.input.parentNode) self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling); | |
| 1529 | + } | |
| 1530 | + | |
| 1531 | + if (!self.config.allowInput) self._input.setAttribute("readonly", "readonly"); | |
| 1532 | + | |
| 1533 | + self._positionElement = self.config.positionElement || self._input; | |
| 1534 | + } | |
| 1535 | + | |
| 1536 | + function setupMobile() { | |
| 1537 | + var inputType = self.config.enableTime ? self.config.noCalendar ? "time" : "datetime-local" : "date"; | |
| 1538 | + | |
| 1539 | + self.mobileInput = createElement("input", self.input.className + " flatpickr-mobile"); | |
| 1540 | + self.mobileInput.step = "any"; | |
| 1541 | + self.mobileInput.tabIndex = 1; | |
| 1542 | + self.mobileInput.type = inputType; | |
| 1543 | + self.mobileInput.disabled = self.input.disabled; | |
| 1544 | + self.mobileInput.placeholder = self.input.placeholder; | |
| 1545 | + | |
| 1546 | + self.mobileFormatStr = inputType === "datetime-local" ? "Y-m-d\\TH:i:S" : inputType === "date" ? "Y-m-d" : "H:i:S"; | |
| 1547 | + | |
| 1548 | + if (self.selectedDates.length) { | |
| 1549 | + self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr); | |
| 1550 | + } | |
| 1551 | + | |
| 1552 | + if (self.config.minDate) self.mobileInput.min = self.formatDate(self.config.minDate, "Y-m-d"); | |
| 1553 | + | |
| 1554 | + if (self.config.maxDate) self.mobileInput.max = self.formatDate(self.config.maxDate, "Y-m-d"); | |
| 1555 | + | |
| 1556 | + self.input.type = "hidden"; | |
| 1557 | + if (self.config.altInput) self.altInput.type = "hidden"; | |
| 1558 | + | |
| 1559 | + try { | |
| 1560 | + self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling); | |
| 1561 | + } catch (e) { | |
| 1562 | + // | |
| 1563 | + } | |
| 1564 | + | |
| 1565 | + self.mobileInput.addEventListener("change", function (e) { | |
| 1566 | + self.setDate(e.target.value, false, self.mobileFormatStr); | |
| 1567 | + triggerEvent("Change"); | |
| 1568 | + triggerEvent("Close"); | |
| 1569 | + }); | |
| 1570 | + } | |
| 1571 | + | |
| 1572 | + function toggle() { | |
| 1573 | + if (self.isOpen) return self.close(); | |
| 1574 | + self.open(); | |
| 1575 | + } | |
| 1576 | + | |
| 1577 | + function triggerEvent(event, data) { | |
| 1578 | + var hooks = self.config["on" + event]; | |
| 1579 | + | |
| 1580 | + if (hooks !== undefined && hooks.length > 0) { | |
| 1581 | + for (var i = 0; hooks[i] && i < hooks.length; i++) { | |
| 1582 | + hooks[i](self.selectedDates, self.input.value, self, data); | |
| 1583 | + } | |
| 1584 | + } | |
| 1585 | + | |
| 1586 | + if (event === "Change") { | |
| 1587 | + self.input.dispatchEvent(createEvent("change")); | |
| 1588 | + | |
| 1589 | + // many front-end frameworks bind to the input event | |
| 1590 | + self.input.dispatchEvent(createEvent("input")); | |
| 1591 | + } | |
| 1592 | + } | |
| 1593 | + | |
| 1594 | + /** | |
| 1595 | + * Creates an Event, normalized across browsers | |
| 1596 | + * @param {String} name the event name, e.g. "click" | |
| 1597 | + * @return {Event} the created event | |
| 1598 | + */ | |
| 1599 | + function createEvent(name) { | |
| 1600 | + if (self._supportsEvents) return new Event(name, { bubbles: true }); | |
| 1601 | + | |
| 1602 | + self._[name + "Event"] = document.createEvent("Event"); | |
| 1603 | + self._[name + "Event"].initEvent(name, true, true); | |
| 1604 | + return self._[name + "Event"]; | |
| 1605 | + } | |
| 1606 | + | |
| 1607 | + function isDateSelected(date) { | |
| 1608 | + for (var i = 0; i < self.selectedDates.length; i++) { | |
| 1609 | + if (compareDates(self.selectedDates[i], date) === 0) return "" + i; | |
| 1610 | + } | |
| 1611 | + | |
| 1612 | + return false; | |
| 1613 | + } | |
| 1614 | + | |
| 1615 | + function isDateInRange(date) { | |
| 1616 | + if (self.config.mode !== "range" || self.selectedDates.length < 2) return false; | |
| 1617 | + return compareDates(date, self.selectedDates[0]) >= 0 && compareDates(date, self.selectedDates[1]) <= 0; | |
| 1618 | + } | |
| 1619 | + | |
| 1620 | + function updateNavigationCurrentMonth() { | |
| 1621 | + if (self.config.noCalendar || self.isMobile || !self.monthNav) return; | |
| 1622 | + | |
| 1623 | + self.currentMonthElement.textContent = self.utils.monthToStr(self.currentMonth) + " "; | |
| 1624 | + self.currentYearElement.value = self.currentYear; | |
| 1625 | + | |
| 1626 | + self._hidePrevMonthArrow = self.config.minDate && (self.currentYear === self.config.minDate.getFullYear() ? self.currentMonth <= self.config.minDate.getMonth() : self.currentYear < self.config.minDate.getFullYear()); | |
| 1627 | + | |
| 1628 | + self._hideNextMonthArrow = self.config.maxDate && (self.currentYear === self.config.maxDate.getFullYear() ? self.currentMonth + 1 > self.config.maxDate.getMonth() : self.currentYear > self.config.maxDate.getFullYear()); | |
| 1629 | + } | |
| 1630 | + | |
| 1631 | + /** | |
| 1632 | + * Updates the values of inputs associated with the calendar | |
| 1633 | + * @return {void} | |
| 1634 | + */ | |
| 1635 | + function updateValue(triggerChange) { | |
| 1636 | + if (!self.selectedDates.length) return self.clear(triggerChange); | |
| 1637 | + | |
| 1638 | + if (self.isMobile) { | |
| 1639 | + self.mobileInput.value = self.selectedDates.length ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr) : ""; | |
| 1640 | + } | |
| 1641 | + | |
| 1642 | + var joinChar = self.config.mode !== "range" ? "; " : self.l10n.rangeSeparator; | |
| 1643 | + | |
| 1644 | + self.input.value = self.selectedDates.map(function (dObj) { | |
| 1645 | + return self.formatDate(dObj, self.config.dateFormat); | |
| 1646 | + }).join(joinChar); | |
| 1647 | + | |
| 1648 | + if (self.config.altInput) { | |
| 1649 | + self.altInput.value = self.selectedDates.map(function (dObj) { | |
| 1650 | + return self.formatDate(dObj, self.config.altFormat); | |
| 1651 | + }).join(joinChar); | |
| 1652 | + } | |
| 1653 | + | |
| 1654 | + if (triggerChange !== false) triggerEvent("ValueUpdate"); | |
| 1655 | + } | |
| 1656 | + | |
| 1657 | + function mouseDelta(e) { | |
| 1658 | + return Math.max(-1, Math.min(1, e.wheelDelta || -e.deltaY)); | |
| 1659 | + } | |
| 1660 | + | |
| 1661 | + function onMonthNavScroll(e) { | |
| 1662 | + e.preventDefault(); | |
| 1663 | + var isYear = self.currentYearElement.parentNode.contains(e.target); | |
| 1664 | + | |
| 1665 | + if (e.target === self.currentMonthElement || isYear) { | |
| 1666 | + | |
| 1667 | + var delta = mouseDelta(e); | |
| 1668 | + | |
| 1669 | + if (isYear) { | |
| 1670 | + changeYear(self.currentYear + delta); | |
| 1671 | + e.target.value = self.currentYear; | |
| 1672 | + } else self.changeMonth(delta, true, false); | |
| 1673 | + } | |
| 1674 | + } | |
| 1675 | + | |
| 1676 | + function onMonthNavClick(e) { | |
| 1677 | + var isPrevMonth = self.prevMonthNav.contains(e.target); | |
| 1678 | + var isNextMonth = self.nextMonthNav.contains(e.target); | |
| 1679 | + | |
| 1680 | + if (isPrevMonth || isNextMonth) changeMonth(isPrevMonth ? -1 : 1);else if (e.target === self.currentYearElement) { | |
| 1681 | + e.preventDefault(); | |
| 1682 | + self.currentYearElement.select(); | |
| 1683 | + } else if (e.target.className === "arrowUp") self.changeYear(self.currentYear + 1);else if (e.target.className === "arrowDown") self.changeYear(self.currentYear - 1); | |
| 1684 | + } | |
| 1685 | + | |
| 1686 | + /** | |
| 1687 | + * Creates an HTMLElement with given tag, class, and textual content | |
| 1688 | + * @param {String} tag the HTML tag | |
| 1689 | + * @param {String} className the new element's class name | |
| 1690 | + * @param {String} content The new element's text content | |
| 1691 | + * @return {HTMLElement} the created HTML element | |
| 1692 | + */ | |
| 1693 | + function createElement(tag, className, content) { | |
| 1694 | + var e = window.document.createElement(tag); | |
| 1695 | + className = className || ""; | |
| 1696 | + content = content || ""; | |
| 1697 | + | |
| 1698 | + e.className = className; | |
| 1699 | + | |
| 1700 | + if (content !== undefined) e.textContent = content; | |
| 1701 | + | |
| 1702 | + return e; | |
| 1703 | + } | |
| 1704 | + | |
| 1705 | + function arrayify(obj) { | |
| 1706 | + if (obj instanceof Array) return obj; | |
| 1707 | + return [obj]; | |
| 1708 | + } | |
| 1709 | + | |
| 1710 | + function toggleClass(elem, className, bool) { | |
| 1711 | + if (bool) return elem.classList.add(className); | |
| 1712 | + elem.classList.remove(className); | |
| 1713 | + } | |
| 1714 | + | |
| 1715 | + /* istanbul ignore next */ | |
| 1716 | + function debounce(func, wait, immediate) { | |
| 1717 | + var timeout = void 0; | |
| 1718 | + return function () { | |
| 1719 | + var context = this, | |
| 1720 | + args = arguments; | |
| 1721 | + clearTimeout(timeout); | |
| 1722 | + timeout = setTimeout(function () { | |
| 1723 | + timeout = null; | |
| 1724 | + if (!immediate) func.apply(context, args); | |
| 1725 | + }, wait); | |
| 1726 | + if (immediate && !timeout) func.apply(context, args); | |
| 1727 | + }; | |
| 1728 | + } | |
| 1729 | + | |
| 1730 | + /** | |
| 1731 | + * Compute the difference in dates, measured in ms | |
| 1732 | + * @param {Date} date1 | |
| 1733 | + * @param {Date} date2 | |
| 1734 | + * @param {Boolean} timeless whether to reset times of both dates to 00:00 | |
| 1735 | + * @return {Number} the difference in ms | |
| 1736 | + */ | |
| 1737 | + function compareDates(date1, date2, timeless) { | |
| 1738 | + if (!(date1 instanceof Date) || !(date2 instanceof Date)) return false; | |
| 1739 | + | |
| 1740 | + if (timeless !== false) { | |
| 1741 | + return new Date(date1.getTime()).setHours(0, 0, 0, 0) - new Date(date2.getTime()).setHours(0, 0, 0, 0); | |
| 1742 | + } | |
| 1743 | + | |
| 1744 | + return date1.getTime() - date2.getTime(); | |
| 1745 | + } | |
| 1746 | + | |
| 1747 | + function timeWrapper(e) { | |
| 1748 | + e.preventDefault(); | |
| 1749 | + | |
| 1750 | + var isKeyDown = e.type === "keydown", | |
| 1751 | + isWheel = e.type === "wheel", | |
| 1752 | + isIncrement = e.type === "increment", | |
| 1753 | + input = e.target; | |
| 1754 | + | |
| 1755 | + if (self.amPM && e.target === self.amPM) return e.target.textContent = ["AM", "PM"][e.target.textContent === "AM" | 0]; | |
| 1756 | + | |
| 1757 | + var min = Number(input.min), | |
| 1758 | + max = Number(input.max), | |
| 1759 | + step = Number(input.step), | |
| 1760 | + curValue = parseInt(input.value, 10), | |
| 1761 | + delta = e.delta || (!isKeyDown ? Math.max(-1, Math.min(1, e.wheelDelta || -e.deltaY)) || 0 : e.which === 38 ? 1 : -1); | |
| 1762 | + | |
| 1763 | + var newValue = curValue + step * delta; | |
| 1764 | + | |
| 1765 | + if (typeof input.value !== "undefined" && input.value.length === 2) { | |
| 1766 | + var isHourElem = input === self.hourElement, | |
| 1767 | + isMinuteElem = input === self.minuteElement; | |
| 1768 | + | |
| 1769 | + if (newValue < min) { | |
| 1770 | + newValue = max + newValue + !isHourElem + (isHourElem && !self.amPM); | |
| 1771 | + | |
| 1772 | + if (isMinuteElem) incrementNumInput(null, -1, self.hourElement); | |
| 1773 | + } else if (newValue > max) { | |
| 1774 | + newValue = input === self.hourElement ? newValue - max - !self.amPM : min; | |
| 1775 | + | |
| 1776 | + if (isMinuteElem) incrementNumInput(null, 1, self.hourElement); | |
| 1777 | + } | |
| 1778 | + | |
| 1779 | + if (self.amPM && isHourElem && (step === 1 ? newValue + curValue === 23 : Math.abs(newValue - curValue) > step)) self.amPM.textContent = self.amPM.textContent === "PM" ? "AM" : "PM"; | |
| 1780 | + | |
| 1781 | + input.value = self.pad(newValue); | |
| 1782 | + } | |
| 1783 | + } | |
| 1784 | + | |
| 1785 | + init(); | |
| 1786 | + return self; | |
| 1787 | +} | |
| 1788 | + | |
| 1789 | +FlatpickrInstance.prototype = { | |
| 1790 | + formats: { | |
| 1791 | + // get the date in UTC | |
| 1792 | + Z: function Z(date) { | |
| 1793 | + return date.toISOString(); | |
| 1794 | + }, | |
| 1795 | + | |
| 1796 | + // weekday name, short, e.g. Thu | |
| 1797 | + D: function D(date) { | |
| 1798 | + return this.l10n.weekdays.shorthand[this.formats.w(date)]; | |
| 1799 | + }, | |
| 1800 | + | |
| 1801 | + // full month name e.g. January | |
| 1802 | + F: function F(date) { | |
| 1803 | + return this.utils.monthToStr(this.formats.n(date) - 1, false); | |
| 1804 | + }, | |
| 1805 | + | |
| 1806 | + // padded hour 1-12 | |
| 1807 | + G: function G(date) { | |
| 1808 | + return FlatpickrInstance.prototype.pad(FlatpickrInstance.prototype.formats.h(date)); | |
| 1809 | + }, | |
| 1810 | + | |
| 1811 | + // hours with leading zero e.g. 03 | |
| 1812 | + H: function H(date) { | |
| 1813 | + return FlatpickrInstance.prototype.pad(date.getHours()); | |
| 1814 | + }, | |
| 1815 | + | |
| 1816 | + // day (1-30) with ordinal suffix e.g. 1st, 2nd | |
| 1817 | + J: function J(date) { | |
| 1818 | + return date.getDate() + this.l10n.ordinal(date.getDate()); | |
| 1819 | + }, | |
| 1820 | + | |
| 1821 | + // AM/PM | |
| 1822 | + K: function K(date) { | |
| 1823 | + return date.getHours() > 11 ? "PM" : "AM"; | |
| 1824 | + }, | |
| 1825 | + | |
| 1826 | + // shorthand month e.g. Jan, Sep, Oct, etc | |
| 1827 | + M: function M(date) { | |
| 1828 | + return this.utils.monthToStr(date.getMonth(), true); | |
| 1829 | + }, | |
| 1830 | + | |
| 1831 | + // seconds 00-59 | |
| 1832 | + S: function S(date) { | |
| 1833 | + return FlatpickrInstance.prototype.pad(date.getSeconds()); | |
| 1834 | + }, | |
| 1835 | + | |
| 1836 | + // unix timestamp | |
| 1837 | + U: function U(date) { | |
| 1838 | + return date.getTime() / 1000; | |
| 1839 | + }, | |
| 1840 | + | |
| 1841 | + W: function W(date) { | |
| 1842 | + return this.config.getWeek(date); | |
| 1843 | + }, | |
| 1844 | + | |
| 1845 | + // full year e.g. 2016 | |
| 1846 | + Y: function Y(date) { | |
| 1847 | + return date.getFullYear(); | |
| 1848 | + }, | |
| 1849 | + | |
| 1850 | + // day in month, padded (01-30) | |
| 1851 | + d: function d(date) { | |
| 1852 | + return FlatpickrInstance.prototype.pad(date.getDate()); | |
| 1853 | + }, | |
| 1854 | + | |
| 1855 | + // hour from 1-12 (am/pm) | |
| 1856 | + h: function h(date) { | |
| 1857 | + return date.getHours() % 12 ? date.getHours() % 12 : 12; | |
| 1858 | + }, | |
| 1859 | + | |
| 1860 | + // minutes, padded with leading zero e.g. 09 | |
| 1861 | + i: function i(date) { | |
| 1862 | + return FlatpickrInstance.prototype.pad(date.getMinutes()); | |
| 1863 | + }, | |
| 1864 | + | |
| 1865 | + // day in month (1-30) | |
| 1866 | + j: function j(date) { | |
| 1867 | + return date.getDate(); | |
| 1868 | + }, | |
| 1869 | + | |
| 1870 | + // weekday name, full, e.g. Thursday | |
| 1871 | + l: function l(date) { | |
| 1872 | + return this.l10n.weekdays.longhand[date.getDay()]; | |
| 1873 | + }, | |
| 1874 | + | |
| 1875 | + // padded month number (01-12) | |
| 1876 | + m: function m(date) { | |
| 1877 | + return FlatpickrInstance.prototype.pad(date.getMonth() + 1); | |
| 1878 | + }, | |
| 1879 | + | |
| 1880 | + // the month number (1-12) | |
| 1881 | + n: function n(date) { | |
| 1882 | + return date.getMonth() + 1; | |
| 1883 | + }, | |
| 1884 | + | |
| 1885 | + // seconds 0-59 | |
| 1886 | + s: function s(date) { | |
| 1887 | + return date.getSeconds(); | |
| 1888 | + }, | |
| 1889 | + | |
| 1890 | + // number of the day of the week | |
| 1891 | + w: function w(date) { | |
| 1892 | + return date.getDay(); | |
| 1893 | + }, | |
| 1894 | + | |
| 1895 | + // last two digits of year e.g. 16 for 2016 | |
| 1896 | + y: function y(date) { | |
| 1897 | + return String(date.getFullYear()).substring(2); | |
| 1898 | + } | |
| 1899 | + }, | |
| 1900 | + | |
| 1901 | + /** | |
| 1902 | + * Formats a given Date object into a string based on supplied format | |
| 1903 | + * @param {Date} dateObj the date object | |
| 1904 | + * @param {String} frmt a string composed of formatting tokens e.g. "Y-m-d" | |
| 1905 | + * @return {String} The textual representation of the date e.g. 2017-02-03 | |
| 1906 | + */ | |
| 1907 | + formatDate: function formatDate(dateObj, frmt) { | |
| 1908 | + var _this = this; | |
| 1909 | + | |
| 1910 | + if (this.config !== undefined && this.config.formatDate !== undefined) return this.config.formatDate(dateObj, frmt); | |
| 1911 | + | |
| 1912 | + return frmt.split("").map(function (c, i, arr) { | |
| 1913 | + return _this.formats[c] && arr[i - 1] !== "\\" ? _this.formats[c](dateObj) : c !== "\\" ? c : ""; | |
| 1914 | + }).join(""); | |
| 1915 | + }, | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + revFormat: { | |
| 1919 | + D: function D() {}, | |
| 1920 | + F: function F(dateObj, monthName) { | |
| 1921 | + dateObj.setMonth(this.l10n.months.longhand.indexOf(monthName)); | |
| 1922 | + }, | |
| 1923 | + G: function G(dateObj, hour) { | |
| 1924 | + dateObj.setHours(parseFloat(hour)); | |
| 1925 | + }, | |
| 1926 | + H: function H(dateObj, hour) { | |
| 1927 | + dateObj.setHours(parseFloat(hour)); | |
| 1928 | + }, | |
| 1929 | + J: function J(dateObj, day) { | |
| 1930 | + dateObj.setDate(parseFloat(day)); | |
| 1931 | + }, | |
| 1932 | + K: function K(dateObj, amPM) { | |
| 1933 | + var hours = dateObj.getHours(); | |
| 1934 | + | |
| 1935 | + if (hours !== 12) dateObj.setHours(hours % 12 + 12 * /pm/i.test(amPM)); | |
| 1936 | + }, | |
| 1937 | + M: function M(dateObj, shortMonth) { | |
| 1938 | + dateObj.setMonth(this.l10n.months.shorthand.indexOf(shortMonth)); | |
| 1939 | + }, | |
| 1940 | + S: function S(dateObj, seconds) { | |
| 1941 | + dateObj.setSeconds(seconds); | |
| 1942 | + }, | |
| 1943 | + U: function U(dateObj, unixSeconds) { | |
| 1944 | + return new Date(parseFloat(unixSeconds) * 1000); | |
| 1945 | + }, | |
| 1946 | + | |
| 1947 | + W: function W(dateObj, weekNumber) { | |
| 1948 | + weekNumber = parseInt(weekNumber); | |
| 1949 | + return new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0, 0); | |
| 1950 | + }, | |
| 1951 | + Y: function Y(dateObj, year) { | |
| 1952 | + dateObj.setFullYear(year); | |
| 1953 | + }, | |
| 1954 | + Z: function Z(dateObj, ISODate) { | |
| 1955 | + return new Date(ISODate); | |
| 1956 | + }, | |
| 1957 | + | |
| 1958 | + d: function d(dateObj, day) { | |
| 1959 | + dateObj.setDate(parseFloat(day)); | |
| 1960 | + }, | |
| 1961 | + h: function h(dateObj, hour) { | |
| 1962 | + dateObj.setHours(parseFloat(hour)); | |
| 1963 | + }, | |
| 1964 | + i: function i(dateObj, minutes) { | |
| 1965 | + dateObj.setMinutes(parseFloat(minutes)); | |
| 1966 | + }, | |
| 1967 | + j: function j(dateObj, day) { | |
| 1968 | + dateObj.setDate(parseFloat(day)); | |
| 1969 | + }, | |
| 1970 | + l: function l() {}, | |
| 1971 | + m: function m(dateObj, month) { | |
| 1972 | + dateObj.setMonth(parseFloat(month) - 1); | |
| 1973 | + }, | |
| 1974 | + n: function n(dateObj, month) { | |
| 1975 | + dateObj.setMonth(parseFloat(month) - 1); | |
| 1976 | + }, | |
| 1977 | + s: function s(dateObj, seconds) { | |
| 1978 | + dateObj.setSeconds(parseFloat(seconds)); | |
| 1979 | + }, | |
| 1980 | + w: function w() {}, | |
| 1981 | + y: function y(dateObj, year) { | |
| 1982 | + dateObj.setFullYear(2000 + parseFloat(year)); | |
| 1983 | + } | |
| 1984 | + }, | |
| 1985 | + | |
| 1986 | + tokenRegex: { | |
| 1987 | + D: "(\\w+)", | |
| 1988 | + F: "(\\w+)", | |
| 1989 | + G: "(\\d\\d|\\d)", | |
| 1990 | + H: "(\\d\\d|\\d)", | |
| 1991 | + J: "(\\d\\d|\\d)\\w+", | |
| 1992 | + K: "(am|AM|Am|aM|pm|PM|Pm|pM)", | |
| 1993 | + M: "(\\w+)", | |
| 1994 | + S: "(\\d\\d|\\d)", | |
| 1995 | + U: "(.+)", | |
| 1996 | + W: "(\\d\\d|\\d)", | |
| 1997 | + Y: "(\\d{4})", | |
| 1998 | + Z: "(.+)", | |
| 1999 | + d: "(\\d\\d|\\d)", | |
| 2000 | + h: "(\\d\\d|\\d)", | |
| 2001 | + i: "(\\d\\d|\\d)", | |
| 2002 | + j: "(\\d\\d|\\d)", | |
| 2003 | + l: "(\\w+)", | |
| 2004 | + m: "(\\d\\d|\\d)", | |
| 2005 | + n: "(\\d\\d|\\d)", | |
| 2006 | + s: "(\\d\\d|\\d)", | |
| 2007 | + w: "(\\d\\d|\\d)", | |
| 2008 | + y: "(\\d{2})" | |
| 2009 | + }, | |
| 2010 | + | |
| 2011 | + pad: function pad(number) { | |
| 2012 | + return ("0" + number).slice(-2); | |
| 2013 | + }, | |
| 2014 | + | |
| 2015 | + /** | |
| 2016 | + * Parses a date(+time) string into a Date object | |
| 2017 | + * @param {String} date the date string, e.g. 2017-02-03 14:45 | |
| 2018 | + * @param {String} givenFormat the date format, e.g. Y-m-d H:i | |
| 2019 | + * @param {Boolean} timeless whether to reset the time of Date object | |
| 2020 | + * @return {Date} the parsed Date object | |
| 2021 | + */ | |
| 2022 | + parseDate: function parseDate(date, givenFormat, timeless) { | |
| 2023 | + if (date !== 0 && !date) return null; | |
| 2024 | + | |
| 2025 | + var date_orig = date; | |
| 2026 | + | |
| 2027 | + if (date instanceof Date) date = new Date(date.getTime()); // create a copy | |
| 2028 | + | |
| 2029 | + else if (date.toFixed !== undefined) // timestamp | |
| 2030 | + date = new Date(date);else { | |
| 2031 | + // date string | |
| 2032 | + var format = givenFormat || (this.config || flatpickr.defaultConfig).dateFormat; | |
| 2033 | + date = String(date).trim(); | |
| 2034 | + | |
| 2035 | + if (date === "today") { | |
| 2036 | + date = new Date(); | |
| 2037 | + timeless = true; | |
| 2038 | + } else if (/Z$/.test(date) || /GMT$/.test(date)) // datestrings w/ timezone | |
| 2039 | + date = new Date(date);else if (this.config && this.config.parseDate) date = this.config.parseDate(date, format);else { | |
| 2040 | + var parsedDate = !this.config || !this.config.noCalendar ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0) : new Date(new Date().setHours(0, 0, 0, 0)); | |
| 2041 | + | |
| 2042 | + var matched = void 0; | |
| 2043 | + | |
| 2044 | + for (var i = 0, matchIndex = 0, regexStr = ""; i < format.length; i++) { | |
| 2045 | + var token = format[i]; | |
| 2046 | + var isBackSlash = token === "\\"; | |
| 2047 | + var escaped = format[i - 1] === "\\" || isBackSlash; | |
| 2048 | + | |
| 2049 | + if (this.tokenRegex[token] && !escaped) { | |
| 2050 | + regexStr += this.tokenRegex[token]; | |
| 2051 | + var match = new RegExp(regexStr).exec(date); | |
| 2052 | + if (match && (matched = true)) { | |
| 2053 | + parsedDate = this.revFormat[token](parsedDate, match[++matchIndex]) || parsedDate; | |
| 2054 | + } | |
| 2055 | + } else if (!isBackSlash) regexStr += "."; // don't really care | |
| 2056 | + } | |
| 2057 | + | |
| 2058 | + date = matched ? parsedDate : null; | |
| 2059 | + } | |
| 2060 | + } | |
| 2061 | + | |
| 2062 | + /* istanbul ignore next */ | |
| 2063 | + if (!(date instanceof Date)) { | |
| 2064 | + console.warn("flatpickr: invalid date " + date_orig); | |
| 2065 | + console.info(this.element); | |
| 2066 | + return null; | |
| 2067 | + } | |
| 2068 | + | |
| 2069 | + if (timeless === true) date.setHours(0, 0, 0, 0); | |
| 2070 | + | |
| 2071 | + return date; | |
| 2072 | + } | |
| 2073 | +}; | |
| 2074 | + | |
| 2075 | +/* istanbul ignore next */ | |
| 2076 | +function _flatpickr(nodeList, config) { | |
| 2077 | + var nodes = Array.prototype.slice.call(nodeList); // static list | |
| 2078 | + var instances = []; | |
| 2079 | + for (var i = 0; i < nodes.length; i++) { | |
| 2080 | + try { | |
| 2081 | + if (nodes[i].getAttribute("data-fp-omit") !== null) continue; | |
| 2082 | + | |
| 2083 | + if (nodes[i]._flatpickr) { | |
| 2084 | + nodes[i]._flatpickr.destroy(); | |
| 2085 | + nodes[i]._flatpickr = null; | |
| 2086 | + } | |
| 2087 | + | |
| 2088 | + nodes[i]._flatpickr = new FlatpickrInstance(nodes[i], config || {}); | |
| 2089 | + instances.push(nodes[i]._flatpickr); | |
| 2090 | + } catch (e) { | |
| 2091 | + console.warn(e, e.stack); | |
| 2092 | + } | |
| 2093 | + } | |
| 2094 | + | |
| 2095 | + return instances.length === 1 ? instances[0] : instances; | |
| 2096 | +} | |
| 2097 | + | |
| 2098 | +/* istanbul ignore next */ | |
| 2099 | +if (typeof HTMLElement !== "undefined") { | |
| 2100 | + // browser env | |
| 2101 | + HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) { | |
| 2102 | + return _flatpickr(this, config); | |
| 2103 | + }; | |
| 2104 | + | |
| 2105 | + HTMLElement.prototype.flatpickr = function (config) { | |
| 2106 | + return _flatpickr([this], config); | |
| 2107 | + }; | |
| 2108 | +} | |
| 2109 | + | |
| 2110 | +/* istanbul ignore next */ | |
| 2111 | +function flatpickr(selector, config) { | |
| 2112 | + if (selector instanceof NodeList) return _flatpickr(selector, config);else if (!(selector instanceof HTMLElement)) return _flatpickr(window.document.querySelectorAll(selector), config); | |
| 2113 | + | |
| 2114 | + return _flatpickr([selector], config); | |
| 2115 | +} | |
| 2116 | + | |
| 2117 | +/* istanbul ignore next */ | |
| 2118 | +flatpickr.defaultConfig = FlatpickrInstance.defaultConfig = { | |
| 2119 | + mode: "single", | |
| 2120 | + | |
| 2121 | + position: "auto", | |
| 2122 | + | |
| 2123 | + animate: window.navigator.userAgent.indexOf("MSIE") === -1, | |
| 2124 | + | |
| 2125 | + // wrap: see https://chmln.github.io/flatpickr/examples/#flatpickr-external-elements | |
| 2126 | + wrap: false, | |
| 2127 | + | |
| 2128 | + // enables week numbers | |
| 2129 | + weekNumbers: false, | |
| 2130 | + | |
| 2131 | + // allow manual datetime input | |
| 2132 | + allowInput: false, | |
| 2133 | + | |
| 2134 | + /* | |
| 2135 | + clicking on input opens the date(time)picker. | |
| 2136 | + disable if you wish to open the calendar manually with .open() | |
| 2137 | + */ | |
| 2138 | + clickOpens: true, | |
| 2139 | + | |
| 2140 | + /* | |
| 2141 | + closes calendar after date selection, | |
| 2142 | + unless 'mode' is 'multiple' or enableTime is true | |
| 2143 | + */ | |
| 2144 | + closeOnSelect: true, | |
| 2145 | + | |
| 2146 | + // display time picker in 24 hour mode | |
| 2147 | + time_24hr: false, | |
| 2148 | + | |
| 2149 | + // enables the time picker functionality | |
| 2150 | + enableTime: false, | |
| 2151 | + | |
| 2152 | + // noCalendar: true will hide the calendar. use for a time picker along w/ enableTime | |
| 2153 | + noCalendar: false, | |
| 2154 | + | |
| 2155 | + // more date format chars at https://chmln.github.io/flatpickr/#dateformat | |
| 2156 | + dateFormat: "Y-m-d", | |
| 2157 | + | |
| 2158 | + // date format used in aria-label for days | |
| 2159 | + ariaDateFormat: "F j, Y", | |
| 2160 | + | |
| 2161 | + // altInput - see https://chmln.github.io/flatpickr/#altinput | |
| 2162 | + altInput: false, | |
| 2163 | + | |
| 2164 | + // the created altInput element will have this class. | |
| 2165 | + altInputClass: "form-control input", | |
| 2166 | + | |
| 2167 | + // same as dateFormat, but for altInput | |
| 2168 | + altFormat: "F j, Y", // defaults to e.g. June 10, 2016 | |
| 2169 | + | |
| 2170 | + // defaultDate - either a datestring or a date object. used for datetimepicker"s initial value | |
| 2171 | + defaultDate: null, | |
| 2172 | + | |
| 2173 | + // the minimum date that user can pick (inclusive) | |
| 2174 | + minDate: null, | |
| 2175 | + | |
| 2176 | + // the maximum date that user can pick (inclusive) | |
| 2177 | + maxDate: null, | |
| 2178 | + | |
| 2179 | + // dateparser that transforms a given string to a date object | |
| 2180 | + parseDate: null, | |
| 2181 | + | |
| 2182 | + // dateformatter that transforms a given date object to a string, according to passed format | |
| 2183 | + formatDate: null, | |
| 2184 | + | |
| 2185 | + getWeek: function getWeek(givenDate) { | |
| 2186 | + var date = new Date(givenDate.getTime()); | |
| 2187 | + var onejan = new Date(date.getFullYear(), 0, 1); | |
| 2188 | + return Math.ceil(((date - onejan) / 86400000 + onejan.getDay() + 1) / 7); | |
| 2189 | + }, | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + // see https://chmln.github.io/flatpickr/#disable | |
| 2193 | + enable: [], | |
| 2194 | + | |
| 2195 | + // see https://chmln.github.io/flatpickr/#disable | |
| 2196 | + disable: [], | |
| 2197 | + | |
| 2198 | + // display the short version of month names - e.g. Sep instead of September | |
| 2199 | + shorthandCurrentMonth: false, | |
| 2200 | + | |
| 2201 | + // displays calendar inline. see https://chmln.github.io/flatpickr/#inline-calendar | |
| 2202 | + inline: false, | |
| 2203 | + | |
| 2204 | + // position calendar inside wrapper and next to the input element | |
| 2205 | + // leave at false unless you know what you"re doing | |
| 2206 | + "static": false, | |
| 2207 | + | |
| 2208 | + // DOM node to append the calendar to in *static* mode | |
| 2209 | + appendTo: null, | |
| 2210 | + | |
| 2211 | + // code for previous/next icons. this is where you put your custom icon code e.g. fontawesome | |
| 2212 | + prevArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>", | |
| 2213 | + nextArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>", | |
| 2214 | + | |
| 2215 | + // enables seconds in the time picker | |
| 2216 | + enableSeconds: false, | |
| 2217 | + | |
| 2218 | + // step size used when scrolling/incrementing the hour element | |
| 2219 | + hourIncrement: 1, | |
| 2220 | + | |
| 2221 | + // step size used when scrolling/incrementing the minute element | |
| 2222 | + minuteIncrement: 5, | |
| 2223 | + | |
| 2224 | + // initial value in the hour element | |
| 2225 | + defaultHour: 12, | |
| 2226 | + | |
| 2227 | + // initial value in the minute element | |
| 2228 | + defaultMinute: 0, | |
| 2229 | + | |
| 2230 | + // disable native mobile datetime input support | |
| 2231 | + disableMobile: false, | |
| 2232 | + | |
| 2233 | + // default locale | |
| 2234 | + locale: "default", | |
| 2235 | + | |
| 2236 | + plugins: [], | |
| 2237 | + | |
| 2238 | + ignoredFocusElements: [], | |
| 2239 | + | |
| 2240 | + // called every time calendar is closed | |
| 2241 | + onClose: undefined, // function (dateObj, dateStr) {} | |
| 2242 | + | |
| 2243 | + // onChange callback when user selects a date or time | |
| 2244 | + onChange: undefined, // function (dateObj, dateStr) {} | |
| 2245 | + | |
| 2246 | + // called for every day element | |
| 2247 | + onDayCreate: undefined, | |
| 2248 | + | |
| 2249 | + // called every time the month is changed | |
| 2250 | + onMonthChange: undefined, | |
| 2251 | + | |
| 2252 | + // called every time calendar is opened | |
| 2253 | + onOpen: undefined, // function (dateObj, dateStr) {} | |
| 2254 | + | |
| 2255 | + // called after the configuration has been parsed | |
| 2256 | + onParseConfig: undefined, | |
| 2257 | + | |
| 2258 | + // called after calendar is ready | |
| 2259 | + onReady: undefined, // function (dateObj, dateStr) {} | |
| 2260 | + | |
| 2261 | + // called after input value updated | |
| 2262 | + onValueUpdate: undefined, | |
| 2263 | + | |
| 2264 | + // called every time the year is changed | |
| 2265 | + onYearChange: undefined, | |
| 2266 | + | |
| 2267 | + onKeyDown: undefined, | |
| 2268 | + | |
| 2269 | + onDestroy: undefined | |
| 2270 | +}; | |
| 2271 | + | |
| 2272 | +/* istanbul ignore next */ | |
| 2273 | +flatpickr.l10ns = { | |
| 2274 | + en: { | |
| 2275 | + weekdays: { | |
| 2276 | + shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], | |
| 2277 | + longhand: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] | |
| 2278 | + }, | |
| 2279 | + months: { | |
| 2280 | + shorthand: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], | |
| 2281 | + longhand: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] | |
| 2282 | + }, | |
| 2283 | + daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], | |
| 2284 | + firstDayOfWeek: 0, | |
| 2285 | + ordinal: function ordinal(nth) { | |
| 2286 | + var s = nth % 100; | |
| 2287 | + if (s > 3 && s < 21) return "th"; | |
| 2288 | + switch (s % 10) { | |
| 2289 | + case 1: | |
| 2290 | + return "st"; | |
| 2291 | + case 2: | |
| 2292 | + return "nd"; | |
| 2293 | + case 3: | |
| 2294 | + return "rd"; | |
| 2295 | + default: | |
| 2296 | + return "th"; | |
| 2297 | + } | |
| 2298 | + }, | |
| 2299 | + rangeSeparator: " to ", | |
| 2300 | + weekAbbreviation: "Wk", | |
| 2301 | + scrollTitle: "Scroll to increment", | |
| 2302 | + toggleTitle: "Click to toggle" | |
| 2303 | + } | |
| 2304 | +}; | |
| 2305 | + | |
| 2306 | +flatpickr.l10ns.default = Object.create(flatpickr.l10ns.en); | |
| 2307 | +flatpickr.localize = function (l10n) { | |
| 2308 | + return _extends(flatpickr.l10ns.default, l10n || {}); | |
| 2309 | +}; | |
| 2310 | +flatpickr.setDefaults = function (config) { | |
| 2311 | + return _extends(flatpickr.defaultConfig, config || {}); | |
| 2312 | +}; | |
| 2313 | + | |
| 2314 | +/* istanbul ignore next */ | |
| 2315 | +if (typeof jQuery !== "undefined") { | |
| 2316 | + jQuery.fn.flatpickr = function (config) { | |
| 2317 | + return _flatpickr(this, config); | |
| 2318 | + }; | |
| 2319 | +} | |
| 2320 | + | |
| 2321 | +Date.prototype.fp_incr = function (days) { | |
| 2322 | + return new Date(this.getFullYear(), this.getMonth(), this.getDate() + parseInt(days, 10)); | |
| 2323 | +}; | |
| 2324 | + | |
| 2325 | +if (typeof module !== "undefined") module.exports = flatpickr; | |
| 0 | 2326 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/assets/plugins/flatpickr/flatpickr.min.css
0 → 100644
| 1 | +.flatpickr-calendar{background:transparent;overflow:hidden;max-height:0;opacity:0;visibility:hidden;text-align:center;padding:0;-webkit-animation:none;animation:none;direction:ltr;border:0;font-size:14px;line-height:24px;border-radius:5px;position:absolute;width:307.875px;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-touch-action:manipulation;touch-action:manipulation;background:#fff;-webkit-box-shadow:1px 0 0 #e6e6e6,-1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,0.08);box-shadow:1px 0 0 #e6e6e6,-1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,0.08);}.flatpickr-calendar.open,.flatpickr-calendar.inline{opacity:1;visibility:visible;overflow:visible;max-height:640px}.flatpickr-calendar.open{display:inline-block;z-index:99999}.flatpickr-calendar.animate.open{-webkit-animation:fpFadeInDown 300ms cubic-bezier(.23,1,.32,1);animation:fpFadeInDown 300ms cubic-bezier(.23,1,.32,1)}.flatpickr-calendar.inline{display:block;position:relative;top:2px}.flatpickr-calendar.static{position:absolute;top:calc(100% + 2px);}.flatpickr-calendar.static.open{z-index:999;display:block}.flatpickr-calendar.hasWeeks{width:auto}.flatpickr-calendar .hasWeeks .dayContainer,.flatpickr-calendar .hasTime .dayContainer{border-bottom:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.flatpickr-calendar .hasWeeks .dayContainer{border-left:0}.flatpickr-calendar.showTimeInput.hasTime .flatpickr-time{height:40px;border-top:1px solid #e6e6e6}.flatpickr-calendar.noCalendar.hasTime .flatpickr-time{height:auto}.flatpickr-calendar:before,.flatpickr-calendar:after{position:absolute;display:block;pointer-events:none;border:solid transparent;content:'';height:0;width:0;left:22px}.flatpickr-calendar.rightMost:before,.flatpickr-calendar.rightMost:after{left:auto;right:22px}.flatpickr-calendar:before{border-width:5px;margin:0 -5px}.flatpickr-calendar:after{border-width:4px;margin:0 -4px}.flatpickr-calendar.arrowTop:before,.flatpickr-calendar.arrowTop:after{bottom:100%}.flatpickr-calendar.arrowTop:before{border-bottom-color:#e6e6e6}.flatpickr-calendar.arrowTop:after{border-bottom-color:#fff}.flatpickr-calendar.arrowBottom:before,.flatpickr-calendar.arrowBottom:after{top:100%}.flatpickr-calendar.arrowBottom:before{border-top-color:#e6e6e6}.flatpickr-calendar.arrowBottom:after{border-top-color:#fff}.flatpickr-calendar:focus{outline:0}.flatpickr-wrapper{position:relative;display:inline-block}.flatpickr-month{background:transparent;color:rgba(0,0,0,0.9);fill:rgba(0,0,0,0.9);height:28px;line-height:1;text-align:center;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden}.flatpickr-prev-month,.flatpickr-next-month{text-decoration:none;cursor:pointer;position:absolute;top:0;line-height:16px;height:28px;padding:10px calc(3.57% - 1.5px);z-index:3;}.flatpickr-prev-month i,.flatpickr-next-month i{position:relative}.flatpickr-prev-month.flatpickr-prev-month,.flatpickr-next-month.flatpickr-prev-month{/* | |
| 2 | + /*rtl:begin:ignore*/left:0;/* | |
| 3 | + /*rtl:end:ignore*/}/* | |
| 4 | + /*rtl:begin:ignore*/ | |
| 5 | +/* | |
| 6 | + /*rtl:end:ignore*/ | |
| 7 | +.flatpickr-prev-month.flatpickr-next-month,.flatpickr-next-month.flatpickr-next-month{/* | |
| 8 | + /*rtl:begin:ignore*/right:0;/* | |
| 9 | + /*rtl:end:ignore*/}/* | |
| 10 | + /*rtl:begin:ignore*/ | |
| 11 | +/* | |
| 12 | + /*rtl:end:ignore*/ | |
| 13 | +.flatpickr-prev-month:hover,.flatpickr-next-month:hover{color:#959ea9;}.flatpickr-prev-month:hover svg,.flatpickr-next-month:hover svg{fill:#f64747}.flatpickr-prev-month svg,.flatpickr-next-month svg{width:14px;}.flatpickr-prev-month svg path,.flatpickr-next-month svg path{-webkit-transition:fill .1s;transition:fill .1s;fill:inherit}.numInputWrapper{position:relative;height:auto;}.numInputWrapper input,.numInputWrapper span{display:inline-block}.numInputWrapper input{width:100%}.numInputWrapper span{position:absolute;right:0;width:14px;padding:0 4px 0 2px;height:50%;line-height:50%;opacity:0;cursor:pointer;border:1px solid rgba(57,57,57,0.05);-webkit-box-sizing:border-box;box-sizing:border-box;}.numInputWrapper span:hover{background:rgba(0,0,0,0.1)}.numInputWrapper span:active{background:rgba(0,0,0,0.2)}.numInputWrapper span:after{display:block;content:"";position:absolute;top:33%}.numInputWrapper span.arrowUp{top:0;border-bottom:0;}.numInputWrapper span.arrowUp:after{border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid rgba(57,57,57,0.6)}.numInputWrapper span.arrowDown{top:50%;}.numInputWrapper span.arrowDown:after{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid rgba(57,57,57,0.6)}.numInputWrapper span svg{width:inherit;height:auto;}.numInputWrapper span svg path{fill:rgba(0,0,0,0.5)}.numInputWrapper:hover{background:rgba(0,0,0,0.05);}.numInputWrapper:hover span{opacity:1}.flatpickr-current-month{font-size:135%;line-height:inherit;font-weight:300;color:inherit;position:absolute;width:75%;left:12.5%;padding:6.16px 0 0 0;line-height:1;height:28px;display:inline-block;text-align:center;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);}.flatpickr-current-month.slideLeft{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0);-webkit-animation:fpFadeOut 400ms ease,fpSlideLeft 400ms cubic-bezier(.23,1,.32,1);animation:fpFadeOut 400ms ease,fpSlideLeft 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-current-month.slideLeftNew{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0);-webkit-animation:fpFadeIn 400ms ease,fpSlideLeftNew 400ms cubic-bezier(.23,1,.32,1);animation:fpFadeIn 400ms ease,fpSlideLeftNew 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-current-month.slideRight{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0);-webkit-animation:fpFadeOut 400ms ease,fpSlideRight 400ms cubic-bezier(.23,1,.32,1);animation:fpFadeOut 400ms ease,fpSlideRight 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-current-month.slideRightNew{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);-webkit-animation:fpFadeIn 400ms ease,fpSlideRightNew 400ms cubic-bezier(.23,1,.32,1);animation:fpFadeIn 400ms ease,fpSlideRightNew 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-current-month span.cur-month{font-family:inherit;font-weight:700;color:inherit;display:inline-block;margin-left:.5ch;padding:0;}.flatpickr-current-month span.cur-month:hover{background:rgba(0,0,0,0.05)}.flatpickr-current-month .numInputWrapper{width:6ch;width:7ch\0;display:inline-block;}.flatpickr-current-month .numInputWrapper span.arrowUp:after{border-bottom-color:rgba(0,0,0,0.9)}.flatpickr-current-month .numInputWrapper span.arrowDown:after{border-top-color:rgba(0,0,0,0.9)}.flatpickr-current-month input.cur-year{background:transparent;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:default;padding:0 0 0 .5ch;margin:0;display:inline-block;font-size:inherit;font-family:inherit;font-weight:300;line-height:inherit;height:initial;border:0;border-radius:0;vertical-align:initial;}.flatpickr-current-month input.cur-year:focus{outline:0}.flatpickr-current-month input.cur-year[disabled],.flatpickr-current-month input.cur-year[disabled]:hover{font-size:100%;color:rgba(0,0,0,0.5);background:transparent;pointer-events:none}.flatpickr-weekdays{background:transparent;text-align:center;overflow:hidden;width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:28px}span.flatpickr-weekday{cursor:default;font-size:90%;background:transparent;color:rgba(0,0,0,0.54);line-height:1;margin:0;text-align:center;display:block;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;font-weight:bolder}.dayContainer,.flatpickr-weeks{padding:1px 0 0 0}.flatpickr-days{position:relative;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;width:307.875px;}.flatpickr-days:focus{outline:0}.dayContainer{padding:0;outline:0;text-align:left;width:307.875px;min-width:307.875px;max-width:307.875px;-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;display:-ms-flexbox;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-wrap:wrap;-ms-flex-pack:justify;-webkit-justify-content:space-around;justify-content:space-around;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);opacity:1}.flatpickr-calendar.animate .dayContainer.slideLeft{-webkit-animation:fpFadeOut 400ms cubic-bezier(.23,1,.32,1),fpSlideLeft 400ms cubic-bezier(.23,1,.32,1);animation:fpFadeOut 400ms cubic-bezier(.23,1,.32,1),fpSlideLeft 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-calendar.animate .dayContainer.slideLeft,.flatpickr-calendar.animate .dayContainer.slideLeftNew{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.flatpickr-calendar.animate .dayContainer.slideLeftNew{-webkit-animation:fpFadeIn 400ms cubic-bezier(.23,1,.32,1),fpSlideLeft 400ms cubic-bezier(.23,1,.32,1);animation:fpFadeIn 400ms cubic-bezier(.23,1,.32,1),fpSlideLeft 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-calendar.animate .dayContainer.slideRight{-webkit-animation:fpFadeOut 400ms cubic-bezier(.23,1,.32,1),fpSlideRight 400ms cubic-bezier(.23,1,.32,1);animation:fpFadeOut 400ms cubic-bezier(.23,1,.32,1),fpSlideRight 400ms cubic-bezier(.23,1,.32,1);-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}.flatpickr-calendar.animate .dayContainer.slideRightNew{-webkit-animation:fpFadeIn 400ms cubic-bezier(.23,1,.32,1),fpSlideRightNew 400ms cubic-bezier(.23,1,.32,1);animation:fpFadeIn 400ms cubic-bezier(.23,1,.32,1),fpSlideRightNew 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-day{background:none;border:1px solid transparent;border-radius:150px;-webkit-box-sizing:border-box;box-sizing:border-box;color:#393939;cursor:pointer;font-weight:400;width:14.2857143%;-webkit-flex-basis:14.2857143%;-ms-flex-preferred-size:14.2857143%;flex-basis:14.2857143%;max-width:39px;height:39px;line-height:39px;margin:0;display:inline-block;position:relative;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;}.flatpickr-day.inRange,.flatpickr-day.prevMonthDay.inRange,.flatpickr-day.nextMonthDay.inRange,.flatpickr-day.today.inRange,.flatpickr-day.prevMonthDay.today.inRange,.flatpickr-day.nextMonthDay.today.inRange,.flatpickr-day:hover,.flatpickr-day.prevMonthDay:hover,.flatpickr-day.nextMonthDay:hover,.flatpickr-day:focus,.flatpickr-day.prevMonthDay:focus,.flatpickr-day.nextMonthDay:focus{cursor:pointer;outline:0;background:#e6e6e6;border-color:#e6e6e6}.flatpickr-day.today{border-color:#959ea9;}.flatpickr-day.today:hover,.flatpickr-day.today:focus{border-color:#959ea9;background:#959ea9;color:#fff}.flatpickr-day.selected,.flatpickr-day.startRange,.flatpickr-day.endRange,.flatpickr-day.selected.inRange,.flatpickr-day.startRange.inRange,.flatpickr-day.endRange.inRange,.flatpickr-day.selected:focus,.flatpickr-day.startRange:focus,.flatpickr-day.endRange:focus,.flatpickr-day.selected:hover,.flatpickr-day.startRange:hover,.flatpickr-day.endRange:hover,.flatpickr-day.selected.prevMonthDay,.flatpickr-day.startRange.prevMonthDay,.flatpickr-day.endRange.prevMonthDay,.flatpickr-day.selected.nextMonthDay,.flatpickr-day.startRange.nextMonthDay,.flatpickr-day.endRange.nextMonthDay{background:#569ff7;-webkit-box-shadow:none;box-shadow:none;color:#fff;border-color:#569ff7}.flatpickr-day.selected.startRange,.flatpickr-day.startRange.startRange,.flatpickr-day.endRange.startRange{border-radius:50px 0 0 50px}.flatpickr-day.selected.endRange,.flatpickr-day.startRange.endRange,.flatpickr-day.endRange.endRange{border-radius:0 50px 50px 0}.flatpickr-day.selected.startRange + .endRange,.flatpickr-day.startRange.startRange + .endRange,.flatpickr-day.endRange.startRange + .endRange{-webkit-box-shadow:-10px 0 0 #569ff7;box-shadow:-10px 0 0 #569ff7}.flatpickr-day.selected.startRange.endRange,.flatpickr-day.startRange.startRange.endRange,.flatpickr-day.endRange.startRange.endRange{border-radius:50px}.flatpickr-day.inRange{border-radius:0;-webkit-box-shadow:-5px 0 0 #e6e6e6,5px 0 0 #e6e6e6;box-shadow:-5px 0 0 #e6e6e6,5px 0 0 #e6e6e6}.flatpickr-day.disabled,.flatpickr-day.disabled:hover{pointer-events:none}.flatpickr-day.disabled,.flatpickr-day.disabled:hover,.flatpickr-day.prevMonthDay,.flatpickr-day.nextMonthDay,.flatpickr-day.notAllowed,.flatpickr-day.notAllowed.prevMonthDay,.flatpickr-day.notAllowed.nextMonthDay{color:rgba(57,57,57,0.3);background:transparent;border-color:transparent;cursor:default}.flatpickr-day.week.selected{border-radius:0;-webkit-box-shadow:-5px 0 0 #569ff7,5px 0 0 #569ff7;box-shadow:-5px 0 0 #569ff7,5px 0 0 #569ff7}.rangeMode .flatpickr-day{margin-top:1px}.flatpickr-weekwrapper{display:inline-block;float:left;}.flatpickr-weekwrapper .flatpickr-weeks{padding:0 12px;-webkit-box-shadow:1px 0 0 #e6e6e6;box-shadow:1px 0 0 #e6e6e6}.flatpickr-weekwrapper .flatpickr-weekday{float:none;width:100%;line-height:28px}.flatpickr-weekwrapper span.flatpickr-day{display:block;width:100%;max-width:none}.flatpickr-innerContainer{display:block;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;}.flatpickr-rContainer{display:inline-block;padding:0;-webkit-box-sizing:border-box;box-sizing:border-box}.flatpickr-time{text-align:center;outline:0;display:block;height:0;line-height:40px;max-height:40px;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}.flatpickr-time:after{content:"";display:table;clear:both}.flatpickr-time .numInputWrapper{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;width:40%;height:40px;float:left;}.flatpickr-time .numInputWrapper span.arrowUp:after{border-bottom-color:#393939}.flatpickr-time .numInputWrapper span.arrowDown:after{border-top-color:#393939}.flatpickr-time.hasSeconds .numInputWrapper{width:26%}.flatpickr-time.time24hr .numInputWrapper{width:49%}.flatpickr-time input{background:transparent;-webkit-box-shadow:none;box-shadow:none;border:0;border-radius:0;text-align:center;margin:0;padding:0;height:inherit;line-height:inherit;cursor:pointer;color:#393939;font-size:14px;position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;}.flatpickr-time input.flatpickr-hour{font-weight:bold}.flatpickr-time input.flatpickr-minute,.flatpickr-time input.flatpickr-second{font-weight:400}.flatpickr-time input:focus{outline:0;border:0}.flatpickr-time .flatpickr-time-separator,.flatpickr-time .flatpickr-am-pm{height:inherit;display:inline-block;float:left;line-height:inherit;color:#393939;font-weight:bold;width:2%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-align-self:center;-ms-flex-item-align:center;align-self:center}.flatpickr-time .flatpickr-am-pm{outline:0;width:18%;cursor:pointer;text-align:center;font-weight:400;}.flatpickr-time .flatpickr-am-pm:hover,.flatpickr-time .flatpickr-am-pm:focus{background:#f0f0f0}.flatpickr-input[readonly]{cursor:pointer}@-webkit-keyframes fpFadeInDown{from{opacity:0;-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0)}to{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}@keyframes fpFadeInDown{from{opacity:0;-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0)}to{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}@-webkit-keyframes fpSlideLeft{from{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}to{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}}@keyframes fpSlideLeft{from{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}to{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}}@-webkit-keyframes fpSlideLeftNew{from{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}@keyframes fpSlideLeftNew{from{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}@-webkit-keyframes fpSlideRight{from{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}to{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}}@keyframes fpSlideRight{from{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}to{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}}@-webkit-keyframes fpSlideRightNew{from{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}@keyframes fpSlideRightNew{from{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}@-webkit-keyframes fpFadeOut{from{opacity:1}to{opacity:0}}@keyframes fpFadeOut{from{opacity:1}to{opacity:0}}@-webkit-keyframes fpFadeIn{from{opacity:0}to{opacity:1}}@keyframes fpFadeIn{from{opacity:0}to{opacity:1}} | |
| 0 | 14 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/assets/plugins/flatpickr/flatpickr.min.js
0 → 100644
| 1 | +/*! flatpickr v3.0.5-1, @license MIT */ | |
| 2 | +function FlatpickrInstance(e,t){function n(e){return e.bind(De)}function a(e){De.config.noCalendar&&!De.selectedDates.length&&(De.selectedDates=[De.now]),he(e),De.selectedDates.length&&(!De.minDateHasTime||"input"!==e.type||e.target.value.length>=2?(i(),le()):setTimeout(function(){i(),le()},1e3))}function i(){if(De.config.enableTime){var e=(parseInt(De.hourElement.value,10)||0)%(De.amPM?12:24),t=(parseInt(De.minuteElement.value,10)||0)%60,n=De.config.enableSeconds?(parseInt(De.secondElement.value,10)||0)%60:0;void 0!==De.amPM&&(e=e%12+12*("PM"===De.amPM.textContent)),De.minDateHasTime&&0===pe(De.latestSelectedDateObj,De.config.minDate)&&(e=Math.max(e,De.config.minDate.getHours()))===De.config.minDate.getHours()&&(t=Math.max(t,De.config.minDate.getMinutes())),De.maxDateHasTime&&0===pe(De.latestSelectedDateObj,De.config.maxDate)&&(e=Math.min(e,De.config.maxDate.getHours()))===De.config.maxDate.getHours()&&(t=Math.min(t,De.config.maxDate.getMinutes())),o(e,t,n)}}function r(e){var t=e||De.latestSelectedDateObj;t&&o(t.getHours(),t.getMinutes(),t.getSeconds())}function o(e,t,n){De.selectedDates.length&&De.latestSelectedDateObj.setHours(e%24,t,n||0,0),De.config.enableTime&&!De.isMobile&&(De.hourElement.value=De.pad(De.config.time_24hr?e:(12+e)%12+12*(e%12==0)),De.minuteElement.value=De.pad(t),De.config.time_24hr||(De.amPM.textContent=e>=12?"PM":"AM"),!0===De.config.enableSeconds&&(De.secondElement.value=De.pad(n)))}function l(e){var t=e.target.value;e.delta&&(t=(parseInt(t)+e.delta).toString()),4!==t.length&&"Enter"!==e.key||(De.currentYearElement.blur(),/[^\d]/.test(t)||O(t))}function c(e,t,n){return t instanceof Array?t.forEach(function(t){return c(e,t,n)}):e instanceof Array?e.forEach(function(e){return c(e,t,n)}):(e.addEventListener(t,n),void De._handlers.push({element:e,event:t,handler:n}))}function s(e){return function(t){return 1===t.which&&e(t)}}function d(){if(De._handlers=[],De._animationLoop=[],De.config.wrap&&["open","close","toggle","clear"].forEach(function(e){Array.prototype.forEach.call(De.element.querySelectorAll("[data-"+e+"]"),function(t){return c(t,"mousedown",s(De[e]))})}),De.isMobile)return ee();if(De.debouncedResize=ge(j,50),De.triggerChange=function(){ne("Change")},De.debouncedChange=ge(De.triggerChange,300),"range"===De.config.mode&&De.daysContainer&&c(De.daysContainer,"mouseover",function(e){return P(e.target)}),c(window.document.body,"keydown",L),De.config.static||c(De._input,"keydown",L),De.config.inline||De.config.static||c(window,"resize",De.debouncedResize),void 0!==window.ontouchstart&&c(window.document,"touchstart",Y),c(window.document,"mousedown",s(Y)),c(De._input,"blur",Y),!0===De.config.clickOpens&&(c(De._input,"focus",De.open),c(De._input,"mousedown",s(De.open))),De.config.noCalendar||(De.monthNav.addEventListener("wheel",function(e){return e.preventDefault()}),c(De.monthNav,"wheel",ge(se,10)),c(De.monthNav,"mousedown",s(de)),c(De.monthNav,["keyup","increment"],l),c(De.daysContainer,"mousedown",s(U)),De.config.animate&&(c(De.daysContainer,["webkitAnimationEnd","animationend"],f),c(De.monthNav,["webkitAnimationEnd","animationend"],m))),De.config.enableTime){var e=function(e){return e.target.select()};c(De.timeContainer,["wheel","input","increment"],a),c(De.timeContainer,"mousedown",s(p)),c(De.timeContainer,["wheel","increment"],De.debouncedChange),c(De.timeContainer,"input",De.triggerChange),c([De.hourElement,De.minuteElement],"focus",e),void 0!==De.secondElement&&c(De.secondElement,"focus",function(){return De.secondElement.select()}),void 0!==De.amPM&&c(De.amPM,"mousedown",s(function(e){a(e),De.triggerChange(e)}))}}function u(){for(var e=De._animationLoop.length;e--;)De._animationLoop[e](),De._animationLoop.splice(e,1)}function f(e){if(De.daysContainer.childNodes.length>1)switch(e.animationName){case"fpSlideLeft":De.daysContainer.lastChild.classList.remove("slideLeftNew"),De.daysContainer.removeChild(De.daysContainer.firstChild),De.days=De.daysContainer.firstChild,u();break;case"fpSlideRight":De.daysContainer.firstChild.classList.remove("slideRightNew"),De.daysContainer.removeChild(De.daysContainer.lastChild),De.days=De.daysContainer.firstChild,u()}}function m(e){switch(e.animationName){case"fpSlideLeftNew":case"fpSlideRightNew":De.navigationCurrentMonth.classList.remove("slideLeftNew"),De.navigationCurrentMonth.classList.remove("slideRightNew");for(var t=De.navigationCurrentMonth;t.nextSibling&&/curr/.test(t.nextSibling.className);)De.monthNav.removeChild(t.nextSibling);for(;t.previousSibling&&/curr/.test(t.previousSibling.className);)De.monthNav.removeChild(t.previousSibling);De.oldCurMonth=null}}function g(e){e=e?De.parseDate(e):De.latestSelectedDateObj||(De.config.minDate>De.now?De.config.minDate:De.config.maxDate&&De.config.maxDate<De.now?De.config.maxDate:De.now);try{De.currentYear=e.getFullYear(),De.currentMonth=e.getMonth()}catch(t){console.error(t.stack),console.warn("Invalid date supplied: "+e)}De.redraw()}function p(e){~e.target.className.indexOf("arrow")&&h(e,e.target.classList.contains("arrowUp")?1:-1)}function h(e,t,n){var a=n||e.target.parentNode.childNodes[0],i=ae("increment");i.delta=t,a.dispatchEvent(i)}function D(e){var t=ue("div","numInputWrapper"),n=ue("input","numInput "+e),a=ue("span","arrowUp"),i=ue("span","arrowDown");return n.type="text",n.pattern="\\d*",t.appendChild(n),t.appendChild(a),t.appendChild(i),t}function v(){var e=window.document.createDocumentFragment();De.calendarContainer=ue("div","flatpickr-calendar"),De.calendarContainer.tabIndex=-1,De.config.noCalendar||(e.appendChild(k()),De.innerContainer=ue("div","flatpickr-innerContainer"),De.config.weekNumbers&&De.innerContainer.appendChild(N()),De.rContainer=ue("div","flatpickr-rContainer"),De.rContainer.appendChild(E()),De.daysContainer||(De.daysContainer=ue("div","flatpickr-days"),De.daysContainer.tabIndex=-1),M(),De.rContainer.appendChild(De.daysContainer),De.innerContainer.appendChild(De.rContainer),e.appendChild(De.innerContainer)),De.config.enableTime&&e.appendChild(x()),me(De.calendarContainer,"rangeMode","range"===De.config.mode),me(De.calendarContainer,"animate",De.config.animate),De.calendarContainer.appendChild(e);var t=De.config.appendTo&&De.config.appendTo.nodeType;if(De.config.inline||De.config.static){if(De.calendarContainer.classList.add(De.config.inline?"inline":"static"),De.config.inline&&!t)return De.element.parentNode.insertBefore(De.calendarContainer,De._input.nextSibling);if(De.config.static){var n=ue("div","flatpickr-wrapper");return De.element.parentNode.insertBefore(n,De.element),n.appendChild(De.element),De.altInput&&n.appendChild(De.altInput),void n.appendChild(De.calendarContainer)}}(t?De.config.appendTo:window.document.body).appendChild(De.calendarContainer)}function C(e,t,n,a){var i=A(t,!0),r=ue("span","flatpickr-day "+e,t.getDate());return r.dateObj=t,r.$i=a,r.setAttribute("aria-label",De.formatDate(t,De.config.ariaDateFormat)),0===pe(t,De.now)&&(De.todayDateElem=r,r.classList.add("today")),i?(r.tabIndex=-1,ie(t)&&(r.classList.add("selected"),De.selectedDateElem=r,"range"===De.config.mode&&(me(r,"startRange",0===pe(t,De.selectedDates[0])),me(r,"endRange",0===pe(t,De.selectedDates[1]))))):(r.classList.add("disabled"),De.selectedDates[0]&&t>De.minRangeDate&&t<De.selectedDates[0]?De.minRangeDate=t:De.selectedDates[0]&&t<De.maxRangeDate&&t>De.selectedDates[0]&&(De.maxRangeDate=t)),"range"===De.config.mode&&(re(t)&&!ie(t)&&r.classList.add("inRange"),1===De.selectedDates.length&&(t<De.minRangeDate||t>De.maxRangeDate)&&r.classList.add("notAllowed")),De.config.weekNumbers&&"prevMonthDay"!==e&&n%7==1&&De.weekNumbers.insertAdjacentHTML("beforeend","<span class='disabled flatpickr-day'>"+De.config.getWeek(t)+"</span>"),ne("DayCreate",r),r}function w(e,t){var n=e+t||0,a=void 0!==e?De.days.childNodes[n]:De.selectedDateElem||De.todayDateElem||De.days.childNodes[0],i=function(){(a=a||De.days.childNodes[n]).focus(),"range"===De.config.mode&&P(a)};if(void 0===a&&0!==t)return t>0?(De.changeMonth(1),n%=42):t<0&&(De.changeMonth(-1),n+=42),b(i);i()}function b(e){if(!0===De.config.animate)return De._animationLoop.push(e);e()}function M(e){var t=(new Date(De.currentYear,De.currentMonth,1).getDay()-De.l10n.firstDayOfWeek+7)%7,n="range"===De.config.mode;De.prevMonthDays=De.utils.getDaysinMonth((De.currentMonth-1+12)%12),De.selectedDateElem=void 0,De.todayDateElem=void 0;var a=De.utils.getDaysinMonth(),i=window.document.createDocumentFragment(),r=De.prevMonthDays+1-t,o=0;for(De.config.weekNumbers&&De.weekNumbers.firstChild&&(De.weekNumbers.textContent=""),n&&(De.minRangeDate=new Date(De.currentYear,De.currentMonth-1,r),De.maxRangeDate=new Date(De.currentYear,De.currentMonth+1,(42-t)%a));r<=De.prevMonthDays;r++,o++)i.appendChild(C("prevMonthDay",new Date(De.currentYear,De.currentMonth-1,r),r,o));for(r=1;r<=a;r++,o++)i.appendChild(C("",new Date(De.currentYear,De.currentMonth,r),r,o));for(var l=a+1;l<=42-t;l++,o++)i.appendChild(C("nextMonthDay",new Date(De.currentYear,De.currentMonth+1,l%a),l,o));n&&1===De.selectedDates.length&&i.childNodes[0]?(De._hidePrevMonthArrow=De._hidePrevMonthArrow||De.minRangeDate>i.childNodes[0].dateObj,De._hideNextMonthArrow=De._hideNextMonthArrow||De.maxRangeDate<new Date(De.currentYear,De.currentMonth+1,1)):oe();var c=ue("div","dayContainer");if(c.appendChild(i),De.config.animate&&void 0!==e)for(;De.daysContainer.childNodes.length>1;)De.daysContainer.removeChild(De.daysContainer.firstChild);else y(De.daysContainer);return e>=0?De.daysContainer.appendChild(c):De.daysContainer.insertBefore(c,De.daysContainer.firstChild),De.days=De.daysContainer.firstChild,De.daysContainer}function y(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function k(){var e=window.document.createDocumentFragment();De.monthNav=ue("div","flatpickr-month"),De.prevMonthNav=ue("span","flatpickr-prev-month"),De.prevMonthNav.innerHTML=De.config.prevArrow,De.currentMonthElement=ue("span","cur-month"),De.currentMonthElement.title=De.l10n.scrollTitle;var t=D("cur-year");return De.currentYearElement=t.childNodes[0],De.currentYearElement.title=De.l10n.scrollTitle,De.config.minDate&&(De.currentYearElement.min=De.config.minDate.getFullYear()),De.config.maxDate&&(De.currentYearElement.max=De.config.maxDate.getFullYear(),De.currentYearElement.disabled=De.config.minDate&&De.config.minDate.getFullYear()===De.config.maxDate.getFullYear()),De.nextMonthNav=ue("span","flatpickr-next-month"),De.nextMonthNav.innerHTML=De.config.nextArrow,De.navigationCurrentMonth=ue("span","flatpickr-current-month"),De.navigationCurrentMonth.appendChild(De.currentMonthElement),De.navigationCurrentMonth.appendChild(t),e.appendChild(De.prevMonthNav),e.appendChild(De.navigationCurrentMonth),e.appendChild(De.nextMonthNav),De.monthNav.appendChild(e),Object.defineProperty(De,"_hidePrevMonthArrow",{get:function(){return this.__hidePrevMonthArrow},set:function(e){this.__hidePrevMonthArrow!==e&&(De.prevMonthNav.style.display=e?"none":"block"),this.__hidePrevMonthArrow=e}}),Object.defineProperty(De,"_hideNextMonthArrow",{get:function(){return this.__hideNextMonthArrow},set:function(e){this.__hideNextMonthArrow!==e&&(De.nextMonthNav.style.display=e?"none":"block"),this.__hideNextMonthArrow=e}}),oe(),De.monthNav}function x(){De.calendarContainer.classList.add("hasTime"),De.config.noCalendar&&De.calendarContainer.classList.add("noCalendar"),De.timeContainer=ue("div","flatpickr-time"),De.timeContainer.tabIndex=-1;var e=ue("span","flatpickr-time-separator",":"),t=D("flatpickr-hour");De.hourElement=t.childNodes[0];var n=D("flatpickr-minute");if(De.minuteElement=n.childNodes[0],De.hourElement.tabIndex=De.minuteElement.tabIndex=-1,De.hourElement.value=De.pad(De.latestSelectedDateObj?De.latestSelectedDateObj.getHours():De.config.defaultHour),De.minuteElement.value=De.pad(De.latestSelectedDateObj?De.latestSelectedDateObj.getMinutes():De.config.defaultMinute),De.hourElement.step=De.config.hourIncrement,De.minuteElement.step=De.config.minuteIncrement,De.hourElement.min=De.config.time_24hr?0:1,De.hourElement.max=De.config.time_24hr?23:12,De.minuteElement.min=0,De.minuteElement.max=59,De.hourElement.title=De.minuteElement.title=De.l10n.scrollTitle,De.timeContainer.appendChild(t),De.timeContainer.appendChild(e),De.timeContainer.appendChild(n),De.config.time_24hr&&De.timeContainer.classList.add("time24hr"),De.config.enableSeconds){De.timeContainer.classList.add("hasSeconds");var a=D("flatpickr-second");De.secondElement=a.childNodes[0],De.secondElement.value=De.latestSelectedDateObj?De.pad(De.latestSelectedDateObj.getSeconds()):"00",De.secondElement.step=De.minuteElement.step,De.secondElement.min=De.minuteElement.min,De.secondElement.max=De.minuteElement.max,De.timeContainer.appendChild(ue("span","flatpickr-time-separator",":")),De.timeContainer.appendChild(a)}return De.config.time_24hr||(De.amPM=ue("span","flatpickr-am-pm",["AM","PM"][De.hourElement.value>11|0]),De.amPM.title=De.l10n.toggleTitle,De.amPM.tabIndex=-1,De.timeContainer.appendChild(De.amPM)),De.timeContainer}function E(){De.weekdayContainer||(De.weekdayContainer=ue("div","flatpickr-weekdays"));var e=De.l10n.firstDayOfWeek,t=De.l10n.weekdays.shorthand.slice();return e>0&&e<t.length&&(t=[].concat(t.splice(e,t.length),t.splice(0,e))),De.weekdayContainer.innerHTML="\n\t\t<span class=flatpickr-weekday>\n\t\t\t"+t.join("</span><span class=flatpickr-weekday>")+"\n\t\t</span>\n\t\t",De.weekdayContainer}function N(){return De.calendarContainer.classList.add("hasWeeks"),De.weekWrapper=ue("div","flatpickr-weekwrapper"),De.weekWrapper.appendChild(ue("span","flatpickr-weekday",De.l10n.weekAbbreviation)),De.weekNumbers=ue("div","flatpickr-weeks"),De.weekWrapper.appendChild(De.weekNumbers),De.weekWrapper}function _(e,t,n){var a=(t=void 0===t||t)?e:e-De.currentMonth,i=!De.config.animate||!1===n;if(!(a<0&&De._hidePrevMonthArrow||a>0&&De._hideNextMonthArrow)){if(De.currentMonth+=a,(De.currentMonth<0||De.currentMonth>11)&&(De.currentYear+=De.currentMonth>11?1:-1,De.currentMonth=(De.currentMonth+12)%12,ne("YearChange")),M(i?void 0:a),i)return ne("MonthChange"),oe();var r=De.navigationCurrentMonth;if(a<0)for(;r.nextSibling&&/curr/.test(r.nextSibling.className);)De.monthNav.removeChild(r.nextSibling);else if(a>0)for(;r.previousSibling&&/curr/.test(r.previousSibling.className);)De.monthNav.removeChild(r.previousSibling);if(De.oldCurMonth=De.navigationCurrentMonth,De.navigationCurrentMonth=De.monthNav.insertBefore(De.oldCurMonth.cloneNode(!0),a>0?De.oldCurMonth.nextSibling:De.oldCurMonth),a>0?(De.daysContainer.firstChild.classList.add("slideLeft"),De.daysContainer.lastChild.classList.add("slideLeftNew"),De.oldCurMonth.classList.add("slideLeft"),De.navigationCurrentMonth.classList.add("slideLeftNew")):a<0&&(De.daysContainer.firstChild.classList.add("slideRightNew"),De.daysContainer.lastChild.classList.add("slideRight"),De.oldCurMonth.classList.add("slideRight"),De.navigationCurrentMonth.classList.add("slideRightNew")),De.currentMonthElement=De.navigationCurrentMonth.firstChild,De.currentYearElement=De.navigationCurrentMonth.lastChild.childNodes[0],oe(),De.oldCurMonth.firstChild.textContent=De.utils.monthToStr(De.currentMonth-a),ne("MonthChange"),document.activeElement&&document.activeElement.$i){var o=document.activeElement.$i;b(function(){w(o,0)})}}}function T(e){De.input.value="",De.altInput&&(De.altInput.value=""),De.mobileInput&&(De.mobileInput.value=""),De.selectedDates=[],De.latestSelectedDateObj=void 0,De.showTimeInput=!1,De.redraw(),!1!==e&&ne("Change")}function I(){De.isOpen=!1,De.isMobile||(De.calendarContainer.classList.remove("open"),De._input.classList.remove("active")),ne("Close")}function S(){void 0!==De.config&&ne("Destroy");for(var e=De._handlers.length;e--;){var t=De._handlers[e];t.element.removeEventListener(t.event,t.handler)}De._handlers=[],De.mobileInput?(De.mobileInput.parentNode&&De.mobileInput.parentNode.removeChild(De.mobileInput),De.mobileInput=null):De.calendarContainer&&De.calendarContainer.parentNode&&De.calendarContainer.parentNode.removeChild(De.calendarContainer),De.altInput&&(De.input.type="text",De.altInput.parentNode&&De.altInput.parentNode.removeChild(De.altInput),delete De.altInput),De.input&&(De.input.type=De.input._type,De.input.classList.remove("flatpickr-input"),De.input.removeAttribute("readonly"),De.input.value=""),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(e){return delete De[e]})}function F(e){return!(!De.config.appendTo||!De.config.appendTo.contains(e))||De.calendarContainer.contains(e)}function Y(e){if(De.isOpen&&!De.config.inline){var t=F(e.target),n=e.target===De.input||e.target===De.altInput||De.element.contains(e.target)||e.path&&e.path.indexOf&&(~e.path.indexOf(De.input)||~e.path.indexOf(De.altInput));("blur"===e.type?n&&e.relatedTarget&&!F(e.relatedTarget):!n&&!t)&&-1===De.config.ignoredFocusElements.indexOf(e.target)&&(De.close(),"range"===De.config.mode&&1===De.selectedDates.length&&(De.clear(!1),De.redraw()))}}function O(e){if(!(!e||De.currentYearElement.min&&e<De.currentYearElement.min||De.currentYearElement.max&&e>De.currentYearElement.max)){var t=parseInt(e,10),n=De.currentYear!==t;De.currentYear=t||De.currentYear,De.config.maxDate&&De.currentYear===De.config.maxDate.getFullYear()?De.currentMonth=Math.min(De.config.maxDate.getMonth(),De.currentMonth):De.config.minDate&&De.currentYear===De.config.minDate.getFullYear()&&(De.currentMonth=Math.max(De.config.minDate.getMonth(),De.currentMonth)),n&&(De.redraw(),ne("YearChange"))}}function A(e,t){if(De.config.minDate&&pe(e,De.config.minDate,void 0!==t?t:!De.minDateHasTime)<0||De.config.maxDate&&pe(e,De.config.maxDate,void 0!==t?t:!De.maxDateHasTime)>0)return!1;if(!De.config.enable.length&&!De.config.disable.length)return!0;for(var n,a=De.parseDate(e,null,!0),i=De.config.enable.length>0,r=i?De.config.enable:De.config.disable,o=0;o<r.length;o++){if((n=r[o])instanceof Function&&n(a))return i;if(n instanceof Date&&n.getTime()===a.getTime())return i;if("string"==typeof n&&De.parseDate(n,null,!0).getTime()===a.getTime())return i;if("object"===(void 0===n?"undefined":_typeof(n))&&n.from&&n.to&&a>=n.from&&a<=n.to)return i}return!i}function L(e){var t=e.target===De._input,n=F(e.target),r=De.config.allowInput,o=De.isOpen&&(!r||!t),l=De.config.inline&&t&&!r;if("Enter"===e.key&&r&&t)return De.setDate(De._input.value,!0,e.target===De.altInput?De.config.altFormat:De.config.dateFormat),e.target.blur();if(n||o||l){var c=De.timeContainer&&De.timeContainer.contains(e.target);switch(e.key){case"Enter":c?le():U(e);break;case"Escape":e.preventDefault(),De.close();break;case"ArrowLeft":case"ArrowRight":if(!c)if(e.preventDefault(),De.daysContainer){var s="ArrowRight"===e.key?1:-1;e.ctrlKey?_(s,!0):w(e.target.$i,s)}else De.config.enableTime&&!c&&De.hourElement.focus();break;case"ArrowUp":case"ArrowDown":e.preventDefault();var d="ArrowDown"===e.key?1:-1;De.daysContainer?e.ctrlKey?(O(De.currentYear-d),w(e.target.$i,0)):c||w(e.target.$i,7*d):De.config.enableTime&&(c||De.hourElement.focus(),a(e));break;case"Tab":e.target===De.hourElement?(e.preventDefault(),De.minuteElement.select()):e.target===De.minuteElement&&(De.secondElement||De.amPM)?(e.preventDefault(),(De.secondElement||De.amPM).focus()):e.target===De.secondElement&&(e.preventDefault(),De.amPM.focus());break;case"a":e.target===De.amPM&&(De.amPM.textContent="AM",i(),le());break;case"p":e.target===De.amPM&&(De.amPM.textContent="PM",i(),le())}ne("KeyDown",e)}}function P(e){if(1===De.selectedDates.length&&e.classList.contains("flatpickr-day")){for(var t=e.dateObj,n=De.parseDate(De.selectedDates[0],null,!0),a=Math.min(t.getTime(),De.selectedDates[0].getTime()),i=Math.max(t.getTime(),De.selectedDates[0].getTime()),r=!1,o=a;o<i;o+=De.utils.duration.DAY)if(!A(new Date(o))){r=!0;break}for(var l=De.days.childNodes[0].dateObj.getTime(),c=0;c<42;c++,l+=De.utils.duration.DAY){(function(o,l){var c=o<De.minRangeDate.getTime()||o>De.maxRangeDate.getTime(),s=De.days.childNodes[l];if(c)return De.days.childNodes[l].classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(e){s.classList.remove(e)}),"continue";if(r&&!c)return"continue";["startRange","inRange","endRange","notAllowed"].forEach(function(e){s.classList.remove(e)});var d=Math.max(De.minRangeDate.getTime(),a),u=Math.min(De.maxRangeDate.getTime(),i);e.classList.add(t<De.selectedDates[0]?"startRange":"endRange"),n<t&&o===n.getTime()?s.classList.add("startRange"):n>t&&o===n.getTime()&&s.classList.add("endRange"),o>=d&&o<=u&&s.classList.add("inRange")})(l,c)}}}function j(){!De.isOpen||De.config.static||De.config.inline||J()}function H(e,t){if(De.isMobile)return e&&(e.preventDefault(),e.target.blur()),setTimeout(function(){De.mobileInput.click()},0),void ne("Open");De.isOpen||De._input.disabled||De.config.inline||(De.isOpen=!0,De.calendarContainer.classList.add("open"),J(t),De._input.classList.add("active"),ne("Open"))}function R(e){return function(t){var n=De.config["_"+e+"Date"]=De.parseDate(t),a=De.config["_"+("min"===e?"max":"min")+"Date"],i=t&&n instanceof Date;i&&(De[e+"DateHasTime"]=n.getHours()||n.getMinutes()||n.getSeconds()),De.selectedDates&&(De.selectedDates=De.selectedDates.filter(function(e){return A(e)}),De.selectedDates.length||"min"!==e||r(n),le()),De.daysContainer&&(K(),i?De.currentYearElement[e]=n.getFullYear():De.currentYearElement.removeAttribute(e),De.currentYearElement.disabled=a&&n&&a.getFullYear()===n.getFullYear())}}function W(){var e=["wrap","weekNumbers","allowInput","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],t=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange"];De.config=Object.create(flatpickr.defaultConfig);var a=_extends({},De.instanceConfig,JSON.parse(JSON.stringify(De.element.dataset||{})));De.config.parseDate=a.parseDate,De.config.formatDate=a.formatDate,Object.defineProperty(De.config,"enable",{get:function(){return De.config._enable||[]},set:function(e){return De.config._enable=G(e)}}),Object.defineProperty(De.config,"disable",{get:function(){return De.config._disable||[]},set:function(e){return De.config._disable=G(e)}}),_extends(De.config,a),!a.dateFormat&&a.enableTime&&(De.config.dateFormat=De.config.noCalendar?"H:i"+(De.config.enableSeconds?":S":""):flatpickr.defaultConfig.dateFormat+" H:i"+(De.config.enableSeconds?":S":"")),a.altInput&&a.enableTime&&!a.altFormat&&(De.config.altFormat=De.config.noCalendar?"h:i"+(De.config.enableSeconds?":S K":" K"):flatpickr.defaultConfig.altFormat+" h:i"+(De.config.enableSeconds?":S":"")+" K"),Object.defineProperty(De.config,"minDate",{get:function(){return this._minDate},set:R("min")}),Object.defineProperty(De.config,"maxDate",{get:function(){return this._maxDate},set:R("max")}),De.config.minDate=a.minDate,De.config.maxDate=a.maxDate;for(var i=0;i<e.length;i++)De.config[e[i]]=!0===De.config[e[i]]||"true"===De.config[e[i]];for(var r=t.length;r--;)void 0!==De.config[t[r]]&&(De.config[t[r]]=fe(De.config[t[r]]||[]).map(n));for(var o=0;o<De.config.plugins.length;o++){var l=De.config.plugins[o](De)||{};for(var c in l)De.config[c]instanceof Array||~t.indexOf(c)?De.config[c]=fe(l[c]).map(n).concat(De.config[c]):void 0===a[c]&&(De.config[c]=l[c])}ne("ParseConfig")}function B(){"object"!==_typeof(De.config.locale)&&void 0===flatpickr.l10ns[De.config.locale]&&console.warn("flatpickr: invalid locale "+De.config.locale),De.l10n=_extends(Object.create(flatpickr.l10ns.default),"object"===_typeof(De.config.locale)?De.config.locale:"default"!==De.config.locale?flatpickr.l10ns[De.config.locale]||{}:{})}function J(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:De._positionElement;if(void 0!==De.calendarContainer){var t=De.calendarContainer.offsetHeight,n=De.calendarContainer.offsetWidth,a=De.config.position,i=e.getBoundingClientRect(),r=window.innerHeight-i.bottom,o="above"===a||"below"!==a&&r<t&&i.top>t,l=window.pageYOffset+i.top+(o?-t-2:e.offsetHeight+2);if(me(De.calendarContainer,"arrowTop",!o),me(De.calendarContainer,"arrowBottom",o),!De.config.inline){var c=window.pageXOffset+i.left,s=window.document.body.offsetWidth-i.right,d=c+n>window.document.body.offsetWidth;me(De.calendarContainer,"rightMost",d),De.config.static||(De.calendarContainer.style.top=l+"px",d?(De.calendarContainer.style.left="auto",De.calendarContainer.style.right=s+"px"):(De.calendarContainer.style.left=c+"px",De.calendarContainer.style.right="auto"))}}}function K(){De.config.noCalendar||De.isMobile||(E(),oe(),M())}function U(e){if(e.preventDefault(),e.stopPropagation(),e.target.classList.contains("flatpickr-day")&&!e.target.classList.contains("disabled")&&!e.target.classList.contains("notAllowed")){var t=De.latestSelectedDateObj=new Date(e.target.dateObj.getTime()),n=t.getMonth()!==De.currentMonth&&"range"!==De.config.mode;if(De.selectedDateElem=e.target,"single"===De.config.mode)De.selectedDates=[t];else if("multiple"===De.config.mode){var a=ie(t);a?De.selectedDates.splice(a,1):De.selectedDates.push(t)}else"range"===De.config.mode&&(2===De.selectedDates.length&&De.clear(),De.selectedDates.push(t),0!==pe(t,De.selectedDates[0],!0)&&De.selectedDates.sort(function(e,t){return e.getTime()-t.getTime()}));if(i(),n){var o=De.currentYear!==t.getFullYear();De.currentYear=t.getFullYear(),De.currentMonth=t.getMonth(),o&&ne("YearChange"),ne("MonthChange")}if(M(),De.minDateHasTime&&De.config.enableTime&&0===pe(t,De.config.minDate)&&r(De.config.minDate),le(),De.config.enableTime&&setTimeout(function(){return De.showTimeInput=!0},50),"range"===De.config.mode&&(1===De.selectedDates.length?(P(e.target),De._hidePrevMonthArrow=De._hidePrevMonthArrow||De.minRangeDate>De.days.childNodes[0].dateObj,De._hideNextMonthArrow=De._hideNextMonthArrow||De.maxRangeDate<new Date(De.currentYear,De.currentMonth+1,1)):oe()),ne("Change"),n?b(function(){return De.selectedDateElem.focus()}):w(e.target.$i,0),De.config.enableTime&&setTimeout(function(){return De.hourElement.select()},451),De.config.closeOnSelect){var l="single"===De.config.mode&&!De.config.enableTime,c="range"===De.config.mode&&2===De.selectedDates.length&&!De.config.enableTime;(l||c)&&De.close()}}}function $(e,t){De.config[e]=t,De.redraw(),g()}function z(e,t){if(e instanceof Array)De.selectedDates=e.map(function(e){return De.parseDate(e,t)});else if(e instanceof Date||!isNaN(e))De.selectedDates=[De.parseDate(e,t)];else if(e&&e.substring)switch(De.config.mode){case"single":De.selectedDates=[De.parseDate(e,t)];break;case"multiple":De.selectedDates=e.split("; ").map(function(e){return De.parseDate(e,t)});break;case"range":De.selectedDates=e.split(De.l10n.rangeSeparator).map(function(e){return De.parseDate(e,t)})}De.selectedDates=De.selectedDates.filter(function(e){return e instanceof Date&&A(e,!1)}),De.selectedDates.sort(function(e,t){return e.getTime()-t.getTime()})}function q(e,t,n){if(0!==e&&!e)return De.clear(t);z(e,n),De.showTimeInput=De.selectedDates.length>0,De.latestSelectedDateObj=De.selectedDates[0],De.redraw(),g(),r(),le(t),t&&ne("Change")}function G(e){for(var t=e.length;t--;)"string"==typeof e[t]||+e[t]?e[t]=De.parseDate(e[t],null,!0):e[t]&&e[t].from&&e[t].to&&(e[t].from=De.parseDate(e[t].from),e[t].to=De.parseDate(e[t].to));return e.filter(function(e){return e})}function V(){De.selectedDates=[],De.now=new Date;var e=De.config.defaultDate||De.input.value;e&&z(e,De.config.dateFormat);var t=De.selectedDates.length?De.selectedDates[0]:De.config.minDate&&De.config.minDate.getTime()>De.now?De.config.minDate:De.config.maxDate&&De.config.maxDate.getTime()<De.now?De.config.maxDate:De.now;De.currentYear=t.getFullYear(),De.currentMonth=t.getMonth(),De.selectedDates.length&&(De.latestSelectedDateObj=De.selectedDates[0]),De.minDateHasTime=De.config.minDate&&(De.config.minDate.getHours()||De.config.minDate.getMinutes()||De.config.minDate.getSeconds()),De.maxDateHasTime=De.config.maxDate&&(De.config.maxDate.getHours()||De.config.maxDate.getMinutes()||De.config.maxDate.getSeconds()),Object.defineProperty(De,"latestSelectedDateObj",{get:function(){return De._selectedDateObj||De.selectedDates[De.selectedDates.length-1]},set:function(e){De._selectedDateObj=e}}),De.isMobile||Object.defineProperty(De,"showTimeInput",{get:function(){return De._showTimeInput},set:function(e){De._showTimeInput=e,De.calendarContainer&&me(De.calendarContainer,"showTimeInput",e),J()}})}function Z(){De.utils={duration:{DAY:864e5},getDaysinMonth:function(e,t){return e=void 0===e?De.currentMonth:e,t=void 0===t?De.currentYear:t,1===e&&(t%4==0&&t%100!=0||t%400==0)?29:De.l10n.daysInMonth[e]},monthToStr:function(e,t){return t=void 0===t?De.config.shorthandCurrentMonth:t,De.l10n.months[(t?"short":"long")+"hand"][e]}}}function Q(){De.formats=Object.create(FlatpickrInstance.prototype.formats),["D","F","J","M","W","l"].forEach(function(e){De.formats[e]=FlatpickrInstance.prototype.formats[e].bind(De)}),De.revFormat.F=FlatpickrInstance.prototype.revFormat.F.bind(De),De.revFormat.M=FlatpickrInstance.prototype.revFormat.M.bind(De)}function X(){if(De.input=De.config.wrap?De.element.querySelector("[data-input]"):De.element,!De.input)return console.warn("Error: invalid input element specified",De.input);De.input._type=De.input.type,De.input.type="text",De.input.classList.add("flatpickr-input"),De._input=De.input,De.config.altInput&&(De.altInput=ue(De.input.nodeName,De.input.className+" "+De.config.altInputClass),De._input=De.altInput,De.altInput.placeholder=De.input.placeholder,De.altInput.disabled=De.input.disabled,De.altInput.required=De.input.required,De.altInput.type="text",De.input.type="hidden",!De.config.static&&De.input.parentNode&&De.input.parentNode.insertBefore(De.altInput,De.input.nextSibling)),De.config.allowInput||De._input.setAttribute("readonly","readonly"),De._positionElement=De.config.positionElement||De._input}function ee(){var e=De.config.enableTime?De.config.noCalendar?"time":"datetime-local":"date";De.mobileInput=ue("input",De.input.className+" flatpickr-mobile"),De.mobileInput.step="any",De.mobileInput.tabIndex=1,De.mobileInput.type=e,De.mobileInput.disabled=De.input.disabled,De.mobileInput.placeholder=De.input.placeholder,De.mobileFormatStr="datetime-local"===e?"Y-m-d\\TH:i:S":"date"===e?"Y-m-d":"H:i:S",De.selectedDates.length&&(De.mobileInput.defaultValue=De.mobileInput.value=De.formatDate(De.selectedDates[0],De.mobileFormatStr)),De.config.minDate&&(De.mobileInput.min=De.formatDate(De.config.minDate,"Y-m-d")),De.config.maxDate&&(De.mobileInput.max=De.formatDate(De.config.maxDate,"Y-m-d")),De.input.type="hidden",De.config.altInput&&(De.altInput.type="hidden");try{De.input.parentNode.insertBefore(De.mobileInput,De.input.nextSibling)}catch(e){}De.mobileInput.addEventListener("change",function(e){De.setDate(e.target.value,!1,De.mobileFormatStr),ne("Change"),ne("Close")})}function te(){if(De.isOpen)return De.close();De.open()}function ne(e,t){var n=De.config["on"+e];if(void 0!==n&&n.length>0)for(var a=0;n[a]&&a<n.length;a++)n[a](De.selectedDates,De.input.value,De,t);"Change"===e&&(De.input.dispatchEvent(ae("change")),De.input.dispatchEvent(ae("input")))}function ae(e){return De._supportsEvents?new Event(e,{bubbles:!0}):(De._[e+"Event"]=document.createEvent("Event"),De._[e+"Event"].initEvent(e,!0,!0),De._[e+"Event"])}function ie(e){for(var t=0;t<De.selectedDates.length;t++)if(0===pe(De.selectedDates[t],e))return""+t;return!1}function re(e){return!("range"!==De.config.mode||De.selectedDates.length<2)&&(pe(e,De.selectedDates[0])>=0&&pe(e,De.selectedDates[1])<=0)}function oe(){De.config.noCalendar||De.isMobile||!De.monthNav||(De.currentMonthElement.textContent=De.utils.monthToStr(De.currentMonth)+" ",De.currentYearElement.value=De.currentYear,De._hidePrevMonthArrow=De.config.minDate&&(De.currentYear===De.config.minDate.getFullYear()?De.currentMonth<=De.config.minDate.getMonth():De.currentYear<De.config.minDate.getFullYear()),De._hideNextMonthArrow=De.config.maxDate&&(De.currentYear===De.config.maxDate.getFullYear()?De.currentMonth+1>De.config.maxDate.getMonth():De.currentYear>De.config.maxDate.getFullYear()))}function le(e){if(!De.selectedDates.length)return De.clear(e);De.isMobile&&(De.mobileInput.value=De.selectedDates.length?De.formatDate(De.latestSelectedDateObj,De.mobileFormatStr):"");var t="range"!==De.config.mode?"; ":De.l10n.rangeSeparator;De.input.value=De.selectedDates.map(function(e){return De.formatDate(e,De.config.dateFormat)}).join(t),De.config.altInput&&(De.altInput.value=De.selectedDates.map(function(e){return De.formatDate(e,De.config.altFormat)}).join(t)),!1!==e&&ne("ValueUpdate")}function ce(e){return Math.max(-1,Math.min(1,e.wheelDelta||-e.deltaY))}function se(e){e.preventDefault();var t=De.currentYearElement.parentNode.contains(e.target);if(e.target===De.currentMonthElement||t){var n=ce(e);t?(O(De.currentYear+n),e.target.value=De.currentYear):De.changeMonth(n,!0,!1)}}function de(e){var t=De.prevMonthNav.contains(e.target),n=De.nextMonthNav.contains(e.target);t||n?_(t?-1:1):e.target===De.currentYearElement?(e.preventDefault(),De.currentYearElement.select()):"arrowUp"===e.target.className?De.changeYear(De.currentYear+1):"arrowDown"===e.target.className&&De.changeYear(De.currentYear-1)}function ue(e,t,n){var a=window.document.createElement(e);return t=t||"",n=n||"",a.className=t,void 0!==n&&(a.textContent=n),a}function fe(e){return e instanceof Array?e:[e]}function me(e,t,n){if(n)return e.classList.add(t);e.classList.remove(t)}function ge(e,t,n){var a=void 0;return function(){var i=this,r=arguments;clearTimeout(a),a=setTimeout(function(){a=null,n||e.apply(i,r)},t),n&&!a&&e.apply(i,r)}}function pe(e,t,n){return e instanceof Date&&t instanceof Date&&(!1!==n?new Date(e.getTime()).setHours(0,0,0,0)-new Date(t.getTime()).setHours(0,0,0,0):e.getTime()-t.getTime())}function he(e){e.preventDefault();var t="keydown"===e.type,n=(e.type,e.type,e.target);if(De.amPM&&e.target===De.amPM)return e.target.textContent=["AM","PM"]["AM"===e.target.textContent|0];var a=Number(n.min),i=Number(n.max),r=Number(n.step),o=parseInt(n.value,10),l=o+r*(e.delta||(t?38===e.which?1:-1:Math.max(-1,Math.min(1,e.wheelDelta||-e.deltaY))||0));if(void 0!==n.value&&2===n.value.length){var c=n===De.hourElement,s=n===De.minuteElement;l<a?(l=i+l+!c+(c&&!De.amPM),s&&h(null,-1,De.hourElement)):l>i&&(l=n===De.hourElement?l-i-!De.amPM:a,s&&h(null,1,De.hourElement)),De.amPM&&c&&(1===r?l+o===23:Math.abs(l-o)>r)&&(De.amPM.textContent="PM"===De.amPM.textContent?"AM":"PM"),n.value=De.pad(l)}}var De=this;return De._={},De._.afterDayAnim=b,De._bind=c,De._compareDates=pe,De._setHoursFromDate=r,De.changeMonth=_,De.changeYear=O,De.clear=T,De.close=I,De._createElement=ue,De.destroy=S,De.isEnabled=A,De.jumpToDate=g,De.open=H,De.redraw=K,De.set=$,De.setDate=q,De.toggle=te,function(){De.element=De.input=e,De.instanceConfig=t||{},De.parseDate=FlatpickrInstance.prototype.parseDate.bind(De),De.formatDate=FlatpickrInstance.prototype.formatDate.bind(De),Q(),W(),B(),X(),V(),Z(),De.isOpen=!1,De.isMobile=!De.config.disableMobile&&!De.config.inline&&"single"===De.config.mode&&!De.config.disable.length&&!De.config.enable.length&&!De.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),De.isMobile||v(),d(),(De.selectedDates.length||De.config.noCalendar)&&(De.config.enableTime&&r(De.config.noCalendar?De.latestSelectedDateObj||De.config.minDate:null),le()),De.showTimeInput=De.selectedDates.length>0||De.config.noCalendar,De.config.weekNumbers&&(De.calendarContainer.style.width=De.daysContainer.offsetWidth+De.weekWrapper.offsetWidth+"px"),De.isMobile||J(),ne("Ready")}(),De}function _flatpickr(e,t){for(var n=Array.prototype.slice.call(e),a=[],i=0;i<n.length;i++)try{if(null!==n[i].getAttribute("data-fp-omit"))continue;n[i]._flatpickr&&(n[i]._flatpickr.destroy(),n[i]._flatpickr=null),n[i]._flatpickr=new FlatpickrInstance(n[i],t||{}),a.push(n[i]._flatpickr)}catch(e){console.warn(e,e.stack)}return 1===a.length?a[0]:a}function flatpickr(e,t){return e instanceof NodeList?_flatpickr(e,t):e instanceof HTMLElement?_flatpickr([e],t):_flatpickr(window.document.querySelectorAll(e),t)}var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};FlatpickrInstance.prototype={formats:{Z:function(e){return e.toISOString()},D:function(e){return this.l10n.weekdays.shorthand[this.formats.w(e)]},F:function(e){return this.utils.monthToStr(this.formats.n(e)-1,!1)},G:function(e){return FlatpickrInstance.prototype.pad(FlatpickrInstance.prototype.formats.h(e))},H:function(e){return FlatpickrInstance.prototype.pad(e.getHours())},J:function(e){return e.getDate()+this.l10n.ordinal(e.getDate())},K:function(e){return e.getHours()>11?"PM":"AM"},M:function(e){return this.utils.monthToStr(e.getMonth(),!0)},S:function(e){return FlatpickrInstance.prototype.pad(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e){return this.config.getWeek(e)},Y:function(e){return e.getFullYear()},d:function(e){return FlatpickrInstance.prototype.pad(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return FlatpickrInstance.prototype.pad(e.getMinutes())},j:function(e){return e.getDate()},l:function(e){return this.l10n.weekdays.longhand[e.getDay()]},m:function(e){return FlatpickrInstance.prototype.pad(e.getMonth()+1)},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},w:function(e){return e.getDay()},y:function(e){return String(e.getFullYear()).substring(2)}},formatDate:function(e,t){var n=this;return void 0!==this.config&&void 0!==this.config.formatDate?this.config.formatDate(e,t):t.split("").map(function(t,a,i){return n.formats[t]&&"\\"!==i[a-1]?n.formats[t](e):"\\"!==t?t:""}).join("")},revFormat:{D:function(){},F:function(e,t){e.setMonth(this.l10n.months.longhand.indexOf(t))},G:function(e,t){e.setHours(parseFloat(t))},H:function(e,t){e.setHours(parseFloat(t))},J:function(e,t){e.setDate(parseFloat(t))},K:function(e,t){var n=e.getHours();12!==n&&e.setHours(n%12+12*/pm/i.test(t))},M:function(e,t){e.setMonth(this.l10n.months.shorthand.indexOf(t))},S:function(e,t){e.setSeconds(t)},U:function(e,t){return new Date(1e3*parseFloat(t))},W:function(e,t){return t=parseInt(t),new Date(e.getFullYear(),0,2+7*(t-1),0,0,0,0,0)},Y:function(e,t){e.setFullYear(t)},Z:function(e,t){return new Date(t)},d:function(e,t){e.setDate(parseFloat(t))},h:function(e,t){e.setHours(parseFloat(t))},i:function(e,t){e.setMinutes(parseFloat(t))},j:function(e,t){e.setDate(parseFloat(t))},l:function(){},m:function(e,t){e.setMonth(parseFloat(t)-1)},n:function(e,t){e.setMonth(parseFloat(t)-1)},s:function(e,t){e.setSeconds(parseFloat(t))},w:function(){},y:function(e,t){e.setFullYear(2e3+parseFloat(t))}},tokenRegex:{D:"(\\w+)",F:"(\\w+)",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"(am|AM|Am|aM|pm|PM|Pm|pM)",M:"(\\w+)",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"(\\w+)",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},pad:function(e){return("0"+e).slice(-2)},parseDate:function(e,t,n){if(0!==e&&!e)return null;var a=e;if(e instanceof Date)e=new Date(e.getTime());else if(void 0!==e.toFixed)e=new Date(e);else{var i=t||(this.config||flatpickr.defaultConfig).dateFormat;if("today"===(e=String(e).trim()))e=new Date,n=!0;else if(/Z$/.test(e)||/GMT$/.test(e))e=new Date(e);else if(this.config&&this.config.parseDate)e=this.config.parseDate(e,i);else{for(var r=this.config&&this.config.noCalendar?new Date((new Date).setHours(0,0,0,0)):new Date((new Date).getFullYear(),0,1,0,0,0,0),o=void 0,l=0,c=0,s="";l<i.length;l++){var d=i[l],u="\\"===d,f="\\"===i[l-1]||u;if(this.tokenRegex[d]&&!f){s+=this.tokenRegex[d];var m=new RegExp(s).exec(e);m&&(o=!0)&&(r=this.revFormat[d](r,m[++c])||r)}else u||(s+=".")}e=o?r:null}}return e instanceof Date?(!0===n&&e.setHours(0,0,0,0),e):(console.warn("flatpickr: invalid date "+a),console.info(this.element),null)}},"undefined"!=typeof HTMLElement&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(e){return _flatpickr(this,e)},HTMLElement.prototype.flatpickr=function(e){return _flatpickr([this],e)}),flatpickr.defaultConfig=FlatpickrInstance.defaultConfig={mode:"single",position:"auto",animate:-1===window.navigator.userAgent.indexOf("MSIE"),wrap:!1,weekNumbers:!1,allowInput:!1,clickOpens:!0,closeOnSelect:!0,time_24hr:!1,enableTime:!1,noCalendar:!1,dateFormat:"Y-m-d",ariaDateFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",altFormat:"F j, Y",defaultDate:null,minDate:null,maxDate:null,parseDate:null,formatDate:null,getWeek:function(e){var t=new Date(e.getTime()),n=new Date(t.getFullYear(),0,1);return Math.ceil(((t-n)/864e5+n.getDay()+1)/7)},enable:[],disable:[],shorthandCurrentMonth:!1,inline:!1,static:!1,appendTo:null,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",enableSeconds:!1,hourIncrement:1,minuteIncrement:5,defaultHour:12,defaultMinute:0,disableMobile:!1,locale:"default",plugins:[],ignoredFocusElements:[],onClose:void 0,onChange:void 0,onDayCreate:void 0,onMonthChange:void 0,onOpen:void 0,onParseConfig:void 0,onReady:void 0,onValueUpdate:void 0,onYearChange:void 0,onKeyDown:void 0,onDestroy:void 0},flatpickr.l10ns={en:{weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var t=e%100;if(t>3&&t<21)return"th";switch(t%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle"}},flatpickr.l10ns.default=Object.create(flatpickr.l10ns.en),flatpickr.localize=function(e){return _extends(flatpickr.l10ns.default,e||{})},flatpickr.setDefaults=function(e){return _extends(flatpickr.defaultConfig,e||{})},"undefined"!=typeof jQuery&&(jQuery.fn.flatpickr=function(e){return _flatpickr(this,e)}),Date.prototype.fp_incr=function(e){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+parseInt(e,10))},"undefined"!=typeof module&&(module.exports=flatpickr); | |
| 0 | 3 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/assets/plugins/flatpickr/ie.css
0 → 100644
src/main/resources/static/real_control_v2/assets/plugins/flatpickr/l10n/zh.js
0 → 100644
| 1 | +/* Mandarin locals for flatpickr */ | |
| 2 | +var flatpickr = flatpickr || { l10ns: {} }; | |
| 3 | +flatpickr.l10ns.zh = {}; | |
| 4 | + | |
| 5 | +flatpickr.l10ns.zh.weekdays = { | |
| 6 | + shorthand: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"], | |
| 7 | + longhand: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"] | |
| 8 | +}; | |
| 9 | + | |
| 10 | +flatpickr.l10ns.zh.months = { | |
| 11 | + shorthand: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], | |
| 12 | + longhand: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"] | |
| 13 | +}; | |
| 14 | + | |
| 15 | +flatpickr.l10ns.zh.rangeSeparator = " 至 "; | |
| 16 | +flatpickr.l10ns.zh.weekAbbreviation = "周"; | |
| 17 | +flatpickr.l10ns.zh.scrollTitle = "滚动切换"; | |
| 18 | +flatpickr.l10ns.zh.toggleTitle = "点击切换 12/24 小时时制"; | |
| 19 | + | |
| 20 | +if (typeof module !== "undefined") module.exports = flatpickr.l10ns; | |
| 0 | 21 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/assets/plugins/flatpickr/plugins/confirmDate/confirmDate.css
0 → 100644
| 1 | +.flatpickr-confirm { | |
| 2 | + height: 40px; | |
| 3 | + max-height: 0px; | |
| 4 | + visibility: hidden; | |
| 5 | + display: flex; | |
| 6 | + justify-content: center; | |
| 7 | + align-items: center; | |
| 8 | + cursor: pointer; | |
| 9 | + background: rgba(0,0,0,0.06) | |
| 10 | +} | |
| 11 | + | |
| 12 | +.flatpickr-confirm svg path { | |
| 13 | + fill: inherit; | |
| 14 | +} | |
| 15 | + | |
| 16 | +.flatpickr-confirm.darkTheme { | |
| 17 | + color: white; | |
| 18 | + fill: white; | |
| 19 | +} | |
| 20 | + | |
| 21 | +.flatpickr-confirm.visible { | |
| 22 | + max-height: 40px; | |
| 23 | + visibility: visible | |
| 24 | +} | ... | ... |
src/main/resources/static/real_control_v2/assets/plugins/flatpickr/plugins/confirmDate/confirmDate.js
0 → 100644
| 1 | +function confirmDatePlugin(pluginConfig) { | |
| 2 | + var defaultConfig = { | |
| 3 | + confirmIcon: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='17' height='17' viewBox='0 0 17 17'> <g> </g> <path d='M15.418 1.774l-8.833 13.485-4.918-4.386 0.666-0.746 4.051 3.614 8.198-12.515 0.836 0.548z' fill='#000000' /> </svg>", | |
| 4 | + confirmText: "OK ", | |
| 5 | + showAlways: false, | |
| 6 | + theme: "light" | |
| 7 | + }; | |
| 8 | + | |
| 9 | + var config = {}; | |
| 10 | + for (var key in defaultConfig) { | |
| 11 | + config[key] = pluginConfig && pluginConfig[key] !== undefined ? pluginConfig[key] : defaultConfig[key]; | |
| 12 | + } | |
| 13 | + | |
| 14 | + return function (fp) { | |
| 15 | + var hooks = { | |
| 16 | + onKeyDown: function onKeyDown(_, __, ___, e) { | |
| 17 | + if (fp.config.enableTime && e.key === "Tab" && e.target === fp.amPM) { | |
| 18 | + e.preventDefault(); | |
| 19 | + fp.confirmContainer.focus(); | |
| 20 | + } else if (e.key === "Enter" && e.target === fp.confirmContainer) fp.close(); | |
| 21 | + }, | |
| 22 | + onReady: function onReady() { | |
| 23 | + if (fp.calendarContainer === undefined) return; | |
| 24 | + | |
| 25 | + fp.confirmContainer = fp._createElement("div", "flatpickr-confirm " + (config.showAlways ? "visible" : "") + " " + config.theme + "Theme", config.confirmText); | |
| 26 | + | |
| 27 | + fp.confirmContainer.tabIndex = -1; | |
| 28 | + fp.confirmContainer.innerHTML += config.confirmIcon; | |
| 29 | + | |
| 30 | + fp.confirmContainer.addEventListener("click", fp.close); | |
| 31 | + fp.calendarContainer.appendChild(fp.confirmContainer); | |
| 32 | + } | |
| 33 | + }; | |
| 34 | + | |
| 35 | + if (!config.showAlways) { | |
| 36 | + hooks.onChange = function (dateObj, dateStr) { | |
| 37 | + var showCondition = fp.config.enableTime || fp.config.mode === "multiple"; | |
| 38 | + if (dateStr && !fp.config.inline && showCondition) return fp.confirmContainer.classList.add("visible"); | |
| 39 | + fp.confirmContainer.classList.remove("visible"); | |
| 40 | + }; | |
| 41 | + } | |
| 42 | + | |
| 43 | + return hooks; | |
| 44 | + }; | |
| 45 | +} | |
| 46 | + | |
| 47 | +if (typeof module !== "undefined") module.exports = confirmDatePlugin; | |
| 0 | 48 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/assets/plugins/flatpickr/plugins/labelPlugin/labelPlugin.js
0 → 100644
| 1 | +function labelPlugin() { | |
| 2 | + return function (fp) { | |
| 3 | + return { | |
| 4 | + onReady: function onReady() { | |
| 5 | + var id = fp.input.id; | |
| 6 | + if (fp.config.altInput && id) { | |
| 7 | + fp.input.removeAttribute("id"); | |
| 8 | + fp.altInput.id = id; | |
| 9 | + } | |
| 10 | + } | |
| 11 | + }; | |
| 12 | + }; | |
| 13 | +} | |
| 14 | + | |
| 15 | +if (typeof module !== "undefined") module.exports = labelPlugin; | |
| 0 | 16 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/assets/plugins/flatpickr/plugins/rangePlugin.js
0 → 100644
| 1 | +var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | |
| 2 | + | |
| 3 | +function rangePlugin() { | |
| 4 | + var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | |
| 5 | + | |
| 6 | + return function (fp) { | |
| 7 | + var dateFormat = void 0; | |
| 8 | + | |
| 9 | + var createSecondInput = function createSecondInput() { | |
| 10 | + if (config.input) { | |
| 11 | + fp.secondInput = config.input instanceof Element ? config.input : window.document.querySelector(config.input); | |
| 12 | + } else { | |
| 13 | + fp.secondInput = fp._input.cloneNode(); | |
| 14 | + fp.secondInput.removeAttribute("id"); | |
| 15 | + fp.secondInput._flatpickr = null; | |
| 16 | + } | |
| 17 | + | |
| 18 | + fp.secondInput.setAttribute("data-fp-omit", ""); | |
| 19 | + | |
| 20 | + fp._bind(fp.secondInput, ["focus", "click"], function (e) { | |
| 21 | + fp.open(e, fp.secondInput); | |
| 22 | + if (fp.selectedDates[1]) { | |
| 23 | + fp.latestSelectedDateObj = fp.selectedDates[1]; | |
| 24 | + fp._setHoursFromDate(fp.selectedDates[1]); | |
| 25 | + fp.jumpToDate(fp.selectedDates[1]); | |
| 26 | + } | |
| 27 | + | |
| 28 | + var _ref = [false, true]; | |
| 29 | + fp._firstInputFocused = _ref[0]; | |
| 30 | + fp._secondInputFocused = _ref[1]; | |
| 31 | + }); | |
| 32 | + | |
| 33 | + fp._bind(fp.secondInput, "blur", function (e) { | |
| 34 | + fp.isOpen = false; | |
| 35 | + }); | |
| 36 | + | |
| 37 | + fp._bind(fp.secondInput, "keydown", function (e) { | |
| 38 | + if (e.key === "Enter") { | |
| 39 | + fp.setDate([fp.selectedDates[0], fp.secondInput.value], true, dateFormat); | |
| 40 | + fp.secondInput.click(); | |
| 41 | + } | |
| 42 | + }); | |
| 43 | + if (!config.input) fp._input.parentNode.insertBefore(fp.secondInput, fp._input.nextSibling); | |
| 44 | + }; | |
| 45 | + | |
| 46 | + return { | |
| 47 | + onParseConfig: function onParseConfig() { | |
| 48 | + fp.config.mode = "range"; | |
| 49 | + fp.config.allowInput = true; | |
| 50 | + dateFormat = fp.config.altInput ? fp.config.altFormat : fp.config.dateFormat; | |
| 51 | + }, | |
| 52 | + onReady: function onReady() { | |
| 53 | + createSecondInput(); | |
| 54 | + fp.config.ignoredFocusElements.push(fp.secondInput); | |
| 55 | + fp._input.removeAttribute("readonly"); | |
| 56 | + fp.secondInput.removeAttribute("readonly"); | |
| 57 | + | |
| 58 | + fp._bind(fp._input, "focus", function (e) { | |
| 59 | + fp.latestSelectedDateObj = fp.selectedDates[0]; | |
| 60 | + fp._setHoursFromDate(fp.selectedDates[0]); | |
| 61 | + var _ref2 = [true, false]; | |
| 62 | + fp._firstInputFocused = _ref2[0]; | |
| 63 | + fp._secondInputFocused = _ref2[1]; | |
| 64 | + | |
| 65 | + fp.jumpToDate(fp.selectedDates[0]); | |
| 66 | + }); | |
| 67 | + | |
| 68 | + fp._bind(fp._input, "keydown", function (e) { | |
| 69 | + if (e.key === "Enter") fp.setDate([fp._input.value, fp.selectedDates[1]], true, dateFormat); | |
| 70 | + }); | |
| 71 | + | |
| 72 | + fp.setDate(fp.selectedDates); | |
| 73 | + }, | |
| 74 | + onChange: function onChange() { | |
| 75 | + if (!fp.selectedDates.length) { | |
| 76 | + setTimeout(function () { | |
| 77 | + if (fp.selectedDates.length) return; | |
| 78 | + | |
| 79 | + fp.secondInput.value = ""; | |
| 80 | + fp._prevDates = []; | |
| 81 | + }, 10); | |
| 82 | + } | |
| 83 | + }, | |
| 84 | + onDestroy: function onDestroy() { | |
| 85 | + if (!config.input) fp.secondInput.parentNode.removeChild(fp.secondInput); | |
| 86 | + delete fp._prevDates; | |
| 87 | + delete fp._firstInputFocused; | |
| 88 | + delete fp._secondInputFocused; | |
| 89 | + }, | |
| 90 | + onValueUpdate: function onValueUpdate(selDates, dateStr) { | |
| 91 | + if (!fp.secondInput) return; | |
| 92 | + | |
| 93 | + fp._prevDates = !fp._prevDates || selDates.length >= fp._prevDates.length ? selDates.map(function (d) { | |
| 94 | + return d; | |
| 95 | + }) // copy | |
| 96 | + : fp._prevDates; | |
| 97 | + | |
| 98 | + if (fp._prevDates.length > selDates.length) { | |
| 99 | + var newSelectedDate = selDates[0]; | |
| 100 | + | |
| 101 | + if (fp._firstInputFocused) fp.setDate([newSelectedDate, fp._prevDates[1]]);else if (fp._secondInputFocused) fp.setDate([fp._prevDates[0], newSelectedDate]); | |
| 102 | + } | |
| 103 | + | |
| 104 | + var _fp$selectedDates$map = fp.selectedDates.map(function (d) { | |
| 105 | + return fp.formatDate(d, dateFormat); | |
| 106 | + }); | |
| 107 | + | |
| 108 | + var _fp$selectedDates$map2 = _slicedToArray(_fp$selectedDates$map, 2); | |
| 109 | + | |
| 110 | + var _fp$selectedDates$map3 = _fp$selectedDates$map2[0]; | |
| 111 | + fp._input.value = _fp$selectedDates$map3 === undefined ? "" : _fp$selectedDates$map3; | |
| 112 | + var _fp$selectedDates$map4 = _fp$selectedDates$map2[1]; | |
| 113 | + fp.secondInput.value = _fp$selectedDates$map4 === undefined ? "" : _fp$selectedDates$map4; | |
| 114 | + } | |
| 115 | + }; | |
| 116 | + }; | |
| 117 | +} | |
| 118 | + | |
| 119 | +if (typeof module !== "undefined") module.exports = rangePlugin; | |
| 0 | 120 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/assets/plugins/flatpickr/plugins/weekSelect/weekSelect.js
0 → 100644
| 1 | +function weekSelectPlugin(pluginConfig) { | |
| 2 | + return function (fp) { | |
| 3 | + function onDayHover(event) { | |
| 4 | + if (!event.target.classList.contains("flatpickr-day")) return; | |
| 5 | + | |
| 6 | + var days = event.target.parentNode.childNodes; | |
| 7 | + var dayIndex = event.target.$i; | |
| 8 | + | |
| 9 | + var dayIndSeven = dayIndex / 7; | |
| 10 | + var weekStartDay = days[7 * Math.floor(dayIndSeven)].dateObj; | |
| 11 | + var weekEndDay = days[7 * Math.ceil(dayIndSeven + 0.01) - 1].dateObj; | |
| 12 | + | |
| 13 | + for (var i = days.length; i--;) { | |
| 14 | + var date = days[i].dateObj; | |
| 15 | + if (date > weekEndDay || date < weekStartDay) days[i].classList.remove("inRange");else days[i].classList.add("inRange"); | |
| 16 | + } | |
| 17 | + } | |
| 18 | + | |
| 19 | + function highlightWeek() { | |
| 20 | + if (fp.selectedDateElem) { | |
| 21 | + fp.weekStartDay = fp.days.childNodes[7 * Math.floor(fp.selectedDateElem.$i / 7)].dateObj; | |
| 22 | + fp.weekEndDay = fp.days.childNodes[7 * Math.ceil(fp.selectedDateElem.$i / 7 + 0.01) - 1].dateObj; | |
| 23 | + } | |
| 24 | + var days = fp.days.childNodes; | |
| 25 | + for (var i = days.length; i--;) { | |
| 26 | + var date = days[i].dateObj; | |
| 27 | + if (date >= fp.weekStartDay && date <= fp.weekEndDay) days[i].classList.add("week", "selected"); | |
| 28 | + } | |
| 29 | + } | |
| 30 | + | |
| 31 | + function clearHover() { | |
| 32 | + var days = fp.days.childNodes; | |
| 33 | + for (var i = days.length; i--;) { | |
| 34 | + days[i].classList.remove("inRange"); | |
| 35 | + } | |
| 36 | + } | |
| 37 | + | |
| 38 | + function onReady() { | |
| 39 | + fp.days.parentNode.addEventListener("mouseover", onDayHover); | |
| 40 | + } | |
| 41 | + | |
| 42 | + return { | |
| 43 | + onChange: highlightWeek, | |
| 44 | + onMonthChange: function onMonthChange() { | |
| 45 | + return fp._.afterDayAnim(highlightWeek); | |
| 46 | + }, | |
| 47 | + onClose: clearHover, | |
| 48 | + onParseConfig: function onParseConfig() { | |
| 49 | + fp.config.mode = "single"; | |
| 50 | + fp.config.enableTime = false; | |
| 51 | + fp.config.dateFormat = "\\W\\e\\e\\k #W, Y"; | |
| 52 | + fp.config.altFormat = "\\W\\e\\e\\k #W, Y"; | |
| 53 | + }, | |
| 54 | + onReady: [onReady, highlightWeek] | |
| 55 | + }; | |
| 56 | + }; | |
| 57 | +} | |
| 58 | + | |
| 59 | +if (typeof module !== "undefined") module.exports = weekSelectPlugin; | |
| 0 | 60 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/assets/plugins/flatpickr/rtl/flatpickr.min.css
0 → 100644
| 1 | +.flatpickr-calendar{background:transparent;overflow:hidden;max-height:0;opacity:0;visibility:hidden;text-align:center;padding:0;animation:none;direction:rtl;border:0;font-size:14px;line-height:24px;border-radius:5px;position:absolute;width:315px;box-sizing:border-box;background:#fff;box-shadow:-1px 0 0 #e6e6e6,1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,0.08);}.flatpickr-calendar.open,.flatpickr-calendar.inline{opacity:1;visibility:visible;overflow:visible;max-height:640px}.flatpickr-calendar.open{display:inline-block;z-index:99999}.flatpickr-calendar.animate.open{animation:flatpickrFadeInDown 300ms cubic-bezier(.23,1,.32,1)}.flatpickr-calendar.inline{display:block;position:relative;top:2px}.flatpickr-calendar.static{position:absolute;top:calc(100% + 2px);}.flatpickr-calendar.static.open{z-index:999;display:block}.flatpickr-calendar.hasWeeks{width:auto}.flatpickr-calendar .hasWeeks .dayContainer,.flatpickr-calendar .hasTime .dayContainer{border-bottom:0;border-bottom-left-radius:0;border-bottom-right-radius:0}.flatpickr-calendar .hasWeeks .dayContainer{border-right:0}.flatpickr-calendar.showTimeInput.hasTime .flatpickr-time{height:40px;border-top:1px solid #e6e6e6}.flatpickr-calendar.noCalendar.hasTime .flatpickr-time{height:auto}.flatpickr-calendar:before,.flatpickr-calendar:after{position:absolute;display:block;pointer-events:none;border:solid transparent;content:'';height:0;width:0;right:22px}.flatpickr-calendar.rightMost:before,.flatpickr-calendar.rightMost:after{right:auto;left:22px}.flatpickr-calendar:before{border-width:5px;margin:0 -5px}.flatpickr-calendar:after{border-width:4px;margin:0 -4px}.flatpickr-calendar.arrowTop:before,.flatpickr-calendar.arrowTop:after{bottom:100%}.flatpickr-calendar.arrowTop:before{border-bottom-color:#e6e6e6}.flatpickr-calendar.arrowTop:after{border-bottom-color:#fff}.flatpickr-calendar.arrowBottom:before,.flatpickr-calendar.arrowBottom:after{top:100%}.flatpickr-calendar.arrowBottom:before{border-top-color:#e6e6e6}.flatpickr-calendar.arrowBottom:after{border-top-color:#fff}.flatpickr-calendar:focus{outline:0}.flatpickr-wrapper{position:relative;display:inline-block}.flatpickr-month{background:transparent;color:rgba(0,0,0,0.9);fill:rgba(0,0,0,0.9);height:28px;line-height:24px;text-align:center;position:relative;user-select:none;overflow:hidden}.flatpickr-prev-month,.flatpickr-next-month{text-decoration:none;cursor:pointer;position:absolute;top:0;height:28px;line-height:16px;padding:10px calc(3.57% - 1.5px);}.flatpickr-prev-month i,.flatpickr-next-month i{position:relative}.flatpickr-prev-month.flatpickr-prev-month,.flatpickr-next-month.flatpickr-prev-month{/* | |
| 2 | + /*rtl:begin:ignore*/right:0;/* | |
| 3 | + /*rtl:end:ignore*/}/* | |
| 4 | + /*rtl:begin:ignore*/ | |
| 5 | +/* | |
| 6 | + /*rtl:end:ignore*/ | |
| 7 | +.flatpickr-prev-month.flatpickr-next-month,.flatpickr-next-month.flatpickr-next-month{/* | |
| 8 | + /*rtl:begin:ignore*/left:0;/* | |
| 9 | + /*rtl:end:ignore*/}/* | |
| 10 | + /*rtl:begin:ignore*/ | |
| 11 | +/* | |
| 12 | + /*rtl:end:ignore*/ | |
| 13 | +.flatpickr-prev-month:hover,.flatpickr-next-month:hover{color:#959ea9;}.flatpickr-prev-month:hover svg,.flatpickr-next-month:hover svg{fill:#f64747}.flatpickr-prev-month svg,.flatpickr-next-month svg{width:14px;}.flatpickr-prev-month svg path,.flatpickr-next-month svg path{transition:fill .1s;fill:inherit}.numInputWrapper{position:relative;height:auto;}.numInputWrapper input,.numInputWrapper span{display:inline-block}.numInputWrapper input{width:100%}.numInputWrapper span{position:absolute;left:0;width:14px;padding:0 2px 0 4px;height:50%;line-height:50%;opacity:0;cursor:pointer;border:1px solid rgba(57,57,57,0.05);box-sizing:border-box;}.numInputWrapper span:hover{background:rgba(0,0,0,0.1)}.numInputWrapper span:active{background:rgba(0,0,0,0.2)}.numInputWrapper span:after{display:block;content:"";position:absolute;top:33%}.numInputWrapper span.arrowUp{top:0;border-bottom:0;}.numInputWrapper span.arrowUp:after{border-right:4px solid transparent;border-left:4px solid transparent;border-bottom:4px solid rgba(57,57,57,0.6)}.numInputWrapper span.arrowDown{top:50%;}.numInputWrapper span.arrowDown:after{border-right:4px solid transparent;border-left:4px solid transparent;border-top:4px solid rgba(57,57,57,0.6)}.numInputWrapper span svg{width:inherit;height:auto;}.numInputWrapper span svg path{fill:rgba(0,0,0,0.5)}.numInputWrapper:hover{background:rgba(0,0,0,0.05);}.numInputWrapper:hover span{opacity:1}.flatpickr-current-month{font-size:135%;line-height:inherit;font-weight:300;color:inherit;position:absolute;width:75%;right:12.5%;top:5px;display:inline-block;text-align:center;transform:translate(0,0);}.flatpickr-current-month.slideLeft{transform:translate(100%,0);animation:fadeOut 400ms ease,slideLeft 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-current-month.slideLeftNew{transform:translate(-100%,0);animation:fadeIn 400ms ease,slideLeftNew 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-current-month.slideRight{transform:translate(-100%,0);animation:fadeOut 400ms ease,slideRight 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-current-month.slideRightNew{transform:translate(0,0);animation:fadeIn 400ms ease,slideRightNew 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-current-month span.cur-month{font-family:inherit;font-weight:700;color:inherit;display:inline-block;margin-right:7px;padding:0;}.flatpickr-current-month span.cur-month:hover{background:rgba(0,0,0,0.05)}.flatpickr-current-month .numInputWrapper{width:6ch;width:7ch\0;display:inline-block;}.flatpickr-current-month .numInputWrapper span.arrowUp:after{border-bottom-color:rgba(0,0,0,0.9)}.flatpickr-current-month .numInputWrapper span.arrowDown:after{border-top-color:rgba(0,0,0,0.9)}.flatpickr-current-month input.cur-year{background:transparent;box-sizing:border-box;color:inherit;cursor:default;padding:0 .5ch 0 0;margin:0;display:inline;font-size:inherit;font-family:inherit;font-weight:300;line-height:inherit;height:initial;border:0;border-radius:0;vertical-align:initial;}.flatpickr-current-month input.cur-year:focus{outline:0}.flatpickr-current-month input.cur-year[disabled],.flatpickr-current-month input.cur-year[disabled]:hover{font-size:100%;color:rgba(0,0,0,0.5);background:transparent;pointer-events:none}.flatpickr-weekdays{background:transparent;text-align:center;overflow:hidden;width:315px;display:flex;align-items:center;height:28px}span.flatpickr-weekday{cursor:default;font-size:90%;color:rgba(0,0,0,0.54);line-height:1;margin:0;background:transparent;text-align:center;display:block;flex:1;font-weight:bolder;margin:0}.dayContainer,.flatpickr-weeks{padding:1px 0 0 0}.flatpickr-days{position:relative;overflow:hidden;display:flex;width:315px;}.flatpickr-days:focus{outline:0}.dayContainer{padding:0;outline:0;text-align:right;width:315px;min-width:315px;max-width:315px;box-sizing:border-box;display:inline-block;display:-ms-flexbox;display:flex;flex-wrap:wrap;-ms-flex-wrap:wrap;-ms-flex-pack:justify;justify-content:space-around;transform:translate(0,0);opacity:1}.flatpickr-calendar.animate .dayContainer.slideLeft{animation:fadeOut 400ms cubic-bezier(.23,1,.32,1),slideLeft 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-calendar.animate .dayContainer.slideLeft,.flatpickr-calendar.animate .dayContainer.slideLeftNew{transform:translate(100%,0)}.flatpickr-calendar.animate .dayContainer.slideLeftNew{animation:fadeIn 400ms cubic-bezier(.23,1,.32,1),slideLeft 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-calendar.animate .dayContainer.slideRight{animation:fadeOut 400ms cubic-bezier(.23,1,.32,1),slideRight 400ms cubic-bezier(.23,1,.32,1);transform:translate(-100%,0)}.flatpickr-calendar.animate .dayContainer.slideRightNew{animation:fadeIn 400ms cubic-bezier(.23,1,.32,1),slideRightNew 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-day{background:none;border:1px solid transparent;border-radius:150px;box-sizing:border-box;color:#393939;cursor:pointer;font-weight:400;width:14.2857143%;flex-basis:14.2857143%;max-width:40px;height:40px;line-height:40px;margin:0;display:inline-block;position:relative;justify-content:center;text-align:center;}.flatpickr-day.inRange,.flatpickr-day.prevMonthDay.inRange,.flatpickr-day.nextMonthDay.inRange,.flatpickr-day.today.inRange,.flatpickr-day.prevMonthDay.today.inRange,.flatpickr-day.nextMonthDay.today.inRange,.flatpickr-day:hover,.flatpickr-day.prevMonthDay:hover,.flatpickr-day.nextMonthDay:hover,.flatpickr-day:focus,.flatpickr-day.prevMonthDay:focus,.flatpickr-day.nextMonthDay:focus{cursor:pointer;outline:0;background:#e6e6e6;border-color:#e6e6e6}.flatpickr-day.today{border-color:#959ea9;}.flatpickr-day.today:hover,.flatpickr-day.today:focus{border-color:#959ea9;background:#959ea9;color:#fff}.flatpickr-day.selected,.flatpickr-day.startRange,.flatpickr-day.endRange,.flatpickr-day.selected.inRange,.flatpickr-day.startRange.inRange,.flatpickr-day.endRange.inRange,.flatpickr-day.selected:focus,.flatpickr-day.startRange:focus,.flatpickr-day.endRange:focus,.flatpickr-day.selected:hover,.flatpickr-day.startRange:hover,.flatpickr-day.endRange:hover,.flatpickr-day.selected.prevMonthDay,.flatpickr-day.startRange.prevMonthDay,.flatpickr-day.endRange.prevMonthDay,.flatpickr-day.selected.nextMonthDay,.flatpickr-day.startRange.nextMonthDay,.flatpickr-day.endRange.nextMonthDay{background:#569ff7;box-shadow:none;color:#fff;border-color:#569ff7}.flatpickr-day.selected.startRange,.flatpickr-day.startRange.startRange,.flatpickr-day.endRange.startRange{border-radius:0 50px 50px 0}.flatpickr-day.selected.endRange,.flatpickr-day.startRange.endRange,.flatpickr-day.endRange.endRange{border-radius:50px 0 0 50px}.flatpickr-day.selected.startRange + .endRange,.flatpickr-day.startRange.startRange + .endRange,.flatpickr-day.endRange.startRange + .endRange{box-shadow:10px 0 0 #569ff7}.flatpickr-day.selected.startRange.endRange,.flatpickr-day.startRange.startRange.endRange,.flatpickr-day.endRange.startRange.endRange{border-radius:50px}.flatpickr-day.inRange{border-radius:0;box-shadow:5px 0 0 #e6e6e6,-5px 0 0 #e6e6e6}.flatpickr-day.disabled,.flatpickr-day.disabled:hover{pointer-events:none}.flatpickr-day.disabled,.flatpickr-day.disabled:hover,.flatpickr-day.prevMonthDay,.flatpickr-day.nextMonthDay,.flatpickr-day.notAllowed,.flatpickr-day.notAllowed.prevMonthDay,.flatpickr-day.notAllowed.nextMonthDay{color:rgba(57,57,57,0.3);background:transparent;border-color:transparent;cursor:default}.rangeMode .flatpickr-day{margin-top:1px}.flatpickr-weekwrapper{display:inline-block;float:right;}.flatpickr-weekwrapper .flatpickr-weeks{padding:1px 12px 0 12px;box-shadow:-1px 0 0 #e6e6e6}.flatpickr-weekwrapper .flatpickr-weekday{float:none;width:100%}.flatpickr-weekwrapper span.flatpickr-day{display:block;width:100%;max-width:none}.flatpickr-innerContainer{display:block;display:flex;box-sizing:border-box;overflow:hidden;}.flatpickr-rContainer{display:inline-block;padding:0;box-sizing:border-box}.flatpickr-time{text-align:center;outline:0;display:block;height:0;line-height:40px;max-height:40px;box-sizing:border-box;overflow:hidden;display:flex;}.flatpickr-time:after{content:"";display:table;clear:both}.flatpickr-time .numInputWrapper{flex:1;width:40%;height:40px;float:right;}.flatpickr-time .numInputWrapper span.arrowUp:after{border-bottom-color:#393939}.flatpickr-time .numInputWrapper span.arrowDown:after{border-top-color:#393939}.flatpickr-time.hasSeconds .numInputWrapper{width:26%}.flatpickr-time.time24hr .numInputWrapper{width:49%}.flatpickr-time input{background:transparent;box-shadow:none;border:0;border-radius:0;text-align:center;margin:0;padding:0;height:inherit;line-height:inherit;cursor:pointer;color:#393939;font-size:14px;position:relative;box-sizing:border-box;}.flatpickr-time input.flatpickr-hour{font-weight:bold}.flatpickr-time input.flatpickr-minute,.flatpickr-time input.flatpickr-second{font-weight:400}.flatpickr-time input:focus{outline:0;border:0}.flatpickr-time .flatpickr-time-separator,.flatpickr-time .flatpickr-am-pm{height:inherit;display:inline-block;float:right;line-height:inherit;color:#393939;font-weight:bold;width:2%;user-select:none}.flatpickr-time .flatpickr-am-pm{outline:0;width:18%;cursor:pointer;text-align:center;font-weight:400;}.flatpickr-time .flatpickr-am-pm:hover,.flatpickr-time .flatpickr-am-pm:focus{background:#f0f0f0}@media all and (-ms-high-contrast:none){.flatpickr-month{padding:0;}.flatpickr-month svg{top:0 !important}}.flatpickr-input[readonly]{cursor:pointer}@-moz-keyframes flatpickrFadeInDown{from{opacity:0;transform:translate3d(0,-20px,0)}to{opacity:1;transform:translate3d(0,0,0)}}@-webkit-keyframes flatpickrFadeInDown{from{opacity:0;transform:translate3d(0,-20px,0)}to{opacity:1;transform:translate3d(0,0,0)}}@-o-keyframes flatpickrFadeInDown{from{opacity:0;transform:translate3d(0,-20px,0)}to{opacity:1;transform:translate3d(0,0,0)}}@keyframes flatpickrFadeInDown{from{opacity:0;transform:translate3d(0,-20px,0)}to{opacity:1;transform:translate3d(0,0,0)}}@-moz-keyframes slideLeft{from{transform:translate(0,0)}to{transform:translate(100%,0)}}@-webkit-keyframes slideLeft{from{transform:translate(0,0)}to{transform:translate(100%,0)}}@-o-keyframes slideLeft{from{transform:translate(0,0)}to{transform:translate(100%,0)}}@keyframes slideLeft{from{transform:translate(0,0)}to{transform:translate(100%,0)}}@-moz-keyframes slideLeftNew{from{transform:translate(-100%,0)}to{transform:translate(0,0)}}@-webkit-keyframes slideLeftNew{from{transform:translate(-100%,0)}to{transform:translate(0,0)}}@-o-keyframes slideLeftNew{from{transform:translate(-100%,0)}to{transform:translate(0,0)}}@keyframes slideLeftNew{from{transform:translate(-100%,0)}to{transform:translate(0,0)}}@-moz-keyframes slideRight{from{transform:translate(0,0)}to{transform:translate(-100%,0)}}@-webkit-keyframes slideRight{from{transform:translate(0,0)}to{transform:translate(-100%,0)}}@-o-keyframes slideRight{from{transform:translate(0,0)}to{transform:translate(-100%,0)}}@keyframes slideRight{from{transform:translate(0,0)}to{transform:translate(-100%,0)}}@-moz-keyframes slideRightNew{from{transform:translate(100%,0)}to{transform:translate(0,0)}}@-webkit-keyframes slideRightNew{from{transform:translate(100%,0)}to{transform:translate(0,0)}}@-o-keyframes slideRightNew{from{transform:translate(100%,0)}to{transform:translate(0,0)}}@keyframes slideRightNew{from{transform:translate(100%,0)}to{transform:translate(0,0)}}@-moz-keyframes fadeOut{from{opacity:1}to{opacity:0}}@-webkit-keyframes fadeOut{from{opacity:1}to{opacity:0}}@-o-keyframes fadeOut{from{opacity:1}to{opacity:0}}@keyframes fadeOut{from{opacity:1}to{opacity:0}}@-moz-keyframes fadeIn{from{opacity:0}to{opacity:1}}@-webkit-keyframes fadeIn{from{opacity:0}to{opacity:1}}@-o-keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeIn{from{opacity:0}to{opacity:1}} | ... | ... |