2017-10-13 22:01:21 +00:00
|
|
|
<script>
|
2018-11-16 19:29:11 +00:00
|
|
|
import { GlLoadingIcon } from '@gitlab/ui';
|
2018-10-10 07:06:25 +00:00
|
|
|
/* eslint-disable vue/require-default-prop */
|
2020-02-28 09:09:01 +00:00
|
|
|
/*
|
2020-04-03 09:09:31 +00:00
|
|
|
This component will be deprecated in favor of gl-deprecated-button.
|
2020-02-28 09:09:01 +00:00
|
|
|
https://gitlab-org.gitlab.io/gitlab-ui/?path=/story/base-button--loading-button
|
|
|
|
https://gitlab.com/gitlab-org/gitlab/issues/207412
|
|
|
|
*/
|
2017-10-13 22:01:21 +00:00
|
|
|
|
2018-10-10 07:06:25 +00:00
|
|
|
export default {
|
2018-11-07 10:06:15 +00:00
|
|
|
components: {
|
|
|
|
GlLoadingIcon,
|
|
|
|
},
|
2018-10-10 07:06:25 +00:00
|
|
|
props: {
|
|
|
|
loading: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
2017-10-24 04:56:39 +00:00
|
|
|
},
|
2018-10-10 07:06:25 +00:00
|
|
|
disabled: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
2017-11-15 23:13:20 +00:00
|
|
|
},
|
2018-10-10 07:06:25 +00:00
|
|
|
label: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
},
|
|
|
|
containerClass: {
|
|
|
|
type: [String, Array, Object],
|
|
|
|
required: false,
|
|
|
|
default: 'btn btn-align-content',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onClick(e) {
|
|
|
|
this.$emit('click', e);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2017-10-13 22:01:21 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2018-11-16 20:07:38 +00:00
|
|
|
<button :class="containerClass" :disabled="loading || disabled" type="button" @click="onClick">
|
2019-03-25 09:00:36 +00:00
|
|
|
<transition name="fade-in">
|
2018-09-11 22:19:21 +00:00
|
|
|
<gl-loading-icon
|
2018-01-05 00:18:35 +00:00
|
|
|
v-if="loading"
|
|
|
|
:inline="true"
|
|
|
|
:class="{
|
2020-07-08 21:09:09 +00:00
|
|
|
'gl-mr-2': label,
|
2018-01-05 00:18:35 +00:00
|
|
|
}"
|
2018-06-11 09:49:47 +00:00
|
|
|
class="js-loading-button-icon"
|
2018-01-05 00:18:35 +00:00
|
|
|
/>
|
|
|
|
</transition>
|
2019-03-25 09:00:36 +00:00
|
|
|
<transition name="fade-in">
|
2018-05-11 14:03:27 +00:00
|
|
|
<slot>
|
2018-11-16 20:07:38 +00:00
|
|
|
<span v-if="label" class="js-loading-button-label"> {{ label }} </span>
|
2018-05-11 14:03:27 +00:00
|
|
|
</slot>
|
2018-01-05 00:18:35 +00:00
|
|
|
</transition>
|
2017-10-13 22:01:21 +00:00
|
|
|
</button>
|
|
|
|
</template>
|