@vue-interface/btn-activity 0.9.12 → 1.1.0
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.
- package/dist/btn-activity.css +1 -0
- package/dist/btn-activity.es.js +715 -0
- package/dist/btn-activity.umd.js +15 -0
- package/index.js +5 -2
- package/package.json +28 -33
- package/src/BtnActivity.vue +67 -61
- package/.eslintrc.js +0 -53
- package/babel.config.js +0 -11
- package/dist/BtnActivity.common.js +0 -8819
- package/dist/BtnActivity.common.js.map +0 -1
- package/dist/BtnActivity.css +0 -1
- package/dist/BtnActivity.umd.js +0 -8829
- package/dist/BtnActivity.umd.js.map +0 -1
- package/dist/BtnActivity.umd.min.js +0 -2
- package/dist/BtnActivity.umd.min.js.map +0 -1
- package/dist/demo.html +0 -19
- package/docs/.vuepress/config.js +0 -44
- package/docs/.vuepress/dist/404.html +0 -19
- package/docs/.vuepress/dist/assets/css/0.styles.275ee968.css +0 -1
- package/docs/.vuepress/dist/assets/img/search.83621669.svg +0 -1
- package/docs/.vuepress/dist/assets/js/10.5d93d289.js +0 -1
- package/docs/.vuepress/dist/assets/js/11.97ab3884.js +0 -1
- package/docs/.vuepress/dist/assets/js/2.f3d148c3.js +0 -1
- package/docs/.vuepress/dist/assets/js/3.81681fff.js +0 -1
- package/docs/.vuepress/dist/assets/js/4.82fa7382.js +0 -1
- package/docs/.vuepress/dist/assets/js/5.3dae6ad4.js +0 -1
- package/docs/.vuepress/dist/assets/js/6.6a04f815.js +0 -1
- package/docs/.vuepress/dist/assets/js/7.c033cb49.js +0 -1
- package/docs/.vuepress/dist/assets/js/8.6d6eb599.js +0 -1
- package/docs/.vuepress/dist/assets/js/9.eaefe866.js +0 -1
- package/docs/.vuepress/dist/assets/js/app.7ed065d3.js +0 -13
- package/docs/.vuepress/dist/examples/index.html +0 -21
- package/docs/.vuepress/dist/examples/test.html +0 -17
- package/docs/.vuepress/dist/index.html +0 -53
- package/docs/.vuepress/dist/options.html +0 -41
- package/docs/.vuepress/dist/tailwindcss.html +0 -85
- package/docs/README.md +0 -17
- package/docs/examples/README.md +0 -3
- package/docs/options.md +0 -44
- package/index.html +0 -177
- package/main.vue +0 -5
- package/postcss.config.js +0 -1
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
- package/src/css/BtnActivity.css +0 -1
- package/tailwind.config.js +0 -19
- package/vue.config.js +0 -12
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
(function(d,v){typeof exports=="object"&&typeof module!="undefined"?v(exports):typeof define=="function"&&define.amd?define(["exports"],v):(d=typeof globalThis!="undefined"?globalThis:d||self,v(d.BtnActivity={}))})(this,function(d){"use strict";function v(t){return v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(t)}function B(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function S(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function j(t,e,i){return e&&S(t.prototype,e),i&&S(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function b(t,e){return b=Object.setPrototypeOf||function(n,r){return n.__proto__=r,n},b(t,e)}function L(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function y(t,e,i){return L()?y=Reflect.construct:y=function(r,o,s){var u=[null];u.push.apply(u,o);var a=Function.bind.apply(r,u),c=new a;return s&&b(c,s.prototype),c},y.apply(null,arguments)}function x(t,e){return F(t)||I(t,e)||D(t,e)||N()}function F(t){if(Array.isArray(t))return t}function I(t,e){var i=t==null?null:typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(i!=null){var n=[],r=!0,o=!1,s,u;try{for(i=i.call(t);!(r=(s=i.next()).done)&&(n.push(s.value),!(e&&n.length===e));r=!0);}catch(a){o=!0,u=a}finally{try{!r&&i.return!=null&&i.return()}finally{if(o)throw u}}return n}}function D(t,e){if(!!t){if(typeof t=="string")return A(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);if(i==="Object"&&t.constructor&&(i=t.constructor.name),i==="Map"||i==="Set")return Array.from(t);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return A(t,e)}}function A(t,e){(e==null||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function N(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var p=function(){return p=Object.assign||function(i){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])}return i},p.apply(this,arguments)};function W(t){return t.toLowerCase()}var Z=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],H=/[^A-Z0-9]+/gi;function U(t,e){e===void 0&&(e={});for(var i=e.splitRegexp,n=i===void 0?Z:i,r=e.stripRegexp,o=r===void 0?H:r,s=e.transform,u=s===void 0?W:s,a=e.delimiter,c=a===void 0?" ":a,f=C(C(t,n,"$1\0$2"),o,"\0"),_=0,l=f.length;f.charAt(_)==="\0";)_++;for(;f.charAt(l-1)==="\0";)l--;return f.slice(_,l).split("\0").map(u).join(c)}function C(t,e,i){return e instanceof RegExp?t.replace(e,i):e.reduce(function(n,r){return n.replace(r,i)},t)}function M(t,e){return e===void 0&&(e={}),U(t,p({delimiter:"."},e))}function m(t,e){return e===void 0&&(e={}),M(t,p({delimiter:"-"},e))}var P=function(){function t(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};B(this,t),this.components={},Object.entries(i).forEach(function(n){var r=x(n,2),o=r[0],s=r[1];e.register(o,s)})}return j(t,[{key:"get",value:function(i){var n=this.components[i=m(i)];if(n)return n;throw new Error('"'.concat(i,'" has not been registered yet!'))}},{key:"register",value:function(i,n){var r=this;return v(i)==="object"?(Object.entries(i).forEach(function(o){var s=x(o,2),u=s[0],a=s[1];r.register(m(u),a)}),this):(this.components[m(i)]=n,this)}},{key:"remove",value:function(i){return delete this.components[m(i)],this}},{key:"reset",value:function(){return this.components={},this}}]),t}();function X(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return y(P,e)}const w=X();var G=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"activity-indicator",class:t.classes,style:t.style},[i("div",{staticClass:"activity-indicator-content"},[i(t.component,{tag:"component",staticClass:"mx-auto"}),t.label?i("div",{staticClass:"activity-indicator-label"},[t._v(" "+t._s(t.label)+" ")]):t._e()],1)])},V=[],$t="";function $(t,e,i,n,r,o,s,u){var a=typeof t=="function"?t.options:t;e&&(a.render=e,a.staticRenderFns=i,a._compiled=!0),n&&(a.functional=!0),o&&(a._scopeId="data-v-"+o);var c;if(s?(c=function(l){l=l||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!l&&typeof __VUE_SSR_CONTEXT__!="undefined"&&(l=__VUE_SSR_CONTEXT__),r&&r.call(this,l),l&&l._registeredComponents&&l._registeredComponents.add(s)},a._ssrRegister=c):r&&(c=u?function(){r.call(this,(a.functional?this.parent:this).$root.$options.shadowRoot)}:r),c)if(a.functional){a._injectStyles=c;var f=a.render;a.render=function(bt,k){return c.call(k),f(bt,k)}}else{var _=a.beforeCreate;a.beforeCreate=_?[].concat(_,c):[c]}return{exports:t,options:a}}function h(t,e="px"){return t!=null&&t!==!1&&isFinite(t)?`${t}${e}`:t}const q={name:"ActivityIndicator",props:{absolute:Boolean,center:Boolean,label:String,size:{type:String,default:"md"},registry:{type:P,default(){return w}},type:{type:String,required:!0},height:[String,Number],maxHeight:[String,Number],minHeight:[String,Number],width:[String,Number],maxWidth:[String,Number],minWidth:[String,Number]},computed:{classes(){return{"activity-indicator-center":this.center,"activity-indicator-absolute":this.absolute,[this.size&&`activity-indicator-${this.size}`]:!!this.size}},style(){return{width:h(this.width),maxWidth:h(this.maxWidth),minWidth:h(this.minWidth),height:h(this.height),maxHeight:h(this.maxHeight),minHeight:h(this.minHeight)}},component(){return()=>{const t=w.get(this.type);return t instanceof Promise?t:typeof t=="function"?t():Promise.resolve(t)}}}},R={};var J=$(q,G,V,!1,K,null,null,null);function K(t){for(let e in R)this[e]=R[e]}var Q=function(){return J.exports}(),St="",xt="",At="",Ct="",Pt="",wt="",Rt="",zt="",Ot="",Tt="",Et="",kt="",Bt="",jt="";/*! *****************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
***************************************************************************** */var g=function(){return g=Object.assign||function(e){for(var i,n=1,r=arguments.length;n<r;n++){i=arguments[n];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},g.apply(this,arguments)};function Y(t){return t.toLowerCase()}var tt=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],et=/[^A-Z0-9]+/gi;function it(t,e){e===void 0&&(e={});for(var i=e.splitRegexp,n=i===void 0?tt:i,r=e.stripRegexp,o=r===void 0?et:r,s=e.transform,u=s===void 0?Y:s,a=e.delimiter,c=a===void 0?" ":a,f=z(z(t,n,"$1\0$2"),o,"\0"),_=0,l=f.length;f.charAt(_)==="\0";)_++;for(;f.charAt(l-1)==="\0";)l--;return f.slice(_,l).split("\0").map(u).join(c)}function z(t,e,i){return e instanceof RegExp?t.replace(e,i):e.reduce(function(n,r){return n.replace(r,i)},t)}function nt(t,e){return e===void 0&&(e={}),it(t,g({delimiter:"."},e))}function rt(t,e){return e===void 0&&(e={}),nt(t,g({delimiter:"-"},e))}var at={props:{size:String,sizePrefix:{type:String,default(){return this.$options.name}}},computed:{sizeableClassPrefix(){return this.sizePrefix&&rt(this.sizePrefix)},sizeableClass(){return!this.size||!this.sizeableClassPrefix?"":`${this.sizeableClassPrefix}-${this.size}`}}},st={props:{variant:String,variantPrefix:{type:String,default(){return this.$options.name&&this.$options.name.toLowerCase()}}},computed:{variantClassPrefix(){return this.variantPrefix},variantClass(){return!this.variant||!this.variantClassPrefix?"":`${this.variantClassPrefix}-${this.variant}`}}},ot=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i(t.component,{tag:"component",class:t.classes,attrs:{disabled:t.disabled,role:"button"},on:{click:function(n){!t.disabled&&t.$emit("click",n)}}},[t._t("default",function(){return[t._v(t._s(t.label))]})],2)},lt=[];const ct={name:"Btn",mixins:[at,st],props:{active:Boolean,block:Boolean,disabled:Boolean,label:String,outline:Boolean,tag:String,variant:{type:String,default:"primary"}},computed:{classes(){return["btn",this.variantClass,this.sizeableClass,this.active&&"active",this.block&&"btn-block",this.disabled&&"disabled"]},component(){return this.tag?this.tag:this.$attrs.to?"router-link":this.$attrs.href?"a":"button"},variantClassPrefix(){return this.variantPrefix+(this.outline?"-outline":"")}}},O={};var ut=$(ct,ot,lt,!1,ft,null,null,null);function ft(t){for(let e in O)this[e]=O[e]}var _t=function(){return ut.exports}(),vt=function(){var t=this,e=this,i=e.$createElement,n=e._self._c||i;return n("btn",{class:e.classes,attrs:{active:e.active,block:e.block,disabled:e.disabled,size:e.size,tag:e.tag,variant:e.variant},on:{click:function(r){return!e.disabled&&e.$emit("click",r,t)}}},[e._t("default",function(){return[e._v(e._s(e.label))]}),n("activity-indicator",e._b({},"activity-indicator",e.indicatorProps,!1))],2)},dt=[],Lt="";const ht=function(t){const e=parseFloat(t||0,10),i=t&&t.match(/m?s/),n=i?i[0]:!1;let r;switch(n){case"s":r=e*1e3;break;case"ms":default:r=e;break}return r||0},T=function(t,e){const i=(t.ownerDocument||document).defaultView;setTimeout(()=>{e.apply()},ht(i.getComputedStyle(t).animationDuration))},yt={name:"BtnActivity",components:{ActivityIndicator:Q,Btn:_t},props:{active:Boolean,activity:Boolean,block:Boolean,disabled:Boolean,indicator:{type:[Object,String],default:"spinner"},label:String,orientation:{type:String,default:"right"},size:{type:String,default:"md"},tag:String,variant:{type:String,default:"primary"}},data(){return{currentActivity:this.activity}},computed:{classes(){const t={disabled:this.disabled,active:this.active,"btn-activity":this.activity};return t["btn-activity-"+this.orientation.replace("btn-activity-","")]=!!this.orientation,t["btn-activity-indicator-"+this.indicatorProps.type.replace("btn-activity-indicator-","")]=!!this.indicatorProps.type,t},indicatorProps(){return Object.assign({type:"spinner"},(typeof this.indicator=="string"?{type:this.indicator}:this.indicator)||{})}},watch:{activity(t){t?this.showActivity():this.hideActivity()}},mounted(){this.activity&&this.showActivity()},methods:{disable(){this.$el.disabled=!0,this.$el.classList.add("disabled")},enable(){this.$el.disabled=!1,this.$el.classList.remove("disabled")},hideActivity(){this.$el.classList.add("btn-hide-activity"),T(this.$el,()=>{this.enable(),this.currentActivity=!1,this.$el.classList.remove("btn-activity","btn-hide-activity"),this.$emit("hide-activity")})},showActivity(){this.currentActivity=!0,this.disable(),T(this.$el,()=>{this.$el.classList.add("btn-activity"),this.$emit("show-activity")})},toggle(){this.currentActivity?this.hideActivity():this.showActivity()}}},E={};var pt=$(yt,vt,dt,!1,mt,null,null,null);function mt(t){for(let e in E)this[e]=E[e]}var gt=function(){return pt.exports}();d.BtnActivity=gt,Object.defineProperties(d,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-interface/btn-activity",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A Vue activity button component.",
|
|
5
|
-
"
|
|
5
|
+
"files": [
|
|
6
|
+
"index.js",
|
|
7
|
+
"dist",
|
|
8
|
+
"src"
|
|
9
|
+
],
|
|
10
|
+
"main": "./dist/btn-activity.umd.js",
|
|
11
|
+
"module": "./index.js",
|
|
12
|
+
"browserslist": "last 2 versions, > 0.5%, ie >= 11",
|
|
6
13
|
"scripts": {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"lint": "vue-cli-service lint",
|
|
11
|
-
"fix": "vue-cli-service lint --fix",
|
|
14
|
+
"dev": "vite",
|
|
15
|
+
"build": "vite build",
|
|
16
|
+
"preview": "vite preview",
|
|
12
17
|
"pre-release": "npm run build; git add . -A; git commit -m 'pre-release commit'",
|
|
13
18
|
"release-patch": "npm run pre-release && npm version patch -m \"%s\" && npm run release;",
|
|
14
19
|
"release-minor": "npm run pre-release && npm version minor -m \"%s\" && npm run release;",
|
|
15
20
|
"release-major": "npm run pre-release && npm version major -m \"%s\" && npm run release;",
|
|
16
|
-
"release": "git add . -A; git commit; git push --tags origin; npm publish;"
|
|
17
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
18
|
-
"docs:dev": "./node_modules/.bin/vuepress dev docs",
|
|
19
|
-
"docs:build": "./node_modules/.bin/vuepress build docs"
|
|
21
|
+
"release": "git add . -A; git commit; git push --tags origin; npm publish;"
|
|
20
22
|
},
|
|
21
23
|
"repository": {
|
|
22
24
|
"type": "git",
|
|
@@ -37,29 +39,22 @@
|
|
|
37
39
|
},
|
|
38
40
|
"homepage": "https://github.com/vue-interface/btn-activity/docs#readme",
|
|
39
41
|
"dependencies": {
|
|
40
|
-
"@vue-interface/activity-indicator": "^0.
|
|
41
|
-
"@vue-interface/btn": "^0.
|
|
42
|
-
"
|
|
43
|
-
"core-js": "^3.6.4",
|
|
44
|
-
"tailwindcss": "^1.8.12",
|
|
45
|
-
"vue": "^2.6.12"
|
|
42
|
+
"@vue-interface/activity-indicator": "^1.0.4",
|
|
43
|
+
"@vue-interface/btn": "^2.0.0",
|
|
44
|
+
"vue": "^2.6.14"
|
|
46
45
|
},
|
|
47
46
|
"devDependencies": {
|
|
48
|
-
"@
|
|
49
|
-
"
|
|
50
|
-
"@vuepress/plugin-register-components": "^1.6.0",
|
|
47
|
+
"@rollup/plugin-babel": "^5.3.0",
|
|
48
|
+
"autoprefixer": "^10.4.2",
|
|
51
49
|
"babel-eslint": "^10.1.0",
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"last 2 versions",
|
|
63
|
-
"not dead"
|
|
64
|
-
]
|
|
50
|
+
"babel-preset-vue": "^2.0.2",
|
|
51
|
+
"change-case": "^4.1.2",
|
|
52
|
+
"eslint": "^6.7.2",
|
|
53
|
+
"eslint-plugin-vue": "^6.2.2",
|
|
54
|
+
"pascalcase": "^2.0.0",
|
|
55
|
+
"postcss": "^8.4.6",
|
|
56
|
+
"tailwindcss": "^3.0.18",
|
|
57
|
+
"vite": "^2.7.2",
|
|
58
|
+
"vite-plugin-vue2": "^1.9.3"
|
|
59
|
+
}
|
|
65
60
|
}
|
package/src/BtnActivity.vue
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
<btn
|
|
3
|
+
:active="active"
|
|
4
|
+
:block="block"
|
|
5
|
+
:disabled="disabled"
|
|
6
|
+
:size="size"
|
|
7
|
+
:tag="tag"
|
|
8
|
+
:variant="variant"
|
|
9
|
+
:class="classes"
|
|
10
|
+
@click="(e) => !disabled && $emit('click', e, this)">
|
|
11
|
+
<slot>{{ label }}</slot>
|
|
5
12
|
<activity-indicator v-bind="indicatorProps" />
|
|
6
|
-
</
|
|
13
|
+
</btn>
|
|
7
14
|
</template>
|
|
8
15
|
|
|
9
16
|
<script>
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import Dots from '@vue-interface/activity-indicator/src/types/Dots';
|
|
13
|
-
import Spinner from '@vue-interface/activity-indicator/src/types/Spinner';
|
|
14
|
-
|
|
15
|
-
register({
|
|
16
|
-
dots: Dots,
|
|
17
|
-
spinner: Spinner
|
|
18
|
-
});
|
|
17
|
+
import { ActivityIndicator } from '@vue-interface/activity-indicator';
|
|
18
|
+
import { Btn } from '@vue-interface/btn';
|
|
19
19
|
|
|
20
20
|
const convertAnimationDelayToInt = function(delay) {
|
|
21
21
|
const num = parseFloat(delay || 0, 10);
|
|
@@ -48,9 +48,10 @@ const animated = function(el, callback) {
|
|
|
48
48
|
export default {
|
|
49
49
|
|
|
50
50
|
name: 'BtnActivity',
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
components: {
|
|
53
|
-
ActivityIndicator
|
|
53
|
+
ActivityIndicator,
|
|
54
|
+
Btn
|
|
54
55
|
},
|
|
55
56
|
|
|
56
57
|
props: {
|
|
@@ -77,33 +78,38 @@ export default {
|
|
|
77
78
|
block: Boolean,
|
|
78
79
|
|
|
79
80
|
/**
|
|
80
|
-
*
|
|
81
|
+
* Disable the button.
|
|
81
82
|
*
|
|
82
83
|
* @property {Boolean}
|
|
83
84
|
*/
|
|
84
85
|
disabled: Boolean,
|
|
85
86
|
|
|
86
87
|
/**
|
|
87
|
-
* The
|
|
88
|
-
* inside the element's html.
|
|
88
|
+
* The type of activity indicator inside the button.
|
|
89
89
|
*
|
|
90
90
|
* @property {String}
|
|
91
91
|
*/
|
|
92
|
-
|
|
92
|
+
indicator: {
|
|
93
|
+
type: [Object, String],
|
|
94
|
+
default: 'spinner'
|
|
95
|
+
},
|
|
93
96
|
|
|
94
97
|
/**
|
|
95
|
-
* The button
|
|
98
|
+
* The button label.
|
|
96
99
|
*
|
|
97
100
|
* @property {String}
|
|
98
101
|
*/
|
|
99
|
-
|
|
102
|
+
label: String,
|
|
100
103
|
|
|
101
104
|
/**
|
|
102
|
-
* The
|
|
105
|
+
* The orientation of the activity button inside the button.
|
|
103
106
|
*
|
|
104
107
|
* @property {String}
|
|
105
108
|
*/
|
|
106
|
-
|
|
109
|
+
orientation: {
|
|
110
|
+
type: String,
|
|
111
|
+
default: 'right'
|
|
112
|
+
},
|
|
107
113
|
|
|
108
114
|
/**
|
|
109
115
|
* The size of the button.
|
|
@@ -116,35 +122,28 @@ export default {
|
|
|
116
122
|
},
|
|
117
123
|
|
|
118
124
|
/**
|
|
119
|
-
* The
|
|
125
|
+
* The HTML tag.
|
|
120
126
|
*
|
|
121
127
|
* @property {String}
|
|
122
128
|
*/
|
|
123
|
-
|
|
124
|
-
type: String,
|
|
125
|
-
default: 'primary'
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* The type of activity indicator inside the button.
|
|
130
|
-
*
|
|
131
|
-
* @property {String}
|
|
132
|
-
*/
|
|
133
|
-
indicator: {
|
|
134
|
-
type: [Object, String],
|
|
135
|
-
default: 'spinner'
|
|
136
|
-
},
|
|
129
|
+
tag: String,
|
|
137
130
|
|
|
138
131
|
/**
|
|
139
|
-
* The
|
|
132
|
+
* The variant of the button.
|
|
140
133
|
*
|
|
141
134
|
* @property {String}
|
|
142
135
|
*/
|
|
143
|
-
|
|
136
|
+
variant: {
|
|
144
137
|
type: String,
|
|
145
|
-
default: '
|
|
138
|
+
default: 'primary'
|
|
146
139
|
}
|
|
147
140
|
},
|
|
141
|
+
|
|
142
|
+
data() {
|
|
143
|
+
return {
|
|
144
|
+
currentActivity: this.activity
|
|
145
|
+
};
|
|
146
|
+
},
|
|
148
147
|
|
|
149
148
|
computed: {
|
|
150
149
|
|
|
@@ -157,12 +156,9 @@ export default {
|
|
|
157
156
|
const classes = {
|
|
158
157
|
'disabled': this.disabled,
|
|
159
158
|
'active': this.active,
|
|
160
|
-
'btn-block': this.block,
|
|
161
159
|
'btn-activity': this.activity
|
|
162
160
|
};
|
|
163
161
|
|
|
164
|
-
classes['btn-' + this.size.replace('btn-', '')] = !!this.size;
|
|
165
|
-
classes['btn-' + this.variant.replace('btn-', '')] = !!this.variant;
|
|
166
162
|
classes['btn-activity-' + this.orientation.replace('btn-activity-', '')] = !!this.orientation;
|
|
167
163
|
classes['btn-activity-indicator-' + this.indicatorProps.type.replace('btn-activity-indicator-', '')] = !!this.indicatorProps.type;
|
|
168
164
|
|
|
@@ -172,7 +168,7 @@ export default {
|
|
|
172
168
|
indicatorProps() {
|
|
173
169
|
return Object.assign({
|
|
174
170
|
type: 'spinner'
|
|
175
|
-
}, (
|
|
171
|
+
}, (typeof this.indicator === 'string' ? {
|
|
176
172
|
type: this.indicator
|
|
177
173
|
} : this.indicator) || {});
|
|
178
174
|
}
|
|
@@ -192,6 +188,12 @@ export default {
|
|
|
192
188
|
|
|
193
189
|
},
|
|
194
190
|
|
|
191
|
+
mounted() {
|
|
192
|
+
if(this.activity) {
|
|
193
|
+
this.showActivity();
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
|
|
195
197
|
methods: {
|
|
196
198
|
|
|
197
199
|
/**
|
|
@@ -201,6 +203,7 @@ export default {
|
|
|
201
203
|
*/
|
|
202
204
|
disable() {
|
|
203
205
|
this.$el.disabled = true;
|
|
206
|
+
this.$el.classList.add('disabled');
|
|
204
207
|
},
|
|
205
208
|
|
|
206
209
|
/**
|
|
@@ -210,48 +213,51 @@ export default {
|
|
|
210
213
|
*/
|
|
211
214
|
enable() {
|
|
212
215
|
this.$el.disabled = false;
|
|
216
|
+
this.$el.classList.remove('disabled');
|
|
213
217
|
},
|
|
214
218
|
|
|
215
219
|
/**
|
|
216
|
-
*
|
|
220
|
+
* Hide the activity indicator inside the button.
|
|
217
221
|
*
|
|
218
222
|
* @return void
|
|
219
223
|
*/
|
|
220
|
-
|
|
221
|
-
this.
|
|
224
|
+
hideActivity() {
|
|
225
|
+
this.$el.classList.add('btn-hide-activity');
|
|
222
226
|
|
|
223
227
|
animated(this.$el, () => {
|
|
224
|
-
this
|
|
225
|
-
this
|
|
228
|
+
this.enable();
|
|
229
|
+
this.currentActivity = false;
|
|
230
|
+
this.$el.classList.remove('btn-activity', 'btn-hide-activity');
|
|
231
|
+
this.$emit('hide-activity');
|
|
226
232
|
});
|
|
227
233
|
},
|
|
228
234
|
|
|
229
235
|
/**
|
|
230
|
-
*
|
|
236
|
+
* Show the activity indicator inside the button.
|
|
231
237
|
*
|
|
232
238
|
* @return void
|
|
233
239
|
*/
|
|
234
|
-
|
|
235
|
-
this
|
|
240
|
+
showActivity() {
|
|
241
|
+
this.currentActivity = true;
|
|
242
|
+
this.disable();
|
|
236
243
|
|
|
237
244
|
animated(this.$el, () => {
|
|
238
|
-
this.
|
|
239
|
-
this.$
|
|
240
|
-
this.$emit('hide-activity');
|
|
245
|
+
this.$el.classList.add('btn-activity');
|
|
246
|
+
this.$emit('show-activity');
|
|
241
247
|
});
|
|
242
248
|
},
|
|
243
249
|
|
|
244
250
|
/**
|
|
245
|
-
*
|
|
251
|
+
* Show the activity indicator inside the button.
|
|
246
252
|
*
|
|
247
253
|
* @return void
|
|
248
254
|
*/
|
|
249
|
-
|
|
250
|
-
if(!this.
|
|
251
|
-
this
|
|
255
|
+
toggle() {
|
|
256
|
+
if(!this.currentActivity) {
|
|
257
|
+
this.showActivity();
|
|
252
258
|
}
|
|
253
259
|
else {
|
|
254
|
-
|
|
260
|
+
this.hideActivity();
|
|
255
261
|
}
|
|
256
262
|
}
|
|
257
263
|
|
package/.eslintrc.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: [
|
|
3
|
-
'plugin:vue/recommended'
|
|
4
|
-
],
|
|
5
|
-
parserOptions: {
|
|
6
|
-
'parser': 'babel-eslint'
|
|
7
|
-
},
|
|
8
|
-
// add your custom rules here
|
|
9
|
-
rules: {
|
|
10
|
-
'vue/no-v-html': 0,
|
|
11
|
-
'vue/require-default-prop': 0,
|
|
12
|
-
"vue/max-attributes-per-line": ["error", {
|
|
13
|
-
"singleline": 5,
|
|
14
|
-
"multiline": {
|
|
15
|
-
"max": 1,
|
|
16
|
-
"allowFirstLine": true
|
|
17
|
-
}
|
|
18
|
-
}],
|
|
19
|
-
"vue/html-indent": ["error", 4, {
|
|
20
|
-
"attribute": 1,
|
|
21
|
-
"baseIndent": 1,
|
|
22
|
-
"closeBracket": 1,
|
|
23
|
-
"alignAttributesVertically": false,
|
|
24
|
-
"ignores": []
|
|
25
|
-
}],
|
|
26
|
-
"vue/html-closing-bracket-newline": ["error", {
|
|
27
|
-
"singleline": "never",
|
|
28
|
-
"multiline": "never"
|
|
29
|
-
}],
|
|
30
|
-
// Ensure no space after keywords like if.
|
|
31
|
-
'keyword-spacing': ["error", {
|
|
32
|
-
"overrides": {
|
|
33
|
-
"if": { "after": false },
|
|
34
|
-
"for": { "after": false },
|
|
35
|
-
"while": { "after": false }
|
|
36
|
-
}
|
|
37
|
-
}],
|
|
38
|
-
// Use alternative brace style
|
|
39
|
-
'brace-style': ['error', 'stroustrup'],
|
|
40
|
-
// No spaces before parens
|
|
41
|
-
'space-before-function-paren': ['error', 'never'],
|
|
42
|
-
// Indent for tabs because spaces suck
|
|
43
|
-
'indent': ['error', 4],
|
|
44
|
-
// Semi colons always where they need to be
|
|
45
|
-
'semi': [2,'always'],
|
|
46
|
-
// allow paren-less arrow functions
|
|
47
|
-
'arrow-parens': 0,
|
|
48
|
-
// allow async-await
|
|
49
|
-
'generator-star-spacing': 0,
|
|
50
|
-
// allow debugger during development
|
|
51
|
-
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
|
|
52
|
-
}
|
|
53
|
-
};
|