beyond-rails 0.0.253 → 0.0.258
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/LineChart.js +1 -0
- data/src/js/components/TagInput.js +20 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83b9e4c8bf66817ec8fa0527c656beaf770bb5b24658c62b64e8bf02bca3efec
|
4
|
+
data.tar.gz: 223409095aaa801811c032862e9faef7819ea886cd2fea927b78f25e1ab9cc29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fc2f2890ac0bf86fe5e1040da650fc627d10f5984b42ae43d85ffd0edd4583c312935b82b617d617276aff89580600b1a818b160ead65c39fb906977871c6e4
|
7
|
+
data.tar.gz: f4ae4425e442cd85834abcb05bc754c2b1f6b256552bdc865f3ccd9a630e5ced6d2093b3875269fe170bc3588be6c2f69ba88807ea121cd3cd3386dcc7b6887c
|
@@ -82,15 +82,23 @@ export default class TagInput {
|
|
82
82
|
}
|
83
83
|
const { elem } = tag
|
84
84
|
const { timeout } = options
|
85
|
-
|
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
|
})
|
@@ -99,9 +107,9 @@ export default class TagInput {
|
|
99
107
|
}
|
100
108
|
}
|
101
109
|
|
102
|
-
getTag(inputValue,
|
110
|
+
getTag(inputValue, options = {}) {
|
103
111
|
|
104
|
-
const classname =
|
112
|
+
const classname = options.classname ? ` ${options.classname}` : ''
|
105
113
|
const tag = document.createElement('div')
|
106
114
|
|
107
115
|
tag.className = 'tag' + classname
|
@@ -122,7 +130,7 @@ export default class TagInput {
|
|
122
130
|
tag.appendChild(btn)
|
123
131
|
this.id += 1
|
124
132
|
|
125
|
-
return { id: this.id, elem: tag, remove: handleBtnClick,
|
133
|
+
return { id: this.id, elem: tag, remove: handleBtnClick, options }
|
126
134
|
}
|
127
135
|
|
128
136
|
setTags(rows) {
|
@@ -134,10 +142,11 @@ export default class TagInput {
|
|
134
142
|
this.tags = tags
|
135
143
|
}
|
136
144
|
|
137
|
-
addTag(inputValue,
|
138
|
-
const tag = this.getTag(inputValue,
|
145
|
+
addTag(inputValue, options = {}) {
|
146
|
+
const tag = this.getTag(inputValue, options)
|
139
147
|
this.tags.push(tag)
|
140
148
|
this.dom.insertBefore(tag.elem, this.inputDiv)
|
149
|
+
this.change(this.tags.slice())
|
141
150
|
}
|
142
151
|
|
143
152
|
async addTagIfNeeded() {
|
@@ -147,12 +156,9 @@ export default class TagInput {
|
|
147
156
|
if (! res.isTag) {
|
148
157
|
return this.shake()
|
149
158
|
}
|
150
|
-
this.addTag(inputValue, res)
|
151
|
-
|
152
159
|
input.value = ''
|
153
160
|
suggestInput.value = ''
|
154
|
-
|
155
|
-
this.change(this.tags.slice())
|
161
|
+
this.addTag(inputValue, res)
|
156
162
|
}
|
157
163
|
|
158
164
|
removeTagIfNeeded() {
|
@@ -184,8 +190,11 @@ export default class TagInput {
|
|
184
190
|
let lastValue = ''
|
185
191
|
|
186
192
|
this.addEvent(input, 'keydown', async event => {
|
193
|
+
|
187
194
|
const key = getKey(event)
|
188
195
|
if ((key === 'enter') && (! this.isComposing)) {
|
196
|
+
event.preventDefault()
|
197
|
+
event.stopPropagation()
|
189
198
|
await this.addTagIfNeeded()
|
190
199
|
}
|
191
200
|
else if ((key === 'backspace') && (lastValue === '')) {
|
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.
|
4
|
+
version: 0.0.258
|
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-
|
12
|
+
date: 2020-11-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sassc
|