beyond-rails 0.0.191 → 0.0.196

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: 829ab78c6cb10cfed4426872b53988d54d3cb86db2b815b3f7c0329a7ae77757
4
- data.tar.gz: 07f25aaca258d9903469ffbe3f895f9c93e875ccb8cf56b04ad5ed3233c0285c
3
+ metadata.gz: af6f1f88484a8fb81cb7fbd3c767a9fa299aa7147328796ca7a6c03a1b91f2e6
4
+ data.tar.gz: 78d0af543fe477024b913db9a32fe8f5b43aea55d15cb61b9e50122c2c535fc2
5
5
  SHA512:
6
- metadata.gz: 7dc6a4d2661e8d91cca160f808cfef41dcbb9e740e71df0ac6dfa89c3e66c9dab2b7f571a0fb71377f2a8cbdee8bcadd74942db00d5462da85961b75e1c83cc2
7
- data.tar.gz: 464c33700e7218031c6b16e2ece1c07d212208ce47bb6378905726a35866da8784d938394d28e1e1bb8c34fe522cbe6daaa1aba42bef4dba1da2fa74064bd7cb
6
+ metadata.gz: 66327bc01ecd8e2feaccbd2ce3bb83b90333c922e668e4f2edbae8dea61e61f98d2dfccbd8dff7d46d6c80a02b0b9a6ec59369a806805d161c6bb698089912c5
7
+ data.tar.gz: e384f507cd9ab6616bf820a95a6fcf141b016f85d8d72c0b2565cbf455f1ce8bde039bf95362bddff55abb5ca00ffc60bc3cbbdd7f54968f0d36002f33931f3f
@@ -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
  }
@@ -444,6 +444,7 @@ export default class LineChart {
444
444
  this.setLabelWidths()
445
445
  this.setLabelHeights()
446
446
  this.setAxisData()
447
+ this.updateLabelSizeForAutoStep()
447
448
  this.setPointPos()
448
449
  this.draw()
449
450
  })
@@ -496,6 +497,7 @@ export default class LineChart {
496
497
  this.setLabelWidths()
497
498
  this.setLabelHeights()
498
499
  this.setAxisData()
500
+ this.updateLabelSizeForAutoStep()
499
501
  this.setPointPos()
500
502
  this.raf(() => this.draw())
501
503
  }
@@ -513,6 +515,22 @@ export default class LineChart {
513
515
  })
514
516
  }
515
517
 
518
+ updateLabelSizeForAutoStep() {
519
+ const { measureWidth } = this
520
+ if (isUndef(this.xStep)) {
521
+ this.xLabelWidth = this.xLabelRows.reduce((width, row) => {
522
+ const measuredWidth = row.length
523
+ return (measuredWidth > width) ? measuredWidth : width
524
+ }, 0)
525
+ }
526
+ if (isUndef(this.yStep)) {
527
+ this.yLabelWidth = this.yLabelRows.reduce((width, row) => {
528
+ const measuredWidth = measureWidth.call(this, row.label)
529
+ return (measuredWidth > width) ? measuredWidth : width
530
+ }, 0)
531
+ }
532
+ }
533
+
516
534
  destroy() {
517
535
  const { dom, canvas } = this
518
536
  const { toXLabel, toYLabel } = this.options
@@ -155,6 +155,10 @@ export default function chartCommon(target) {
155
155
  return [stepStart, stepEnd]
156
156
  }
157
157
 
158
+ measureWidth(value) {
159
+ return this.ctx.measureText(value).width
160
+ }
161
+
158
162
  raf(fn) {
159
163
  if (isDef(window.requestAnimationFrame)) {
160
164
  return window.requestAnimationFrame(fn)
@@ -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,
@@ -4,17 +4,14 @@
4
4
  padding: .75rem 1rem;
5
5
  margin-bottom: 1rem;
6
6
  list-style: none;
7
- .breadcrumb-item + .breadcrumb-item::before {
7
+ li + li::before {
8
8
  display: inline-block;
9
9
  padding-right: .7rem;
10
10
  padding-left: .7rem;
11
- color: #6c757d;
11
+ color: $text-color-strong;
12
12
  content: '/';
13
13
  }
14
- .breadcrumb-item.active {
15
- color: #6c757d;
16
- }
17
- .breadcrumb-item a {
18
- color: #000;
14
+ li:last-child {
15
+ color: $text-color-strong;
19
16
  }
20
17
  }
@@ -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.191
4
+ version: 0.0.196
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-08 00:00:00.000000000 Z
12
+ date: 2020-09-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sassc