beyond-rails 0.0.252 → 0.0.257

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aeaaa8c47595bc3cfacda7f7db2589e616e00915caaa00e2e13bdbac8692a996
4
- data.tar.gz: 383c3b183f28a4690f329bd9eccf27e61392bd86c68dbc5acb42b2ea1c37fa08
3
+ metadata.gz: 878355b9e7a2f59f8ab506c681088d7eae160f0f73440a4352a64da64e44f484
4
+ data.tar.gz: effed2b5389dc1e2859f99f86dc900ced79aa347cc0db2c9e126d0313dba5a6e
5
5
  SHA512:
6
- metadata.gz: 93d1309fee7cdf8c3b7b12cb10d40ce5cac534d3a17d0e768371530392d7bdde0d959bd566d26e4c8018db2101bf7d256716e14d515552ca3164b150cf5af310
7
- data.tar.gz: 892c06951f5f82361c8c6331a5781026562227d9fe93daca94580f4eddec5c1ede43f989f52923eed140974626b64658472e7f8e2d7e4eb5b7824a96218e851e
6
+ metadata.gz: ea0dc3ec729df8ac0bca7d89828dd89fd932da5d809376503eb59f115c8113f89d165e22aa38c71bbcbf97c36bcbb3f088a38c3fee1d77eea9090ae68964875f
7
+ data.tar.gz: f48ff5af5ca71be4b4a2409581514142bcaadb0fb8135f54c8080f9f0cd66041dcace5e33ce181980369d29be35570279b53e59e0dbf171c5e1cde3b5cb40501
@@ -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,8 +107,9 @@ export default class TagInput {
99
107
  }
100
108
  }
101
109
 
102
- addTag(inputValue, res) {
103
- const classname = res.classname ? ` ${res.classname}` : ''
110
+ getTag(inputValue, options = {}) {
111
+
112
+ const classname = options.classname ? ` ${options.classname}` : ''
104
113
  const tag = document.createElement('div')
105
114
 
106
115
  tag.className = 'tag' + classname
@@ -119,10 +128,25 @@ export default class TagInput {
119
128
  }
120
129
  btn.addEventListener('click', handleBtnClick)
121
130
  tag.appendChild(btn)
122
-
123
131
  this.id += 1
124
- this.tags.push({ id: this.id, elem: tag, remove: handleBtnClick, res })
125
- this.dom.insertBefore(tag, this.inputDiv)
132
+
133
+ return { id: this.id, elem: tag, remove: handleBtnClick, options }
134
+ }
135
+
136
+ setTags(rows) {
137
+ const { dom, inputDiv } = this
138
+ const tags = rows.map(row => this.getTag(row.text, row))
139
+ tags.forEach(tag => {
140
+ dom.insertBefore(tag.elem, inputDiv)
141
+ })
142
+ this.tags = tags
143
+ }
144
+
145
+ addTag(inputValue, options = {}) {
146
+ const tag = this.getTag(inputValue, options)
147
+ this.tags.push(tag)
148
+ this.dom.insertBefore(tag.elem, this.inputDiv)
149
+ this.change(this.tags.slice())
126
150
  }
127
151
 
128
152
  async addTagIfNeeded() {
@@ -132,12 +156,9 @@ export default class TagInput {
132
156
  if (! res.isTag) {
133
157
  return this.shake()
134
158
  }
135
- this.addTag(inputValue, res)
136
-
137
159
  input.value = ''
138
160
  suggestInput.value = ''
139
-
140
- this.change(this.tags.slice())
161
+ this.addTag(inputValue, res)
141
162
  }
142
163
 
143
164
  removeTagIfNeeded() {
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.257
5
5
  platform: ruby
6
6
  authors:
7
7
  - kmsheng