beyond-rails 0.0.223 → 0.0.228
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/src/js/components/Dropdown.js +27 -5
- data/src/js/components/LineChart.js +54 -7
- data/src/sass/_main.scss +9 -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: d82d76600a18e4dddf1f90ec992290bc8a69926b5c692078f61d80bb0e68848f
|
4
|
+
data.tar.gz: 6619b2c4e47a4f7c05527ef852326c83a2d6d8049d0fb1db55156d701986874e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bcf523d47193022e785bf994ce5a186683211fa1afd5007cdf31699fb9d6d0ff53bdc81b1fde8edd0511c17b2bc51c657c28da4cf9d0b4576b1786f7fee5cd8
|
7
|
+
data.tar.gz: 54c2534a83ffb83f4281920d1fa2d7a688beda57168282ce253bc53afb48df596121dfb04b05cf611adc26e99c6e089b09d233d4ec3d9873260b38faca752160
|
@@ -51,15 +51,28 @@ export default class Dropdown {
|
|
51
51
|
this.addEvents()
|
52
52
|
}
|
53
53
|
|
54
|
-
|
54
|
+
restoreMenuAttrs() {
|
55
|
+
const { menu, place, align } = this
|
56
|
+
if (place) {
|
57
|
+
menu.dataset.place = place
|
58
|
+
}
|
59
|
+
if (align) {
|
60
|
+
menu.dataset.align = align
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
hideMenu(immediate = false) {
|
55
65
|
const { menu } = this
|
56
66
|
menu.style.transform = 'scale(.8)'
|
57
67
|
menu.style.opacity = 0
|
58
|
-
setTimeout(() => menu.remove(), 300)
|
59
68
|
|
60
|
-
|
61
|
-
|
62
|
-
|
69
|
+
if (immediate) {
|
70
|
+
menu.remove()
|
71
|
+
}
|
72
|
+
else {
|
73
|
+
setTimeout(() => menu.remove(), 300)
|
74
|
+
}
|
75
|
+
this.restoreMenuAttrs()
|
63
76
|
this.isMenuVisible = false
|
64
77
|
}
|
65
78
|
|
@@ -145,4 +158,13 @@ export default class Dropdown {
|
|
145
158
|
this.adjustMenuPos()
|
146
159
|
}, 300))
|
147
160
|
}
|
161
|
+
|
162
|
+
destroy() {
|
163
|
+
// prevent next re-bind error
|
164
|
+
const { menu } = this
|
165
|
+
if (menu) {
|
166
|
+
this.hideMenu(true)
|
167
|
+
document.body.appendChild(menu)
|
168
|
+
}
|
169
|
+
}
|
148
170
|
}
|
@@ -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
@@ -153,6 +153,15 @@ $color-active: #5469d4;
|
|
153
153
|
border: 0;
|
154
154
|
}
|
155
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
|
+
|
156
165
|
input[type=file], /* FF, IE7+, chrome (except button) */
|
157
166
|
input[type=file]::-webkit-file-upload-button { /* chromes and blink button */
|
158
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.228
|
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
|