beyond-rails 0.0.251 → 0.0.252

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 +17 -11
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7c25c8becf8350b03ce7b3be5e10d7aa6a5e7c748609be8c6004066dfb1b4e2
4
- data.tar.gz: 60db926a555eecbd5ab96f3d7018909eb071c35e5415da248c0b8265812fb6f9
3
+ metadata.gz: aeaaa8c47595bc3cfacda7f7db2589e616e00915caaa00e2e13bdbac8692a996
4
+ data.tar.gz: 383c3b183f28a4690f329bd9eccf27e61392bd86c68dbc5acb42b2ea1c37fa08
5
5
  SHA512:
6
- metadata.gz: f1d4b5d3497fb25c8fe860f73d8cc0428253d05621e110acbbe4a5099ecb96c17c96ba5628d31f272056c336d86db5fa28622efd2ca0d549cdf55509b271d4f1
7
- data.tar.gz: d84d78e047382a8c69af7fa8f8826103ae1a3b4bc8705b5ca070015e0b90fbd408a61d2fc8e558bd4629bb36584f74e1d62352bd2bde6e4dd2ed78e776da3d48
6
+ metadata.gz: 93d1309fee7cdf8c3b7b12cb10d40ce5cac534d3a17d0e768371530392d7bdde0d959bd566d26e4c8018db2101bf7d256716e14d515552ca3164b150cf5af310
7
+ data.tar.gz: 892c06951f5f82361c8c6331a5781026562227d9fe93daca94580f4eddec5c1ede43f989f52923eed140974626b64658472e7f8e2d7e4eb5b7824a96218e851e
@@ -75,21 +75,27 @@ export default class TagInput {
75
75
  }, 500)
76
76
  }
77
77
 
78
- setTag(id, options = {}) {
78
+ setTagAttrs(id, rows = [], options = {}) {
79
79
  const tag = this.tags.find(tag => tag.id === id)
80
80
  if (! tag) {
81
81
  return
82
82
  }
83
- if (options.classname) {
84
- const originalClassname = tag.elem.className
85
- tag.elem.className = options.classname
86
- if (options.classnameTimeout) {
87
- setTimeout(() => {
88
- if (document.body.contains(tag.elem)) {
89
- tag.elem.className = originalClassname
90
- }
91
- }, options.classnameTimeout)
92
- }
83
+ const { elem } = tag
84
+ const { timeout } = options
85
+ const oldAttrs = rows.map(row => elem.getAttribute(row.name))
86
+
87
+ rows.forEach(row => {
88
+ elem.setAttribute(row.name, row.value)
89
+ })
90
+
91
+ if (timeout) {
92
+ setTimeout(() => {
93
+ if (document.body.contains(elem)) {
94
+ rows.forEach((row, i) => {
95
+ elem.setAttribute(row.name, oldAttrs[i])
96
+ })
97
+ }
98
+ }, timeout)
93
99
  }
94
100
  }
95
101
 
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.251
4
+ version: 0.0.252
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-11-24 00:00:00.000000000 Z
12
+ date: 2020-11-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sassc