matrialcalendar.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <style>
  2. .dayparts {
  3. width: 750px;
  4. }
  5. .dayparts table {
  6. width: 100%;
  7. }
  8. .dayparts td {
  9. cursor: pointer;
  10. width: 26px;
  11. height: 26px;
  12. border: 1px solid #ccc;
  13. }
  14. .dayparts th {
  15. font-weight: normal;
  16. }
  17. .dayparts td, .dayparts th {
  18. -webkit-touch-callout: none;
  19. -webkit-user-select: none;
  20. -khtml-user-select: none;
  21. -moz-user-select: none;
  22. -ms-user-select: none;
  23. user-select: none;
  24. padding: 0;
  25. }
  26. .dayparts tr:first-child th {
  27. text-align: left;
  28. text-indent: -4px;
  29. }
  30. .dayparts tr:not(:first-child) th {
  31. text-align: right;
  32. padding-right: 5px;
  33. }
  34. .dayparts .selected {
  35. background: #1e4163;
  36. color: white;
  37. }
  38. .dayparts button {
  39. margin-top: 10px;
  40. float: right;
  41. cursor: pointer;
  42. margin-right: 25px;
  43. }
  44. .dayparts a {
  45. cursor: pointer;
  46. }
  47. .dayparts a:hover {
  48. color: #333333;
  49. }
  50. .flex-size {
  51. -webkit-flex: 1;
  52. flex: 1;
  53. }
  54. .calendar-md {
  55. display: -webkit-flex;
  56. display: flex;
  57. flex-direction:column;
  58. margin: 0;
  59. width: 100%;
  60. min-height: 100%;
  61. height: 100%;
  62. }
  63. .calendar-md .subheader {
  64. background: rgba(0, 0, 0, 0.02);
  65. border: 1px solid rgba(0, 0, 0, 0.12);
  66. margin-right: 0;
  67. min-height: 36px;
  68. }
  69. .layout-row {
  70. display: inherit;
  71. flex-direction:row;
  72. }
  73. .layout-padding {
  74. padding: 8px;
  75. flex:1;
  76. }
  77. .layout-height{
  78. display: inherit;
  79. flex:1;
  80. align-content:center;
  81. }
  82. .subheader-day {
  83. min-width: 48px;
  84. }
  85. .weekday{
  86. border: 1px solid rgba(0, 0, 0, 0.12);
  87. cursor: pointer;
  88. }
  89. .flex {
  90. -webkit-flex:1;
  91. flex:1;
  92. box-sizing:border-box;
  93. }
  94. angular-dayparts .calendar-md .layout-row.entity .weekday:hover {
  95. background: rgba(17, 110, 191, 0.75);
  96. }
  97. angular-dayparts .calendar-md .layout-row.entity *:disabled {
  98. color: rgba(0, 0, 0, 0.3);
  99. pointer-events: none;
  100. cursor: auto;
  101. }
  102. angular-dayparts .calendar-md .layout-row.entity .weekday.active {
  103. box-shadow: 5px 5px 3px 0px rgba(0,0,0,0.75);
  104. background: rgba(17, 110, 191, 0.75);
  105. }
  106. </style>
  107. <!-- <script>
  108. angular.module('app', ['angular-dayparts']).controller('main', function($scope){
  109. $scope.options = {
  110. reset: true,
  111. onChange: function(selected) {
  112. console.log('selected', selected);
  113. },
  114. selected: []
  115. };
  116. });
  117. </script> -->
  118. <md-content id="calendar-demo" ng-controller="calendarCtrl" layout="column" layout-fill>
  119. <div class="input-group" style="padding: 10px;">
  120. <label class="btn btn-primary" ng-model="calendarView" btn-radio="'month'">
  121. <span translate="calendar.MONTH">Month</span>
  122. </label>
  123. <label class="btn btn-primary" ng-model="calendarView" btn-radio="'week'">
  124. <span translate="calendar.WEEK">Week</span>
  125. </label>
  126. </div>
  127. <div ng-if="calendarView=='week'" ng-model="options.selected">
  128. <angular-dayparts options="options"></angular-dayparts>
  129. </div>
  130. <div ng-if="calendarView=='month'">
  131. <calendar-md flex layout layout-fill
  132. calendar-direction="direction"
  133. on-prev-month="prevMonth"
  134. on-next-month="nextMonth"
  135. on-day-click="dayClick"
  136. title-format="'MMMM y'"
  137. ng-model='selectedDate'
  138. day-format="'d'"
  139. day-label-format="'EEE'"
  140. day-label-tooltip-format="'EEEE'"
  141. day-tooltip-format="'fullDate'"
  142. week-starts-on="firstDayOfWeek"
  143. day-content="setDayContent"></calendar-md>
  144. </div>
  145. <div class="panel-footer " ng-if="calendarView=='week'">
  146. <a ng-click="saveweek(options.selected);" class="btn btn-primary liveright">保存</a>
  147. </div>
  148. </div>