beyond-rails 0.0.255 → 0.0.256

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/src/js/components/TagInput.js +11 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68c18389bc3fc3c322900aa4f5fb6883b68cb5255fc26bf3ed8ab257f55b22b6
4
- data.tar.gz: d52ea6b4f1d3aee55fdf7e3d1b539c2128187158116af66eabca5dc3d40b328a
3
+ metadata.gz: c3e85d9b4c8f791f8ed1eb1bac8a68f71ca189301734451410d1da2628cf49e9
4
+ data.tar.gz: fb6e1b6de1b7703918a39e5f426bcfad2cc743fbb5c9534878e86ba3f635586d
5
5
  SHA512:
6
- metadata.gz: 6af46b3f2c22d2aa4f2ba797071df8b0216923ec5943983293b68d3d6b5f393e7882a73ead03045add7489ca8caaf48a6460f8ea9e84287153c4f02cfb7a3602
7
- data.tar.gz: bdacd91a41fd9cb6739253ae8639ef1340425822191287203896ccb4fb30b80215799cf36e98cbcb631cd72e057dacd89560d89789c3fc60423c7f5109cb0f07
6
+ metadata.gz: 7408a3297619f390240197b29e768e9a37ad7c3377072470edafdbc29762d8bbd3b146f14808417ea1f16258c79e0cf30d2b09f0581ff4f755beb2c20422a5b0
7
+ data.tar.gz: 90c1d93650ecdfa61be3ea6e4d37c8bbe81804748fb9233cb5bf48fbfa6fde4ff555f2a5ffcd2f9d5409c3dd0f142dd2a944fa2ddede8cb5780400bd75eaa029
@@ -82,15 +82,23 @@ export default class TagInput {
82
82
  }
83
83
  const { elem } = tag
84
84
  const { timeout } = options
85
- const oldAttrs = rows.map(row => elem.getAttribute(row.name))
85
+
86
+ if (this.timer) {
87
+ clearTimeout(this.timer)
88
+ this.timer = null
89
+ }
90
+ else {
91
+ this.oldAttrs = rows.map(row => elem.getAttribute(row.name))
92
+ }
86
93
 
87
94
  rows.forEach(row => {
88
95
  elem.setAttribute(row.name, row.value)
89
96
  })
90
97
 
91
98
  if (timeout) {
92
- setTimeout(() => {
99
+ this.timer = setTimeout(() => {
93
100
  if (document.body.contains(elem)) {
101
+ const { oldAttrs } = this
94
102
  rows.forEach((row, i) => {
95
103
  elem.setAttribute(row.name, oldAttrs[i])
96
104
  })
@@ -148,10 +156,9 @@ export default class TagInput {
148
156
  if (! res.isTag) {
149
157
  return this.shake()
150
158
  }
151
- this.addTag(inputValue, res)
152
-
153
159
  input.value = ''
154
160
  suggestInput.value = ''
161
+ this.addTag(inputValue, res)
155
162
  }
156
163
 
157
164
  removeTagIfNeeded() {
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.255
4
+ version: 0.0.256
5
5
  platform: ruby
6
6
  authors:
7
7
  - kmsheng