cxcalendar.css 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. /*!
  2. * cxCalendar
  3. * ------------------------------ */
  4. .cxcalendar {
  5. --cxcalendar-bg: #fff;
  6. --cxcalendar-border: #ccc;
  7. --cxcalendar-item-bg: #eee;
  8. --cxcalendar-text-color: #333;
  9. --cxcalendar-days-color: #666;
  10. --cxcalendar-sat-color: #4a89dc;
  11. --cxcalendar-sun-color: #da4453;
  12. --cxcalendar-other-color: #ccc;
  13. --cxcalendar-note-color: #aaa;
  14. --cxcalendar-now-bg: #f3f3f3;
  15. --cxcalendar-set-bg: #8cc152;
  16. --cxcalendar-range-bg: #dceffc;
  17. --cxcalendar-range-set-bg: #70a9ce;
  18. --cxcalendar-btn-color: #fff;
  19. --cxcalendar-btn-bg: #666;
  20. --cxcalendar-confirm-bg: #4a89dc;
  21. --cxcalendar-gap-out: 8px;
  22. --cxcalendar-text-size: 14px;
  23. --cxcalendar-title-size: 16px;
  24. --cxcalendar-unit-size: 10px;
  25. --cxcalendar-btn-size: 12px;
  26. position: fixed;
  27. z-index: 10000;
  28. top: -999px;
  29. left: -999px;
  30. width: 266px;
  31. border: 1px solid var(--cxcalendar-border);
  32. border-radius: 3px;
  33. background-color: var(--cxcalendar-bg);
  34. box-shadow: 1px 2px 3px rgba(0,0,0,.2);
  35. color: var(--cxcalendar-text-color);
  36. font-size: var(--cxcalendar-text-size);
  37. opacity: 0;
  38. transform: translate(0,5%);
  39. transition-property: opacity,transform;
  40. transition-duration: .3s;
  41. -webkit-user-select: none;
  42. user-select: none
  43. }
  44. .cxcalendar_mask {
  45. display: none;
  46. position: fixed;
  47. z-index: 9999;
  48. top: 0;
  49. left: 0;
  50. right: 0;
  51. bottom: 0;
  52. background-color: rgba(0,0,0,0)
  53. }
  54. .cxcalendar.show {
  55. opacity: 1;
  56. transform: translate(0,0)
  57. }
  58. .cxcalendar.show + .cxcalendar_mask {
  59. display: block
  60. }
  61. .cxcalendar_hd {
  62. position: relative;
  63. height: 32px;
  64. padding: var(--cxcalendar-gap-out);
  65. padding-bottom: 0;
  66. font-weight: 700;
  67. font-size: var(--cxcalendar-title-size);
  68. line-height: 32px;
  69. text-align: center
  70. }
  71. .cxcalendar_hd .next,
  72. .cxcalendar_hd .prev {
  73. position: absolute;
  74. top: var(--cxcalendar-gap-out);
  75. width: 30px;
  76. height: 30px;
  77. padding: 0;
  78. border: 1px solid transparent;
  79. border-radius: 3px;
  80. color: var(--cxcalendar-text-color);
  81. font-size: 0;
  82. line-height: 0;
  83. text-decoration: none;
  84. outline: 0;
  85. transition-property: border-color,background-color;
  86. transition-duration: .2s
  87. }
  88. .cxcalendar_hd .prev {
  89. left: var(--cxcalendar-gap-out)
  90. }
  91. .cxcalendar_hd .next {
  92. right: var(--cxcalendar-gap-out)
  93. }
  94. .cxcalendar_hd .next:before,
  95. .cxcalendar_hd .prev:before {
  96. content: '';
  97. position: absolute;
  98. top: 50%;
  99. left: 50%;
  100. width: 0;
  101. height: 0;
  102. margin: -6px 0 0 -5px;
  103. border-top: 6px solid transparent;
  104. border-bottom: 6px solid transparent
  105. }
  106. .cxcalendar_hd .prev:before {
  107. border-right: 10px solid currentColor
  108. }
  109. .cxcalendar_hd .next:before {
  110. border-left: 10px solid currentColor
  111. }
  112. .cxcalendar_bd .times select,
  113. .cxcalendar_hd select {
  114. display: inline-block;
  115. box-sizing: border-box;
  116. height: 32px;
  117. margin: 0;
  118. padding: 0 .5em;
  119. border: 1px solid transparent;
  120. border-radius: 3px;
  121. background: 0 0;
  122. color: var(--cxcalendar-text-color);
  123. font-weight: 700;
  124. font-size: var(--cxcalendar-title-size);
  125. line-height: 32px;
  126. text-align: center;
  127. vertical-align: top;
  128. outline: 0;
  129. cursor: pointer;
  130. transition-property: border-color,background-color;
  131. transition-duration: .2s;
  132. -webkit-appearance: none;
  133. appearance: none
  134. }
  135. .cxcalendar_hd em {
  136. display: inline-block;
  137. padding: 0 1px;
  138. font-style: normal
  139. }
  140. .cxcalendar_hd .year + em:after {
  141. content: '年'
  142. }
  143. .cxcalendar_hd .month + em:after {
  144. content: '月'
  145. }
  146. .cxcalendar_hd .fill {
  147. font-weight: 400;
  148. font-size: var(--cxcalendar-text-size)
  149. }
  150. .cxcalendar_hd .fill span {
  151. padding: 0 4px
  152. }
  153. .cxcalendar_bd .times select:hover,
  154. .cxcalendar_hd .next:hover,
  155. .cxcalendar_hd .prev:hover,
  156. .cxcalendar_hd select:hover {
  157. border-color: var(--cxcalendar-border);
  158. background: var(--cxcalendar-item-bg)
  159. }
  160. .cxcalendar_bd {
  161. position: relative;
  162. padding: var(--cxcalendar-gap-out);
  163. padding-top: 0;
  164. z-index: 1
  165. }
  166. .cxcalendar_bd ul {
  167. position: relative;
  168. margin: 0;
  169. padding: 0;
  170. list-style: none;
  171. color: var(--cxcalendar-days-color);
  172. line-height: 32px;
  173. text-align: center;
  174. display: flex;
  175. flex-wrap: wrap;
  176. justify-content: center;
  177. align-content: flex-start
  178. }
  179. .cxcalendar_bd ul li {
  180. box-sizing: border-box;
  181. position: relative;
  182. height: 36px;
  183. margin: 0;
  184. padding: 0;
  185. border: 2px solid var(--cxcalendar-bg);
  186. border-radius: 5px;
  187. cursor: pointer;
  188. flex: none;
  189. transition-property: background-color,color;
  190. transition-duration: .2s
  191. }
  192. .cxcalendar_bd ul li.del,
  193. .cxcalendar_bd ul li.week {
  194. cursor: default
  195. }
  196. .cxcalendar_bd ul li.del,
  197. .cxcalendar_bd ul li.del.holiday,
  198. .cxcalendar_bd ul li.del.now,
  199. .cxcalendar_bd ul li.del.sat,
  200. .cxcalendar_bd ul li.del.sun {
  201. color: var(--cxcalendar-other-color);
  202. text-decoration: line-through
  203. }
  204. .cxcalendar_bd ul li.now {
  205. background-color: var(--cxcalendar-now-bg)
  206. }
  207. .cxcalendar_bd ul li.del:hover,
  208. .cxcalendar_bd ul li.now.del,
  209. .cxcalendar_bd ul li.week:hover {
  210. background: 0 0
  211. }
  212. .cxcalendar_bd ul li:hover {
  213. background-color: var(--cxcalendar-item-bg)
  214. }
  215. .cxcalendar_bd ul li.selected,
  216. .cxcalendar_bd ul li.selected.holiday,
  217. .cxcalendar_bd ul li.selected.other,
  218. .cxcalendar_bd ul li.selected.sat,
  219. .cxcalendar_bd ul li.selected.sun,
  220. .cxcalendar_bd ul li.selected:hover {
  221. background-color: var(--cxcalendar-set-bg);
  222. color: var(--cxcalendar-btn-color)
  223. }
  224. .cxcalendar_bd ul li.del:after,
  225. .cxcalendar_bd ul li.selected:after {
  226. color: inherit
  227. }
  228. .cxcalendar_bd .days li {
  229. flex-basis: 14%
  230. }
  231. .cxcalendar_bd .days .sat {
  232. color: var(--cxcalendar-sat-color)
  233. }
  234. .cxcalendar_bd .days .holiday,
  235. .cxcalendar_bd .days .sun {
  236. color: var(--cxcalendar-sun-color)
  237. }
  238. .cxcalendar_bd .days .other {
  239. color: var(--cxcalendar-other-color)
  240. }
  241. .cxcalendar_bd .days li.week.sat,
  242. .cxcalendar_bd .days li.week.sun {
  243. color: inherit
  244. }
  245. .cxcalendar_bd .months li {
  246. flex-basis: 33%
  247. }
  248. .cxcalendar_bd .years li {
  249. flex-basis: 25%
  250. }
  251. .cxcalendar_bd .months li:after,
  252. .cxcalendar_bd .years li:after {
  253. content: '月';
  254. display: inline-block;
  255. margin-left: 2px;
  256. color: var(--cxcalendar-note-color);
  257. font-size: var(--cxcalendar-unit-size);
  258. vertical-align: top
  259. }
  260. .cxcalendar_bd .years li:after {
  261. content: '年'
  262. }
  263. .cxcalendar_bd .times {
  264. position: relative;
  265. margin-top: var(--cxcalendar-gap-out);
  266. padding-top: var(--cxcalendar-gap-out);
  267. color: var(--cxcalendar-note-color);
  268. line-height: 32px;
  269. display: flex
  270. }
  271. .cxcalendar_bd .times:before {
  272. content: '';
  273. position: absolute;
  274. top: 0;
  275. left: 0;
  276. right: 0;
  277. height: 1px;
  278. background: linear-gradient(to right,rgba(0,0,0,0) 0,rgba(0,0,0,.1) 15%,rgba(0,0,0,.1) 85%,rgba(0,0,0,0) 100%)
  279. }
  280. .cxcalendar_bd .times:only-child:before {
  281. display: none
  282. }
  283. .cxcalendar_bd .times section {
  284. flex: 1;
  285. display: flex;
  286. justify-content: center
  287. }
  288. .cxcalendar_bd .times section:before {
  289. content: '选择时间';
  290. margin-right: .5em
  291. }
  292. .cxcalendar_bd .times select {
  293. font-weight: 400;
  294. font-size: var(--cxcalendar-text-size)
  295. }
  296. .cxcalendar_bd .times i {
  297. padding: 0 1px;
  298. font-style: normal
  299. }
  300. .cxcalendar_bd .times i:after {
  301. content: ':'
  302. }
  303. .cxcalendar_acts {
  304. padding: var(--cxcalendar-gap-out) 0;
  305. border-top: 1px solid var(--cxcalendar-border);
  306. border-radius: 0 0 3px 3px;
  307. background-color: var(--cxcalendar-item-bg);
  308. font-size: var(--cxcalendar-btn-size);
  309. line-height: 30px;
  310. display: flex;
  311. justify-content: center
  312. }
  313. .cxcalendar_acts a {
  314. padding: 0 1em;
  315. border-radius: 3px;
  316. background-color: var(--cxcalendar-btn-bg);
  317. color: var(--cxcalendar-btn-color);
  318. text-decoration: none;
  319. text-align: center;
  320. transition-property: opacity;
  321. transition-duration: .2s
  322. }
  323. .cxcalendar_acts a + a {
  324. margin-left: 1em
  325. }
  326. .cxcalendar_acts a:hover {
  327. color: var(--cxcalendar-btn-color);
  328. opacity: .8
  329. }
  330. .cxcalendar_acts .today:before {
  331. content: '今天'
  332. }
  333. .cxcalendar_acts .clear:before {
  334. content: '清除'
  335. }
  336. .cxcalendar_acts .confirm {
  337. background-color: var(--cxcalendar-confirm-bg)
  338. }
  339. .cxcalendar_acts .confirm:before {
  340. content: '确定'
  341. }
  342. .cxcalendar.m_datetime .cxcalendar_acts .today:before,
  343. .cxcalendar.m_time .cxcalendar_acts .today:before {
  344. content: '现在'
  345. }
  346. .cxcalendar.m_year .cxcalendar_acts .today:before {
  347. content: '今年'
  348. }
  349. .cxcalendar.m_month .cxcalendar_acts .today:before {
  350. content: '本月'
  351. }
  352. .cxcalendar.at_end .cxcalendar_hd .next,
  353. .cxcalendar.at_start .cxcalendar_hd .prev {
  354. color: var(--cxcalendar-other-color);
  355. cursor: default
  356. }
  357. .cxcalendar.at_end .cxcalendar_hd .next:hover,
  358. .cxcalendar.at_start .cxcalendar_hd .prev:hover {
  359. border-color: transparent;
  360. background: 0 0
  361. }
  362. .cxcalendar.range {
  363. width: 524px
  364. }
  365. .cxcalendar.range .cxcalendar_bd .days,
  366. .cxcalendar.range .cxcalendar_bd .months,
  367. .cxcalendar.range .cxcalendar_bd .years,
  368. .cxcalendar.range .cxcalendar_hd {
  369. display: flex
  370. }
  371. .cxcalendar.range .cxcalendar_bd ul,
  372. .cxcalendar.range .cxcalendar_hd section {
  373. flex: 1
  374. }
  375. .cxcalendar.range .cxcalendar_bd ul + ul {
  376. margin-left: var(--cxcalendar-gap-out)
  377. }
  378. .cxcalendar.range .cxcalendar_bd ul + ul:before {
  379. content: '';
  380. position: absolute;
  381. top: 0;
  382. bottom: 0;
  383. left: -4px;
  384. width: 1px;
  385. background: linear-gradient(to bottom,rgba(0,0,0,0) 0,rgba(0,0,0,.1) 35%,rgba(0,0,0,.1) 65%,rgba(0,0,0,0) 100%)
  386. }
  387. .cxcalendar.range .cxcalendar_bd ul li.other {
  388. visibility: hidden
  389. }
  390. .cxcalendar.range .cxcalendar_bd ul li.selected {
  391. background-color: var(--cxcalendar-range-bg);
  392. color: var(--cxcalendar-days-color)
  393. }
  394. .cxcalendar.range .cxcalendar_bd ul li.selected.end,
  395. .cxcalendar.range .cxcalendar_bd ul li.selected.start {
  396. background-color: var(--cxcalendar-range-set-bg);
  397. color: var(--cxcalendar-btn-color)
  398. }
  399. .cxcalendar.range .cxcalendar_bd .times section:first-child:before {
  400. content: '开始时间'
  401. }
  402. .cxcalendar.range .cxcalendar_bd .times section:nth-child(2):before {
  403. content: '结束时间'
  404. }
  405. .cxcalendar.fixed {
  406. position: fixed;
  407. top: auto;
  408. bottom: -500px;
  409. left: 0;
  410. right: 0;
  411. width: auto;
  412. border: none;
  413. border-radius: 0;
  414. box-shadow: none;
  415. opacity: 1;
  416. transform: none;
  417. transition-property: bottom
  418. }
  419. .cxcalendar.fixed + .cxcalendar_mask {
  420. display: block;
  421. background-color: rgba(0,0,0,0);
  422. transform: translate(0,-100%);
  423. transition-property: background-color,transform;
  424. transition-duration: .3s,0s;
  425. transition-delay: 0s,0.3s
  426. }
  427. .cxcalendar.fixed.show {
  428. bottom: 0
  429. }
  430. .cxcalendar.fixed.show + .cxcalendar_mask {
  431. background-color: rgba(0,0,0,.4);
  432. transform: translate(0,0);
  433. transition-delay: 0s
  434. }
  435. .cxcalendar.fixed .cxcalendar_bd ul:nth-child(2),
  436. .cxcalendar.fixed .cxcalendar_hd section:nth-child(2) {
  437. display: none
  438. }
  439. .cxcalendar.fixed .cxcalendar_bd .times {
  440. display: block
  441. }
  442. .cxcalendar.fixed .cxcalendar_hd .prev {
  443. left: 24px
  444. }
  445. .cxcalendar.fixed .cxcalendar_hd .next {
  446. right: 24px
  447. }
  448. .cxcalendar.fixed .cxcalendar_bd {
  449. padding-bottom: 20px
  450. }
  451. .cxcalendar.fixed .cxcalendar_bd ul {
  452. line-height: 36px
  453. }
  454. .cxcalendar.fixed .cxcalendar_bd ul li {
  455. height: 40px
  456. }
  457. .cxcalendar.fixed .cxcalendar_bd .times {
  458. padding-top: 10px;
  459. padding-bottom: 10px
  460. }
  461. .cxcalendar.fixed .cxcalendar_acts {
  462. position: absolute;
  463. top: auto;
  464. left: auto;
  465. bottom: 100%;
  466. right: 10px;
  467. width: auto;
  468. padding: 0;
  469. border: none;
  470. background: 0 0;
  471. line-height: 32px;
  472. display: flex
  473. }
  474. .cxcalendar.fixed .cxcalendar_acts a {
  475. border-radius: 3px 3px 0 0
  476. }
  477. .cxcalendar.has_weeknum .cxcalendar_bd .days ul {
  478. padding-left: 24px
  479. }
  480. .cxcalendar.has_weeknum .cxcalendar_bd .days li[data-week-num]:before {
  481. content: attr(data-week-num);
  482. position: absolute;
  483. top: 50%;
  484. left: -16px;
  485. width: 16px;
  486. margin-top: -8px;
  487. margin-left: -8px;
  488. border-radius: 3px;
  489. background-color: rgba(0,0,0,.1);
  490. color: #fff;
  491. font-size: var(--cxcalendar-unit-size);
  492. line-height: 16px;
  493. text-align: center;
  494. pointer-events: none
  495. }
  496. .cxcalendar.not_secs .times .mint + i,
  497. .cxcalendar.not_secs .times .secs {
  498. display: none
  499. }
  500. .cxcalendar.not_acts .cxcalendar_acts {
  501. display: none
  502. }
  503. .cxcalendar.en .cxcalendar_bd .months li:after,
  504. .cxcalendar.en .cxcalendar_bd .years li:after,
  505. .cxcalendar.en .cxcalendar_hd .month + em:after,
  506. .cxcalendar.en .cxcalendar_hd .year + em:after {
  507. content: ''
  508. }
  509. .cxcalendar.en .cxcalendar_bd .times section:before {
  510. content: 'Time:'
  511. }
  512. .cxcalendar.en .cxcalendar_acts .today:before {
  513. content: 'Now'
  514. }
  515. .cxcalendar.en .cxcalendar_acts .clear:before {
  516. content: 'Clear'
  517. }
  518. .cxcalendar.en .cxcalendar_acts .confirm:before {
  519. content: 'Ok'
  520. }
  521. .cxcalendar.en.range .cxcalendar_bd .times section:first-child:before {
  522. content: 'Start Time:'
  523. }
  524. .cxcalendar.en.range .cxcalendar_bd .times section:nth-child(2):before {
  525. content: 'End Time:'
  526. }
  527. @media (prefers-color-scheme:dark) {
  528. .cxcalendar {
  529. --cxcalendar-bg: #222;
  530. --cxcalendar-item-bg: #333;
  531. --cxcalendar-border: #444;
  532. --cxcalendar-text-color: #eee;
  533. --cxcalendar-days-color: #ddd;
  534. --cxcalendar-other-color: #555;
  535. --cxcalendar-note-color: #888;
  536. --cxcalendar-now-bg: #333;
  537. --cxcalendar-set-bg: #8cc152;
  538. --cxcalendar-range-bg: #29485d;
  539. --cxcalendar-range-set-bg: #70a9ce;
  540. --cxcalendar-btn-color: #333;
  541. --cxcalendar-btn-bg: #ccc;
  542. --cxcalendar-confirm-bg: #4a89dc
  543. }
  544. .cxcalendar.range .cxcalendar_bd ul li.selected.end,
  545. .cxcalendar.range .cxcalendar_bd ul li.selected.start,
  546. .cxcalendar_acts .confirm,
  547. .cxcalendar_acts .confirm:hover,
  548. .cxcalendar_bd ul li.selected,
  549. .cxcalendar_bd ul li.selected.holiday,
  550. .cxcalendar_bd ul li.selected.other,
  551. .cxcalendar_bd ul li.selected.sat,
  552. .cxcalendar_bd ul li.selected.sun,
  553. .cxcalendar_bd ul li.selected:hover {
  554. color: #fff
  555. }
  556. .cxcalendar_bd .times:before {
  557. background: linear-gradient(to right,rgba(255,255,255,0) 0,rgba(255,255,255,.1) 15%,rgba(255,255,255,.1) 85%,rgba(255,255,255,0) 100%)
  558. }
  559. .cxcalendar.range .cxcalendar_bd ul + ul:before {
  560. background: linear-gradient(to bottom,rgba(255,255,255,0) 0,rgba(255,255,255,.1) 35%,rgba(255,255,255,.1) 65%,rgba(255,255,255,0) 100%)
  561. }
  562. .cxcalendar.has_weeknum .cxcalendar_bd .days li[data-week-num]:before {
  563. background-color: rgba(255,255,255,.1);
  564. color: #888
  565. }
  566. }
  567. @media (min-width:640px) {
  568. .cxcalendar.fixed .cxcalendar_bd ul:nth-child(2),
  569. .cxcalendar.fixed .cxcalendar_hd section:nth-child(2) {
  570. display: inherit
  571. }
  572. .cxcalendar.fixed .cxcalendar_bd .times {
  573. display: flex
  574. }
  575. }
  576. @media (width:375px) and (height:812px),
  577. (width:414px) and (height:896px),
  578. (width:390px) and (height:844px),
  579. (width:428px) and (height:926px) {
  580. .cxcalendar.fixed .cxcalendar_bd {
  581. padding-bottom: env(safe-area-inset-bottom)
  582. }
  583. }