beyond-rails 0.0.194 → 0.0.199

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: 1887cf7a29a1219ee0a2c8539bc2217e01463de1b0a0347455f3dfa7350fd71d
4
- data.tar.gz: 4907c8b698d88f672d4010643fbed444a1747beefcc9120f4feea78d1a53bdfe
3
+ metadata.gz: cbb0db0d80e57e8bb4a91b58d77eeb12a06b694f5856f63da43da7cdd732f295
4
+ data.tar.gz: 5aafc18db515eebfc63d8e79e13b8c0b5439bedb911f4468ef56cc8a511427a3
5
5
  SHA512:
6
- metadata.gz: 1f6aac570b43111c125dcd9918804adb181d1d0bc1a2a8ec21740ecf337b6b9bacb3d67145b8ac5beac0481cde2b46bee905d1f6a25449df43baf339e0d44644
7
- data.tar.gz: 1979260d816dd8508c07cfdc81605bf301a0c8f0f73e3e8ad0b6d22425e0c86d1f24042910791a69e8e86b21427f6c22c4180030b32922e1b9ed9d6d3b61f95d
6
+ metadata.gz: 28fde13d8065e18ac84947ab68e6a34c8d41a6d9aa745d378a757033d335369e2ee5fae0e940db4d359c441f220c199b5b1cded5f7fa65b0da6286476fdfc63a
7
+ data.tar.gz: 648d773be42c9f6243390d80aa53d26bbd46c297e7cb035c32ae98e76d4df514ce1c75fcd53a15ca898203cb2624187b5f9e3d4c1dad091c928552100bb7bdbc
@@ -20,7 +20,7 @@ export default class BarChart {
20
20
  this.options = options
21
21
  this.bars = []
22
22
 
23
- this.height = options.height || 186
23
+ this.height = options.height
24
24
  this.width = options.width
25
25
 
26
26
  this.toYLabel = isDef(options.toYLabel) ? mem(options.toYLabel) : (v => v)
@@ -46,7 +46,7 @@ export default class BarChart {
46
46
 
47
47
  init() {
48
48
  this.setDpr()
49
- this.setDomWidthIfNeeded()
49
+ this.setDomSizeIfNeeded()
50
50
  this.setCanvas()
51
51
  this.clear()
52
52
  this.bindMedia()
@@ -342,7 +342,7 @@ export default class BarChart {
342
342
  refresh() {
343
343
  this.raf(() => {
344
344
  this.clearBarPos()
345
- this.setDomWidthIfNeeded()
345
+ this.setDomSizeIfNeeded()
346
346
  this.setCanvasSize(this.canvas)
347
347
  this.setLabelWidths()
348
348
  this.setLabelHeights()
@@ -60,7 +60,8 @@ export default class DateMenu {
60
60
  }
61
61
 
62
62
  useSingleMenu() {
63
- return isTouchDevice() || this.options.useSingleMenu
63
+ const { useSingleMenu, isStatic } = this.options
64
+ return isTouchDevice() || isStatic || useSingleMenu
64
65
  }
65
66
 
66
67
  setHoveredCell(data) {
@@ -204,7 +205,8 @@ export default class DateMenu {
204
205
 
205
206
  addMenu() {
206
207
  const dom = document.createElement('div')
207
- dom.className = 'date-menu'
208
+ const className = this.options.isStatic ? 'date-menu static' : 'date-menu'
209
+ dom.className = className
208
210
 
209
211
  if (this.useSingleMenu()) {
210
212
  dom.innerHTML = `
@@ -257,7 +259,15 @@ export default class DateMenu {
257
259
  this.btnPrev = dom.querySelector('[data-btn-prev]')
258
260
  this.btnNext = dom.querySelector('[data-btn-next]')
259
261
  }
260
- document.body.appendChild(dom)
262
+
263
+ const container = this.options.dom
264
+
265
+ if (container) {
266
+ container.appendChild(dom)
267
+ }
268
+ else {
269
+ document.body.appendChild(dom)
270
+ }
261
271
  this.dom = dom
262
272
  }
263
273
 
@@ -350,8 +360,17 @@ export default class DateMenu {
350
360
  show(src) {
351
361
  const { dom } = this
352
362
  dom.style.opacity = 0
353
- dom.style.display = 'block'
354
- this.pos(src)
363
+
364
+ if (this.options.isStatic) {
365
+ dom.style.display = 'inline-block'
366
+ }
367
+ else {
368
+ dom.style.display = 'block'
369
+ }
370
+
371
+ if (src) {
372
+ this.pos(src)
373
+ }
355
374
  dom.style.opacity = 1
356
375
  this.isVisible = true
357
376
  }
@@ -41,7 +41,7 @@ export default class LineChart {
41
41
  this.dom = dom
42
42
  this.options = options
43
43
  this.pointsArr = []
44
- this.height = options.height || 150
44
+ this.height = options.height
45
45
  this.width = options.width
46
46
 
47
47
  this.toXLabel = isDef(options.toXLabel) ? mem(options.toXLabel) : (v => v)
@@ -76,7 +76,7 @@ export default class LineChart {
76
76
 
77
77
  init() {
78
78
  this.setDpr()
79
- this.setDomWidthIfNeeded()
79
+ this.setDomSizeIfNeeded()
80
80
  this.setCanvas()
81
81
  this.clear()
82
82
  this.bindMedia()
@@ -438,7 +438,7 @@ export default class LineChart {
438
438
  refresh() {
439
439
  this.raf(() => {
440
440
  this.clearPointPos()
441
- this.setDomWidthIfNeeded()
441
+ this.setDomSizeIfNeeded()
442
442
  this.setCanvasSize(this.canvas)
443
443
  this.layers.forEach(layer => this.setCanvasSize(layer.canvas))
444
444
  this.setLabelWidths()
@@ -205,10 +205,13 @@ export default function chartCommon(target) {
205
205
  canvas.getContext('2d').scale(dpr, dpr)
206
206
  }
207
207
 
208
- setDomWidthIfNeeded() {
208
+ setDomSizeIfNeeded() {
209
209
  if (isUndef(this.options.width)) {
210
210
  this.width = this.dom.offsetWidth
211
211
  }
212
+ if (isUndef(this.options.height)) {
213
+ this.height = this.dom.offsetHeight
214
+ }
212
215
  }
213
216
 
214
217
  setDpr() {
@@ -9,6 +9,7 @@ import Autocomplete from './components/Autocomplete'
9
9
  import BarChart from './components/BarChart'
10
10
  import Btn from './components/Btn'
11
11
  import Checkbox from './components/Checkbox'
12
+ import DateMenu from './components/DateMenu'
12
13
  import DateTimeRanger from './components/DateTimeRanger'
13
14
  import Datepicker from './components/Datepicker'
14
15
  import Dropdown from './components/Dropdown'
@@ -33,6 +34,7 @@ export {
33
34
  BarChart,
34
35
  Btn,
35
36
  Checkbox,
37
+ DateMenu,
36
38
  DateTimeRanger,
37
39
  Datepicker,
38
40
  Dropdown,
@@ -122,13 +122,13 @@ $color-active: #5469d4;
122
122
  }
123
123
 
124
124
  .align-left {
125
- text-align: left;
125
+ text-align: left !important;
126
126
  }
127
127
  .align-right {
128
- text-align: right;
128
+ text-align: right !important;
129
129
  }
130
130
  .align-center {
131
- text-align: center;
131
+ text-align: center !important;
132
132
  }
133
133
 
134
134
  .sr-only {
@@ -2,6 +2,7 @@
2
2
  outline: 0;
3
3
  background-color: #fff;
4
4
  display: inline-flex;
5
+ justify-content: center;
5
6
  align-items: center;
6
7
  border: 0;
7
8
  padding: 6px 12px 7px;
@@ -6,6 +6,9 @@
6
6
  0 5px 15px 0 rgba(0, 0, 0, .08);
7
7
  background-color: #fff;
8
8
  white-space: nowrap;
9
+ &.static {
10
+ position: static;
11
+ }
9
12
  .date-menu-content {
10
13
  display: inline-block;
11
14
  position: relative;
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.194
4
+ version: 0.0.199
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-09-14 00:00:00.000000000 Z
12
+ date: 2020-09-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sassc