beyond-rails 0.0.269 → 0.0.274

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d41b21a153a6a43a56575b0cde527fe030b9c31e2323729259bcfd8b869a049
4
- data.tar.gz: 408fcaaf73bd21fa7dfb52b3faa42ff44c8fda0247e7cc6b8792f82003d53f7e
3
+ metadata.gz: '019b06ed5825f1ea7d525d647ba1f118d676a311ebf6c5ff652074d43b2bcf75'
4
+ data.tar.gz: 24e79142445705b4ec67ef98f068b98b219bdfae0b0434e54d3e4bc100c95c9d
5
5
  SHA512:
6
- metadata.gz: 3dfe20d9ce4b0b86fe30da9c85f7edab753264fcfb386b16433370a44b7748c9d39f377421f83b07b03e395b085323174fc4929e60e24422cf708f43d5e0fba6
7
- data.tar.gz: afead4a051571df239994f0f1680f7caea17f63d741b28bbd22aa29275a541527927112ed8bb02c986a81bc87c5ef3e6d81fbd4dbc3da3330f2f7f422678c0ce
6
+ metadata.gz: fbffbf93644151d9efb3ffa39adcf053234e78eeefaf441336e295adff02277239b6a6464993d2fa891b9ffb8acf6476eca915ebb550f033b77d67717d4dd5a8
7
+ data.tar.gz: 000f1dfd749a56f479de5765897cfa20edf97cae9320ffbee308e742d434e6c24ad72b62e2979cd2445250e6441de34299e808af99e170445998ba3c1841ca84
@@ -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
  }
@@ -247,17 +247,10 @@ export default class SearchDropdown {
247
247
  return Array.from(this.menuContent.querySelectorAll('[data-item]'))
248
248
  }
249
249
 
250
- findClickedItem(target, parent) {
251
- const rows = this.getMenuItemEls()
252
- let node = target
253
- while (node.parentNode !== parent) {
254
- if ('item' in node.dataset) {
255
- const index = rows.findIndex(row => row === node)
256
- return this.items[index]
257
- }
258
- node = node.parentNode
259
- }
260
- return null
250
+ findClickedItem(target) {
251
+ const index = this.getMenuItemEls()
252
+ .findIndex(item => (target === item) || (item.contains(target)))
253
+ return this.items[index]
261
254
  }
262
255
 
263
256
  isInputFocused() {
@@ -170,6 +170,11 @@ export default class TagInput {
170
170
  const { input, suggestInput } = this
171
171
  const inputValue = suggestInput.value || input.value
172
172
  const res = await this.validate(inputValue)
173
+ if (res.clear) {
174
+ input.value = ''
175
+ suggestInput.value = ''
176
+ return
177
+ }
173
178
  if (! res.isTag) {
174
179
  return this.shake()
175
180
  }
@@ -243,7 +248,7 @@ export default class TagInput {
243
248
 
244
249
  destroy() {
245
250
  this.tags.forEach(tag => tag.remove())
246
- this.inputDiv.remove()
251
+ this.inputDiv && this.inputDiv.remove()
247
252
  this.canvas = null
248
253
  this.input = null
249
254
  this.suggestInput = null
@@ -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.269
4
+ version: 0.0.274
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-08 00:00:00.000000000 Z
12
+ date: 2020-12-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sassc