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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03b03c2d04ee16bcfa672bcba9fb50cef0984d90b7269c50eae9cf12a7da092e
4
- data.tar.gz: f63820f652d27f0a426ada80703966c6891f7f94e3551f1d393fe5527310d1fc
3
+ metadata.gz: 83b9e4c8bf66817ec8fa0527c656beaf770bb5b24658c62b64e8bf02bca3efec
4
+ data.tar.gz: 223409095aaa801811c032862e9faef7819ea886cd2fea927b78f25e1ab9cc29
5
5
  SHA512:
6
- metadata.gz: 4f48f3c0d1d3ca9e3d4377cab79b72cb88260fa8b41e78d470c35b94a65c7f5c39bc84b839b809fc2023e1f0d6890167643cc3f16cc0740225548616144e4cca
7
- data.tar.gz: 174f888a6d5fdc5b9b97b95a0afe55c754373eea237988fb43328122fce91fe207a2c93d196ee308bbf7c3597e27211c2a6cc727c8299363a0cc69c8844a87a1
6
+ metadata.gz: 5fc2f2890ac0bf86fe5e1040da650fc627d10f5984b42ae43d85ffd0edd4583c312935b82b617d617276aff89580600b1a818b160ead65c39fb906977871c6e4
7
+ data.tar.gz: f4ae4425e442cd85834abcb05bc754c2b1f6b256552bdc865f3ccd9a630e5ced6d2093b3875269fe170bc3588be6c2f69ba88807ea121cd3cd3386dcc7b6887c
@@ -553,6 +553,7 @@ export default class LineChart {
553
553
  if (isDef(toYLabel)) {
554
554
  mem.clear(this.toYLabel)
555
555
  }
556
+ this.pointsArr.length = 0
556
557
  this.clearPointPos()
557
558
  this.unbindMedia()
558
559
  this.removeAllLayers()
@@ -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
  })
@@ -99,9 +107,9 @@ export default class TagInput {
99
107
  }
100
108
  }
101
109
 
102
- getTag(inputValue, res) {
110
+ getTag(inputValue, options = {}) {
103
111
 
104
- const classname = res.classname ? ` ${res.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, res }
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, res) {
138
- const tag = this.getTag(inputValue, res)
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.253
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-25 00:00:00.000000000 Z
12
+ date: 2020-11-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sassc