beyond-rails 0.0.173 → 0.0.174

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0db9116ac128821f93d7e9db1a61ed9188dc8530c6898680c2f6801736f10060
4
- data.tar.gz: 0e898067612eb1cae224e39199e1e480d6aa8d0ff63fe223b550229fb7c98c0c
3
+ metadata.gz: fb6cc664c895e3beeeac6fe084c161fafd8c5e6a14528e7cfac406e2c1ff73fa
4
+ data.tar.gz: 7934608321985371bf12d6e22c1fb084c09c8da04cd67409ef56a80d2e4f6bf3
5
5
  SHA512:
6
- metadata.gz: 57fc84e18786cfbc35a6655c2d0138220149b2d201de0bbcbee44ca2aa45ccce3d749a6453adcb5213663c2fe7fb81b491930b4d8ae1a0f730dd68763d443fce
7
- data.tar.gz: 9fd66c2560112cb1ff4628969f9e8d85ed3ce36c9ce8d6459521ba75e7a3632bf2bdbe147faaeaa77dd261d3743dd7979ad78f75c6df249dbb191fd7b685412a
6
+ metadata.gz: 22fcfa6f7b34d2e477add0179c8f07aac9d51be5a244645d652f364483eda83075b128b6ef4df28558d33b022044e289c10c1c4f3cde2f8ded1c91b76bde22e9
7
+ data.tar.gz: 934d0818ac057a0642aeb514df5309310b7e155ad126cb20652bc09b903cb0fd748bfeb83c673f8ddeea7338e7affa95e15d58dcb928dec5dccac34a742b85ab
@@ -97,12 +97,20 @@ export default class Datepicker {
97
97
  this.nextDate = res
98
98
  }
99
99
 
100
+ clearBlurTimer() {
101
+ if (this._blurTimer) {
102
+ clearTimeout(this._blurTimer)
103
+ this._blurTimer = null
104
+ }
105
+ }
106
+
100
107
  handleDateInputBlur() {
101
108
  const { nextDate, date, dateInput } = this
102
109
 
103
110
  if (date === null) {
104
111
  dateInput.setDate(null)
105
112
  this.timeInput && this.timeInput.setDate(null)
113
+ this._blurTimer = setTimeout(() => this.emitChange(), 50)
106
114
  }
107
115
  else if (nextDate) {
108
116
  this.date = nextDate
@@ -191,6 +199,8 @@ export default class Datepicker {
191
199
  event.stopPropagation()
192
200
  event.preventDefault()
193
201
 
202
+ this.clearBlurTimer()
203
+
194
204
  const { year, month, date } = res
195
205
  this.date = set(this.date || new Date(), { year, month, date })
196
206
  this.dateInput.setDate(this.date)
@@ -0,0 +1,12 @@
1
+ import { test } from '~/test/utils'
2
+ import dateEq from '~/src/js/utils/dateEq'
3
+
4
+ test('dateEq', t => {
5
+
6
+ // Sun Jul 12 2020 18:31:43 GMT+0800 (Taipei Standard Time)
7
+ const date1 = new Date(1594549903944)
8
+
9
+ // Sun Jul 12 2020 18:31:43 GMT+0800 (Taipei Standard Time)
10
+ const date2 = new Date(1594549903944)
11
+ t.true(dateEq(date1, date2))
12
+ })
@@ -0,0 +1,12 @@
1
+ import { test } from '~/test/utils'
2
+ import dateGt from '~/src/js/utils/dateGt'
3
+
4
+ test('dateGt', t => {
5
+
6
+ // Sun Jul 12 2020 18:31:43 GMT+0800 (Taipei Standard Time)
7
+ const date1 = new Date(1594549903944)
8
+
9
+ // Mon Jul 13 2020 18:31:43 GMT+0800 (Taipei Standard Time)
10
+ const date2 = new Date(1594636303944)
11
+ t.true(dateGt(date2, date1))
12
+ })
@@ -0,0 +1,12 @@
1
+ import { test } from '~/test/utils'
2
+ import dateLt from '~/src/js/utils/dateLt'
3
+
4
+ test('dateLt', t => {
5
+
6
+ // Sun Jul 12 2020 18:31:43 GMT+0800 (Taipei Standard Time)
7
+ const date1 = new Date(1594549903944)
8
+
9
+ // Mon Jul 13 2020 18:31:43 GMT+0800 (Taipei Standard Time)
10
+ const date2 = new Date(1594636303944)
11
+ t.true(dateLt(date1, date2))
12
+ })
@@ -0,0 +1,25 @@
1
+ import { test } from '~/test/utils'
2
+ import getKey from '~/src/js/utils/getKey'
3
+
4
+ test('getKey', t => {
5
+
6
+ const keyMap = {
7
+ 13: 'enter',
8
+ 17: 'ctrl',
9
+ 27: 'esc',
10
+ 38: 'up',
11
+ 40: 'down',
12
+ 70: 'f',
13
+ 91: 'left-meta',
14
+ 93: 'right-meta'
15
+ }
16
+
17
+ for (const [k, v] of Object.entries(keyMap)) {
18
+ const keyCode = parseInt(k, 10)
19
+ const event = { keyCode }
20
+ t.is(getKey(event), v)
21
+ }
22
+
23
+ // Return empty string when keyCode is not found.
24
+ t.is(getKey({ keyCode: 9999 }), '')
25
+ })
@@ -0,0 +1,8 @@
1
+ import { test } from '~/test/utils'
2
+ import msToS from '~/src/js/utils/msToS'
3
+
4
+ test('msToS', t => {
5
+ t.is(msToS(1000), 1)
6
+ t.is(msToS(1200), 1)
7
+ t.is(msToS(900), 0)
8
+ })
@@ -4,7 +4,7 @@ import getDomPos from '@superlanding/getdompos'
4
4
  import getScrollLeft from '@superlanding/getscrollleft'
5
5
  import getScrollTop from '@superlanding/getscrolltop'
6
6
  import timestampToDate from '@superlanding/timestamptodate'
7
- import toPixel from '@superlanding/toPixel'
7
+ import toPixel from '@superlanding/topixel'
8
8
 
9
9
  // date-fns
10
10
  import addDays from 'date-fns/addDays'
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.173
4
+ version: 0.0.174
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-06-30 00:00:00.000000000 Z
12
+ date: 2020-07-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sassc
@@ -141,6 +141,11 @@ files:
141
141
  - src/js/polyfills/nodeContains.js
142
142
  - src/js/polyfills/nodeHasAttribute.js
143
143
  - src/js/polyfills/nodeRemove.js
144
+ - src/js/tests/utils/dateEq.test.js
145
+ - src/js/tests/utils/dateGt.test.js
146
+ - src/js/tests/utils/dateLt.test.js
147
+ - src/js/tests/utils/getKey.test.js
148
+ - src/js/tests/utils/msToS.test.js
144
149
  - src/js/utils/bind.js
145
150
  - src/js/utils/dateEq.js
146
151
  - src/js/utils/dateGt.js