beyond-rails 0.0.252 → 0.0.253
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 +4 -4
- data/src/js/components/TagInput.js +19 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03b03c2d04ee16bcfa672bcba9fb50cef0984d90b7269c50eae9cf12a7da092e
|
4
|
+
data.tar.gz: f63820f652d27f0a426ada80703966c6891f7f94e3551f1d393fe5527310d1fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f48f3c0d1d3ca9e3d4377cab79b72cb88260fa8b41e78d470c35b94a65c7f5c39bc84b839b809fc2023e1f0d6890167643cc3f16cc0740225548616144e4cca
|
7
|
+
data.tar.gz: 174f888a6d5fdc5b9b97b95a0afe55c754373eea237988fb43328122fce91fe207a2c93d196ee308bbf7c3597e27211c2a6cc727c8299363a0cc69c8844a87a1
|
@@ -99,7 +99,8 @@ export default class TagInput {
|
|
99
99
|
}
|
100
100
|
}
|
101
101
|
|
102
|
-
|
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
|
-
|
125
|
-
this.
|
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() {
|