beyond-rails 0.0.249 → 0.0.250
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/src/js/components/MonthMenu.js +16 -2
- data/src/js/components/Monthpicker.js +3 -1
- data/src/js/utils/index.js +2 -0
- data/src/sass/components/_month-menu.scss +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 322787a4c8946f84a187c1d8a6f61ae484e197a5295c872f63aa5cbc7ed43f91
|
4
|
+
data.tar.gz: 64d4fd67dd0c18f3441e3bc09d5d57c4ccb518e2368c5318a7654a025c97a7e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 787409b5d76b822cc1cb20494c71892c48a4277edc0de48f70ccaba4180ccb473f4c88d09cb988015cf3355c9a0e3f48e48f09a439edeb76f5266c104e6f7e11
|
7
|
+
data.tar.gz: db95d7c2437ddebab2e7da69ce48c88fc612b4fc72784ec83cc800ed138339fff8db27a54cc7b8743d2c3175066748b6c069b41832d063dd30bb0feec98a1b3d
|
@@ -6,6 +6,7 @@ import {
|
|
6
6
|
chunk,
|
7
7
|
format,
|
8
8
|
range,
|
9
|
+
isFuture,
|
9
10
|
setYear,
|
10
11
|
setMonth,
|
11
12
|
getYear,
|
@@ -27,6 +28,7 @@ export default class MonthMenu {
|
|
27
28
|
this.options = options
|
28
29
|
this.tz = options.tz || DEFAULT_TIMEZONE
|
29
30
|
this.locale = options.locale || DEFAULT_LOCALE
|
31
|
+
this.noFuture = options.noFuture || true
|
30
32
|
this.change = options.change || noop
|
31
33
|
this.isVisible = false
|
32
34
|
this.loopIndex = 0
|
@@ -39,7 +41,7 @@ export default class MonthMenu {
|
|
39
41
|
}
|
40
42
|
|
41
43
|
renderTableContent() {
|
42
|
-
const { date, menuDate, locale } = this
|
44
|
+
const { date, menuDate, locale, noFuture } = this
|
43
45
|
|
44
46
|
const currentYear = date ? getYear(date) : null
|
45
47
|
const currentMonth = date ? getMonth(date) : null
|
@@ -52,7 +54,15 @@ export default class MonthMenu {
|
|
52
54
|
|
53
55
|
const isCurrentMonth = (currentYear === getYear(d)) && (currentMonth === getMonth(d))
|
54
56
|
|
55
|
-
|
57
|
+
let classname = 'cell'
|
58
|
+
|
59
|
+
if (isCurrentMonth) {
|
60
|
+
classname = 'cell selected-ex'
|
61
|
+
}
|
62
|
+
else if (noFuture && isFuture(d)) {
|
63
|
+
classname = 'cell js-disabled'
|
64
|
+
}
|
65
|
+
|
56
66
|
return `<td class="${classname}" data-month-td="${month}">${text}</td>`
|
57
67
|
}).join('')
|
58
68
|
return `<tr>${tds}</tr>`
|
@@ -201,6 +211,10 @@ export default class MonthMenu {
|
|
201
211
|
const year = getYear(this.menuDate)
|
202
212
|
const month = parseInt(target.dataset.monthTd, 10)
|
203
213
|
|
214
|
+
if (target.classList.contains('js-disabled')) {
|
215
|
+
return
|
216
|
+
}
|
217
|
+
|
204
218
|
if (! this.date) {
|
205
219
|
this.date = new Date(this.menuDate.getTime())
|
206
220
|
}
|
@@ -15,6 +15,7 @@ export default class Monthpicker {
|
|
15
15
|
|
16
16
|
this.options = options
|
17
17
|
this.backdropMode = options.backdropMode || 'auto'
|
18
|
+
this.noFuture = options.noFuture || true
|
18
19
|
this.change = options.change || noop
|
19
20
|
this.init()
|
20
21
|
}
|
@@ -32,7 +33,8 @@ export default class Monthpicker {
|
|
32
33
|
this.monthInput.setDate(date)
|
33
34
|
this.monthInput.clearStatus()
|
34
35
|
this.monthMenu.hide()
|
35
|
-
}
|
36
|
+
},
|
37
|
+
noFuture: this.noFuture
|
36
38
|
})
|
37
39
|
this.addEvents()
|
38
40
|
}
|
data/src/js/utils/index.js
CHANGED
@@ -29,6 +29,7 @@ import startOfDay from 'date-fns/startOfDay'
|
|
29
29
|
import startOfMonth from 'date-fns/startOfMonth'
|
30
30
|
import subMonths from 'date-fns/subMonths'
|
31
31
|
import toDate from 'date-fns/toDate'
|
32
|
+
import isFuture from 'date-fns/isFuture'
|
32
33
|
import { format } from 'date-fns-tz'
|
33
34
|
|
34
35
|
// lodash
|
@@ -75,6 +76,7 @@ export {
|
|
75
76
|
startOfMonth,
|
76
77
|
subMonths,
|
77
78
|
toDate,
|
79
|
+
isFuture,
|
78
80
|
format,
|
79
81
|
|
80
82
|
// lodash
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beyond-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.250
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kmsheng
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-11-
|
12
|
+
date: 2020-11-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sassc
|