beyond-rails 0.0.252 → 0.0.253

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/src/js/components/TagInput.js +19 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aeaaa8c47595bc3cfacda7f7db2589e616e00915caaa00e2e13bdbac8692a996
4
- data.tar.gz: 383c3b183f28a4690f329bd9eccf27e61392bd86c68dbc5acb42b2ea1c37fa08
3
+ metadata.gz: 03b03c2d04ee16bcfa672bcba9fb50cef0984d90b7269c50eae9cf12a7da092e
4
+ data.tar.gz: f63820f652d27f0a426ada80703966c6891f7f94e3551f1d393fe5527310d1fc
5
5
  SHA512:
6
- metadata.gz: 93d1309fee7cdf8c3b7b12cb10d40ce5cac534d3a17d0e768371530392d7bdde0d959bd566d26e4c8018db2101bf7d256716e14d515552ca3164b150cf5af310
7
- data.tar.gz: 892c06951f5f82361c8c6331a5781026562227d9fe93daca94580f4eddec5c1ede43f989f52923eed140974626b64658472e7f8e2d7e4eb5b7824a96218e851e
6
+ metadata.gz: 4f48f3c0d1d3ca9e3d4377cab79b72cb88260fa8b41e78d470c35b94a65c7f5c39bc84b839b809fc2023e1f0d6890167643cc3f16cc0740225548616144e4cca
7
+ data.tar.gz: 174f888a6d5fdc5b9b97b95a0afe55c754373eea237988fb43328122fce91fe207a2c93d196ee308bbf7c3597e27211c2a6cc727c8299363a0cc69c8844a87a1
@@ -99,7 +99,8 @@ export default class TagInput {
99
99
  }
100
100
  }
101
101
 
102
- addTag(inputValue, res) {
102
+ getTag(inputValue, res) {
103
+
103
104
  const classname = res.classname ? ` ${res.classname}` : ''
104
105
  const tag = document.createElement('div')
105
106
 
@@ -119,10 +120,24 @@ export default class TagInput {
119
120
  }
120
121
  btn.addEventListener('click', handleBtnClick)
121
122
  tag.appendChild(btn)
122
-
123
123
  this.id += 1
124
- this.tags.push({ id: this.id, elem: tag, remove: handleBtnClick, res })
125
- this.dom.insertBefore(tag, this.inputDiv)
124
+
125
+ return { id: this.id, elem: tag, remove: handleBtnClick, res }
126
+ }
127
+
128
+ setTags(rows) {
129
+ const { dom, inputDiv } = this
130
+ const tags = rows.map(row => this.getTag(row.text, row))
131
+ tags.forEach(tag => {
132
+ dom.insertBefore(tag.elem, inputDiv)
133
+ })
134
+ this.tags = tags
135
+ }
136
+
137
+ addTag(inputValue, res) {
138
+ const tag = this.getTag(inputValue, res)
139
+ this.tags.push(tag)
140
+ this.dom.insertBefore(tag.elem, this.inputDiv)
126
141
  }
127
142
 
128
143
  async addTagIfNeeded() {
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.252
4
+ version: 0.0.253
5
5
  platform: ruby
6
6
  authors:
7
7
  - kmsheng