kui-vue 3.2.6 → 3.2.7

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 (71) hide show
  1. package/components/_tool/directives.js +3 -1
  2. package/components/_tool/docClick.js +3 -1
  3. package/components/_tool/outsiteclick.js +1 -2
  4. package/components/_tool/resize.js +2 -3
  5. package/components/_tool/scroll.js +2 -3
  6. package/components/_tool/transfer.js +3 -1
  7. package/components/affix/affix.jsx +1 -1
  8. package/components/base/drop.jsx +3 -3
  9. package/components/bin/index.js +2 -0
  10. package/components/datePicker/datecalendar.jsx +143 -79
  11. package/components/datePicker/datepicker.jsx +6 -5
  12. package/components/datePicker/demo/base.md +2 -0
  13. package/components/datePicker/demo/index.vue +2 -0
  14. package/components/datePicker/demo/inside.md +76 -0
  15. package/components/datePicker/demo/size.md +3 -3
  16. package/components/datePicker/index.js +2 -1
  17. package/components/datePicker/index.md +1 -0
  18. package/components/datePicker/styles/calendar.less +149 -49
  19. package/components/datePicker/styles/datepicker.less +1 -1
  20. package/components/drawer/demo/base.md +2 -2
  21. package/components/drawer/demo/custom.md +1 -1
  22. package/components/drawer/demo/form.md +1 -1
  23. package/components/drawer/demo/target.md +14 -3
  24. package/components/drawer/drawer.jsx +6 -6
  25. package/components/drawer/index.md +1 -1
  26. package/components/drawer/styles/animal.less +2 -1
  27. package/components/drawer/styles/index.less +26 -10
  28. package/components/icon/demo/search.vue +2 -2
  29. package/components/image/preview.jsx +10 -8
  30. package/components/index.js +3 -3
  31. package/components/locale/lang/de.js +2 -1
  32. package/components/locale/lang/el.js +2 -1
  33. package/components/locale/lang/en.js +2 -1
  34. package/components/locale/lang/fr.js +2 -1
  35. package/components/locale/lang/it.js +2 -1
  36. package/components/locale/lang/ja.js +2 -1
  37. package/components/locale/lang/ko.js +2 -1
  38. package/components/locale/lang/ru.js +2 -1
  39. package/components/locale/lang/th.js +2 -1
  40. package/components/locale/lang/ua.js +2 -1
  41. package/components/locale/lang/vi.js +2 -1
  42. package/components/locale/lang/zh-CN.js +3 -2
  43. package/components/locale/lang/zh-TW.js +2 -1
  44. package/components/message/styles/index.less +4 -3
  45. package/components/modal/index.js +7 -5
  46. package/components/modal/modal.jsx +36 -32
  47. package/components/space/space.jsx +2 -2
  48. package/components/table/extend.jsx +1 -1
  49. package/components/table/table.jsx +3 -3
  50. package/components/tabs/tabs.jsx +2 -2
  51. package/components/treeselect/treeselect.vue +36 -35
  52. package/components/upload/index.md +1 -1
  53. package/components/upload/styles/index.less +1 -1
  54. package/components/upload/upload.jsx +1 -1
  55. package/dist/k-ui.css +2 -2
  56. package/dist/k-ui.js +2 -2
  57. package/dist/locale/de.js +8 -0
  58. package/dist/locale/el.js +8 -0
  59. package/dist/locale/en.js +8 -0
  60. package/dist/locale/fr.js +8 -0
  61. package/dist/locale/it.js +8 -0
  62. package/dist/locale/ja.js +8 -0
  63. package/dist/locale/ko.js +8 -0
  64. package/dist/locale/ru.js +8 -0
  65. package/dist/locale/th.js +8 -0
  66. package/dist/locale/ua.js +8 -0
  67. package/dist/locale/vi.js +8 -0
  68. package/dist/locale/zhCN.js +8 -0
  69. package/dist/locale/zhTW.js +8 -0
  70. package/package.json +1 -1
  71. package/readme.md +1 -1
@@ -1,7 +1,9 @@
1
+ import Vue from 'vue';
2
+ const SSR = Vue.prototype.$isServer
1
3
  export default {
2
4
  inserted(el, { value }, vnode) {
3
5
  let transfer = el.getAttribute ? el.getAttribute('data-transfer') : el.dataset.transfer
4
- if (transfer === 'true') {
6
+ if (!SSR && transfer === 'true') {
5
7
  const parentNode = el.parentNode
6
8
  if (!parentNode) return false;
7
9
  let empty = document.createComment('')
@@ -1,3 +1,5 @@
1
+ import Vue from 'vue';
2
+ const SSR = Vue.prototype.$isServer
1
3
  export default {
2
4
  bind(el, binding) {
3
5
  let docClick = (e) => {
@@ -9,7 +11,7 @@ export default {
9
11
  }
10
12
  }
11
13
  el._docClick = docClick
12
- document.addEventListener('click', docClick)
14
+ !SSR && document.addEventListener('click', docClick)
13
15
  },
14
16
  unbind(el, bind) {
15
17
  document.removeEventListener('click', el._docClick)
@@ -2,8 +2,7 @@ import Vue from 'vue';
2
2
  const SSR = Vue.prototype.$isServer
3
3
  export default {
4
4
  bind(el, { value }) {
5
- if (SSR) return;
6
- if (typeof value == 'function') {
5
+ if (!SSR && typeof value == 'function') {
7
6
  document.addEventListener('click', value)
8
7
  }
9
8
  },
@@ -2,13 +2,12 @@ import Vue from 'vue';
2
2
  const SSR = Vue.prototype.$isServer
3
3
  export default {
4
4
  bind(el, { value }) {
5
- if (SSR) return;
6
- if (typeof value == 'function') {
5
+ if (typeof value == 'function' && !SSR) {
7
6
  window.addEventListener('resize', value)
8
7
  }
9
8
  },
10
9
  unbind(el, { value }) {
11
- if (typeof value == 'function')
10
+ if (typeof value == 'function' && !SSR)
12
11
  window.removeEventListener('resize', value)
13
12
  }
14
13
  }
@@ -2,13 +2,12 @@ import Vue from 'vue';
2
2
  const SSR = Vue.prototype.$isServer
3
3
  export default {
4
4
  bind(el, { value }) {
5
- if (SSR) return;
6
- if (typeof value == 'function') {
5
+ if (typeof value == 'function' && !SSR) {
7
6
  window.addEventListener('scroll', value)
8
7
  }
9
8
  },
10
9
  unbind(el, { value }) {
11
- if (typeof value == 'function')
10
+ if (typeof value == 'function' && !SSR)
12
11
  window.removeEventListener('scroll', value)
13
12
  }
14
13
  }
@@ -1,7 +1,9 @@
1
1
 
2
+ import Vue from 'vue';
3
+ const SSR = Vue.prototype.$isServer
2
4
  export default {
3
5
  inserted(el, { value }, vnode) {
4
- if (value) {
6
+ if (!SSR && value) {
5
7
  const parentNode = el.parentNode
6
8
  if (!parentNode) return false;
7
9
 
@@ -32,7 +32,7 @@ export default {
32
32
  },
33
33
  mounted() {
34
34
  let target = this.target()
35
- if (target) {
35
+ if (target && !this.$isServer) {
36
36
  target.addEventListener('scroll', this.updatePosition)
37
37
  }
38
38
  },
@@ -15,7 +15,7 @@ export default {
15
15
  placement: String,
16
16
  trigger: { type: String, default: "click" },
17
17
  transitionName: { type: String, default: 'dropdown' },
18
- selection: Element,
18
+ selection: { validator: v => true },
19
19
  updateKey: [String, Object, Array]
20
20
  },
21
21
 
@@ -53,10 +53,10 @@ export default {
53
53
  },
54
54
  mounted() {
55
55
  this.$nextTick(() => this.setPosition())
56
- document.addEventListener('mousedown', this.onMouseDown)
56
+ !this.$isServer && document.addEventListener('mousedown', this.onMouseDown)
57
57
  },
58
58
  beforeDestroy() {
59
- document.removeEventListener('mousedown', this.onMouseDown)
59
+ !this.$isServer && document.removeEventListener('mousedown', this.onMouseDown)
60
60
  },
61
61
  render() {
62
62
  const props = {
@@ -0,0 +1,2 @@
1
+ import '../index.js'
2
+ import '../styles/index.less';
@@ -13,11 +13,11 @@ export default {
13
13
  mode: { type: String, default: 'date' },
14
14
  format: { type: String, default: 'YYYY-MM-DD' },
15
15
  float: String,
16
+ pickerSize: String,
16
17
  },
17
18
  data() {
18
19
  return {
19
20
  showYears: false,
20
- showMonths: false,
21
21
  showTimes: false,
22
22
  currentValue: this.value ? new Date(this.value) : '',
23
23
  today: new Date(),
@@ -31,7 +31,7 @@ export default {
31
31
  monthsHead: "1.2.3.4.5.6.7.8.9.10.11.12".split("."),
32
32
  // months: t('k.datePicker.months'), // months of panel
33
33
  // weeks: t('k.datePicker.weeks'), // weeks
34
- years: [],
34
+ // years: [],
35
35
 
36
36
  };
37
37
  },
@@ -45,10 +45,23 @@ export default {
45
45
  this.updateStamp()
46
46
  }
47
47
  },
48
+ showYears(show) {
49
+ if (show) {
50
+ this.$nextTick(e => {
51
+ let year = new Date().getFullYear()
52
+ let y = this.years.indexOf(this.year || year)
53
+ let d = [y, this.month].map(x => x * 40)
54
+ let years = this.$refs.yearspicker;
55
+ let month = this.$refs.monthspicker;
56
+ years.scrollTop = d[0]
57
+ month.scrollTop = d[1]
58
+ })
59
+ }
60
+ },
48
61
  showTimes(show) {
49
62
  if (show) {
50
63
  this.$nextTick(e => {
51
- let d = [this.hour, this.minute, this.second].map(x => x * 24)
64
+ let d = [this.hour, this.minute, this.second].map(x => x * 32)
52
65
  let childs = this.$refs.timepicker.children;
53
66
  [0, 1, 2].map((e, i) => childs[i].scrollTop = d[i])
54
67
  })
@@ -91,6 +104,15 @@ export default {
91
104
  }
92
105
  return days;
93
106
  },
107
+ years() {
108
+ let year = new Date().getFullYear()
109
+ let min = year - 100, max = year + 100;
110
+ let y = []
111
+ for (let j = min; j <= max; j++) {
112
+ y.push(j)
113
+ }
114
+ return y
115
+ }
94
116
  },
95
117
  methods: {
96
118
  updateStamp() {
@@ -107,28 +129,19 @@ export default {
107
129
  this.year = d.getFullYear()
108
130
  this.month = d.getMonth()
109
131
  this.day = d.getDate()
110
- this.setYears(this.year);
111
132
  if (this.showTime && this.currentValue) {
112
133
  this.hour = d.getHours()
113
134
  this.minute = d.getMinutes()
114
135
  this.second = d.getSeconds()
115
136
  }
116
137
  },
117
- setYears(year) {
118
- const arr = [];
119
- let start = year - 1;
120
- while (arr.length < 12) {
121
- arr.push(start++);
122
- }
123
- this.years = arr
124
- },
138
+
125
139
  nextMonth() {
126
140
  if (this.month < 11) {
127
141
  this.month++;
128
142
  } else {
129
143
  this.month = 0;
130
144
  this.year++;
131
- this.setYears(this.year)
132
145
  }
133
146
  },
134
147
  prevMonth() {
@@ -137,7 +150,6 @@ export default {
137
150
  } else {
138
151
  this.month = 11;
139
152
  this.year--;
140
- this.setYears(this.year)
141
153
  }
142
154
  },
143
155
  classes(Y, M, D, out, format) {
@@ -189,12 +201,14 @@ export default {
189
201
  let disabled = this.disabledDate(time)
190
202
 
191
203
  let classes = {
192
- 'k-calendar-date': true,
204
+ 'k-calendar-date': format == 'YYYYMMDD',
193
205
  'k-calendar-date-today': istoday,
194
206
  'k-calendar-date-on': on && !out && !disabled,
195
- 'k-calendar-date-selected': isselected && !out,
196
- 'k-calendar-date-disabled': disabled,
197
- 'k-calendar-date-out': out
207
+ 'k-calendar-item-selected': isselected && !out,
208
+ 'k-calendar-item-disabled': disabled,
209
+ 'k-calendar-date-out': out,
210
+ 'k-calendar-year-item': format == 'YYYY',
211
+ 'k-calendar-month-item': format == 'YYYYMM',
198
212
  }
199
213
  return classes
200
214
  },
@@ -207,8 +221,11 @@ export default {
207
221
  this.currentValue = new Date(this.currentValue).setMonth(m)
208
222
  if (this.mode == 'month') {
209
223
  this.setDate()
210
- } else
211
- this.showMonths = 0
224
+ }
225
+
226
+ this.$nextTick(() => {
227
+ this.setYMScroll()
228
+ })
212
229
  },
213
230
  setYear(e, y) {
214
231
  e.stopPropagation();
@@ -217,18 +234,20 @@ export default {
217
234
  }
218
235
  this.year = y
219
236
  if (this.years.indexOf(y) == 0) {
220
- this.setYears(y - 10)
221
237
  return;
222
238
  }
223
239
  if (this.years.indexOf(y) == 11) {
224
- this.setYears(y)
225
240
  return;
226
241
  }
227
242
  this.currentValue = new Date(this.currentValue).setYear(y)
228
- this.showYears = 0
243
+ // this.showYears = 0
229
244
  if (this.mode == 'year') {
230
245
  this.$emit('input', this.currentValue)
246
+ this.$emit('change', this.currentValue)
231
247
  }
248
+ this.$nextTick(() => {
249
+ this.setYMScroll()
250
+ })
232
251
  },
233
252
  setDay(e, j) {
234
253
  e.stopPropagation();
@@ -256,6 +275,7 @@ export default {
256
275
  time = temp < date ? [temp, date] : [date, temp]
257
276
  // this.DatePicker.currentValue = time
258
277
  this.$emit('input', time)
278
+ this.$emit('change', time)
259
279
  }
260
280
  }
261
281
  if ((float == 'right' && n) || (float == 'left' && p)) {
@@ -300,22 +320,22 @@ export default {
300
320
  <li onClick={e => this.setTime(j, t, e)} class={this.timeClass(j, t, d)}>{this.fix(j)}</li>)
301
321
  },
302
322
  setShowTime() {
303
- this.showMonths = 0
304
323
  this.showYears = 0
305
- if (this.mode == 'range') {
306
- this.DatePicker.temp_range_showtime = !this.DatePicker.temp_range_showtime
307
- this.showTimes = this.DatePicker.temp_range_showtime
308
- } else {
309
- this.showTimes = !this.showTimes
310
- }
324
+ // if (this.mode == 'range') {
325
+ // this.DatePicker.temp_range_showtime = !this.DatePicker.temp_range_showtime
326
+ // this.showTimes = this.DatePicker.temp_range_showtime
327
+ // } else {
328
+ this.showTimes = !this.showTimes
329
+ // }
330
+ // if (this.showTimes) {
331
+ // this.$nextTick(() => {
332
+ // this.setTimeScroll()
333
+ // })
334
+ // }
311
335
  },
312
336
  setShowYear() {
313
337
  !this.showTimes && (this.showYears = !this.showYears)
314
338
  },
315
- setShowMonth(e) {
316
- e.stopPropagation()
317
- !this.showTimes && (this.showMonths = !this.showMonths)
318
- },
319
339
  setTime(v, t, e) {
320
340
  e.stopPropagation();
321
341
  if (e.target.className.indexOf('k-calendar-time-disabled') >= 0) {
@@ -344,11 +364,25 @@ export default {
344
364
  break;
345
365
  default: ;
346
366
  }
347
-
348
- this.setTimeScroll()
367
+ this.$nextTick(() => {
368
+ this.setTimeScroll()
369
+ })
370
+ },
371
+ setYMScroll() {
372
+ let year = new Date().getFullYear()
373
+ let y = this.years.indexOf(this.year || year)
374
+ let d = [y, this.month].map(x => x * 40)
375
+ let years = this.$refs.yearspicker
376
+ let month = this.$refs.monthspicker
377
+ animate({
378
+ draw: function (progress) {
379
+ years.scrollTop += progress * (d[0] - years.scrollTop)
380
+ month.scrollTop += progress * (d[1] - month.scrollTop)
381
+ }
382
+ })
349
383
  },
350
384
  setTimeScroll() {
351
- let d = [this.hour, this.minute, this.second].map(x => x * 24)
385
+ let d = [this.hour, this.minute, this.second].map(x => x * 32)
352
386
  let childs = this.$refs.timepicker.children;
353
387
  animate({
354
388
  draw: function (progress) {
@@ -358,76 +392,95 @@ export default {
358
392
  },
359
393
  setDate() {
360
394
  if (this.mode == 'range') {
361
- let values = this.DatePicker.currentValue;
395
+ let values = this.DatePicker.currentValue || [];
362
396
  let t1 = this.DatePicker.temp_range_left || values[0],
363
397
  t2 = this.DatePicker.temp_range_right || values[1];
364
398
  let date = t1 > t2 ? [t2, t1] : [t1, t2]
365
399
  this.$emit('input', date)
400
+ this.$emit('change', date)
366
401
  } else {
367
402
  let date = new Date(this.year, this.month, this.day, this.hour, this.minute, this.second)
368
403
  this.showTimes = false
369
- this.showMonths = false
370
404
  this.showYears = false
371
405
  this.currentValue = date
372
406
  this.$emit('input', date)
407
+ this.$emit('change', date)
373
408
  }
374
409
  },
375
- setToday() {
376
- this.currentValue = new Date()
410
+ setToday(e) {
411
+ let d = new Date()
412
+ this.currentValue = d
377
413
  this.updateStamp()
378
- this.setDate()
414
+ if (this.mode != 'range') {
415
+ this.setDate()
416
+ } else {
417
+ let { float } = this
418
+ this.hour = d.getHours()
419
+ this.minute = d.getMinutes()
420
+ this.second = d.getSeconds()
421
+ let j = {
422
+ y: d.getFullYear(),
423
+ m: d.getMonth(),
424
+ d: d.getDate(),
425
+ p: float == 'left',
426
+ n: float == 'right'
427
+ }
428
+ this.setDay(e, j)
429
+ }
379
430
  },
380
431
  nextYear() {
381
- let y = this.year + (this.showMonths ? 1 : 10)
432
+ let y = this.year + 10
382
433
  this.year = y
383
- this.setYears(y)
384
434
  },
385
435
  prevYear() {
386
- let y = this.year - (this.showMonths ? 1 : 10)
436
+ let y = this.year - 10
387
437
  this.year = y
388
- this.setYears(y)
438
+ },
439
+ back() {
440
+ this.showYears = false
441
+ this.showTimes = false
389
442
  }
390
443
  },
391
444
  mounted() {
392
445
  this.updateStamp()
393
446
  },
394
447
  render() {
395
- let { classes, year, month, day, hour, minute, second, showYears, showMonths, disabledDate,
448
+ let { classes, year, month, day, hour, minute, second, showYears, disabledDate, pickerSize,
396
449
  showTimes, getTime, mode, DatePicker, float, currentValue } = this
450
+ let small = pickerSize == 'small', btnSize = small ? 'small' : null;
397
451
  let isRange = mode == 'range', values = DatePicker.currentValue || [];
398
452
  let temp_left, temp_right;
399
453
  if (isRange) {
400
- showTimes = DatePicker.temp_range_showtime
454
+ // showTimes = DatePicker.temp_range_showtime
401
455
  temp_left = DatePicker.temp_range_left || values[0]
402
456
  temp_right = DatePicker.temp_range_right || values[1]
403
457
  }
404
458
 
405
- showMonths = showMonths || mode == 'month'
406
- showYears = showYears || mode == 'year'
459
+ showYears = showYears || mode == 'year' || mode == 'month'
407
460
  let months = t('k.datePicker.months');
408
461
  let weeks = t('k.datePicker.weeks');
409
- let showArrow = true
410
462
  //header
411
463
  let headNode = []
412
- if (!showTimes)
413
- headNode.push(<span class="k-calendar-prev-year-btn" onClick={this.prevYear}>«</span>)
414
- if ((!showYears && !showMonths && !showTimes))
415
- headNode.push(<span class="k-calendar-prev-month-btn" onClick={this.prevMonth}>‹</span>)
416
- headNode.push(<span class="k-calendar-year-select" onClick={this.setShowYear}>{year}{t('k.datePicker.year')}</span>)
417
- if (!showYears && !showMonths) {
418
- headNode.push(<span class="k-calendar-month-select" onClick={this.setShowMonth}>{months[month]}</span>)
464
+ if (!showTimes && !showYears) {
465
+ headNode.push(<Button icon="chevron-double-back-outline" size={btnSize} theme="normal" class="k-calendar-prev-year-btn" onClick={this.prevYear}></Button>)
466
+ headNode.push(<Button icon="chevron-back-outline" size={btnSize} theme="normal" class="k-calendar-prev-month-btn" onClick={this.prevMonth}></Button>)
467
+ } else if (mode != 'year' && mode != 'month') {
468
+ headNode.push(<Button class="k-calendar-back" size={btnSize} icon="chevron-back-outline" theme="normal" onClick={this.back}>{t('k.datePicker.back')} </Button>)
469
+ }
470
+ headNode.push(<Button class="k-calendar-year-select" size={btnSize} theme="normal" onClick={this.setShowYear}>{year}{t('k.datePicker.year')} {months[month]} {!showYears && showTimes ? day : ''}</Button>)
471
+ if (!showYears) {
419
472
  if (!showTimes)
420
- headNode.push(<span class="k-calendar-next-month-btn" onClick={this.nextMonth}>›</span>)
421
- else
422
- headNode.push(<span class="k-calendar-day-select">{day}{t('k.datePicker.day')}</span>)
473
+ headNode.push(<Button theme="normal" size={btnSize} icon="chevron-forward-outline" class="k-calendar-next-month-btn" onClick={this.nextMonth}></Button>)
474
+ // else
475
+ // headNode.push(<span class="k-calendar-day-select">{day}{t('k.datePicker.day')}</span>)
423
476
  }
424
- if (!showTimes)
425
- headNode.push(<span class="k-calendar-next-year-btn" onClick={this.nextYear}>»</span>)
477
+ if (!showTimes && !showYears)
478
+ headNode.push(<Button icon="chevron-double-forward-outline" size={btnSize} theme="normal" class="k-calendar-next-year-btn" onClick={this.nextYear}></Button>)
426
479
 
427
480
  //body
428
481
  const bodyNode = []
429
- if (mode == 'date' || isRange) {
430
- let weekNode = weeks.map(w => <span class="k-calendar-week" key={w}>{w}</span>)
482
+ if ((mode == 'date' || isRange) && !showYears && !showTimes) {
483
+ let weekNode = weeks.map(w => <span class="k-calendar-weekday" key={w}>{w}</span>)
431
484
  const getDay = (j, x) => {
432
485
  const props = {
433
486
  domProps: { innerHTML: j.d },
@@ -440,18 +493,28 @@ export default {
440
493
  }
441
494
  return <span {...props} />
442
495
  }
443
- let dayNode = this.days.map((j, x) => getDay(j, x))
444
- const daysNode = <div class="k-calendar-days">{weekNode}{dayNode}</div>
496
+ let wekday = [], temp = [];
497
+ this.days.forEach((j, x) => {
498
+ let d = getDay(j, x)
499
+ temp.push(d)
500
+ if ((x + 1) % 7 == 0) {
501
+ wekday.push(<div class="k-calendar-week">{temp}</div>)
502
+ temp = []
503
+ }
504
+ })
505
+ const daysNode = <div class="k-calendar-weeks">{wekday}</div>
506
+ const weeksNode = <div class="k-calendar-weekdays">{weekNode}</div>
507
+ bodyNode.push(weeksNode)
445
508
  bodyNode.push(daysNode)
446
509
  }
447
- if (showMonths) {
510
+ // console.log(showYears)
511
+ if (showYears) {
448
512
  const m = months.map((i, j) => <span key={i} class={classes(year, j, day, null, 'YYYYMM')} onClick={(e) => this.setMonth(e, j)}>{i}</span >)
449
- const mouthNode = <div class="k-calendar-months">{m}</div>
513
+ const mouthNode = <div class="k-calendar-months" ref="monthspicker">{m}</div>
450
514
  bodyNode.push(mouthNode)
451
- }
452
- if (showYears) {
453
- const y = this.years.map((i, j) => <span key={j} class={classes(i, month, day, (j == 0 || j == 11), 'YYYY')} onClick={(e) => this.setYear(e, i)}>{i}</span >)
454
- const yearNode = <div class="k-calendar-years">{y}</div>
515
+
516
+ const y = this.years.map((i, j) => <span key={j} class={classes(i, month, day, null, 'YYYY')} onClick={(e) => this.setYear(e, i)}>{i}</span >)
517
+ const yearNode = <div class="k-calendar-years" ref="yearspicker">{y}</div>
455
518
  bodyNode.push(yearNode)
456
519
  }
457
520
  //footer
@@ -475,22 +538,23 @@ export default {
475
538
  bodyNode.push(timeNode)
476
539
 
477
540
  }
478
- if ((this.showTime && !isRange) || (this.showTime && isRange && float == 'right')) {
541
+
542
+ if (this.showTime) {
479
543
  //footer
480
544
  // let disabled = moment()
481
545
  let disabled = disabledDate(new Date())
482
546
  let time_disabled = isRange ? !(temp_left && temp_right) : (!currentValue);
483
547
 
484
- !isRange && footerNode.push(<Button type="link" size='small' disabled={disabled} class="k-calendar-btn-today" onClick={this.setToday}>{t('k.datePicker.now')}</Button>)
485
- footerNode.push(<Button type="link" size="small" disabled={time_disabled} onClick={this.setShowTime}>{showTimes ? t('k.datePicker.selectDate') : t('k.datePicker.selectTime')}</Button>)
486
- footerNode.push(<Button type="primary" size='small' disabled={time_disabled} onClick={this.setDate}>{t('k.datePicker.ok')}</Button>)
548
+ footerNode.push(<Button theme="normal" size={btnSize} disabled={disabled} class="k-calendar-btn-today" onClick={this.setToday}>{t('k.datePicker.now')}</Button>)
549
+ footerNode.push(<Button theme="normal" size={btnSize} disabled={time_disabled} onClick={this.setShowTime}>{showTimes ? t('k.datePicker.selectDate') : t('k.datePicker.selectTime')}</Button>)
550
+ if (!isRange || float != 'left') footerNode.push(<Button type="primary" class="k-calendar-btn-ok" size={btnSize} disabled={time_disabled} onClick={this.setDate}>{t('k.datePicker.ok')}</Button>)
487
551
  } else if (mode == 'date') {
488
552
  let disabled = disabledDate(new Date())
489
- footerNode.push(<Button type="link" disabled={disabled} block size='small' onClick={this.setToday}>{t('k.datePicker.today')}</Button>)
553
+ footerNode.push(<Button theme="normal" size={btnSize} disabled={disabled} block onClick={this.setToday}>{t('k.datePicker.today')}</Button>)
490
554
  }
491
555
  footerNode = footerNode.length || (isRange && this.showTime) ? <div class="k-calendar-footer">{footerNode}</div> : null
492
556
  return (
493
- <div class="k-calendar">
557
+ <div class={['k-calendar', { 'k-calendar-small': small }]}>
494
558
  <div class="k-calendar-head">{headNode}</div>
495
559
  <div class="k-calendar-body">{bodyNode}</div>
496
560
  {footerNode}
@@ -17,6 +17,7 @@ export default {
17
17
  format: { type: String, default: 'YYYY-MM-DD' },
18
18
  clearable: { type: Boolean, default: true },
19
19
  bordered: { type: Boolean, default: true },
20
+ pickerSize: String,
20
21
  size: {
21
22
  default: 'default',
22
23
  validator(value) {
@@ -131,7 +132,7 @@ export default {
131
132
  // console.log(t('k.datePicker'))
132
133
  let { currentValue, placeholder, disabled, clearable,
133
134
  opened, size, label, transfer, bordered, theme, shape, dateIcon,
134
- format, mode, disabledTime, disabledDate, showTime
135
+ format, mode, disabledTime, disabledDate, showTime, pickerSize
135
136
  } = this
136
137
  let childNode = [], isRange = mode == 'range';
137
138
 
@@ -170,13 +171,13 @@ export default {
170
171
  currentValue = currentValue || []
171
172
  let v1 = currentValue[0] || '', v2 = currentValue[1] || '';
172
173
  let leftProps = {
173
- props: { format, mode, disabledTime, disabledDate, showTime, float: 'left', value: v1 },
174
+ props: { format, mode, disabledTime, disabledDate, showTime, float: 'left', value: v1, pickerSize },
174
175
  on: {
175
176
  input: e => this.updateValue(e)
176
177
  }
177
178
  }
178
179
  let rightProps = {
179
- props: { format, mode, disabledTime, disabledDate, showTime, float: 'right', value: v2 },
180
+ props: { format, mode, disabledTime, disabledDate, showTime, float: 'right', value: v2, pickerSize },
180
181
  on: {
181
182
  input: e => this.updateValue(e)
182
183
  }
@@ -185,7 +186,7 @@ export default {
185
186
  calendar.push(<Calendar {...leftProps} />, <Calendar {...rightProps} />)
186
187
  } else {
187
188
  const props = {
188
- props: { format, mode, disabledTime, disabledDate, showTime, value: currentValue },
189
+ props: { format, mode, disabledTime, disabledDate, showTime, value: currentValue, pickerSize },
189
190
  on: {
190
191
  input: e => {
191
192
  this.updateValue(e);
@@ -201,7 +202,7 @@ export default {
201
202
  transfer: transfer,
202
203
  selection: this.$el,
203
204
  value: this.opened,
204
- placement:'bottom-left',
205
+ placement: 'bottom-left',
205
206
  transitionName: 'k-date-picker'
206
207
  },
207
208
  on: {
@@ -7,10 +7,12 @@
7
7
  <template>
8
8
  <div>
9
9
  <DatePicker />
10
+ <DatePicker placeholder="小尺寸/Small" picker-size="small"/>
10
11
  <br/>
11
12
  <DatePicker mode="month" placeholder="请选择月份"/>
12
13
  <br/>
13
14
  <DatePicker mode="range" />
15
+ <DatePicker mode="range" picker-size="small" showTime/>
14
16
  </div>
15
17
  </template>
16
18
  ```
@@ -2,6 +2,7 @@
2
2
  import Info from './info'
3
3
  import Base from './base.md'
4
4
  import Theme from './theme.md'
5
+ import Inside from './inside.md'
5
6
  import Disabled from './disabled.md'
6
7
  import NoBorder from './noborder.md'
7
8
  import DisabledDate from './disabled-date.md'
@@ -16,6 +17,7 @@ export default {
16
17
  <Info class="typo" />
17
18
  <Base />
18
19
  <Theme />
20
+ <Inside />
19
21
  <Disabled />
20
22
  <NoBorder />
21
23
  <Format />