beyond-rails 0.0.222 → 0.0.227
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/src/js/components/LineChart.js +54 -7
- data/src/sass/_main.scss +19 -0
- data/src/sass/components/_btn.scss +20 -0
- data/src/sass/components/_table.scss +16 -0
- data/src/sass/layout/_col.scss +1 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4240bb4020f2fa8d7a190f8026ba1bc9434e0a20ccc545156ff5935ad174f76c
|
4
|
+
data.tar.gz: b0eef0c93430d3955695451c4db43fb350dfbd02afe9bf16e1a49d5df3f543e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b050adf27c9cf90bae213bd72144f227b2ff831c5c2b768380ee44473fa31f1b885032c66ff66c31874a78025a07f9f00238ced01ce861d68d644a2bd5f265a6
|
7
|
+
data.tar.gz: e763f9218b0ea16809f0ad13f6027b06758e26604789f85b44e54341a3ae88ff0027abc36b6a3edfb5f8d29c90794cd959bc809e820a5f4f907e8a3b1eab0f91
|
@@ -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 =
|
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
|
-
|
295
|
+
let x = this.xAxisMiddle
|
275
296
|
|
276
|
-
|
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
|
-
|
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
|
-
|
511
|
-
|
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
|
})
|
data/src/sass/_main.scss
CHANGED
@@ -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;
|
@@ -97,6 +97,11 @@
|
|
97
97
|
@include ripple(48px, 0, 0);
|
98
98
|
}
|
99
99
|
|
100
|
+
.btn.btn-outline,
|
101
|
+
a.btn.btn-outline {
|
102
|
+
color: $text-color;
|
103
|
+
}
|
104
|
+
|
100
105
|
.btn.btn-outline {
|
101
106
|
background-color: #fff;
|
102
107
|
font-size: 13px;
|
@@ -186,3 +191,18 @@ button.close {
|
|
186
191
|
color: #fff;
|
187
192
|
}
|
188
193
|
}
|
194
|
+
|
195
|
+
.btn-file {
|
196
|
+
position: relative;
|
197
|
+
input[type="file"] {
|
198
|
+
position: absolute;
|
199
|
+
top: 0;
|
200
|
+
right: 0;
|
201
|
+
left: 0;
|
202
|
+
bottom: 0;
|
203
|
+
width: 100%;
|
204
|
+
padding: 0;
|
205
|
+
margin: 0;
|
206
|
+
opacity: 0;
|
207
|
+
}
|
208
|
+
}
|
@@ -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
|
}
|
data/src/sass/layout/_col.scss
CHANGED
@@ -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-#{$
|
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.
|
4
|
+
version: 0.0.227
|
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-
|
12
|
+
date: 2020-10-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sassc
|