beyond-rails 0.0.274 → 0.0.280

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: '019b06ed5825f1ea7d525d647ba1f118d676a311ebf6c5ff652074d43b2bcf75'
4
- data.tar.gz: 24e79142445705b4ec67ef98f068b98b219bdfae0b0434e54d3e4bc100c95c9d
3
+ metadata.gz: a38b5de8421d706a385ccebb6032d1fa306d5c975ed677dc10fd8d9c06e593b4
4
+ data.tar.gz: c1c622ec7af60ba0a2122d31c6220a899cb528aeb728be883cd66540edb4441c
5
5
  SHA512:
6
- metadata.gz: fbffbf93644151d9efb3ffa39adcf053234e78eeefaf441336e295adff02277239b6a6464993d2fa891b9ffb8acf6476eca915ebb550f033b77d67717d4dd5a8
7
- data.tar.gz: 000f1dfd749a56f479de5765897cfa20edf97cae9320ffbee308e742d434e6c24ad72b62e2979cd2445250e6441de34299e808af99e170445998ba3c1841ca84
6
+ metadata.gz: ffc1c3a27cbcfb636150b2c1d621342d5e171d5b87bec8dcd6132894dc6be1e33bd0fc64c5184eaf7d810fb74353d615a3d458aba9079015e3d4faa0cdce352d
7
+ data.tar.gz: 207893d015edba194e178cf3ea00e81cf1c9c3431b4cf647f3284e8e3920c2421b888b73639a429c599544a9bd1983793e4289fd896023face3538c0965183a5
@@ -11,8 +11,11 @@ export default class Btn {
11
11
  }
12
12
 
13
13
  showLoader() {
14
+ if (this.loading) {
15
+ return
16
+ }
14
17
  const { dom } = this
15
- this._innerHtml = dom.innerHTML
18
+ this.innerHtml = dom.innerHTML
16
19
  dom.style.height = toPixel(dom.offsetHeight)
17
20
  dom.style.width = toPixel(dom.offsetWidth)
18
21
  dom.innerHTML = `
@@ -28,14 +31,23 @@ export default class Btn {
28
31
  }
29
32
 
30
33
  hideLoader() {
34
+
35
+ if (! this.loading) {
36
+ return
37
+ }
31
38
  const { dom } = this
32
39
  dom.style.removeProperty('width')
33
40
  dom.style.removeProperty('height')
34
- dom.innerHTML = this._innerHtml
41
+
42
+ const { innerHtml } = this
43
+
44
+ if (innerHtml) {
45
+ dom.innerHTML = innerHtml
46
+ }
35
47
  }
36
48
 
37
49
  setLoading(loading) {
38
- this.loading = loading
39
50
  loading ? this.showLoader() : this.hideLoader()
51
+ this.loading = loading
40
52
  }
41
53
  }
@@ -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,
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.274
4
+ version: 0.0.280
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-31 00:00:00.000000000 Z
12
+ date: 2021-01-26 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.