vue-datepicker.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958
  1. <template>
  2. <div class="cov-vue-date">
  3. <div class="datepickbox">
  4. <input
  5. v-model="date.time"
  6. type="text"
  7. title="input date"
  8. class="cov-datepicker"
  9. :readonly="readonly"
  10. :disabled="readonly"
  11. :placeholder="option.placeholder"
  12. :required="required"
  13. :style="option.inputStyle ? option.inputStyle : {}"
  14. @click="showCheck"
  15. @foucus="showCheck"
  16. />
  17. <span
  18. v-if="readonly != true && readonly != 'true'"
  19. class="glyphicon glyphicon-remove-circle btn-remove"
  20. @click="date.time = ''; $emit('change', '')"
  21. />
  22. </div>
  23. <div
  24. v-if="showInfo.check && readonly != true && readonly != 'true'"
  25. class="datepicker-overlay"
  26. :style="{'background' : option.overlayOpacity? 'rgba(0,0,0,'+option.overlayOpacity+')' : 'rgba(0,0,0,0.5)'}"
  27. @click="dismiss($event)"
  28. >
  29. <div
  30. class="cov-date-body"
  31. :style="{'background-color': option.color ? option.color.header : '#3f51b5'}"
  32. >
  33. <div class="cov-date-monthly">
  34. <div
  35. class="cov-date-previous"
  36. @click="nextMonth('pre')"
  37. >
  38. «
  39. </div>
  40. <div
  41. class="cov-date-caption"
  42. :style="{'color': option.color ? option.color.headerText : '#fff'}"
  43. >
  44. <span @click="showYear"><small>{{ checked.year }}</small></span>
  45. <br />
  46. <span @click="showMonth">{{ displayInfo.month }}</span>
  47. </div>
  48. <div
  49. class="cov-date-next"
  50. @click="nextMonth('next')"
  51. >
  52. »
  53. </div>
  54. </div>
  55. <div
  56. v-if="showInfo.day"
  57. class="cov-date-box"
  58. >
  59. <div class="cov-picker-box">
  60. <div class="week">
  61. <ul>
  62. <li v-for="weekie in library.week" :key="'weekie-' + weekie">{{ weekie }}</li>
  63. </ul>
  64. </div>
  65. <div
  66. v-for="day in dayList"
  67. :key="'day-' + day"
  68. class="day"
  69. track-by="$index"
  70. :class="{'checked':day.checked,'unavailable':day.unavailable,'passive-day': !(day.inMonth)}"
  71. :style="day.checked ?
  72. (option.color && option.color.checkedDay ? { background: option.color.checkedDay } : { background: '#F50057' }) : {}"
  73. @click="checkDay(day)"
  74. >
  75. {{ day.value }}
  76. </div>
  77. </div>
  78. </div>
  79. <div
  80. v-if="showInfo.year"
  81. class="cov-date-box list-box"
  82. >
  83. <div
  84. id="yearList"
  85. class="cov-picker-box date-list"
  86. >
  87. <div
  88. v-for="yearItem in library.year"
  89. :key="'year-' + yearItem"
  90. class="date-item"
  91. track-by="$index"
  92. @click="setYear(yearItem)"
  93. >
  94. {{ yearItem }}
  95. </div>
  96. </div>
  97. </div>
  98. <div
  99. v-if="showInfo.month"
  100. class="cov-date-box list-box"
  101. >
  102. <div class="cov-picker-box date-list">
  103. <div
  104. v-for="monthItem in library.month"
  105. :key="'month-' + monthItem"
  106. class="date-item"
  107. track-by="$index"
  108. @click="setMonth(monthItem)"
  109. >
  110. {{ monthItem }}
  111. </div>
  112. </div>
  113. </div>
  114. <div
  115. v-if="showInfo.hour"
  116. class="cov-date-box list-box"
  117. >
  118. <div class="cov-picker-box date-list">
  119. <div class="watch-box">
  120. <div class="hour-box">
  121. <div class="mui-pciker-rule mui-pciker-rule-ft" />
  122. <ul>
  123. <li
  124. v-for="hitem in hours"
  125. :key="'hour-' + hitem"
  126. class="hour-item"
  127. :class="{'active':hitem.checked}"
  128. @click="setTime('hour', hitem, hours)"
  129. >
  130. {{ hitem.value }}
  131. </li>
  132. </ul>
  133. </div>
  134. <div class="min-box">
  135. <div class="mui-pciker-rule mui-pciker-rule-ft" />
  136. <div
  137. v-for="mitem in mins"
  138. :key="'min-' + mitem"
  139. class="min-item"
  140. :class="{'active':mitem.checked}"
  141. @click="setTime('min',mitem, mins)"
  142. >
  143. {{ mitem.value }}
  144. </div>
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. <div class="button-box">
  150. <span @click="showInfo.check=false">{{ option.buttons? option.buttons.cancel : 'Cancel' }}</span>
  151. <span @click="picked">{{ option.buttons? option.buttons.ok : 'Ok' }}</span>
  152. </div>
  153. </div>
  154. </div>
  155. </div>
  156. </template>
  157. <script>
  158. 'use strict';
  159. Object.defineProperty(exports, '__esModule', {
  160. value: true,
  161. });
  162. var _moment = require('moment');
  163. var _moment2 = _interopRequireDefault(_moment);
  164. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  165. exports.default = {
  166. name: 'vue-datepicker',
  167. props: {
  168. required: false,
  169. date: {
  170. type: Object,
  171. required: true,
  172. },
  173. readonly: {
  174. type: Boolean,
  175. default: false,
  176. },
  177. option: {
  178. type: Object,
  179. default: function _default() {
  180. return {
  181. type: 'day',
  182. SundayFirst: false,
  183. week: ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'],
  184. month: ['January', 'February', 'March', 'April', 'May'
  185. , 'June', 'July', 'August', 'September', 'October'
  186. , 'November', 'December'],
  187. format: 'YYYY-MM-DD',
  188. color: {
  189. checked: '#F50057',
  190. header: '#3f51b5',
  191. headerText: '#fff',
  192. },
  193. inputStyle: {
  194. 'display': 'inline-block',
  195. 'padding': '6px',
  196. 'line-height': '22px',
  197. 'font-size': '16px',
  198. 'border': '2px solid #fff',
  199. 'box-shadow': '0 1px 3px 0 rgba(0, 0, 0, 0.2)',
  200. 'border-radius': '2px',
  201. 'color': '#5F5F5F',
  202. },
  203. placeholder: 'when?',
  204. buttons: {
  205. ok: 'OK',
  206. cancel: 'Cancel',
  207. },
  208. overlayOpacity: 0.5,
  209. dismissible: true,
  210. };
  211. },
  212. },
  213. limit: {
  214. type: Array,
  215. default: function _default() {
  216. return [];
  217. },
  218. },
  219. },
  220. data: function data() {
  221. function hours() {
  222. var list = [];
  223. var hour = 24;
  224. while (hour > 0) {
  225. hour--;
  226. list.push({
  227. checked: false,
  228. value: hour < 10 ? '0' + hour : hour,
  229. });
  230. }
  231. return list;
  232. }
  233. function mins() {
  234. var list = [];
  235. var min = 60;
  236. while (min > 0) {
  237. min--;
  238. list.push({
  239. checked: false,
  240. value: min < 10 ? '0' + min : min,
  241. });
  242. }
  243. return list;
  244. }
  245. return {
  246. hours: hours(),
  247. mins: mins(),
  248. showInfo: {
  249. hour: false,
  250. day: false,
  251. month: false,
  252. year: false,
  253. check: false,
  254. },
  255. displayInfo: {
  256. month: '',
  257. },
  258. library: {
  259. week: this.option.week,
  260. month: this.option.month,
  261. year: [],
  262. },
  263. checked: {
  264. oldtime: '',
  265. currentMoment: null,
  266. year: '',
  267. month: '',
  268. day: '',
  269. hour: '00',
  270. min: '00',
  271. },
  272. dayList: [],
  273. selectedDays: [],
  274. };
  275. },
  276. methods: {
  277. pad: function pad(n) {
  278. n = Math.floor(n);
  279. return n < 10 ? '0' + n : n;
  280. },
  281. nextMonth: function nextMonth(type) {
  282. var next = null;
  283. type === 'next'
  284. ? next = (0, _moment2.default)(this.checked.currentMoment).add(1, 'M')
  285. : next = (0, _moment2.default)(this.checked.currentMoment).add(-1, 'M');
  286. this.showDay(next);
  287. },
  288. showDay: function showDay(time) {
  289. if (time === undefined || !Date.parse(time)) {
  290. this.checked.currentMoment = (0, _moment2.default)();
  291. } else {
  292. this.checked.currentMoment = (0, _moment2.default)(time, this.option.format);
  293. }
  294. this.showOne('day');
  295. this.checked.year = (0, _moment2.default)(this.checked.currentMoment).format('YYYY');
  296. this.checked.month = (0, _moment2.default)(this.checked.currentMoment).format('MM');
  297. this.checked.day = (0, _moment2.default)(this.checked.currentMoment).format('DD');
  298. this.displayInfo.month = this.library.month[(0, _moment2.default)(this.checked.currentMoment).month()];
  299. var days = [];
  300. var currentMoment = this.checked.currentMoment;
  301. var firstDay = (0, _moment2.default)(currentMoment).date(1).day();
  302. // gettting previous and next month
  303. // let currentMonth = moment(currentMoment)
  304. var previousMonth = (0, _moment2.default)(currentMoment);
  305. var nextMonth = (0, _moment2.default)(currentMoment);
  306. nextMonth.add(1, 'months');
  307. previousMonth.subtract(1, 'months');
  308. var monthDays = (0, _moment2.default)(currentMoment).daysInMonth();
  309. var oldtime = this.checked.oldtime;
  310. for (var i = 1; i <= monthDays; ++i) {
  311. days.push({
  312. value: i,
  313. inMonth: true,
  314. unavailable: false,
  315. checked: false,
  316. moment: (0, _moment2.default)(currentMoment).date(i),
  317. });
  318. if (i === Math.ceil((0, _moment2.default)(currentMoment).format('D'))
  319. && (0, _moment2.default)(oldtime, this.option.format).year() === (0, _moment2.default)(currentMoment).year()
  320. && (0, _moment2.default)(oldtime, this.option.format).month() === (0, _moment2.default)(currentMoment).month()) {
  321. days[i - 1].checked = true;
  322. }
  323. this.checkBySelectDays(i, days);
  324. }
  325. if (firstDay === 0) firstDay = 7;
  326. for (var _i = 0; _i < firstDay - (this.option.SundayFirst ? 0 : 1); _i++) {
  327. var passiveDay = {
  328. value: previousMonth.daysInMonth() - _i,
  329. inMonth: false,
  330. action: 'previous',
  331. unavailable: false,
  332. checked: false,
  333. moment: (0, _moment2.default)(currentMoment).date(1).subtract(_i + 1, 'days'),
  334. };
  335. days.unshift(passiveDay);
  336. }
  337. if (this.limit.length > 0) {
  338. var _iteratorNormalCompletion = true;
  339. var _didIteratorError = false;
  340. var _iteratorError = undefined;
  341. try {
  342. for (var _iterator = this.limit[Symbol.iterator](), _step;
  343. !(_iteratorNormalCompletion = (_step = _iterator.next()).done);
  344. _iteratorNormalCompletion = true) {
  345. var li = _step.value;
  346. switch (li.type) {
  347. case 'fromto':
  348. days = this.limitFromTo(li, days);
  349. break;
  350. case 'weekday':
  351. days = this.limitWeekDay(li, days);
  352. break;
  353. }
  354. }
  355. } catch (err) {
  356. _didIteratorError = true;
  357. _iteratorError = err;
  358. } finally {
  359. try {
  360. if (!_iteratorNormalCompletion && _iterator.return) {
  361. _iterator.return();
  362. }
  363. } finally {
  364. if (_didIteratorError) {
  365. // eslint-disable-next-line
  366. throw _iteratorError;
  367. }
  368. }
  369. }
  370. }
  371. var passiveDaysAtFinal = 42 - days.length;
  372. for (var _i2 = 1; _i2 <= passiveDaysAtFinal; _i2++) {
  373. var _passiveDay = {
  374. value: _i2,
  375. inMonth: false,
  376. action: 'next',
  377. unavailable: false,
  378. checked: false,
  379. moment: (0, _moment2.default)(currentMoment).add(1, 'months').date(_i2),
  380. };
  381. days.push(_passiveDay);
  382. }
  383. this.dayList = days;
  384. },
  385. checkBySelectDays: function checkBySelectDays(d, days) {
  386. var _this = this;
  387. this.selectedDays.forEach(function (day) {
  388. if (_this.checked.year ===
  389. (0, _moment2.default)(day).format('YYYY') && _this.checked.month === (0, _moment2.default)(day).format('MM') && d === Math.ceil((0, _moment2.default)(day).format('D'))) {
  390. days[d - 1].checked = true;
  391. }
  392. });
  393. },
  394. limitWeekDay: function limitWeekDay(limit, days) {
  395. days.map(function (day) {
  396. if (limit.available.indexOf(Math.floor(day.moment.format('d'))) === -1) {
  397. day.unavailable = true;
  398. }
  399. });
  400. return days;
  401. },
  402. limitFromTo: function limitFromTo(limit, days) {
  403. var _this2 = this;
  404. if (limit.from || limit.to) {
  405. days.map(function (day) {
  406. if (_this2.getLimitCondition(limit, day)) {
  407. day.unavailable = true;
  408. }
  409. });
  410. }
  411. return days;
  412. },
  413. getLimitCondition: function getLimitCondition(limit, day) {
  414. var tmpMoment = (0, _moment2.default)(this.checked.year + '-' + this.pad(this.checked.month) + '-' + this.pad(day.value));
  415. if (limit.from && !limit.to) {
  416. return !tmpMoment.isAfter(limit.from);
  417. } else if (!limit.from && limit.to) {
  418. return !tmpMoment.isBefore(limit.to);
  419. } else {
  420. return !tmpMoment.isBetween(limit.from, limit.to);
  421. }
  422. },
  423. checkDay: function checkDay(obj) {
  424. if (obj.unavailable || obj.value === '') {
  425. return false;
  426. }
  427. if (!obj.inMonth) {
  428. this.nextMonth(obj.action);
  429. }
  430. if (this.option.type === 'day' || this.option.type === 'min') {
  431. this.dayList.forEach(function (x) {
  432. x.checked = false;
  433. });
  434. this.checked.day = this.pad(obj.value);
  435. obj.checked = true;
  436. } else {
  437. var day = this.pad(obj.value);
  438. var ctime = this.checked.year + '-' + this.checked.month + '-' + day;
  439. if (obj.checked === true) {
  440. obj.checked = false;
  441. this.selectedDays.$remove(ctime);
  442. } else {
  443. this.selectedDays.push(ctime);
  444. obj.checked = true;
  445. }
  446. }
  447. switch (this.option.type) {
  448. case 'day':
  449. this.picked();
  450. break;
  451. case 'min':
  452. this.showOne('hour');
  453. // shift activated time items to visible position.
  454. this.shiftActTime();
  455. break;
  456. }
  457. },
  458. showYear: function showYear() {
  459. var _this3 = this;
  460. var year = (0, _moment2.default)(this.checked.currentMoment).year();
  461. this.library.year = [];
  462. var yearTmp = [];
  463. for (var i = year - 100; i < year + 5; ++i) {
  464. yearTmp.push(i);
  465. }
  466. this.library.year = yearTmp;
  467. this.showOne('year');
  468. this.$nextTick(function () {
  469. var listDom = document.getElementById('yearList');
  470. listDom.scrollTop = listDom.scrollHeight - 100;
  471. _this3.addYear();
  472. });
  473. },
  474. showOne: function showOne(type) {
  475. switch (type) {
  476. case 'year':
  477. this.showInfo.hour = false;
  478. this.showInfo.day = false;
  479. this.showInfo.year = true;
  480. this.showInfo.month = false;
  481. break;
  482. case 'month':
  483. this.showInfo.hour = false;
  484. this.showInfo.day = false;
  485. this.showInfo.year = false;
  486. this.showInfo.month = true;
  487. break;
  488. case 'day':
  489. this.showInfo.hour = false;
  490. this.showInfo.day = true;
  491. this.showInfo.year = false;
  492. this.showInfo.month = false;
  493. break;
  494. case 'hour':
  495. this.showInfo.hour = true;
  496. this.showInfo.day = false;
  497. this.showInfo.year = false;
  498. this.showInfo.month = false;
  499. break;
  500. default:
  501. this.showInfo.day = true;
  502. this.showInfo.year = false;
  503. this.showInfo.month = false;
  504. this.showInfo.hour = false;
  505. }
  506. },
  507. showMonth: function showMonth() {
  508. this.showOne('month');
  509. },
  510. addYear: function addYear() {
  511. var _this4 = this;
  512. var listDom = document.getElementById('yearList');
  513. // eslint-disable-next-line
  514. listDom.addEventListener('scroll', function (e) {
  515. if (listDom.scrollTop < listDom.scrollHeight - 100) {
  516. var len = _this4.library.year.length;
  517. var lastYear = _this4.library.year[len - 1];
  518. _this4.library.year.push(lastYear + 1);
  519. }
  520. }, false);
  521. },
  522. setYear: function setYear(year) {
  523. this.checked.currentMoment = (0, _moment2.default)(year + '-' + this.checked.month + '-' + this.checked.day);
  524. this.showDay(this.checked.currentMoment);
  525. },
  526. setMonth: function setMonth(month) {
  527. var mo = this.library.month.indexOf(month) + 1;
  528. if (mo < 10) {
  529. mo = '0' + '' + mo;
  530. }
  531. this.checked.currentMoment = (0, _moment2.default)(this.checked.year + '-' + mo + '-' + this.checked.day);
  532. this.showDay(this.checked.currentMoment);
  533. },
  534. showCheck: function showCheck() {
  535. if (this.date.time === '') {
  536. this.showDay();
  537. } else {
  538. if (this.option.type === 'day' || this.option.type === 'min') {
  539. this.checked.oldtime = this.date.time;
  540. this.showDay(this.date.time);
  541. } else {
  542. this.selectedDays = JSON.parse(this.date.time);
  543. if (this.selectedDays.length) {
  544. this.checked.oldtime = this.selectedDays[0];
  545. this.showDay(this.selectedDays[0]);
  546. } else {
  547. this.showDay();
  548. }
  549. }
  550. }
  551. this.showInfo.check = true;
  552. },
  553. setTime: function setTime(type, obj, list) {
  554. var _iteratorNormalCompletion2 = true;
  555. var _didIteratorError2 = false;
  556. var _iteratorError2 = undefined;
  557. try {
  558. for (var _iterator2 = list[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
  559. var item = _step2.value;
  560. item.checked = false;
  561. if (item.value === obj.value) {
  562. item.checked = true;
  563. this.checked[type] = item.value;
  564. }
  565. }
  566. } catch (err) {
  567. _didIteratorError2 = true;
  568. _iteratorError2 = err;
  569. } finally {
  570. try {
  571. if (!_iteratorNormalCompletion2 && _iterator2.return) {
  572. _iterator2.return();
  573. }
  574. } finally {
  575. if (_didIteratorError2) {
  576. // eslint-disable-next-line
  577. throw _iteratorError2;
  578. }
  579. }
  580. }
  581. },
  582. picked: function picked() {
  583. if (this.option.type === 'day' || this.option.type === 'min') {
  584. var ctime = this.checked.year + '-' + this.checked.month + '-' + this.checked.day + ' ' + this.checked.hour + ':' + this.checked.min;
  585. this.checked.currentMoment = (0, _moment2.default)(ctime, 'YYYY-MM-DD HH:mm');
  586. this.date.time = (0, _moment2.default)(this.checked.currentMoment).format(this.option.format);
  587. } else {
  588. this.date.time = JSON.stringify(this.selectedDays);
  589. }
  590. this.showInfo.check = false;
  591. this.$emit('change', this.date.time);
  592. },
  593. dismiss: function dismiss(evt) {
  594. if (evt.target.className === 'datepicker-overlay') {
  595. if (this.option.dismissible === undefined || this.option.dismissible) {
  596. this.showInfo.check = false;
  597. this.$emit('cancel');
  598. }
  599. }
  600. },
  601. shiftActTime: function shiftActTime() {
  602. // shift activated time items to visible position.
  603. this.$nextTick(function () {
  604. if (!document.querySelector('.hour-item.active')) {
  605. return false;
  606. }
  607. document.querySelector('.hour-box').scrollTop = (document.querySelector('.hour-item.active').offsetTop || 0) - 250;
  608. document.querySelector('.min-box').scrollTop = (document.querySelector('.min-item.active').offsetTop || 0) - 250;
  609. });
  610. },
  611. },
  612. };
  613. </script>
  614. <style scoped>
  615. .datepicker-overlay {
  616. position: fixed;
  617. width: 100%;
  618. height: 100%;
  619. z-index: 998;
  620. top: 0;
  621. left: 0;
  622. overflow: hidden;
  623. -webkit-animation: fadein 0.5s;
  624. /* Safari, Chrome and Opera > 12.1 */
  625. -moz-animation: fadein 0.5s;
  626. /* Firefox < 16 */
  627. -ms-animation: fadein 0.5s;
  628. /* Internet Explorer */
  629. -o-animation: fadein 0.5s;
  630. /* Opera < 12.1 */
  631. animation: fadein 0.5s;
  632. }
  633. @keyframes fadein {
  634. from {
  635. opacity: 0;
  636. }
  637. to {
  638. opacity: 1;
  639. }
  640. }
  641. /* Firefox < 16 */
  642. @-moz-keyframes fadein {
  643. from {
  644. opacity: 0;
  645. }
  646. to {
  647. opacity: 1;
  648. }
  649. }
  650. /* Safari, Chrome and Opera > 12.1 */
  651. @-webkit-keyframes fadein {
  652. from {
  653. opacity: 0;
  654. }
  655. to {
  656. opacity: 1;
  657. }
  658. }
  659. /* Internet Explorer */
  660. @-ms-keyframes fadein {
  661. from {
  662. opacity: 0;
  663. }
  664. to {
  665. opacity: 1;
  666. }
  667. }
  668. /* Opera < 12.1 */
  669. @-o-keyframes fadein {
  670. from {
  671. opacity: 0;
  672. }
  673. to {
  674. opacity: 1;
  675. }
  676. }
  677. .cov-date-body {
  678. display: inline-block;
  679. background: #3f51b5;
  680. overflow: hidden;
  681. position: relative;
  682. font-size: 16px;
  683. font-family: "Roboto";
  684. font-weight: 400;
  685. position: fixed;
  686. display: block;
  687. width: 400px;
  688. max-width: 100%;
  689. z-index: 999;
  690. top: 50%;
  691. left: 50%;
  692. -webkit-transform: translate(-50%, -50%);
  693. -ms-transform: translate(-50%, -50%);
  694. transform: translate(-50%, -50%);
  695. box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2);
  696. }
  697. .cov-picker-box {
  698. background: #fff;
  699. width: 100%;
  700. display: inline-block;
  701. padding: 25px;
  702. box-sizing: border-box !important;
  703. -moz-box-sizing: border-box !important;
  704. -webkit-box-sizing: border-box !important;
  705. -ms-box-sizing: border-box !important;
  706. width: 400px;
  707. max-width: 100%;
  708. height: 280px;
  709. text-align: start !important;
  710. }
  711. .cov-picker-box td {
  712. height: 34px;
  713. width: 34px;
  714. padding: 0;
  715. line-height: 34px;
  716. color: #000;
  717. background: #fff;
  718. text-align: center;
  719. cursor: pointer;
  720. }
  721. .cov-picker-box td:hover {
  722. background: #e6e6e6;
  723. }
  724. table {
  725. border-collapse: collapse;
  726. border-spacing: 0;
  727. width: 100%;
  728. }
  729. .day {
  730. width: 14.2857143%;
  731. display: inline-block;
  732. text-align: center;
  733. cursor: pointer;
  734. height: 34px;
  735. padding: 0;
  736. line-height: 34px;
  737. color: #000;
  738. background: #fff;
  739. vertical-align: middle;
  740. }
  741. .week ul {
  742. margin: 0 0 8px;
  743. padding: 0;
  744. list-style: none;
  745. }
  746. .week ul li {
  747. width: 14.2%;
  748. display: inline-block;
  749. text-align: center;
  750. background: transparent;
  751. color: #000;
  752. font-weight: bold;
  753. }
  754. .passive-day {
  755. color: #bbb;
  756. }
  757. .checked {
  758. background: #f50057;
  759. color: #fff !important;
  760. border-radius: 3px;
  761. }
  762. .unavailable {
  763. color: #ccc;
  764. cursor: not-allowed;
  765. }
  766. .cov-date-monthly {
  767. height: 150px;
  768. }
  769. .cov-date-monthly > div {
  770. display: inline-block;
  771. padding: 0;
  772. margin: 0;
  773. vertical-align: middle;
  774. color: #fff;
  775. height: 150px;
  776. float: left;
  777. text-align: center;
  778. cursor: pointer;
  779. }
  780. .cov-date-previous,
  781. .cov-date-next {
  782. position: relative;
  783. width: 20% !important;
  784. text-indent: -300px;
  785. overflow: hidden;
  786. color: #fff;
  787. }
  788. .cov-date-caption {
  789. width: 60%;
  790. padding: 50px 0 !important;
  791. box-sizing: border-box;
  792. font-size: 24px;
  793. }
  794. .cov-date-caption span:hover {
  795. color: rgba(255, 255, 255, 0.7);
  796. }
  797. .cov-date-previous:hover,
  798. .cov-date-next:hover {
  799. background: rgba(255, 255, 255, 0.1);
  800. }
  801. .day:hover {
  802. background: #eaeaea;
  803. }
  804. .unavailable:hover {
  805. background: none;
  806. }
  807. .checked:hover {
  808. background: #ff4f8e;
  809. }
  810. .cov-date-next::before,
  811. .cov-date-previous::before {
  812. width: 20px;
  813. height: 2px;
  814. text-align: center;
  815. position: absolute;
  816. background: #fff;
  817. top: 50%;
  818. margin-top: -7px;
  819. margin-left: -7px;
  820. left: 50%;
  821. line-height: 0;
  822. content: "";
  823. -webkit-transform: rotate(45deg);
  824. -moz-transform: rotate(45deg);
  825. transform: rotate(45deg);
  826. }
  827. .cov-date-next::after,
  828. .cov-date-previous::after {
  829. width: 20px;
  830. height: 2px;
  831. text-align: center;
  832. position: absolute;
  833. background: #fff;
  834. margin-top: 6px;
  835. margin-left: -7px;
  836. top: 50%;
  837. left: 50%;
  838. line-height: 0;
  839. content: "";
  840. -webkit-transform: rotate(-45deg);
  841. -moz-transform: rotate(-45deg);
  842. transform: rotate(-45deg);
  843. }
  844. .cov-date-previous::after {
  845. -webkit-transform: rotate(45deg);
  846. -moz-transform: rotate(45deg);
  847. transform: rotate(45deg);
  848. }
  849. .cov-date-previous::before {
  850. -webkit-transform: rotate(-45deg);
  851. -moz-transform: rotate(-45deg);
  852. transform: rotate(-45deg);
  853. }
  854. .date-item {
  855. text-align: center;
  856. font-size: 20px;
  857. padding: 10px 0;
  858. cursor: pointer;
  859. }
  860. .date-item:hover {
  861. background: #e0e0e0;
  862. }
  863. .date-list {
  864. overflow: auto;
  865. vertical-align: top;
  866. padding: 0;
  867. }
  868. .cov-vue-date {
  869. display: inline-block;
  870. color: #5d5d5d;
  871. }
  872. .button-box {
  873. background: #fff;
  874. vertical-align: top;
  875. height: 50px;
  876. line-height: 50px;
  877. text-align: right;
  878. padding-right: 20px;
  879. }
  880. .button-box span {
  881. cursor: pointer;
  882. padding: 10px 20px;
  883. }
  884. .watch-box {
  885. height: 100%;
  886. overflow: hidden;
  887. }
  888. .hour-box,
  889. .min-box {
  890. display: inline-block;
  891. width: 50%;
  892. text-align: center;
  893. height: 100%;
  894. overflow: auto;
  895. float: left;
  896. }
  897. .hour-box ul,
  898. .min-box ul {
  899. list-style: none;
  900. margin: 0;
  901. padding: 0;
  902. }
  903. .hour-item,
  904. .min-item {
  905. padding: 10px;
  906. font-size: 36px;
  907. cursor: pointer;
  908. }
  909. .hour-item:hover,
  910. .min-item:hover {
  911. background: #e3e3e3;
  912. }
  913. .hour-box .active,
  914. .min-box .active {
  915. background: #f50057;
  916. color: #fff !important;
  917. }
  918. ::-webkit-scrollbar {
  919. width: 2px;
  920. }
  921. ::-webkit-scrollbar-track {
  922. background: #e3e3e3;
  923. }
  924. ::-webkit-scrollbar-thumb {
  925. background: #c1c1c1;
  926. border-radius: 2px;
  927. }
  928. .btn-remove {
  929. float: right;
  930. top: -33px;
  931. right: 1px;
  932. position: relative;
  933. cursor: pointer;
  934. padding: 9px;
  935. }
  936. .cov-datepicker[disabled] {
  937. cursor: not-allowed;
  938. background-color: #eee !important;
  939. opacity: 1;
  940. }
  941. </style>