beyond-rails 0.0.221 → 0.0.226

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: fcaf483b7501fa330c379d3c95aa48b0b03a919779f826d3de924419712ef5a7
4
- data.tar.gz: 7261373eabc32b8320c6dfb103191af62f58c184591c2be03640ea7d92578d82
3
+ metadata.gz: 6fe2004947bfbece8fa387026c40c31985d67b4de2fc8898dceb8d3691c7fbf9
4
+ data.tar.gz: '0182a586b22fd35847e4339c944dea67ee0a2f9057f4cc7e6384034d1c65cd44'
5
5
  SHA512:
6
- metadata.gz: 386edb5bdf6ccf290a4d471004fd457c61d5ec63b67d0ef0c032e513b9a9b3d0dbff099e4ddca788940bd4e4f14fcca894410a0e1169279edf168a45f55a6f67
7
- data.tar.gz: b09ce56ee589e899f5fe66294fc09fe385e6b4ecc2e5ecebecec786e91b729a43957e59628c1a9a45e0cc0189993ed2f0a51731fd466d3357d9039edb13ee56a
6
+ metadata.gz: 4800cdd8e025687e8d85c9a0445ef1fbd2e494bd99163defdbada82c6ec9b55822bea288fb15056250e5cb384a0254c1ff0ceb047b535ba3084d2700c8914987
7
+ data.tar.gz: f7ae8ead35cbcd39956223080bd08892d757ccb95f8f904dedcc523d60d53ca537b0be857e7e9dabe97be4ba2a90cc21a01f021a1aadf76e9e2f45eeee16750d
@@ -83,6 +83,10 @@ export default class LineChart {
83
83
  this.bindPointMouseOver()
84
84
  }
85
85
 
86
+ get noData() {
87
+ return (this.xLabelRows.length === 0) && (this.yLabelRows.length === 0)
88
+ }
89
+
86
90
  get contentWidth() {
87
91
  return this.width - (this.xPadding * 2) - this.yLabelMargin -
88
92
  this.yLabelWidth - (this.xLabelWidth / 2)
@@ -130,6 +134,10 @@ export default class LineChart {
130
134
  return this.xAxisStart + this.contentWidth
131
135
  }
132
136
 
137
+ get xAxisMiddle() {
138
+ return (this.xAxisEnd - this.xAxisStart) / 2
139
+ }
140
+
133
141
  get xRatio() {
134
142
  const lineWidth = this.xAxisEnd - this.xAxisStart
135
143
  const xDelta = this.lastX - this.firstX
@@ -145,6 +153,10 @@ export default class LineChart {
145
153
  return this.yAxisStart - this.contentHeight
146
154
  }
147
155
 
156
+ get yAxisMiddle() {
157
+ return (this.yAxisStart - this.yAxisEnd) / 2
158
+ }
159
+
148
160
  get yRatio() {
149
161
  const lineHeight = this.yAxisStart - this.yAxisEnd
150
162
  const yDelta = Math.abs(this.lastY - this.firstY)
@@ -200,8 +212,17 @@ export default class LineChart {
200
212
  ctx.lineWidth = 2
201
213
 
202
214
  this.pointsArr.forEach((points, i) => {
215
+ const style = lineStyles[i] ? lineStyles[i] : '#000'
216
+
217
+ // only one point in a line
218
+ if (points.length === 1) {
219
+ const pos = pointPosMap.get(points[0])
220
+ this.fillCircle(ctx, pos.x, pos.y, 2, style)
221
+ return
222
+ }
223
+
203
224
  ctx.beginPath()
204
- ctx.strokeStyle = lineStyles[i] ? lineStyles[i] : '#000'
225
+ ctx.strokeStyle = style
205
226
  points.forEach(p => {
206
227
  const pos = pointPosMap.get(p)
207
228
  ctx.lineTo(pos.x, pos.y)
@@ -271,10 +292,13 @@ export default class LineChart {
271
292
 
272
293
  ctx.strokeStyle = '#3c4257'
273
294
 
274
- xLabelRows.forEach((row, i) => {
295
+ let x = this.xAxisMiddle
275
296
 
276
- const x = xAxisStart + ((row.value - firstX) / xRatio)
297
+ xLabelRows.forEach((row, i) => {
277
298
 
299
+ if (xRatio !== 0) {
300
+ x = xAxisStart + ((row.value - firstX) / xRatio)
301
+ }
278
302
  ctx.beginPath()
279
303
  ctx.moveTo(x, scaleStart)
280
304
  ctx.lineTo(x, scaleEnd)
@@ -293,8 +317,12 @@ export default class LineChart {
293
317
  ctx.fillStyle = '#3c4257'
294
318
  ctx.textAlign = 'right'
295
319
 
320
+ let y = this.yAxisMiddle
321
+
296
322
  yLabelRows.forEach(row => {
297
- const y = yAxisStart - ((row.value - firstY) / yRatio)
323
+ if (yRatio !== 0) {
324
+ y = yAxisStart - ((row.value - firstY) / yRatio)
325
+ }
298
326
  ctx.fillText(row.label, x, y - halfYLabelHeight)
299
327
  })
300
328
  }
@@ -445,8 +473,13 @@ export default class LineChart {
445
473
  this.setLabelHeights()
446
474
  this.setAxisData()
447
475
  this.updateLabelSizeForAutoStep()
476
+
477
+ if (this.noData) {
478
+ return this.raf(() => this.clear())
479
+ }
480
+
448
481
  this.setPointPos()
449
- this.draw()
482
+ this.raf(() => this.draw())
450
483
  })
451
484
  }
452
485
 
@@ -498,6 +531,10 @@ export default class LineChart {
498
531
  this.setLabelHeights()
499
532
  this.setAxisData()
500
533
  this.updateLabelSizeForAutoStep()
534
+
535
+ if (this.noData) {
536
+ return this.raf(() => this.clear())
537
+ }
501
538
  this.setPointPos()
502
539
  this.raf(() => this.draw())
503
540
  }
@@ -505,10 +542,20 @@ export default class LineChart {
505
542
  setPointPos() {
506
543
  const { firstX, firstY, pointPosMap, xAxisStart, xRatio, yAxisStart, yRatio } = this
507
544
 
545
+ // edge case: only one point
546
+ let x = this.xAxisMiddle
547
+ let y = this.yAxisMiddle
548
+
508
549
  this.pointsArr.forEach((points, i) => {
509
550
  points.forEach(point => {
510
- const x = xAxisStart + ((point.x - firstX) / xRatio)
511
- const y = yAxisStart - ((point.y - firstY) / yRatio)
551
+
552
+ if (xRatio !== 0) {
553
+ x = xAxisStart + ((point.x - firstX) / xRatio)
554
+ }
555
+ if (yRatio !== 0) {
556
+ y = yAxisStart - ((point.y - firstY) / yRatio)
557
+ }
558
+
512
559
  const pos = { x, y }
513
560
  pointPosMap.set(point, pos)
514
561
  })
@@ -131,6 +131,16 @@ $color-active: #5469d4;
131
131
  text-align: center !important;
132
132
  }
133
133
 
134
+ .float-left {
135
+ float: left !important;
136
+ }
137
+ .float-right {
138
+ float: right !important;
139
+ }
140
+ .float-none {
141
+ float: none !important;
142
+ }
143
+
134
144
  .sr-only {
135
145
  position: absolute;
136
146
  width: 1px;
@@ -143,6 +153,15 @@ $color-active: #5469d4;
143
153
  border: 0;
144
154
  }
145
155
 
156
+ hr {
157
+ margin-top: 20px;
158
+ margin-bottom: 20px;
159
+ border-top: 1px solid #e3e8ee;
160
+ border-left: 0;
161
+ border-right: 0;
162
+ border-bottom: 0;
163
+ }
164
+
146
165
  input[type=file], /* FF, IE7+, chrome (except button) */
147
166
  input[type=file]::-webkit-file-upload-button { /* chromes and blink button */
148
167
  cursor: pointer;
@@ -90,27 +90,27 @@
90
90
 
91
91
  .#{$classname} {
92
92
  @if $side == '' {
93
- #{$prop}: $space;
93
+ #{$prop}: $space !important;
94
94
  }
95
95
  @else if $side == 't' {
96
- #{$prop}-top: $space;
96
+ #{$prop}-top: $space !important;
97
97
  }
98
98
  @else if $side == 'b' {
99
- #{$prop}-bottom: $space;
99
+ #{$prop}-bottom: $space !important;
100
100
  }
101
101
  @else if $side == 'l' {
102
- #{$prop}-left: $space;
102
+ #{$prop}-left: $space !important;
103
103
  }
104
104
  @else if $side == 'r' {
105
- #{$prop}-right: $space;
105
+ #{$prop}-right: $space !important;
106
106
  }
107
107
  @else if $side == 'x' {
108
- #{$prop}-left: $space;
109
- #{$prop}-right: $space;
108
+ #{$prop}-left: $space !important;
109
+ #{$prop}-right: $space !important;
110
110
  }
111
111
  @else if $side == 'y' {
112
- #{$prop}-top: $space;
113
- #{$prop}-bottom: $space;
112
+ #{$prop}-top: $space !important;
113
+ #{$prop}-bottom: $space !important;
114
114
  }
115
115
  @else {
116
116
  @error "Unknown side #{$side}.";
@@ -186,3 +186,18 @@ button.close {
186
186
  color: #fff;
187
187
  }
188
188
  }
189
+
190
+ .btn-file {
191
+ position: relative;
192
+ input[type="file"] {
193
+ position: absolute;
194
+ top: 0;
195
+ right: 0;
196
+ left: 0;
197
+ bottom: 0;
198
+ width: 100%;
199
+ padding: 0;
200
+ margin: 0;
201
+ opacity: 0;
202
+ }
203
+ }
@@ -4,6 +4,14 @@
4
4
  overflow-x: auto;
5
5
  -webkit-overflow-scrolling: touch;
6
6
  }
7
+
8
+ %disabled-td {
9
+ cursor: not-allowed;
10
+ background-color: #ddd;
11
+ color: #333;
12
+ box-shadow: inset 0 -1px #c7c7c7;
13
+ }
14
+
7
15
  .table {
8
16
  width: 100%;
9
17
  margin-bottom: 1rem;
@@ -51,6 +59,11 @@
51
59
  padding: 7px;
52
60
  box-shadow: inset 0 -1px #e3e8ee;
53
61
  }
62
+ tr.disabled {
63
+ > td {
64
+ @extend %disabled-td;
65
+ }
66
+ }
54
67
  tr {
55
68
  transition: .3s all;
56
69
  }
@@ -61,5 +74,8 @@
61
74
  tr:nth-child(even) td {
62
75
  background-color: #f7fafc;
63
76
  }
77
+ tr.disabled:nth-child(even) td {
78
+ @extend %disabled-td;
79
+ }
64
80
  }
65
81
  }
@@ -49,13 +49,12 @@
49
49
  }
50
50
 
51
51
  @for $i from 1 through length($breakpoints) {
52
- $breakpoint: nth($breakpoints, $i);
53
52
  $size: nth($screen-sizes, $i);
54
53
  .col-#{$size} {
55
54
  @extend %col-basic;
56
55
  }
57
56
  @for $j from 1 through $col-total {
58
- .col-#{$i},
57
+ .col-#{$j},
59
58
  .col-#{$size}-#{$j} {
60
59
  @extend %col-basic;
61
60
  }
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.221
4
+ version: 0.0.226
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-10-05 00:00:00.000000000 Z
12
+ date: 2020-10-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sassc