|
70 | 70 | <slot name="loading"></slot> |
71 | 71 | </template> |
72 | 72 | </pivot-table> |
73 | | - <div ref="pivot-copied-alert" class="alert alert-secondary pivot-alert hide" @click="hideCopiedAlert"> |
74 | | - Copied to clipboard |
75 | | - </div> |
| 73 | + <transition name="copied-alert"> |
| 74 | + <div v-if="showCopiedAlert" class="alert alert-secondary pivot-copied-alert"> |
| 75 | + Copied to clipboard |
| 76 | + </div> |
| 77 | + </transition> |
76 | 78 | </div> |
77 | 79 |
|
78 | 80 | <div v-if="showSettings" class="table-option-button circle-background bg-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-b-tooltip:hover title="Show menu"></div> |
79 | 81 | <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> |
80 | | - <a ref="pivot-copy-button" class="dropdown-item" href="#">Copy table to clipboard</a> |
81 | | - <a class="dropdown-item" href="#!" @click="_clickedSaveButton('csv')">Save table in CSV</a> |
82 | | - <a class="dropdown-item" href="#!" @click="_clickedSaveButton('tsv')">Save table in TSV</a> |
| 82 | + <button ref="pivot-copy-button" class="dropdown-item" >Copy table to clipboard</button> |
| 83 | + <button class="dropdown-item" @click="_clickedSaveButton('csv')">Save table in CSV</button> |
| 84 | + <button class="dropdown-item" @click="_clickedSaveButton('tsv')">Save table in TSV</button> |
83 | 85 | </div> |
84 | 86 | </div> |
85 | 87 | </div> |
@@ -166,7 +168,8 @@ export default { |
166 | 168 | colFields: this.fields.colFields, |
167 | 169 | fieldsOrder: this.fields.fieldsOrder |
168 | 170 | }, |
169 | | - dragging: false |
| 171 | + dragging: false, |
| 172 | + showCopiedAlert: false |
170 | 173 | } |
171 | 174 | }, |
172 | 175 | created () { |
@@ -255,20 +258,9 @@ export default { |
255 | 258 | } |
256 | 259 | this._sortFields(this.internal.fieldsOrder) |
257 | 260 | }, |
258 | | - onPivotTableCopied (e) { |
259 | | - this.showCopiedAlert() |
260 | | - setTimeout(this.startHideCopiedAlert, 500) |
261 | | - }, |
262 | | - showCopiedAlert () { |
263 | | - this.$refs['pivot-copied-alert'].classList.remove('hide') |
264 | | - }, |
265 | | - startHideCopiedAlert () { |
266 | | - this.$refs['pivot-copied-alert'].classList.add('hiding') |
267 | | - setTimeout(this.hideCopiedAlert, 1000) |
268 | | - }, |
269 | | - hideCopiedAlert () { |
270 | | - this.$refs['pivot-copied-alert'].classList.remove('hiding') |
271 | | - this.$refs['pivot-copied-alert'].classList.add('hide') |
| 261 | + onPivotTableCopied () { |
| 262 | + this.showCopiedAlert = true |
| 263 | + setTimeout(() => { this.showCopiedAlert = false }, 700) |
272 | 264 | } |
273 | 265 | } |
274 | 266 | } |
@@ -413,19 +405,17 @@ $hamburger-svg: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/ |
413 | 405 | left: $base-space*3 + 10rem - $border-space*3; |
414 | 406 | } |
415 | 407 |
|
416 | | -.pivot-alert { |
| 408 | +.pivot-copied-alert { |
417 | 409 | position: absolute; |
418 | 410 | bottom: 1rem; |
419 | 411 | right: 1rem; |
420 | | - opacity: 0.8; |
421 | | - visibility: vislble; |
422 | | - transition: opacity 1s ease-in-out; |
423 | | - &.hiding { |
424 | | - opacity: 0; |
425 | | - visibility: visible; |
426 | | - } |
427 | | - &.hide { |
428 | | - visibility: hidden; |
429 | | - } |
| 412 | +} |
| 413 | +
|
| 414 | +.copied-alert-enter-active { |
| 415 | + opacity: 0.6; |
| 416 | +} |
| 417 | +.copied-alert-leave-active { |
| 418 | + opacity: 0; |
| 419 | + transition: all 0.7s ease; |
430 | 420 | } |
431 | 421 | </style> |
0 commit comments