beyond-rails 1.0.1 → 1.0.2

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: 13dbeb989ab2f48c2b943a38ba11e44c76c2c40f1c71e43a6147a62d462deea1
4
- data.tar.gz: 565b347f30cf323cf9cb1544928e292529a38295ce2986c4f157d52296aa2df6
3
+ metadata.gz: d92b118dbf4ed4cb5c041cfe46ba20762bb42860576d77348ee235fcc96b3792
4
+ data.tar.gz: f981bdb20cf4262c65f1cb4ff147887e102be054acea8b59c83bc338877cfae6
5
5
  SHA512:
6
- metadata.gz: 9e07cef68473ff31897dff7ad742c88314555252cea27c3b91f59cfec044605a2690a5cd6737b4fce37a28669d0f25086a748225cf3dee04264168fbc6a5d54f
7
- data.tar.gz: 746929a87982024cff6afa0922aae9a8e2ce4b6b11c42f80b820bd02da24244d5d51f5418249ae3143ba369648eaa22a70b83ef22431a841a112d3a9e2c7bb38
6
+ metadata.gz: '009339b8c94ac51ff8b1173a0a94b06dcd96864c4c50fc9b327da0a2a61be534d8081d1b3d1e84f2382ceee4b115ca5d368fe284cf47856ab087eb2bc8aee0a3'
7
+ data.tar.gz: 29e59d32a6a1825e88f719d78bffa6019b3de4e2cbe3bdc27fa46b9ca5857e48a1d6520d932f7670032723a4d1b5bbb6d1e6c28dcc29f31a57bbf337d526b4d5
@@ -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', () => this.toggleMenu())
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
 
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: 1.0.1
4
+ version: 1.0.2
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: 2021-08-10 00:00:00.000000000 Z
12
+ date: 2021-11-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sassc