beyond-rails 0.0.272 → 0.0.278

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: 90e90e6f38c45540cbedb5ccc0341459c5a9a210d27c472aa97b340a4b2d9814
4
- data.tar.gz: 34f2a1783e2c88888e782bdb42517d0a53b2dd6505a69542519aac2689e20d2c
3
+ metadata.gz: 357f7181d6ead420e1734b599acbc3fdf635fcf665be35bbb26e37796e6d3eb5
4
+ data.tar.gz: 58958b9fe36351364410b06c08822e1963f8bd02ee9a46bfab08353a1ef9d24a
5
5
  SHA512:
6
- metadata.gz: 355b5f4412816e6219309c12a2b9a779920bb9e1dda4a1c65827efddad7a51dcc20cac7fafea460fe48f7550a28b44741f7f13112d9f6d265718d1587980bd38
7
- data.tar.gz: da9e828f1ecc04b2398ff6418da097a88895454f5cc24d0e9c935cacfcc5cc0da10d4b0417e1f232e61e5765cd5c627cc31404719ba995ade2d430d5a8ce7716
6
+ metadata.gz: be99024014dda5554c501d5ac151e91a3107d92970f16de660154124b091e384f9d463a2899ec498d5f255aacdd3050ebd5c1e9f8c23b325a42019f0c6049689
7
+ data.tar.gz: 2af808b2f3510ce0901ec556a2ea3b19edd8a73e7e65dd511d19c8e81ade97f04dac88adc715d94f113ca0bc42d3a61393dd7196f829201deb86fa5781388a7d
@@ -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
  }
@@ -63,7 +63,12 @@ export default class Datepicker {
63
63
  this.focused = true
64
64
  this.clearInputStatus()
65
65
  this.dateInput.setActive(true)
66
- this.dateMenu.setDate({ date: this.menuDate })
66
+
67
+ this.dateMenu.setDate({
68
+ date: this.menuDate,
69
+ startDate: this.date
70
+ })
71
+
67
72
  this.dateMenu.show(this.dom)
68
73
  this.timeMenu && this.timeMenu.hide()
69
74
  }
@@ -88,7 +93,8 @@ export default class Datepicker {
88
93
  return
89
94
  }
90
95
 
91
- const res = parse(value, dateInput.datePattern, date)
96
+ const res = parse(value, dateInput.datePattern, date || new Date())
97
+
92
98
  this.nextDate = null
93
99
  if (res.toString() === 'Invalid Date') {
94
100
  return dateInput.setDanger(true)
@@ -107,16 +113,17 @@ export default class Datepicker {
107
113
  handleDateInputBlur() {
108
114
  const { nextDate, date, dateInput } = this
109
115
 
110
- if (date === null) {
116
+ if ((date === null) && (nextDate === null)) {
111
117
  dateInput.setDate(null)
112
118
  this.timeInput && this.timeInput.setDate(null)
113
119
  this._blurTimer = setTimeout(() => this.emitChange(), 50)
114
120
  }
115
121
  else if (nextDate) {
116
122
  this.date = nextDate
123
+ this.menuDate = nextDate
117
124
  dateInput.setDate(nextDate)
118
- this.dateMenu.setDate({ startDate: nextDate })
119
125
  this.nextDate = null
126
+ this.emitChange()
120
127
  }
121
128
  else {
122
129
  dateInput.setDate(date)
@@ -16,6 +16,7 @@ export default class PieChart {
16
16
  this.total = 0
17
17
 
18
18
  this.options = options
19
+ this.labelVisible = isDef(options.labelVisible) ? options.labelVisible : true
19
20
  this.height = options.height
20
21
  this.width = options.width
21
22
  this.padding = isDef(options.padding) ? options.padding : 30
@@ -236,8 +237,10 @@ export default class PieChart {
236
237
  this.total = data.reduce((t, row) => t + row.value, 0)
237
238
  this.data = this.setAngles(data)
238
239
  this.raf(() => {
239
- const labels = this.data.map(row => row.label)
240
- this.drawLabels(labels, this.styles)
240
+ if (this.labelVisible) {
241
+ const labels = this.data.map(row => row.label)
242
+ this.drawLabels(labels, this.styles)
243
+ }
241
244
  this.draw()
242
245
  })
243
246
  }
@@ -26,6 +26,7 @@ export default class SearchDropdown {
26
26
  this.offsetTop = options.offsetTop || 0
27
27
  this.offsetLeft = options.offsetLeft || 0
28
28
  this.noDataMsg = options.noDataMsg || '沒有資料'
29
+ this.getFloatedTargetPos = options.getFloatedTargetPos || getFloatedTargetPos
29
30
  this.isMenuVisible = false
30
31
  this.lastKeyword = null
31
32
  this.selectedIndex = 0
@@ -164,7 +165,7 @@ export default class SearchDropdown {
164
165
 
165
166
  adjustMenuPos() {
166
167
  const { menu, dom, offset, offsetLeft, offsetTop } = this
167
- const { pos, place, align } = getFloatedTargetPos({
168
+ const { pos, place, align } = this.getFloatedTargetPos({
168
169
  src: dom,
169
170
  target: menu,
170
171
  place: this.place,
@@ -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.278
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: 2021-01-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sassc
@@ -288,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
288
288
  - !ruby/object:Gem::Version
289
289
  version: '0'
290
290
  requirements: []
291
- rubygems_version: 3.0.8
291
+ rubygems_version: 3.0.9
292
292
  signing_key:
293
293
  specification_version: 4
294
294
  summary: beyond is a collection of frontend components which aims for admin website.