beyond-rails 0.0.295 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/src/font/beyond.eot +0 -0
- data/src/font/beyond.svg +9 -2
- data/src/font/beyond.ttf +0 -0
- data/src/font/beyond.woff +0 -0
- data/src/font/beyond.woff2 +0 -0
- data/src/js/components/BarChart.js +19 -7
- data/src/js/components/Dropdown.js +9 -2
- data/src/js/components/LineChart.js +18 -8
- data/src/js/components/PieChart.js +16 -6
- data/src/js/components/SearchDropdown.js +10 -5
- data/src/js/components/Tooltip.js +1 -5
- data/src/js/consts/index.js +42 -0
- data/src/js/decorators/chartCommon.js +4 -1
- data/src/js/index.js +0 -1
- data/src/sass/_base.scss +170 -0
- data/src/sass/_beyond-dark.scss +3 -0
- data/src/sass/_beyond.scss +0 -54
- data/src/sass/_main.scss +56 -176
- data/src/sass/abstracts/_mixins.scss +2 -4
- data/src/sass/abstracts/_placeholders.scss +3 -3
- data/src/sass/abstracts/_post-variables.scss +85 -0
- data/src/sass/abstracts/_variables.scss +296 -222
- data/src/sass/base/_background.scss +2 -3
- data/src/sass/base/_typography.scss +18 -17
- data/src/sass/components/_alert.scss +8 -14
- data/src/sass/components/_autocomplete.scss +4 -5
- data/src/sass/components/_avatar.scss +5 -6
- data/src/sass/components/_badge.scss +2 -4
- data/src/sass/components/_breadcrumb.scss +3 -2
- data/src/sass/components/_btn-group.scss +1 -1
- data/src/sass/components/_btn.scss +65 -67
- data/src/sass/components/_card.scss +12 -6
- data/src/sass/components/_chart.scss +5 -5
- data/src/sass/components/_checkbox.scss +8 -8
- data/src/sass/components/_date-menu.scss +10 -10
- data/src/sass/components/_date-time-ranger.scss +9 -3
- data/src/sass/components/_dropdown.scss +22 -14
- data/src/sass/components/_form.scss +17 -18
- data/src/sass/components/_icon.scss +143 -2
- data/src/sass/components/_input.scss +4 -4
- data/src/sass/components/_mega-menu.scss +9 -6
- data/src/sass/components/_modal.scss +5 -6
- data/src/sass/components/_month-menu.scss +11 -11
- data/src/sass/components/_nav.scss +5 -5
- data/src/sass/components/_navbar.scss +26 -33
- data/src/sass/components/_pagination.scss +9 -8
- data/src/sass/components/_radio.scss +2 -4
- data/src/sass/components/_search-dropdown.scss +3 -2
- data/src/sass/components/_select.scss +15 -23
- data/src/sass/components/_sidebar.scss +1 -1
- data/src/sass/components/_spinner.scss +0 -1
- data/src/sass/components/_switch.scss +5 -5
- data/src/sass/components/_tabbox.scss +19 -32
- data/src/sass/components/_table.scss +13 -14
- data/src/sass/components/_tag-input.scss +2 -4
- data/src/sass/components/_tag.scss +4 -4
- data/src/sass/components/_time-menu.scss +4 -4
- data/src/sass/components/_toast.scss +4 -3
- data/src/sass/components/_tooltip.scss +19 -27
- data/src/sass/themes/_dark.scss +309 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1804f518e40f24b57bb76c5d0739a063d9f91400963e7467cb61dd8cb28af2d
|
4
|
+
data.tar.gz: 76c17444b4c4e614e9e637f1da0ac12d07d03a986f542d0de067a4ed9ca7cfe8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6eff3dfc7511bb2c89c86f54817b3175b5710bb1bb9384ac3d7a9473a50a38f41e812d325accafc1d7b12ba9724f4e8438e93d3f77a5400139b252bf226352d5
|
7
|
+
data.tar.gz: a7e0eb9127f29f277849e8f8dcb7664540d2033817491b742e51161497e8af1fe59aaf87abd35a5dfbebbd5b088c95f2adc8e2e687880874a6157d406f2b02f7
|
data/src/font/beyond.eot
CHANGED
Binary file
|
data/src/font/beyond.svg
CHANGED
@@ -142,6 +142,13 @@
|
|
142
142
|
<glyph unicode="" glyph-name="expand" d="M511.868-65.382h-0.845c-14.249 0.040-27.086 6.057-36.136 15.676-0.801 0.713-1.585 1.457-2.35 2.231l-343.999 348.25c-19.309 19.548-19.115 51.047 0.432 70.356s51.047 19.115 70.356-0.432l262.305-265.547 1.213 575.831c0.058 27.476 22.379 49.703 49.855 49.645s49.703-22.379 49.645-49.855l-1.215-576.566 263.564 266.512c19.32 19.536 50.82 19.712 70.356 0.391s19.712-50.82 0.391-70.356l-347.473-351.359c-9.914-10.025-23.035-14.952-36.101-14.777v0zM143.131 880c-16.089 0-29.131 17.909-29.131 40s13.042 40 29.131 40h737.738c16.089 0 29.131-17.909 29.131-40s-13.042-40-29.131-40h-737.738z" />
|
143
143
|
<glyph unicode="" glyph-name="shrink" d="M511.868 733.382c13.066 0.174 26.187-4.752 36.101-14.777l347.473-351.359c19.32-19.536 19.145-51.036-0.391-70.356s-51.036-19.145-70.356 0.391l-263.564 266.512 1.215-576.566c0.058-27.476-22.169-49.797-49.645-49.855s-49.797 22.169-49.855 49.646l-1.213 575.831-262.305-265.547c-19.309-19.548-50.808-19.741-70.356-0.432s-19.741 50.808-0.432 70.356l343.999 348.25c0.765 0.774 1.548 1.518 2.35 2.231 9.050 9.619 21.887 15.636 36.136 15.676h0.845zM143.131 880c-16.089 0-29.131 17.909-29.131 40s13.042 40 29.131 40h737.738c16.089 0 29.131-17.909 29.131-40s-13.042-40-29.131-40h-737.738z" />
|
144
144
|
<glyph unicode="" glyph-name="brush-alt" d="M895.693 940.743c39.535 21.353 73.331 18.001 101.388-10.056s31.529-61.973 10.415-101.747c-143.315-175.012-239.296-288.064-287.944-339.154-72.972-76.635-157.854-139.003-163.736-133.121-6.569 6.569-118.875 118.875-132.999 132.999 0 0-26.317 11.172 133.364 163.493 106.454 101.547 219.625 197.409 339.512 287.586zM354.82 430.539c43.447-43.447 87.986-87.092 133.617-130.937 0.461-110.050-52.691-190.068-159.457-240.055s-216.426 4.111-328.98 162.293c77.634-4.996 125.092 4.308 142.375 27.91 26.195 35.773 7.996 84.241 73.273 146.441 36.047 34.348 107.648 34.348 139.172 34.348z" />
|
145
|
-
<glyph unicode="&#
|
146
|
-
<glyph unicode="&#
|
145
|
+
<glyph unicode="" glyph-name="pencil7" d="M768 416v-352h-640v640h352l128 128h-512c-52.8 0-96-43.2-96-96v-704c0-52.8 43.2-96 96-96h704c52.798 0 96 43.2 96 96v512l-128-128zM864 960l-608-608v-160h160l608 608c0 96-64 160-160 160zM416 320l-48 48 480 480 48-48-480-480z" />
|
146
|
+
<glyph unicode="" glyph-name="store2" d="M416 384h-192c-17.672 0-32-14.326-32-32v-192c0-17.674 14.328-32 32-32h192c17.672 0 32 14.326 32 32v192c0 17.674-14.328 32-32 32zM384 192h-128v128h128v-128zM1024 576v288c0 17.672-14.326 32-32 32h-960c-17.672 0-32-14.328-32-32v-288c0-47.274 25.78-88.612 64-110.78v-465.22h-32c-17.672 0-32-14.326-32-32s14.328-32 32-32h960c17.674 0 32 14.326 32 32s-14.326 32-32 32h-32v465.22c38.22 22.168 64 63.506 64 110.78zM640 832h128v-256c0-35.29-28.71-64-64-64-35.292 0-64 28.71-64 64v256zM256 832h128v-256c0-35.29-28.71-64-64-64-35.292 0-64 28.71-64 64v256zM768 0h-128v256h128v-256zM896 0h-64v288c0 17.674-14.326 32-32 32h-192c-17.674 0-32-14.326-32-32v-288h-448v448c38.204 0 72.526 16.844 96 43.472 23.474-26.628 57.796-43.472 96-43.472s72.526 16.844 96 43.472c23.474-26.628 57.796-43.472 96-43.472s72.528 16.844 96 43.47c23.472-26.626 57.796-43.47 96-43.47s72.528 16.844 96 43.47c23.472-26.626 57.796-43.47 96-43.47v-448z" />
|
147
|
+
<glyph unicode="" glyph-name="basket" d="M812.988 576l-177.842 231.53c3.122 7.54 4.854 15.802 4.854 24.47 0 35.346-28.652 64-64 64-35.346 0-64-28.654-64-64s28.654-64 64-64c2.842 0 5.632 0.204 8.376 0.564l147.912-192.564h-440.574l147.912 192.564c2.742-0.36 5.534-0.564 8.374-0.564 35.346 0 64 28.654 64 64s-28.654 64-64 64-64-28.654-64-64c0-8.668 1.732-16.93 4.854-24.468l-177.842-231.532h-211.012v-128h64l64-512h768l64 512h64v128h-211.012zM320 64h-128v128h128v-128zM320 320h-128v128h128v-128zM576 64h-128v128h128v-128zM576 320h-128v128h128v-128zM832 64h-128v128h128v-128zM832 320h-128v128h128v-128z" />
|
148
|
+
<glyph unicode="" glyph-name="coin-dollar" d="M480 896c-265.096 0-480-214.904-480-480 0-265.098 214.904-480 480-480 265.098 0 480 214.902 480 480 0 265.096-214.902 480-480 480zM480 32c-212.078 0-384 171.922-384 384s171.922 384 384 384c212.078 0 384-171.922 384-384s-171.922-384-384-384zM512 448v128h128v64h-128v64h-64v-64h-128v-256h128v-128h-128v-64h128v-64h64v64h128.002l-0.002 256h-128zM448 448h-64v128h64v-128zM576.002 256h-64.002v128h64.002v-128z" />
|
149
|
+
<glyph unicode="" glyph-name="database-refresh" d="M923.004 507.004c-50.316 43.010-115.62 68.996-187.004 68.996-140.95 0-258.234-101.262-283.116-235h98.562c23.058 80.174 97.062 139 184.554 139 44.798 0 86.038-15.45 118.736-41.264l-118.736-118.736h288v288l-100.996-100.996zM736 96c-44.798 0-86.038 15.45-118.736 41.264l118.736 118.736h-288v-288l100.996 100.996c50.312-43.012 115.62-68.996 187.004-68.996 140.95 0 258.232 101.262 283.116 235h-98.556c-23.064-80.174-97.068-139-184.56-139zM138.12 374.66c-48.8 17.594-68.726 35.99-74.12 43.338v161.998c63.702-41.124 168.942-67.996 288-67.996 10.79 0 21.458 0.234 32 0.666v84.098c-10.574-0.488-21.246-0.764-32-0.764-73.698 0-144.112 11.6-198.27 32.662-45.24 17.594-63.712 35.99-68.71 43.338 4.998 7.348 23.47 25.744 68.71 43.338 54.158 21.062 124.572 32.662 198.27 32.662s144.112-11.6 198.272-32.662c45.238-17.594 63.71-35.99 68.708-43.338-3.924-5.768-16.16-18.346-43.124-32h121.096c4.618 10.34 7.046 21.042 7.046 32 0 88.366-157.596 160-352 160s-351.998-71.634-351.998-160v-512c0-88.366 157.596-160 352-160 10.79 0 21.458 0.232 32 0.664v83.984c-10.582-0.418-21.254-0.648-32-0.648-79.5 0-155.458 11.6-213.88 32.662-48.802 17.594-68.728 35.99-74.12 43.338v165.994c63.702-41.124 168.942-67.996 288-67.996 10.79 0 21.458 0.232 32 0.666v83.982c-10.582-0.418-21.254-0.648-32-0.648-79.5 0-155.458 11.6-213.88 32.662z" />
|
150
|
+
<glyph unicode="" glyph-name="bug" d="M1024 384v64h-193.29c-5.862 72.686-31.786 139.026-71.67 192.25h161.944l70.060 280.24-62.090 15.522-57.94-231.76h-174.68c-0.892 0.694-1.796 1.374-2.698 2.056 6.71 19.502 10.362 40.422 10.362 62.194 0.002 105.76-85.958 191.498-191.998 191.498s-192-85.738-192-191.5c0-21.772 3.65-42.692 10.362-62.194-0.9-0.684-1.804-1.362-2.698-2.056h-174.68l-57.94 231.76-62.090-15.522 70.060-280.24h161.944c-39.884-53.222-65.806-119.562-71.668-192.248h-193.29v-64h193.37c3.802-45.664 15.508-88.812 33.638-127.75h-123.992l-70.060-280.238 62.090-15.524 57.94 231.762h112.354c58.692-78.032 147.396-127.75 246.66-127.75s187.966 49.718 246.662 127.75h112.354l57.94-231.762 62.090 15.524-70.060 280.238h-123.992c18.13 38.938 29.836 82.086 33.636 127.75h193.37z" />
|
151
|
+
<glyph unicode="" glyph-name="meter" d="M512 896c282.77 0 512-229.23 512-512 0-192.792-106.576-360.666-264.008-448h-495.984c-157.432 87.334-264.008 255.208-264.008 448 0 282.77 229.23 512 512 512zM801.914 94.086c77.438 77.44 120.086 180.398 120.086 289.914h-90v64h85.038c-7.014 44.998-21.39 88.146-42.564 128h-106.474v64h64.284c-9.438 11.762-19.552 23.096-30.37 33.914-46.222 46.22-101.54 80.038-161.914 99.798v-69.712h-64v85.040c-20.982 3.268-42.36 4.96-64 4.96s-43.018-1.69-64-4.96v-85.040h-64v69.712c-60.372-19.76-115.692-53.576-161.914-99.798-10.818-10.818-20.932-22.152-30.37-33.914h64.284v-64h-106.476c-21.174-39.854-35.552-83.002-42.564-128h85.040v-64h-90c0-109.516 42.648-212.474 120.086-289.914 10.71-10.71 21.924-20.728 33.56-30.086h192.354l36.572 512h54.856l36.572-512h192.354c11.636 9.358 22.852 19.378 33.56 30.086z" />
|
152
|
+
<glyph unicode="" glyph-name="target1" d="M1024 512h-100.924c-27.64 178.24-168.836 319.436-347.076 347.076v100.924h-128v-100.924c-178.24-27.64-319.436-168.836-347.076-347.076h-100.924v-128h100.924c27.64-178.24 168.836-319.436 347.076-347.076v-100.924h128v100.924c178.24 27.64 319.436 168.836 347.076 347.076h100.924v128zM792.822 512h-99.762c-19.284 54.55-62.51 97.778-117.060 117.060v99.762c107.514-24.49 192.332-109.31 216.822-216.822zM512 384c-35.346 0-64 28.654-64 64s28.654 64 64 64c35.346 0 64-28.654 64-64s-28.654-64-64-64zM448 728.822v-99.762c-54.55-19.282-97.778-62.51-117.060-117.060h-99.762c24.49 107.512 109.31 192.332 216.822 216.822zM231.178 384h99.762c19.282-54.55 62.51-97.778 117.060-117.060v-99.762c-107.512 24.49-192.332 109.308-216.822 216.822zM576 167.178v99.762c54.55 19.284 97.778 62.51 117.060 117.060h99.762c-24.49-107.514-109.308-192.332-216.822-216.822z" />
|
153
|
+
<glyph unicode="" glyph-name="pencil-ruler" d="M249.562 945.846c-5.964 8.882-15.986 14.21-26.676 14.154-10.7-0.040-20.672-5.422-26.574-14.346l-127-192c-3.464-5.236-5.312-11.376-5.312-17.654v-736c0-35.29 28.708-64 64-64h192c35.29 0 64 28.71 64 64v736c0 6.356-1.894 12.57-5.44 17.846l-128.998 192zM197.868 832h51.082l71.050-105.752 0.022-662.248h-192.022v662.374l69.868 105.626zM224 128c17.672 0 32 14.326 32 32v512c0 17.672-14.328 32-32 32s-32-14.328-32-32v-512c0-17.674 14.328-32 32-32zM512 960v-1024h384v1024h-384zM832 832h-64v-64h64v-64h-128v-64h128v-64h-64v-64h64v-64h-128v-64h128v-64h-64v-64h64v-64h-128v-64h128v-128h-256v896h256v-64z" />
|
147
154
|
</font></defs></svg>
|
data/src/font/beyond.ttf
CHANGED
Binary file
|
data/src/font/beyond.woff
CHANGED
Binary file
|
data/src/font/beyond.woff2
CHANGED
Binary file
|
@@ -4,7 +4,7 @@ import isDef from '../utils/isDef'
|
|
4
4
|
import isUndef from '../utils/isUndef'
|
5
5
|
import isInt from '../utils/isInt'
|
6
6
|
import { mem, range, sortBy, throttle, uniqBy } from '../utils'
|
7
|
-
import {
|
7
|
+
import { THEME_DEFAULT, CHART_STYLE } from '../consts'
|
8
8
|
|
9
9
|
@supportDom
|
10
10
|
@chartCommon
|
@@ -30,8 +30,7 @@ export default class BarChart {
|
|
30
30
|
this.yLabelMargin = isDef(options.yLanelMargin) ? options.yLabelMargin : 14
|
31
31
|
|
32
32
|
this.fontSize = options.fontSize || 12
|
33
|
-
this.
|
34
|
-
this.barStyles = options.barStyles || DEFAULT_CHART_STYLES
|
33
|
+
this.setTheme(options)
|
35
34
|
|
36
35
|
this.yLabelRows = []
|
37
36
|
this.barPosMap = new Map()
|
@@ -48,6 +47,19 @@ export default class BarChart {
|
|
48
47
|
this.bindBarVisible()
|
49
48
|
}
|
50
49
|
|
50
|
+
setTheme(opts) {
|
51
|
+
const options = Object.assign({}, this.options, opts)
|
52
|
+
const theme = options.theme || THEME_DEFAULT
|
53
|
+
const style = CHART_STYLE[theme]
|
54
|
+
this.theme = theme
|
55
|
+
this.bg = options.bg || style.bg
|
56
|
+
this.line = options.line || style.line
|
57
|
+
this.txt = options.txt || style.txt
|
58
|
+
this.glowAlpha = options.glowAlpha || style.glowAlpha
|
59
|
+
this.barStyles = options.barStyles || style.variants
|
60
|
+
this.setBg()
|
61
|
+
}
|
62
|
+
|
51
63
|
get contentWidth() {
|
52
64
|
return this.width - (this.xPadding * 2) - this.yLabelMargin -
|
53
65
|
this.yLabelWidth - this.halfXLabelWidth
|
@@ -140,7 +152,7 @@ export default class BarChart {
|
|
140
152
|
const xStart = this.xPadding
|
141
153
|
const xEnd = this.width - this.xPadding - this.yLabelWidth - this.yLabelMargin
|
142
154
|
|
143
|
-
ctx.strokeStyle =
|
155
|
+
ctx.strokeStyle = this.line
|
144
156
|
ctx.lineWidth = 1
|
145
157
|
|
146
158
|
yLabelRows.forEach(row => {
|
@@ -164,7 +176,7 @@ export default class BarChart {
|
|
164
176
|
let x = xAxisStart
|
165
177
|
|
166
178
|
ctx.textBaseline = 'top'
|
167
|
-
ctx.fillStyle =
|
179
|
+
ctx.fillStyle = this.txt
|
168
180
|
|
169
181
|
xLabelRows.forEach((row, i) => {
|
170
182
|
ctx.fillText(row.label, x, y)
|
@@ -177,7 +189,7 @@ export default class BarChart {
|
|
177
189
|
const x = this.width - this.xPadding
|
178
190
|
const delta = yLabelHeight * .45
|
179
191
|
|
180
|
-
ctx.fillStyle =
|
192
|
+
ctx.fillStyle = this.txt
|
181
193
|
ctx.textAlign = 'right'
|
182
194
|
|
183
195
|
yLabelRows.forEach(row => {
|
@@ -210,7 +222,7 @@ export default class BarChart {
|
|
210
222
|
const glowHeight = ((glowWidth - width) / 2) + height
|
211
223
|
const glowX = x - ((glowWidth - width) / 2)
|
212
224
|
const glowY = y - (glowHeight - height)
|
213
|
-
ctx.globalAlpha =
|
225
|
+
ctx.globalAlpha = this.glowAlpha
|
214
226
|
ctx.fillStyle = this.barStyles[res.index]
|
215
227
|
ctx.fillRect(glowX, glowY, glowWidth, glowHeight)
|
216
228
|
ctx.restore()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import getFloatedTargetPos from '../utils/getFloatedTargetPos'
|
2
2
|
import supportDom from '../decorators/supportDom'
|
3
|
-
import { isFunction, toPixel, throttle } from '../utils'
|
3
|
+
import { isFunction, toPixel, throttle, noop } from '../utils'
|
4
4
|
|
5
5
|
@supportDom
|
6
6
|
export default class Dropdown {
|
@@ -14,6 +14,7 @@ export default class Dropdown {
|
|
14
14
|
this.defaultTextNode = this.getDefaultTextNode(dom, options.textIndex)
|
15
15
|
this.defaultText = this.defaultTextNode ? this.defaultTextNode.textContent.trim() : ''
|
16
16
|
this.backdropMode = options.backdropMode || 'auto'
|
17
|
+
this.hidden = options.hidden || noop
|
17
18
|
this.init()
|
18
19
|
}
|
19
20
|
|
@@ -136,7 +137,12 @@ export default class Dropdown {
|
|
136
137
|
})
|
137
138
|
}
|
138
139
|
|
139
|
-
this.addEvent(this.dom, 'click', () =>
|
140
|
+
this.addEvent(this.dom, 'click', () => {
|
141
|
+
this.toggleMenu()
|
142
|
+
if (! this.isMenuVisible) {
|
143
|
+
this.hidden()
|
144
|
+
}
|
145
|
+
})
|
140
146
|
|
141
147
|
this.addEvent(document, 'click', event => {
|
142
148
|
if (! this.isMenuVisible) {
|
@@ -148,6 +154,7 @@ export default class Dropdown {
|
|
148
154
|
// is backdrop
|
149
155
|
if ((event.target !== this.dom) && (! this.dom.contains(event.target))) {
|
150
156
|
this.hideMenu()
|
157
|
+
this.hidden()
|
151
158
|
}
|
152
159
|
})
|
153
160
|
|
@@ -3,7 +3,7 @@ import chartCommon from '../decorators/chartCommon'
|
|
3
3
|
import isDef from '../utils/isDef'
|
4
4
|
import isUndef from '../utils/isUndef'
|
5
5
|
import { mem, range, sortBy, throttle, uniqBy } from '../utils'
|
6
|
-
import {
|
6
|
+
import { THEME_DEFAULT, CHART_STYLE } from '../consts'
|
7
7
|
|
8
8
|
/**
|
9
9
|
* -------------------------------------------------------------------------------------------------
|
@@ -52,10 +52,8 @@ export default class LineChart {
|
|
52
52
|
this.xLabelMargin = isDef(options.xLabelMargin) ? options.xLabelMargin : 10
|
53
53
|
this.yLabelMargin = isDef(options.yLanelMargin) ? options.yLabelMargin : 10
|
54
54
|
|
55
|
-
this.lineStyles = options.lineStyles || DEFAULT_CHART_STYLES
|
56
|
-
|
57
|
-
this.bg = options.bg || '#fff'
|
58
55
|
this.fontSize = options.fontSize || 12
|
56
|
+
this.setTheme(options)
|
59
57
|
|
60
58
|
this.xStep = options.xStep
|
61
59
|
this.yStep = options.yStep
|
@@ -79,6 +77,18 @@ export default class LineChart {
|
|
79
77
|
this.bindPointMouseOver()
|
80
78
|
}
|
81
79
|
|
80
|
+
setTheme(opts) {
|
81
|
+
const options = Object.assign({}, this.options, opts)
|
82
|
+
const theme = options.theme || THEME_DEFAULT
|
83
|
+
const style = CHART_STYLE[theme]
|
84
|
+
this.theme = theme
|
85
|
+
this.bg = options.bg || style.bg
|
86
|
+
this.line = options.line || style.line
|
87
|
+
this.txt = options.txt || style.txt
|
88
|
+
this.lineStyles = options.lineStyles || style.variants
|
89
|
+
this.setBg()
|
90
|
+
}
|
91
|
+
|
82
92
|
get noData() {
|
83
93
|
return (this.xLabelRows.length === 0) && (this.yLabelRows.length === 0)
|
84
94
|
}
|
@@ -175,7 +185,7 @@ export default class LineChart {
|
|
175
185
|
|
176
186
|
const { ctx, yLabelRows, contentWidth, firstY, xAxisStart, yAxisStart, yRatio } = this
|
177
187
|
|
178
|
-
ctx.strokeStyle =
|
188
|
+
ctx.strokeStyle = this.line
|
179
189
|
ctx.lineWidth = 1
|
180
190
|
|
181
191
|
yLabelRows.forEach(row => {
|
@@ -247,10 +257,10 @@ export default class LineChart {
|
|
247
257
|
const scaleEnd = y - scaleMargin
|
248
258
|
|
249
259
|
ctx.textBaseline = 'top'
|
250
|
-
ctx.fillStyle =
|
260
|
+
ctx.fillStyle = this.txt
|
251
261
|
ctx.textAlign = 'center'
|
252
262
|
|
253
|
-
ctx.strokeStyle =
|
263
|
+
ctx.strokeStyle = this.txt
|
254
264
|
|
255
265
|
let x = this.xAxisMiddle
|
256
266
|
|
@@ -274,7 +284,7 @@ export default class LineChart {
|
|
274
284
|
const x = this.width - this.xPadding
|
275
285
|
const halfYLabelHeight = this.yLabelHeight / 2
|
276
286
|
|
277
|
-
ctx.fillStyle =
|
287
|
+
ctx.fillStyle = this.txt
|
278
288
|
ctx.textAlign = 'right'
|
279
289
|
|
280
290
|
let y = this.yAxisMiddle
|
@@ -4,7 +4,7 @@ import isFn from '../utils/isFn'
|
|
4
4
|
import isDef from '../utils/isDef'
|
5
5
|
import isUndef from '../utils/isUndef'
|
6
6
|
import { throttle } from '../utils'
|
7
|
-
import {
|
7
|
+
import { THEME_DEFAULT, CHART_STYLE } from '../consts'
|
8
8
|
|
9
9
|
@supportDom
|
10
10
|
@chartCommon
|
@@ -20,8 +20,7 @@ export default class PieChart {
|
|
20
20
|
this.height = options.height
|
21
21
|
this.width = options.width
|
22
22
|
this.padding = isDef(options.padding) ? options.padding : 30
|
23
|
-
this.
|
24
|
-
this.bg = options.bg || '#fff'
|
23
|
+
this.setTheme(options)
|
25
24
|
|
26
25
|
this.init()
|
27
26
|
}
|
@@ -36,6 +35,17 @@ export default class PieChart {
|
|
36
35
|
this.bindPointMouseOver()
|
37
36
|
}
|
38
37
|
|
38
|
+
setTheme(opts) {
|
39
|
+
const options = Object.assign({}, this.options, opts)
|
40
|
+
const theme = options.theme || THEME_DEFAULT
|
41
|
+
const style = CHART_STYLE[theme]
|
42
|
+
this.theme = theme
|
43
|
+
this.bg = options.bg || style.bg
|
44
|
+
this.glowAlpha = options.glowAlpha || style.glowAlpha
|
45
|
+
this.styles = options.styles || style.variants
|
46
|
+
this.setBg()
|
47
|
+
}
|
48
|
+
|
39
49
|
get x() {
|
40
50
|
return this.width / 2
|
41
51
|
}
|
@@ -99,7 +109,7 @@ export default class PieChart {
|
|
99
109
|
distance += ratio
|
100
110
|
})
|
101
111
|
|
102
|
-
this.fillCircle(ctx, x, y, centerCircleRadius,
|
112
|
+
this.fillCircle(ctx, x, y, centerCircleRadius, this.bg)
|
103
113
|
}
|
104
114
|
|
105
115
|
handleDprChange() {
|
@@ -177,11 +187,11 @@ export default class PieChart {
|
|
177
187
|
|
178
188
|
const options = {
|
179
189
|
style: this.styles[index],
|
180
|
-
alpha: .
|
190
|
+
alpha: this.glowAlpha
|
181
191
|
}
|
182
192
|
const radiusDelta = (radius - centerCircleRadius) * .3
|
183
193
|
this.fillArc(ctx, x, y, radius + radiusDelta, startAngle, endAngle, options)
|
184
|
-
this.fillCircle(this.firstLayer.ctx, x, y, centerCircleRadius,
|
194
|
+
this.fillCircle(this.firstLayer.ctx, x, y, centerCircleRadius, this.bg)
|
185
195
|
}
|
186
196
|
|
187
197
|
clearSliceGlow() {
|
@@ -304,6 +304,8 @@ export default class SearchDropdown {
|
|
304
304
|
this.addEvent(this.menuContent, 'click', event => {
|
305
305
|
const item = this.findClickedItem(event.target)
|
306
306
|
if (item) {
|
307
|
+
event.preventDefault()
|
308
|
+
event.stopPropagation()
|
307
309
|
this.setItem(item)
|
308
310
|
}
|
309
311
|
})
|
@@ -333,9 +335,10 @@ export default class SearchDropdown {
|
|
333
335
|
if (! this.isMenuVisible) {
|
334
336
|
return
|
335
337
|
}
|
336
|
-
const
|
337
|
-
|
338
|
-
(! this.
|
338
|
+
const { target } = event
|
339
|
+
const isBackdrop = (target !== this.dom) &&
|
340
|
+
(! this.dom.contains(target)) &&
|
341
|
+
(! this.menu.contains(target))
|
339
342
|
|
340
343
|
if (isBackdrop) {
|
341
344
|
this.hideMenu()
|
@@ -386,8 +389,10 @@ export default class SearchDropdown {
|
|
386
389
|
}
|
387
390
|
|
388
391
|
destroy() {
|
389
|
-
this.menu
|
390
|
-
|
392
|
+
if (this.menu) {
|
393
|
+
this.menu.remove()
|
394
|
+
this.menu = null
|
395
|
+
}
|
391
396
|
this.input = null
|
392
397
|
this.menuContent = null
|
393
398
|
this.loader = null
|
@@ -67,12 +67,10 @@ export default class Tooltip {
|
|
67
67
|
this.addEvent(dom, 'mouseover', () => {
|
68
68
|
|
69
69
|
const msg = this.dom.dataset.msg || ''
|
70
|
-
const style = this.dom.dataset.style || 'default'
|
71
70
|
|
72
71
|
if (msg.length === 0) {
|
73
72
|
return
|
74
73
|
}
|
75
|
-
|
76
74
|
this.setTooltipMsg()
|
77
75
|
|
78
76
|
tooltip.style.opacity = 0
|
@@ -84,9 +82,7 @@ export default class Tooltip {
|
|
84
82
|
place: this.getPlace(),
|
85
83
|
offset: this.getOffset()
|
86
84
|
})
|
87
|
-
|
88
|
-
tooltip.className = (style === 'default') ? 'tooltip' : `tooltip tooltip-popover ${place}`
|
89
|
-
|
85
|
+
tooltip.className = `tooltip ${place}`
|
90
86
|
tooltip.style.left = toPixel(pos.left)
|
91
87
|
tooltip.style.top = toPixel(pos.top)
|
92
88
|
tooltip.style.opacity = 1
|
data/src/js/consts/index.js
CHANGED
@@ -4,6 +4,48 @@ export const DEFAULT_TIMEZONE = 'Asia/Taipei'
|
|
4
4
|
|
5
5
|
export const DEFAULT_LOCALE = locale
|
6
6
|
|
7
|
+
export const THEME_DEFAULT = 'default'
|
8
|
+
|
9
|
+
export const THEME_DARK = 'dark'
|
10
|
+
|
11
|
+
export const THEMES = [
|
12
|
+
{ text: 'Default', value: THEME_DEFAULT },
|
13
|
+
{ text: 'Dark', value: THEME_DARK }
|
14
|
+
]
|
15
|
+
|
16
|
+
export const CHART_STYLE = {
|
17
|
+
[THEME_DEFAULT]: {
|
18
|
+
bg: '#fff',
|
19
|
+
txt: '#3c4257',
|
20
|
+
line: 'rgba(224, 224, 224, .5)',
|
21
|
+
glowAlpha: .2,
|
22
|
+
variants: [
|
23
|
+
'#5469d4',
|
24
|
+
'#7c54d4',
|
25
|
+
'#a254d4',
|
26
|
+
'#c040a2',
|
27
|
+
'#ff5604',
|
28
|
+
'#0be4e3',
|
29
|
+
'#00d924'
|
30
|
+
]
|
31
|
+
},
|
32
|
+
[THEME_DARK]: {
|
33
|
+
bg: '#070B1F',
|
34
|
+
txt: '#fff',
|
35
|
+
line: 'rgba(255, 255, 255, .3)',
|
36
|
+
glowAlpha: .3,
|
37
|
+
variants: [
|
38
|
+
'#769aff',
|
39
|
+
'#9e72ff',
|
40
|
+
'#c66cff',
|
41
|
+
'#ff5ed9',
|
42
|
+
'#ff5604',
|
43
|
+
'#0be4e3',
|
44
|
+
'#00d924'
|
45
|
+
]
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
7
49
|
export const DEFAULT_CHART_STYLES = [
|
8
50
|
'#5469d4',
|
9
51
|
'#7c54d4',
|
@@ -213,12 +213,15 @@ export default function chartCommon(target) {
|
|
213
213
|
this.dom.appendChild(box)
|
214
214
|
}
|
215
215
|
|
216
|
+
setBg() {
|
217
|
+
this.dom.style.backgroundColor = this.bg
|
218
|
+
}
|
219
|
+
|
216
220
|
drawLabels(labels, styles = DEFAULT_CHART_STYLES) {
|
217
221
|
if (labels.length <= 0) {
|
218
222
|
return
|
219
223
|
}
|
220
224
|
const { labelBox, handleLabelMouseOver, handleLabelMouseLeave } = this
|
221
|
-
this.dom.style.backgroundColor = this.bg
|
222
225
|
|
223
226
|
this.offLabels.forEach(off => off())
|
224
227
|
labelBox.innerHTML = ''
|
data/src/js/index.js
CHANGED
data/src/sass/_base.scss
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
html {
|
2
|
+
height: 100%;
|
3
|
+
}
|
4
|
+
body {
|
5
|
+
color: $txt;
|
6
|
+
box-sizing: border-box;
|
7
|
+
font-family: 'Noto Sans CJK TC', 'PingFang TC', 'Microsoft JhengHei',
|
8
|
+
'Helvetica Neue', Helvetica, Verdana, 'Open Sans', sans-serif;
|
9
|
+
font-size: 16px;
|
10
|
+
|
11
|
+
.content {
|
12
|
+
flex: 1;
|
13
|
+
}
|
14
|
+
&.with-footer {
|
15
|
+
min-height: 100%;
|
16
|
+
display: flex;
|
17
|
+
flex-direction: column;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
*,
|
21
|
+
*:before,
|
22
|
+
*:after {
|
23
|
+
box-sizing: inherit;
|
24
|
+
}
|
25
|
+
|
26
|
+
:focus {
|
27
|
+
outline: 1px solid $bg-outline;
|
28
|
+
outline-offset: 2px;
|
29
|
+
}
|
30
|
+
|
31
|
+
// for ie11
|
32
|
+
body:focus {
|
33
|
+
outline: 0;
|
34
|
+
}
|
35
|
+
|
36
|
+
h1, h2, h3, h4, h5, h6 {
|
37
|
+
margin-top: 0;
|
38
|
+
margin-bottom: 8px;
|
39
|
+
}
|
40
|
+
|
41
|
+
ul {
|
42
|
+
list-style-type: none;
|
43
|
+
padding: 0;
|
44
|
+
margin: 0;
|
45
|
+
}
|
46
|
+
|
47
|
+
p {
|
48
|
+
line-height: 2.1em;
|
49
|
+
margin-top: 0;
|
50
|
+
margin-bottom: 1rem;
|
51
|
+
}
|
52
|
+
small {
|
53
|
+
font-size: 70%;
|
54
|
+
}
|
55
|
+
blockquote {
|
56
|
+
margin: 0 0 1rem;
|
57
|
+
}
|
58
|
+
|
59
|
+
th, td {
|
60
|
+
padding: 7px;
|
61
|
+
}
|
62
|
+
|
63
|
+
a {
|
64
|
+
cursor: pointer;
|
65
|
+
color: $txt-anchor;
|
66
|
+
text-decoration: none;
|
67
|
+
&:hover {
|
68
|
+
color: $txt-anchor-ex;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
// active style
|
73
|
+
$color-active: #5469d4;
|
74
|
+
|
75
|
+
.select,
|
76
|
+
.select.select-outline,
|
77
|
+
.select.select-outline-strong,
|
78
|
+
.btn.btn-dropdown,
|
79
|
+
.search-input,
|
80
|
+
.input {
|
81
|
+
&.active {
|
82
|
+
color: $color-active;
|
83
|
+
box-shadow: 0 1px 1px 0 rgba(54, 59, 255, .6),
|
84
|
+
rgba(14, 48, 173, .3) 0 0 0 1px,
|
85
|
+
rgba(14, 26, 62, .12) 0 2px 5px 0;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
.search-input.active .input,
|
89
|
+
.search-input.active .icon-search:before {
|
90
|
+
color: $color-active;
|
91
|
+
}
|
92
|
+
|
93
|
+
.input,
|
94
|
+
.select,
|
95
|
+
.select.select-outline,
|
96
|
+
.select.select-outline-strong {
|
97
|
+
&:focus.active {
|
98
|
+
color: $color-active;
|
99
|
+
box-shadow: 0 1px 1px 0 rgba(54, 59, 255, .6),
|
100
|
+
rgba(14, 48, 173, .3) 0 0 0 1px,
|
101
|
+
rgba(14, 26, 62, .12) 0 2px 5px 0,
|
102
|
+
0 0 0 4px rgba(58, 151, 212, .28);
|
103
|
+
}
|
104
|
+
}
|
105
|
+
.search-input.active.outline {
|
106
|
+
color: $color-active;
|
107
|
+
box-shadow: 0 1px 1px 0 rgba(54, 59, 255, .6),
|
108
|
+
rgba(14, 48, 173, .3) 0 0 0 1px,
|
109
|
+
rgba(14, 26, 62, .12) 0 2px 5px 0,
|
110
|
+
0 0 0 4px rgba(58, 151, 212, .28);
|
111
|
+
}
|
112
|
+
|
113
|
+
.scrollable {
|
114
|
+
overflow-y: scroll;
|
115
|
+
-webkit-overflow-scrolling: touch;
|
116
|
+
}
|
117
|
+
|
118
|
+
.align-left {
|
119
|
+
text-align: left !important;
|
120
|
+
}
|
121
|
+
.align-right {
|
122
|
+
text-align: right !important;
|
123
|
+
}
|
124
|
+
.align-center {
|
125
|
+
text-align: center !important;
|
126
|
+
}
|
127
|
+
|
128
|
+
.float-left {
|
129
|
+
float: left !important;
|
130
|
+
}
|
131
|
+
.float-right {
|
132
|
+
float: right !important;
|
133
|
+
}
|
134
|
+
.float-none {
|
135
|
+
float: none !important;
|
136
|
+
}
|
137
|
+
|
138
|
+
.sr-only {
|
139
|
+
position: absolute;
|
140
|
+
width: 1px;
|
141
|
+
height: 1px;
|
142
|
+
padding: 0;
|
143
|
+
overflow: hidden;
|
144
|
+
clip: rect(0, 0, 0, 0);
|
145
|
+
white-space: nowrap;
|
146
|
+
clip-path: inset(50%);
|
147
|
+
border: 0;
|
148
|
+
}
|
149
|
+
|
150
|
+
.full-width {
|
151
|
+
width: 100% !important;
|
152
|
+
}
|
153
|
+
|
154
|
+
hr {
|
155
|
+
margin-top: 20px;
|
156
|
+
margin-bottom: 20px;
|
157
|
+
border-top: 1px solid $hr-border;
|
158
|
+
border-left: 0;
|
159
|
+
border-right: 0;
|
160
|
+
border-bottom: 0;
|
161
|
+
}
|
162
|
+
|
163
|
+
input[type=file], /* FF, IE7+, chrome (except button) */
|
164
|
+
input[type=file]::-webkit-file-upload-button { /* chromes and blink button */
|
165
|
+
cursor: pointer;
|
166
|
+
}
|
167
|
+
|
168
|
+
.nowrap {
|
169
|
+
white-space: nowrap !important;
|
170
|
+
}
|
data/src/sass/_beyond.scss
CHANGED
@@ -1,56 +1,2 @@
|
|
1
1
|
@import './abstracts/_variables';
|
2
|
-
@import './abstracts/_placeholders';
|
3
|
-
@import './abstracts/_mixins';
|
4
|
-
@import './vendor/_normalize';
|
5
|
-
@import './vendor/_turbolink';
|
6
|
-
@import './base/_background';
|
7
|
-
@import './base/_typography';
|
8
|
-
@import './_animations';
|
9
2
|
@import './_main';
|
10
|
-
@import './layout/_border-util';
|
11
|
-
@import './layout/_col';
|
12
|
-
@import './layout/_container';
|
13
|
-
@import './layout/_offset-util';
|
14
|
-
@import './layout/_sizing-util';
|
15
|
-
@import './layout/_spacing-util';
|
16
|
-
@import './layout/_visibility-util';
|
17
|
-
@import './layout/_flex-util';
|
18
|
-
@import './components/_alert';
|
19
|
-
@import './components/_autocomplete';
|
20
|
-
@import './components/_avatar';
|
21
|
-
@import './components/_badge';
|
22
|
-
@import './components/_breadcrumb';
|
23
|
-
@import './components/_btn';
|
24
|
-
@import './components/_btn-group';
|
25
|
-
@import './components/_card';
|
26
|
-
@import './components/_checkbox';
|
27
|
-
@import './components/_date-input';
|
28
|
-
@import './components/_date-menu';
|
29
|
-
@import './components/_month-menu';
|
30
|
-
@import './components/_date-time-ranger';
|
31
|
-
@import './components/_datepicker';
|
32
|
-
@import './components/_dropdown';
|
33
|
-
@import './components/_form';
|
34
|
-
@import './components/_icon';
|
35
|
-
@import './components/_input';
|
36
|
-
@import './components/_list';
|
37
|
-
@import './components/_modal';
|
38
|
-
@import './components/_nav';
|
39
|
-
@import './components/_navbar';
|
40
|
-
@import './components/_pagination';
|
41
|
-
@import './components/_radio';
|
42
|
-
@import './components/_search-dropdown';
|
43
|
-
@import './components/_select';
|
44
|
-
@import './components/_sidebar';
|
45
|
-
@import './components/_spinner';
|
46
|
-
@import './components/_tabbox';
|
47
|
-
@import './components/_table';
|
48
|
-
@import './components/_tag';
|
49
|
-
@import './components/_tag-input';
|
50
|
-
@import './components/_time-input';
|
51
|
-
@import './components/_time-menu';
|
52
|
-
@import './components/_toast';
|
53
|
-
@import './components/_tooltip';
|
54
|
-
@import './components/_switch';
|
55
|
-
@import './components/_mega-menu';
|
56
|
-
@import './components/_chart';
|