beyond-rails 0.0.272 → 0.0.273

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90e90e6f38c45540cbedb5ccc0341459c5a9a210d27c472aa97b340a4b2d9814
4
- data.tar.gz: 34f2a1783e2c88888e782bdb42517d0a53b2dd6505a69542519aac2689e20d2c
3
+ metadata.gz: c04ff681a69cc5fa1390b5604f9a688b755cd9f777a7e7dec03233926f02d64e
4
+ data.tar.gz: d1e29eac5f98b4a9756df1b782ae0e25ac1362ff56c0a8727f2462f98da04227
5
5
  SHA512:
6
- metadata.gz: 355b5f4412816e6219309c12a2b9a779920bb9e1dda4a1c65827efddad7a51dcc20cac7fafea460fe48f7550a28b44741f7f13112d9f6d265718d1587980bd38
7
- data.tar.gz: da9e828f1ecc04b2398ff6418da097a88895454f5cc24d0e9c935cacfcc5cc0da10d4b0417e1f232e61e5765cd5c627cc31404719ba995ade2d430d5a8ce7716
6
+ metadata.gz: 7d23e149d907d36fe563a10722de5ea0c82ae4ee59cf5a556d2a6dc9b43ffb5e9160677eb4f01b65d5c6af25ddfca0725ad1fbfaaac920ddaddc71bd02467768
7
+ data.tar.gz: 1de47922ab5d2db2c2219c42cf79d0c91a6e068a151bb7778bcc595734443549b993675300aa107685078124f7c596d74cc1667b7382632c4a8d299b1fddb7d9
@@ -12,12 +12,13 @@ import {
12
12
  getDaysInMonth,
13
13
  getMonth,
14
14
  getYear,
15
- throttle,
15
+ isFuture,
16
16
  range,
17
17
  set,
18
18
  startOfDay,
19
19
  startOfMonth,
20
20
  subMonths,
21
+ throttle,
21
22
  toPixel,
22
23
  format
23
24
  } from '../utils'
@@ -46,6 +47,7 @@ export default class DateMenu {
46
47
  this.endDate = endDate
47
48
  this.hoveredCellData = null
48
49
  this.options = options
50
+ this.noFuture = options.noFuture || false
49
51
  this.tz = options.tz || DEFAULT_TIMEZONE
50
52
  this.locale = options.locale || DEFAULT_LOCALE
51
53
  this.captionPattern = options.captionPattern || 'yyyy MMMM'
@@ -74,7 +76,7 @@ export default class DateMenu {
74
76
 
75
77
  getTableRows(date) {
76
78
 
77
- const { startDate, endDate } = this
79
+ const { noFuture, startDate, endDate } = this
78
80
 
79
81
  const daysInMonth = getDaysInMonth(date)
80
82
  const firstDateOfMonth = startOfMonth(date)
@@ -118,6 +120,7 @@ export default class DateMenu {
118
120
  isStartDate: dateEq(initialStartDate, d),
119
121
  isEndDate: dateEq(initialEndDate, d),
120
122
  isSelected: (resCompareStart <= 0) && (resCompareEnd >= 0),
123
+ isDisabled: noFuture && isFuture(d),
121
124
  isToday: (today === formatDate(d)),
122
125
  day
123
126
  }
@@ -191,6 +194,9 @@ export default class DateMenu {
191
194
  if (row.type === CELL_TYPE_EMPTY) {
192
195
  return '<td></td>'
193
196
  }
197
+ if (row.isDisabled) {
198
+ return `<td class="cell js-disabled">${row.day}</td>`
199
+ }
194
200
  if (row.isStartDate || row.isEndDate) {
195
201
  return `<td class="cell selected-ex" data-date-table-cell>${row.day}</td>`
196
202
  }
@@ -70,6 +70,10 @@
70
70
  border-style: solid;
71
71
  border-color: #e3e8ee;
72
72
  }
73
+ &.cell.js-disabled {
74
+ opacity: .4;
75
+ cursor: not-allowed;
76
+ }
73
77
  &.cell.today {
74
78
  background-color: #fffef4;
75
79
  }
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.272
4
+ version: 0.0.273
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-12-15 00:00:00.000000000 Z
12
+ date: 2020-12-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sassc