@kengic/uni 0.5.1 → 0.5.2-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/uni/uni-ui/uni-badge/uni-badge.vue +222 -219
  2. package/dist/uni/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +29 -29
  3. package/dist/uni/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +88 -88
  4. package/dist/uni/uni-ui/uni-calendar/calendar.js +936 -532
  5. package/dist/uni/uni-ui/uni-calendar/i18n/en.json +10 -10
  6. package/dist/uni/uni-ui/uni-calendar/i18n/index.js +8 -7
  7. package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hans.json +10 -10
  8. package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hant.json +10 -10
  9. package/dist/uni/uni-ui/uni-calendar/uni-calendar-item.vue +190 -168
  10. package/dist/uni/uni-ui/uni-calendar/uni-calendar.vue +459 -459
  11. package/dist/uni/uni-ui/uni-calendar/util.js +324 -340
  12. package/dist/uni/uni-ui/uni-card/uni-card.vue +8 -1
  13. package/dist/uni/uni-ui/uni-col/uni-col.vue +294 -287
  14. package/dist/uni/uni-ui/uni-collapse/uni-collapse.vue +139 -140
  15. package/dist/uni/uni-ui/uni-collapse-item/uni-collapse-item.vue +381 -378
  16. package/dist/uni/uni-ui/uni-combox/uni-combox.vue +280 -272
  17. package/dist/uni/uni-ui/uni-countdown/i18n/en.json +4 -4
  18. package/dist/uni/uni-ui/uni-countdown/i18n/index.js +8 -7
  19. package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hans.json +4 -4
  20. package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hant.json +4 -4
  21. package/dist/uni/uni-ui/uni-countdown/uni-countdown.vue +249 -257
  22. package/dist/uni/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +832 -813
  23. package/dist/uni/uni-ui/uni-data-picker/keypress.js +42 -42
  24. package/dist/uni/uni-ui/uni-data-picker/uni-data-picker.vue +535 -516
  25. package/dist/uni/uni-ui/uni-data-pickerview/uni-data-picker.js +623 -618
  26. package/dist/uni/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +293 -288
  27. package/dist/uni/uni-ui/uni-data-select/uni-data-select.vue +495 -509
  28. package/dist/uni/uni-ui/uni-dateformat/date-format.js +181 -184
  29. package/dist/uni/uni-ui/uni-dateformat/uni-dateformat.vue +81 -82
  30. package/dist/uni/uni-ui/uni-datetime-picker/calendar-item.vue +176 -170
  31. package/dist/uni/uni-ui/uni-datetime-picker/calendar.vue +926 -920
  32. package/dist/uni/uni-ui/uni-datetime-picker/i18n/en.json +20 -20
  33. package/dist/uni/uni-ui/uni-datetime-picker/i18n/index.js +8 -7
  34. package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +21 -21
  35. package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +21 -21
  36. package/dist/uni/uni-ui/uni-datetime-picker/time-picker.vue +921 -926
  37. package/dist/uni/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1059 -1012
  38. package/dist/uni/uni-ui/uni-datetime-picker/util.js +366 -377
  39. package/dist/uni/uni-ui/uni-drawer/keypress.js +42 -42
  40. package/dist/uni/uni-ui/uni-drawer/uni-drawer.vue +176 -167
  41. package/dist/uni/uni-ui/uni-easyinput/common.js +40 -42
  42. package/dist/uni/uni-ui/uni-easyinput/uni-easyinput.vue +628 -547
  43. package/dist/uni/uni-ui/uni-fab/uni-fab.vue +507 -483
  44. package/dist/uni/uni-ui/uni-fav/i18n/en.json +2 -2
  45. package/dist/uni/uni-ui/uni-fav/i18n/index.js +8 -7
  46. package/dist/uni/uni-ui/uni-fav/i18n/zh-Hans.json +2 -2
  47. package/dist/uni/uni-ui/uni-fav/i18n/zh-Hant.json +2 -2
  48. package/dist/uni/uni-ui/uni-fav/uni-fav.vue +155 -147
  49. package/dist/uni/uni-ui/uni-file-picker/choose-and-upload-file.js +172 -198
  50. package/dist/uni/uni-ui/uni-file-picker/uni-file-picker.vue +636 -634
  51. package/dist/uni/uni-ui/uni-file-picker/upload-file.vue +294 -293
  52. package/dist/uni/uni-ui/uni-file-picker/upload-image.vue +267 -270
  53. package/dist/uni/uni-ui/uni-file-picker/utils.js +81 -82
  54. package/dist/uni/uni-ui/uni-forms/uni-forms.vue +360 -372
  55. package/dist/uni/uni-ui/uni-forms/utils.js +170 -174
  56. package/dist/uni/uni-ui/uni-forms/validate.js +447 -456
  57. package/dist/uni/uni-ui/uni-forms-item/uni-forms-item.vue +497 -497
  58. package/dist/uni/uni-ui/uni-goods-nav/i18n/en.json +4 -4
  59. package/dist/uni/uni-ui/uni-goods-nav/i18n/index.js +8 -7
  60. package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hans.json +4 -4
  61. package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hant.json +4 -4
  62. package/dist/uni/uni-ui/uni-goods-nav/uni-goods-nav.vue +238 -222
  63. package/dist/uni/uni-ui/uni-grid/uni-grid.vue +134 -134
  64. package/dist/uni/uni-ui/uni-grid-item/uni-grid-item.vue +121 -119
  65. package/dist/uni/uni-ui/uni-group/uni-group.vue +121 -121
  66. package/dist/uni/uni-ui/uni-icons/icons.js +1170 -1168
  67. package/dist/uni/uni-ui/uni-icons/uni-icons.vue +91 -86
  68. package/dist/uni/uni-ui/uni-icons/uniicons.css +166 -166
  69. package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +129 -129
  70. package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list.vue +352 -347
  71. package/dist/uni/uni-ui/uni-link/uni-link.vue +134 -119
  72. package/dist/uni/uni-ui/uni-list/uni-list.vue +119 -110
  73. package/dist/uni/uni-ui/uni-list/uni-refresh.vue +14 -14
  74. package/dist/uni/uni-ui/uni-list/uni-refresh.wxs +14 -14
  75. package/dist/uni/uni-ui/uni-list-ad/uni-list-ad.vue +101 -95
  76. package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.scss +18 -18
  77. package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.vue +602 -586
  78. package/dist/uni/uni-ui/uni-list-item/uni-list-item.vue +507 -503
  79. package/dist/uni/uni-ui/uni-load-more/i18n/en.json +3 -3
  80. package/dist/uni/uni-ui/uni-load-more/i18n/index.js +8 -7
  81. package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hans.json +3 -3
  82. package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hant.json +3 -3
  83. package/dist/uni/uni-ui/uni-load-more/uni-load-more.vue +402 -392
  84. package/dist/uni/uni-ui/uni-nav-bar/uni-nav-bar.vue +328 -330
  85. package/dist/uni/uni-ui/uni-nav-bar/uni-status-bar.vue +17 -17
  86. package/dist/uni/uni-ui/uni-notice-bar/uni-notice-bar.vue +422 -401
  87. package/dist/uni/uni-ui/uni-number-box/uni-number-box.vue +211 -205
  88. package/dist/uni/uni-ui/uni-pagination/i18n/en.json +3 -3
  89. package/dist/uni/uni-ui/uni-pagination/i18n/es.json +3 -3
  90. package/dist/uni/uni-ui/uni-pagination/i18n/fr.json +3 -3
  91. package/dist/uni/uni-ui/uni-pagination/i18n/index.js +12 -11
  92. package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hans.json +3 -3
  93. package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hant.json +3 -3
  94. package/dist/uni/uni-ui/uni-pagination/uni-pagination.vue +450 -433
  95. package/dist/uni/uni-ui/uni-popup/uni-popup.vue +404 -404
  96. package/dist/uni/uni-ui/uni-popup-dialog/keypress.js +42 -42
  97. package/dist/uni/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +1 -0
  98. package/dist/uni/uni-ui/uni-popup-message/uni-popup-message.vue +126 -125
  99. package/dist/uni/uni-ui/uni-popup-share/uni-popup-share.vue +172 -172
  100. package/dist/uni/uni-ui/uni-rate/uni-rate.vue +343 -347
  101. package/dist/uni/uni-ui/uni-row/uni-row.vue +180 -182
  102. package/dist/uni/uni-ui/uni-scss/changelog.md +11 -4
  103. package/dist/uni/uni-ui/uni-scss/package.json +73 -73
  104. package/dist/uni/uni-ui/uni-scss/readme.md +2 -1
  105. package/dist/uni/uni-ui/uni-scss/styles/setting/_border.scss +2 -2
  106. package/dist/uni/uni-ui/uni-scss/styles/setting/_color.scss +46 -47
  107. package/dist/uni/uni-ui/uni-scss/styles/setting/_radius.scss +49 -49
  108. package/dist/uni/uni-ui/uni-scss/styles/setting/_space.scss +52 -53
  109. package/dist/uni/uni-ui/uni-scss/styles/setting/_styles.scss +142 -147
  110. package/dist/uni/uni-ui/uni-scss/styles/setting/_text.scss +20 -20
  111. package/dist/uni/uni-ui/uni-scss/styles/setting/_variables.scss +111 -95
  112. package/dist/uni/uni-ui/uni-scss/styles/tools/functions.scss +28 -18
  113. package/dist/uni/uni-ui/uni-scss/theme.scss +10 -7
  114. package/dist/uni/uni-ui/uni-scss/variables.scss +42 -24
  115. package/dist/uni/uni-ui/uni-search-bar/i18n/en.json +3 -3
  116. package/dist/uni/uni-ui/uni-search-bar/i18n/index.js +8 -7
  117. package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hans.json +2 -2
  118. package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hant.json +2 -2
  119. package/dist/uni/uni-ui/uni-search-bar/uni-search-bar.vue +290 -281
  120. package/dist/uni/uni-ui/uni-section/uni-section.vue +149 -146
  121. package/dist/uni/uni-ui/uni-segmented-control/uni-segmented-control.vue +141 -131
  122. package/dist/uni/uni-ui/uni-steps/uni-steps.vue +255 -236
  123. package/dist/uni/uni-ui/uni-swipe-action/uni-swipe-action.vue +51 -51
  124. package/dist/uni/uni-ui/uni-swipe-action-item/bindingx.js +276 -282
  125. package/dist/uni/uni-ui/uni-swipe-action-item/isPC.js +10 -10
  126. package/dist/uni/uni-ui/uni-swipe-action-item/mpalipay.js +182 -187
  127. package/dist/uni/uni-ui/uni-swipe-action-item/mpother.js +235 -244
  128. package/dist/uni/uni-ui/uni-swipe-action-item/mpwxs.js +70 -75
  129. package/dist/uni/uni-ui/uni-swipe-action-item/render.js +238 -247
  130. package/dist/uni/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +387 -313
  131. package/dist/uni/uni-ui/uni-swipe-action-item/wx.wxs +206 -215
  132. package/dist/uni/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +241 -197
  133. package/dist/uni/uni-ui/uni-table/uni-table.vue +445 -447
  134. package/dist/uni/uni-ui/uni-tag/uni-tag.vue +234 -244
  135. package/dist/uni/uni-ui/uni-tbody/uni-tbody.vue +20 -23
  136. package/dist/uni/uni-ui/uni-td/uni-td.vue +79 -80
  137. package/dist/uni/uni-ui/uni-th/filter-dropdown.vue +510 -503
  138. package/dist/uni/uni-ui/uni-th/uni-th.vue +289 -273
  139. package/dist/uni/uni-ui/uni-thead/uni-thead.vue +115 -114
  140. package/dist/uni/uni-ui/uni-title/uni-title.vue +151 -154
  141. package/dist/uni/uni-ui/uni-tooltip/uni-tooltip.vue +55 -60
  142. package/dist/uni/uni-ui/uni-tr/table-checkbox.vue +162 -163
  143. package/dist/uni/uni-ui/uni-tr/uni-tr.vue +158 -157
  144. package/dist/uni/uni-ui/uni-transition/createAnimation.js +130 -113
  145. package/dist/uni/uni-ui/uni-transition/uni-transition.vue +274 -272
  146. package/package.json +1 -1
@@ -67,499 +67,499 @@
67
67
  </template>
68
68
 
69
69
  <script>
70
- import Calendar from './util.js';
71
- import CalendarItem from './uni-calendar-item.vue';
70
+ import Calendar from './util.js';
71
+ import CalendarItem from './uni-calendar-item.vue';
72
72
 
73
- import { initVueI18n } from '@dcloudio/uni-i18n';
74
- import i18nMessages from './i18n';
73
+ import { initVueI18n } from '@dcloudio/uni-i18n';
74
+ import i18nMessages from './i18n';
75
75
 
76
- const { t } = initVueI18n(i18nMessages);
76
+ const { t } = initVueI18n(i18nMessages);
77
77
 
78
- /**
79
- * Calendar 日历
80
- * @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
81
- * @tutorial https://ext.dcloud.net.cn/plugin?id=56
82
- * @property {String} date 自定义当前时间,默认为今天
83
- * @property {Boolean} lunar 显示农历
84
- * @property {String} startDate 日期选择范围-开始日期
85
- * @property {String} endDate 日期选择范围-结束日期
86
- * @property {Boolean} range 范围选择
87
- * @property {Boolean} insert = [true|false] 插入模式,默认为false
88
- * @value true 弹窗模式
89
- * @value false 插入模式
90
- * @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容
91
- * @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}]
92
- * @property {Boolean} showMonth 是否选择月份为背景
93
- * @event {Function} change 日期改变,`insert :ture` 时生效
94
- * @event {Function} confirm 确认选择`insert :false` 时生效
95
- * @event {Function} monthSwitch 切换月份时触发
96
- * @example <uni-calendar :insert="true":lunar="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" />
97
- */
98
- export default {
99
- name: 'UniCalendar',
100
- components: {
101
- CalendarItem,
102
- },
103
- emits: ['close', 'confirm', 'change', 'monthSwitch'],
104
- props: {
105
- date: {
106
- type: String,
107
- default: '',
108
- },
109
- selected: {
110
- type: Array,
111
- default() {
112
- return [];
78
+ /**
79
+ * Calendar 日历
80
+ * @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
81
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=56
82
+ * @property {String} date 自定义当前时间,默认为今天
83
+ * @property {Boolean} lunar 显示农历
84
+ * @property {String} startDate 日期选择范围-开始日期
85
+ * @property {String} endDate 日期选择范围-结束日期
86
+ * @property {Boolean} range 范围选择
87
+ * @property {Boolean} insert = [true|false] 插入模式,默认为false
88
+ * @value true 弹窗模式
89
+ * @value false 插入模式
90
+ * @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容
91
+ * @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}]
92
+ * @property {Boolean} showMonth 是否选择月份为背景
93
+ * @event {Function} change 日期改变,`insert :ture` 时生效
94
+ * @event {Function} confirm 确认选择`insert :false` 时生效
95
+ * @event {Function} monthSwitch 切换月份时触发
96
+ * @example <uni-calendar :insert="true":lunar="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" />
97
+ */
98
+ export default {
99
+ name: 'UniCalendar',
100
+ components: {
101
+ CalendarItem,
102
+ },
103
+ emits: ['close', 'confirm', 'change', 'monthSwitch'],
104
+ props: {
105
+ date: {
106
+ type: String,
107
+ default: '',
108
+ },
109
+ selected: {
110
+ type: Array,
111
+ default() {
112
+ return [];
113
+ },
114
+ },
115
+ lunar: {
116
+ type: Boolean,
117
+ default: false,
118
+ },
119
+ startDate: {
120
+ type: String,
121
+ default: '',
122
+ },
123
+ endDate: {
124
+ type: String,
125
+ default: '',
126
+ },
127
+ range: {
128
+ type: Boolean,
129
+ default: false,
130
+ },
131
+ insert: {
132
+ type: Boolean,
133
+ default: true,
134
+ },
135
+ showMonth: {
136
+ type: Boolean,
137
+ default: true,
138
+ },
139
+ clearDate: {
140
+ type: Boolean,
141
+ default: true,
113
142
  },
114
143
  },
115
- lunar: {
116
- type: Boolean,
117
- default: false,
118
- },
119
- startDate: {
120
- type: String,
121
- default: '',
122
- },
123
- endDate: {
124
- type: String,
125
- default: '',
126
- },
127
- range: {
128
- type: Boolean,
129
- default: false,
130
- },
131
- insert: {
132
- type: Boolean,
133
- default: true,
134
- },
135
- showMonth: {
136
- type: Boolean,
137
- default: true,
138
- },
139
- clearDate: {
140
- type: Boolean,
141
- default: true,
142
- },
143
- },
144
- data() {
145
- return {
146
- show: false,
147
- weeks: [],
148
- calendar: {},
149
- nowDate: '',
150
- aniMaskShow: false,
151
- };
152
- },
153
- computed: {
154
- /**
155
- * for i18n
156
- */
157
-
158
- okText() {
159
- return t('uni-calender.ok');
160
- },
161
- cancelText() {
162
- return t('uni-calender.cancel');
163
- },
164
- todayText() {
165
- return t('uni-calender.today');
166
- },
167
- monText() {
168
- return t('uni-calender.MON');
169
- },
170
- TUEText() {
171
- return t('uni-calender.TUE');
172
- },
173
- WEDText() {
174
- return t('uni-calender.WED');
175
- },
176
- THUText() {
177
- return t('uni-calender.THU');
178
- },
179
- FRIText() {
180
- return t('uni-calender.FRI');
181
- },
182
- SATText() {
183
- return t('uni-calender.SAT');
184
- },
185
- SUNText() {
186
- return t('uni-calender.SUN');
187
- },
188
- },
189
- watch: {
190
- date(newVal) {
191
- // this.cale.setDate(newVal)
192
- this.init(newVal);
193
- },
194
- startDate(val) {
195
- this.cale.resetSatrtDate(val);
196
- this.cale.setDate(this.nowDate.fullDate);
197
- this.weeks = this.cale.weeks;
198
- },
199
- endDate(val) {
200
- this.cale.resetEndDate(val);
201
- this.cale.setDate(this.nowDate.fullDate);
202
- this.weeks = this.cale.weeks;
203
- },
204
- selected(newVal) {
205
- this.cale.setSelectInfo(this.nowDate.fullDate, newVal);
206
- this.weeks = this.cale.weeks;
207
- },
208
- },
209
- created() {
210
- this.cale = new Calendar({
211
- selected: this.selected,
212
- startDate: this.startDate,
213
- endDate: this.endDate,
214
- range: this.range,
215
- });
216
- this.init(this.date);
217
- },
218
- methods: {
219
- // 取消穿透
220
- clean() {},
221
- bindDateChange(e) {
222
- const value = e.detail.value + '-1';
223
- this.setDate(value);
144
+ data() {
145
+ return {
146
+ show: false,
147
+ weeks: [],
148
+ calendar: {},
149
+ nowDate: '',
150
+ aniMaskShow: false,
151
+ };
152
+ },
153
+ computed: {
154
+ /**
155
+ * for i18n
156
+ */
224
157
 
225
- const { year, month } = this.cale.getDate(value);
226
- this.$emit('monthSwitch', {
227
- year,
228
- month,
229
- });
230
- },
231
- /**
232
- * 初始化日期显示
233
- * @param {Object} date
234
- */
235
- init(date) {
236
- this.cale.setDate(date);
237
- this.weeks = this.cale.weeks;
238
- this.nowDate = this.calendar = this.cale.getInfo(date);
239
- },
240
- /**
241
- * 打开日历弹窗
242
- */
243
- open() {
244
- // 弹窗模式并且清理数据
245
- if (this.clearDate && !this.insert) {
246
- this.cale.cleanMultipleStatus();
247
- // this.cale.setDate(this.date)
248
- this.init(this.date);
249
- }
250
- this.show = true;
251
- this.$nextTick(() => {
252
- setTimeout(() => {
253
- this.aniMaskShow = true;
254
- }, 50);
255
- });
256
- },
257
- /**
258
- * 关闭日历弹窗
259
- */
260
- close() {
261
- this.aniMaskShow = false;
262
- this.$nextTick(() => {
263
- setTimeout(() => {
264
- this.show = false;
265
- this.$emit('close');
266
- }, 300);
267
- });
268
- },
269
- /**
270
- * 确认按钮
271
- */
272
- confirm() {
273
- this.setEmit('confirm');
274
- this.close();
275
- },
276
- /**
277
- * 变化触发
278
- */
279
- change() {
280
- if (!this.insert) return;
281
- this.setEmit('change');
158
+ okText() {
159
+ return t('uni-calender.ok');
160
+ },
161
+ cancelText() {
162
+ return t('uni-calender.cancel');
163
+ },
164
+ todayText() {
165
+ return t('uni-calender.today');
166
+ },
167
+ monText() {
168
+ return t('uni-calender.MON');
169
+ },
170
+ TUEText() {
171
+ return t('uni-calender.TUE');
172
+ },
173
+ WEDText() {
174
+ return t('uni-calender.WED');
175
+ },
176
+ THUText() {
177
+ return t('uni-calender.THU');
178
+ },
179
+ FRIText() {
180
+ return t('uni-calender.FRI');
181
+ },
182
+ SATText() {
183
+ return t('uni-calender.SAT');
184
+ },
185
+ SUNText() {
186
+ return t('uni-calender.SUN');
187
+ },
282
188
  },
283
- /**
284
- * 选择月份触发
285
- */
286
- monthSwitch() {
287
- let { year, month } = this.nowDate;
288
- this.$emit('monthSwitch', {
289
- year,
290
- month: Number(month),
291
- });
189
+ watch: {
190
+ date(newVal) {
191
+ // this.cale.setDate(newVal)
192
+ this.init(newVal);
193
+ },
194
+ startDate(val) {
195
+ this.cale.resetSatrtDate(val);
196
+ this.cale.setDate(this.nowDate.fullDate);
197
+ this.weeks = this.cale.weeks;
198
+ },
199
+ endDate(val) {
200
+ this.cale.resetEndDate(val);
201
+ this.cale.setDate(this.nowDate.fullDate);
202
+ this.weeks = this.cale.weeks;
203
+ },
204
+ selected(newVal) {
205
+ this.cale.setSelectInfo(this.nowDate.fullDate, newVal);
206
+ this.weeks = this.cale.weeks;
207
+ },
292
208
  },
293
- /**
294
- * 派发事件
295
- * @param {Object} name
296
- */
297
- setEmit(name) {
298
- let { year, month, date, fullDate, lunar, extraInfo } = this.calendar;
299
- this.$emit(name, {
300
- range: this.cale.multipleStatus,
301
- year,
302
- month,
303
- date,
304
- fulldate: fullDate,
305
- lunar,
306
- extraInfo: extraInfo || {},
209
+ created() {
210
+ this.cale = new Calendar({
211
+ selected: this.selected,
212
+ startDate: this.startDate,
213
+ endDate: this.endDate,
214
+ range: this.range,
307
215
  });
308
- },
309
- /**
310
- * 选择天触发
311
- * @param {Object} weeks
312
- */
313
- choiceDate(weeks) {
314
- if (weeks.disable) return;
315
- this.calendar = weeks;
316
- // 设置多选
317
- this.cale.setMultiple(this.calendar.fullDate);
318
- this.weeks = this.cale.weeks;
319
- this.change();
320
- },
321
- /**
322
- * 回到今天
323
- */
324
- backToday() {
325
- const nowYearMonth = `${this.nowDate.year}-${this.nowDate.month}`;
326
- const date = this.cale.getDate(new Date());
327
- const todayYearMonth = `${date.year}-${date.month}`;
216
+ this.init(this.date);
217
+ },
218
+ methods: {
219
+ // 取消穿透
220
+ clean() {},
221
+ bindDateChange(e) {
222
+ const value = e.detail.value + '-1';
223
+ this.setDate(value);
328
224
 
329
- if (nowYearMonth !== todayYearMonth) {
330
- this.monthSwitch();
331
- }
225
+ const { year, month } = this.cale.getDate(value);
226
+ this.$emit('monthSwitch', {
227
+ year,
228
+ month,
229
+ });
230
+ },
231
+ /**
232
+ * 初始化日期显示
233
+ * @param {Object} date
234
+ */
235
+ init(date) {
236
+ this.cale.setDate(date);
237
+ this.weeks = this.cale.weeks;
238
+ this.nowDate = this.calendar = this.cale.getInfo(date);
239
+ },
240
+ /**
241
+ * 打开日历弹窗
242
+ */
243
+ open() {
244
+ // 弹窗模式并且清理数据
245
+ if (this.clearDate && !this.insert) {
246
+ this.cale.cleanMultipleStatus();
247
+ // this.cale.setDate(this.date)
248
+ this.init(this.date);
249
+ }
250
+ this.show = true;
251
+ this.$nextTick(() => {
252
+ setTimeout(() => {
253
+ this.aniMaskShow = true;
254
+ }, 50);
255
+ });
256
+ },
257
+ /**
258
+ * 关闭日历弹窗
259
+ */
260
+ close() {
261
+ this.aniMaskShow = false;
262
+ this.$nextTick(() => {
263
+ setTimeout(() => {
264
+ this.show = false;
265
+ this.$emit('close');
266
+ }, 300);
267
+ });
268
+ },
269
+ /**
270
+ * 确认按钮
271
+ */
272
+ confirm() {
273
+ this.setEmit('confirm');
274
+ this.close();
275
+ },
276
+ /**
277
+ * 变化触发
278
+ */
279
+ change() {
280
+ if (!this.insert) return;
281
+ this.setEmit('change');
282
+ },
283
+ /**
284
+ * 选择月份触发
285
+ */
286
+ monthSwitch() {
287
+ let { year, month } = this.nowDate;
288
+ this.$emit('monthSwitch', {
289
+ year,
290
+ month: Number(month),
291
+ });
292
+ },
293
+ /**
294
+ * 派发事件
295
+ * @param {Object} name
296
+ */
297
+ setEmit(name) {
298
+ let { year, month, date, fullDate, lunar, extraInfo } = this.calendar;
299
+ this.$emit(name, {
300
+ range: this.cale.multipleStatus,
301
+ year,
302
+ month,
303
+ date,
304
+ fulldate: fullDate,
305
+ lunar,
306
+ extraInfo: extraInfo || {},
307
+ });
308
+ },
309
+ /**
310
+ * 选择天触发
311
+ * @param {Object} weeks
312
+ */
313
+ choiceDate(weeks) {
314
+ if (weeks.disable) return;
315
+ this.calendar = weeks;
316
+ // 设置多选
317
+ this.cale.setMultiple(this.calendar.fullDate);
318
+ this.weeks = this.cale.weeks;
319
+ this.change();
320
+ },
321
+ /**
322
+ * 回到今天
323
+ */
324
+ backToday() {
325
+ const nowYearMonth = `${this.nowDate.year}-${this.nowDate.month}`;
326
+ const date = this.cale.getDate(new Date());
327
+ const todayYearMonth = `${date.year}-${date.month}`;
332
328
 
333
- this.init(date.fullDate);
334
- this.change();
335
- },
336
- /**
337
- * 上个月
338
- */
339
- pre() {
340
- const preDate = this.cale.getDate(this.nowDate.fullDate, -1, 'month').fullDate;
341
- this.setDate(preDate);
342
- this.monthSwitch();
343
- },
344
- /**
345
- * 下个月
346
- */
347
- next() {
348
- const nextDate = this.cale.getDate(this.nowDate.fullDate, +1, 'month').fullDate;
349
- this.setDate(nextDate);
350
- this.monthSwitch();
351
- },
352
- /**
353
- * 设置日期
354
- * @param {Object} date
355
- */
356
- setDate(date) {
357
- this.cale.setDate(date);
358
- this.weeks = this.cale.weeks;
359
- this.nowDate = this.cale.getInfo(date);
329
+ if (nowYearMonth !== todayYearMonth) {
330
+ this.monthSwitch();
331
+ }
332
+
333
+ this.init(date.fullDate);
334
+ this.change();
335
+ },
336
+ /**
337
+ * 上个月
338
+ */
339
+ pre() {
340
+ const preDate = this.cale.getDate(this.nowDate.fullDate, -1, 'month').fullDate;
341
+ this.setDate(preDate);
342
+ this.monthSwitch();
343
+ },
344
+ /**
345
+ * 下个月
346
+ */
347
+ next() {
348
+ const nextDate = this.cale.getDate(this.nowDate.fullDate, +1, 'month').fullDate;
349
+ this.setDate(nextDate);
350
+ this.monthSwitch();
351
+ },
352
+ /**
353
+ * 设置日期
354
+ * @param {Object} date
355
+ */
356
+ setDate(date) {
357
+ this.cale.setDate(date);
358
+ this.weeks = this.cale.weeks;
359
+ this.nowDate = this.cale.getInfo(date);
360
+ },
360
361
  },
361
- },
362
- };
362
+ };
363
363
  </script>
364
364
 
365
365
  <style lang="scss" scoped>
366
- $uni-bg-color-mask: rgba(
367
- $color: #000000,
368
- $alpha: 0.4,
369
- );
370
- $uni-border-color: #ededed;
371
- $uni-text-color: #333;
372
- $uni-bg-color-hover: #f1f1f1;
373
- $uni-font-size-base: 14px;
374
- $uni-text-color-placeholder: #808080;
375
- $uni-color-subtitle: #555555;
376
- $uni-text-color-grey: #999;
377
- .uni-calendar {
378
- /* #ifndef APP-NVUE */
379
- display: flex;
380
- /* #endif */
381
- flex-direction: column;
382
- }
366
+ $uni-bg-color-mask: rgba(
367
+ $color: #000000,
368
+ $alpha: 0.4,
369
+ );
370
+ $uni-border-color: #ededed;
371
+ $uni-text-color: #333;
372
+ $uni-bg-color-hover: #f1f1f1;
373
+ $uni-font-size-base: 14px;
374
+ $uni-text-color-placeholder: #808080;
375
+ $uni-color-subtitle: #555555;
376
+ $uni-text-color-grey: #999;
377
+ .uni-calendar {
378
+ /* #ifndef APP-NVUE */
379
+ display: flex;
380
+ /* #endif */
381
+ flex-direction: column;
382
+ }
383
383
 
384
- .uni-calendar__mask {
385
- position: fixed;
386
- bottom: 0;
387
- top: 0;
388
- left: 0;
389
- right: 0;
390
- background-color: $uni-bg-color-mask;
391
- transition-property: opacity;
392
- transition-duration: 0.3s;
393
- opacity: 0;
394
- /* #ifndef APP-NVUE */
395
- z-index: 99;
396
- /* #endif */
397
- }
384
+ .uni-calendar__mask {
385
+ position: fixed;
386
+ bottom: 0;
387
+ top: 0;
388
+ left: 0;
389
+ right: 0;
390
+ background-color: $uni-bg-color-mask;
391
+ transition-property: opacity;
392
+ transition-duration: 0.3s;
393
+ opacity: 0;
394
+ /* #ifndef APP-NVUE */
395
+ z-index: 99;
396
+ /* #endif */
397
+ }
398
398
 
399
- .uni-calendar--mask-show {
400
- opacity: 1;
401
- }
399
+ .uni-calendar--mask-show {
400
+ opacity: 1;
401
+ }
402
402
 
403
- .uni-calendar--fixed {
404
- position: fixed;
405
- /* #ifdef APP-NVUE */
406
- bottom: 0;
407
- /* #endif */
408
- left: 0;
409
- right: 0;
410
- transition-property: transform;
411
- transition-duration: 0.3s;
412
- transform: translateY(460px);
413
- /* #ifndef APP-NVUE */
414
- bottom: calc(var(--window-bottom));
415
- z-index: 99;
416
- /* #endif */
417
- }
403
+ .uni-calendar--fixed {
404
+ position: fixed;
405
+ /* #ifdef APP-NVUE */
406
+ bottom: 0;
407
+ /* #endif */
408
+ left: 0;
409
+ right: 0;
410
+ transition-property: transform;
411
+ transition-duration: 0.3s;
412
+ transform: translateY(460px);
413
+ /* #ifndef APP-NVUE */
414
+ bottom: calc(var(--window-bottom));
415
+ z-index: 99;
416
+ /* #endif */
417
+ }
418
418
 
419
- .uni-calendar--ani-show {
420
- transform: translateY(0);
421
- }
419
+ .uni-calendar--ani-show {
420
+ transform: translateY(0);
421
+ }
422
422
 
423
- .uni-calendar__content {
424
- background-color: #fff;
425
- }
423
+ .uni-calendar__content {
424
+ background-color: #fff;
425
+ }
426
426
 
427
- .uni-calendar__header {
428
- position: relative;
429
- /* #ifndef APP-NVUE */
430
- display: flex;
431
- /* #endif */
432
- flex-direction: row;
433
- justify-content: center;
434
- align-items: center;
435
- height: 50px;
436
- border-bottom-color: $uni-border-color;
437
- border-bottom-style: solid;
438
- border-bottom-width: 1px;
439
- }
427
+ .uni-calendar__header {
428
+ position: relative;
429
+ /* #ifndef APP-NVUE */
430
+ display: flex;
431
+ /* #endif */
432
+ flex-direction: row;
433
+ justify-content: center;
434
+ align-items: center;
435
+ height: 50px;
436
+ border-bottom-color: $uni-border-color;
437
+ border-bottom-style: solid;
438
+ border-bottom-width: 1px;
439
+ }
440
440
 
441
- .uni-calendar--fixed-top {
442
- /* #ifndef APP-NVUE */
443
- display: flex;
444
- /* #endif */
445
- flex-direction: row;
446
- justify-content: space-between;
447
- border-top-color: $uni-border-color;
448
- border-top-style: solid;
449
- border-top-width: 1px;
450
- }
441
+ .uni-calendar--fixed-top {
442
+ /* #ifndef APP-NVUE */
443
+ display: flex;
444
+ /* #endif */
445
+ flex-direction: row;
446
+ justify-content: space-between;
447
+ border-top-color: $uni-border-color;
448
+ border-top-style: solid;
449
+ border-top-width: 1px;
450
+ }
451
451
 
452
- .uni-calendar--fixed-width {
453
- width: 50px;
454
- }
452
+ .uni-calendar--fixed-width {
453
+ width: 50px;
454
+ }
455
455
 
456
- .uni-calendar__backtoday {
457
- position: absolute;
458
- right: 0;
459
- top: 25 rpx;
460
- padding: 0 5px;
461
- padding-left: 10px;
462
- height: 25px;
463
- line-height: 25px;
464
- font-size: 12px;
465
- border-top-left-radius: 25px;
466
- border-bottom-left-radius: 25px;
467
- color: $uni-text-color;
468
- background-color: $uni-bg-color-hover;
469
- }
456
+ .uni-calendar__backtoday {
457
+ position: absolute;
458
+ right: 0;
459
+ top: 25 rpx;
460
+ padding: 0 5px;
461
+ padding-left: 10px;
462
+ height: 25px;
463
+ line-height: 25px;
464
+ font-size: 12px;
465
+ border-top-left-radius: 25px;
466
+ border-bottom-left-radius: 25px;
467
+ color: $uni-text-color;
468
+ background-color: $uni-bg-color-hover;
469
+ }
470
470
 
471
- .uni-calendar__header-text {
472
- text-align: center;
473
- width: 100px;
474
- font-size: $uni-font-size-base;
475
- color: $uni-text-color;
476
- }
471
+ .uni-calendar__header-text {
472
+ text-align: center;
473
+ width: 100px;
474
+ font-size: $uni-font-size-base;
475
+ color: $uni-text-color;
476
+ }
477
477
 
478
- .uni-calendar__header-btn-box {
479
- /* #ifndef APP-NVUE */
480
- display: flex;
481
- /* #endif */
482
- flex-direction: row;
483
- align-items: center;
484
- justify-content: center;
485
- width: 50px;
486
- height: 50px;
487
- }
478
+ .uni-calendar__header-btn-box {
479
+ /* #ifndef APP-NVUE */
480
+ display: flex;
481
+ /* #endif */
482
+ flex-direction: row;
483
+ align-items: center;
484
+ justify-content: center;
485
+ width: 50px;
486
+ height: 50px;
487
+ }
488
488
 
489
- .uni-calendar__header-btn {
490
- width: 10px;
491
- height: 10px;
492
- border-left-color: $uni-text-color-placeholder;
493
- border-left-style: solid;
494
- border-left-width: 2px;
495
- border-top-color: $uni-color-subtitle;
496
- border-top-style: solid;
497
- border-top-width: 2px;
498
- }
489
+ .uni-calendar__header-btn {
490
+ width: 10px;
491
+ height: 10px;
492
+ border-left-color: $uni-text-color-placeholder;
493
+ border-left-style: solid;
494
+ border-left-width: 2px;
495
+ border-top-color: $uni-color-subtitle;
496
+ border-top-style: solid;
497
+ border-top-width: 2px;
498
+ }
499
499
 
500
- .uni-calendar--left {
501
- transform: rotate(-45deg);
502
- }
500
+ .uni-calendar--left {
501
+ transform: rotate(-45deg);
502
+ }
503
503
 
504
- .uni-calendar--right {
505
- transform: rotate(135deg);
506
- }
504
+ .uni-calendar--right {
505
+ transform: rotate(135deg);
506
+ }
507
507
 
508
- .uni-calendar__weeks {
509
- position: relative;
510
- /* #ifndef APP-NVUE */
511
- display: flex;
512
- /* #endif */
513
- flex-direction: row;
514
- }
508
+ .uni-calendar__weeks {
509
+ position: relative;
510
+ /* #ifndef APP-NVUE */
511
+ display: flex;
512
+ /* #endif */
513
+ flex-direction: row;
514
+ }
515
515
 
516
- .uni-calendar__weeks-item {
517
- flex: 1;
518
- }
516
+ .uni-calendar__weeks-item {
517
+ flex: 1;
518
+ }
519
519
 
520
- .uni-calendar__weeks-day {
521
- flex: 1;
522
- /* #ifndef APP-NVUE */
523
- display: flex;
524
- /* #endif */
525
- flex-direction: column;
526
- justify-content: center;
527
- align-items: center;
528
- height: 45px;
529
- border-bottom-color: #f5f5f5;
530
- border-bottom-style: solid;
531
- border-bottom-width: 1px;
532
- }
520
+ .uni-calendar__weeks-day {
521
+ flex: 1;
522
+ /* #ifndef APP-NVUE */
523
+ display: flex;
524
+ /* #endif */
525
+ flex-direction: column;
526
+ justify-content: center;
527
+ align-items: center;
528
+ height: 45px;
529
+ border-bottom-color: #f5f5f5;
530
+ border-bottom-style: solid;
531
+ border-bottom-width: 1px;
532
+ }
533
533
 
534
- .uni-calendar__weeks-day-text {
535
- font-size: 14px;
536
- }
534
+ .uni-calendar__weeks-day-text {
535
+ font-size: 14px;
536
+ }
537
537
 
538
- .uni-calendar__box {
539
- position: relative;
540
- }
538
+ .uni-calendar__box {
539
+ position: relative;
540
+ }
541
541
 
542
- .uni-calendar__box-bg {
543
- /* #ifndef APP-NVUE */
544
- display: flex;
545
- /* #endif */
546
- justify-content: center;
547
- align-items: center;
548
- position: absolute;
549
- top: 0;
550
- left: 0;
551
- right: 0;
552
- bottom: 0;
553
- }
542
+ .uni-calendar__box-bg {
543
+ /* #ifndef APP-NVUE */
544
+ display: flex;
545
+ /* #endif */
546
+ justify-content: center;
547
+ align-items: center;
548
+ position: absolute;
549
+ top: 0;
550
+ left: 0;
551
+ right: 0;
552
+ bottom: 0;
553
+ }
554
554
 
555
- .uni-calendar__box-bg-text {
556
- font-size: 200px;
557
- font-weight: bold;
558
- color: $uni-text-color-grey;
559
- opacity: 0.1;
560
- text-align: center;
561
- /* #ifndef APP-NVUE */
562
- line-height: 1;
563
- /* #endif */
564
- }
555
+ .uni-calendar__box-bg-text {
556
+ font-size: 200px;
557
+ font-weight: bold;
558
+ color: $uni-text-color-grey;
559
+ opacity: 0.1;
560
+ text-align: center;
561
+ /* #ifndef APP-NVUE */
562
+ line-height: 1;
563
+ /* #endif */
564
+ }
565
565
  </style>