2018-03-17 18:26:18 +05:30
|
|
|
<script>
|
2019-02-15 15:39:39 +05:30
|
|
|
import { GlLoadingIcon } from '@gitlab/ui';
|
2018-12-13 13:39:08 +05:30
|
|
|
/* eslint-disable vue/require-default-prop */
|
2020-04-08 14:13:33 +05:30
|
|
|
/*
|
2020-04-22 19:07:51 +05:30
|
|
|
This component will be deprecated in favor of gl-deprecated-button.
|
2020-04-08 14:13:33 +05:30
|
|
|
https://gitlab-org.gitlab.io/gitlab-ui/?path=/story/base-button--loading-button
|
|
|
|
https://gitlab.com/gitlab-org/gitlab/issues/207412
|
|
|
|
*/
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
GlLoadingIcon,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
loading: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
2018-03-17 18:26:18 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
disabled: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
2018-03-17 18:26:18 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
label: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
},
|
|
|
|
containerClass: {
|
|
|
|
type: [String, Array, Object],
|
|
|
|
required: false,
|
|
|
|
default: 'btn btn-align-content',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onClick(e) {
|
|
|
|
this.$emit('click', e);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2018-03-17 18:26:18 +05:30
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2019-02-15 15:39:39 +05:30
|
|
|
<button :class="containerClass" :disabled="loading || disabled" type="button" @click="onClick">
|
2019-07-07 11:18:12 +05:30
|
|
|
<transition name="fade-in">
|
2018-12-05 23:21:45 +05:30
|
|
|
<gl-loading-icon
|
2018-03-17 18:26:18 +05:30
|
|
|
v-if="loading"
|
|
|
|
:inline="true"
|
|
|
|
:class="{
|
2019-02-15 15:39:39 +05:30
|
|
|
'append-right-5': label,
|
2018-03-17 18:26:18 +05:30
|
|
|
}"
|
2018-11-08 19:23:39 +05:30
|
|
|
class="js-loading-button-icon"
|
2018-03-17 18:26:18 +05:30
|
|
|
/>
|
|
|
|
</transition>
|
2019-07-07 11:18:12 +05:30
|
|
|
<transition name="fade-in">
|
2018-11-08 19:23:39 +05:30
|
|
|
<slot>
|
2019-02-15 15:39:39 +05:30
|
|
|
<span v-if="label" class="js-loading-button-label"> {{ label }} </span>
|
2018-11-08 19:23:39 +05:30
|
|
|
</slot>
|
2018-03-17 18:26:18 +05:30
|
|
|
</transition>
|
|
|
|
</button>
|
|
|
|
</template>
|