@vue-interface/btn-activity 2.0.0-beta.10 → 2.0.0-beta.11
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.js +33 -275
- package/dist/btn-activity.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/btn-activity.js
CHANGED
|
@@ -1,273 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
props: {
|
|
7
|
-
absolute: Boolean,
|
|
8
|
-
center: Boolean,
|
|
9
|
-
label: String,
|
|
10
|
-
size: {
|
|
11
|
-
type: String,
|
|
12
|
-
default: "md"
|
|
13
|
-
},
|
|
14
|
-
registry: {
|
|
15
|
-
type: String,
|
|
16
|
-
default: "indicators"
|
|
17
|
-
},
|
|
18
|
-
type: {
|
|
19
|
-
type: String,
|
|
20
|
-
required: !0
|
|
21
|
-
},
|
|
22
|
-
height: [String, Number],
|
|
23
|
-
maxHeight: [String, Number],
|
|
24
|
-
minHeight: [String, Number],
|
|
25
|
-
width: [String, Number],
|
|
26
|
-
maxWidth: [String, Number],
|
|
27
|
-
minWidth: [String, Number]
|
|
28
|
-
},
|
|
29
|
-
data: () => ({
|
|
30
|
-
is: null
|
|
31
|
-
}),
|
|
32
|
-
setup(t) {
|
|
33
|
-
return {
|
|
34
|
-
registryInstance: O(t.registry || "indicators")
|
|
35
|
-
};
|
|
36
|
-
},
|
|
37
|
-
computed: {
|
|
38
|
-
classes() {
|
|
39
|
-
return {
|
|
40
|
-
"activity-indicator-center": this.center,
|
|
41
|
-
"activity-indicator-absolute": this.absolute,
|
|
42
|
-
[this.size && `activity-indicator-${this.size}`]: !!this.size
|
|
43
|
-
};
|
|
44
|
-
},
|
|
45
|
-
style() {
|
|
46
|
-
return {
|
|
47
|
-
width: r(this.width),
|
|
48
|
-
maxWidth: r(this.maxWidth),
|
|
49
|
-
minWidth: r(this.minWidth),
|
|
50
|
-
height: r(this.height),
|
|
51
|
-
maxHeight: r(this.maxHeight),
|
|
52
|
-
minHeight: r(this.minHeight)
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
async mounted() {
|
|
57
|
-
const t = await this.component();
|
|
58
|
-
this.is = () => t;
|
|
59
|
-
},
|
|
60
|
-
methods: {
|
|
61
|
-
async component() {
|
|
62
|
-
let t = this.registryInstance.get(this.type);
|
|
63
|
-
return t instanceof Promise ? t : (typeof t == "function" && (t = await t()), t.default ? t.default : t);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}), W = (t, i) => {
|
|
67
|
-
const e = t.__vccOpts || t;
|
|
68
|
-
for (const [n, s] of i)
|
|
69
|
-
e[n] = s;
|
|
70
|
-
return e;
|
|
71
|
-
}, D = { class: "activity-indicator-content" }, L = {
|
|
72
|
-
key: 1,
|
|
73
|
-
class: "activity-indicator-label"
|
|
74
|
-
};
|
|
75
|
-
function I(t, i, e, n, s, o) {
|
|
76
|
-
return a(), g("div", {
|
|
77
|
-
class: j(["activity-indicator", t.classes]),
|
|
78
|
-
style: N(t.style)
|
|
79
|
-
}, [
|
|
80
|
-
E("div", D, [
|
|
81
|
-
t.is ? (a(), y(x(t.is()), {
|
|
82
|
-
key: 0,
|
|
83
|
-
class: "mx-auto"
|
|
84
|
-
})) : $("", !0),
|
|
85
|
-
t.label ? (a(), g("div", L, f(t.label), 1)) : $("", !0)
|
|
86
|
-
])
|
|
87
|
-
], 6);
|
|
88
|
-
}
|
|
89
|
-
const Z = /* @__PURE__ */ W(V, [["render", I]]);
|
|
90
|
-
var F = Object.defineProperty, M = (t, i, e) => i in t ? F(t, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[i] = e, T = (t, i, e) => (M(t, typeof i != "symbol" ? i + "" : i, e), e), u = function() {
|
|
91
|
-
return u = Object.assign || function(t) {
|
|
92
|
-
for (var i, e = 1, n = arguments.length; e < n; e++) {
|
|
93
|
-
i = arguments[e];
|
|
94
|
-
for (var s in i)
|
|
95
|
-
Object.prototype.hasOwnProperty.call(i, s) && (t[s] = i[s]);
|
|
96
|
-
}
|
|
97
|
-
return t;
|
|
98
|
-
}, u.apply(this, arguments);
|
|
99
|
-
};
|
|
100
|
-
function q(t) {
|
|
101
|
-
return t.toLowerCase();
|
|
102
|
-
}
|
|
103
|
-
var G = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g], J = /[^A-Z0-9]+/gi;
|
|
104
|
-
function K(t, i) {
|
|
105
|
-
i === void 0 && (i = {});
|
|
106
|
-
for (var e = i.splitRegexp, n = e === void 0 ? G : e, s = i.stripRegexp, o = s === void 0 ? J : s, c = i.transform, v = c === void 0 ? q : c, l = i.delimiter, B = l === void 0 ? " " : l, h = S(S(t, n, "$1\0$2"), o, "\0"), p = 0, m = h.length; h.charAt(p) === "\0"; )
|
|
107
|
-
p++;
|
|
108
|
-
for (; h.charAt(m - 1) === "\0"; )
|
|
109
|
-
m--;
|
|
110
|
-
return h.slice(p, m).split("\0").map(v).join(B);
|
|
111
|
-
}
|
|
112
|
-
function S(t, i, e) {
|
|
113
|
-
return i instanceof RegExp ? t.replace(i, e) : i.reduce(function(n, s) {
|
|
114
|
-
return n.replace(s, e);
|
|
115
|
-
}, t);
|
|
116
|
-
}
|
|
117
|
-
function Q(t, i) {
|
|
118
|
-
return i === void 0 && (i = {}), K(t, u({ delimiter: "." }, i));
|
|
119
|
-
}
|
|
120
|
-
function d(t, i) {
|
|
121
|
-
return i === void 0 && (i = {}), Q(t, u({ delimiter: "-" }, i));
|
|
122
|
-
}
|
|
123
|
-
class U {
|
|
124
|
-
constructor(i = {}) {
|
|
125
|
-
T(this, "components"), this.components = /* @__PURE__ */ new Map(), Object.entries(i).forEach(([e, n]) => {
|
|
126
|
-
this.register(e, n);
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
get(i) {
|
|
130
|
-
const e = this.components.get(
|
|
131
|
-
i = d(i)
|
|
132
|
-
);
|
|
133
|
-
if (e)
|
|
134
|
-
return e;
|
|
135
|
-
throw new Error(`"${i}" has not been registered yet!`);
|
|
136
|
-
}
|
|
137
|
-
register(i, e) {
|
|
138
|
-
return typeof i == "object" ? (Object.entries(i).forEach(([n, s]) => {
|
|
139
|
-
this.register(d(n), s);
|
|
140
|
-
}), this) : (this.components.set(d(i), e), this);
|
|
141
|
-
}
|
|
142
|
-
remove(i) {
|
|
143
|
-
return this.components.delete(d(i)), this;
|
|
144
|
-
}
|
|
145
|
-
reset() {
|
|
146
|
-
return this.components = /* @__PURE__ */ new Map(), this;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
function X(t = {}) {
|
|
150
|
-
return new U(t);
|
|
151
|
-
}
|
|
152
|
-
X();
|
|
153
|
-
const Y = {
|
|
154
|
-
props: {
|
|
155
|
-
componentPrefix: String,
|
|
156
|
-
size: String,
|
|
157
|
-
sizePrefix: String
|
|
158
|
-
},
|
|
159
|
-
computed: {
|
|
160
|
-
sizeableClassPrefix() {
|
|
161
|
-
return this.sizePrefix || this.componentPrefix;
|
|
162
|
-
},
|
|
163
|
-
hasSizeablePrefix() {
|
|
164
|
-
return this.size === void 0 ? !1 : !!this.size.match(new RegExp(`^${this.sizeableClassPrefix}`));
|
|
165
|
-
},
|
|
166
|
-
sizeableClass() {
|
|
167
|
-
return this.size ? !this.sizeableClassPrefix || this.hasSizeablePrefix ? this.size : `${this.sizeableClassPrefix}-${this.size}` : "";
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}, tt = {
|
|
171
|
-
props: {
|
|
172
|
-
componentPrefix: String,
|
|
173
|
-
variant: String,
|
|
174
|
-
variantPrefix: String
|
|
175
|
-
},
|
|
176
|
-
computed: {
|
|
177
|
-
variantClassPrefix() {
|
|
178
|
-
return this.variantPrefix || this.componentPrefix;
|
|
179
|
-
},
|
|
180
|
-
hasVariantPrefix() {
|
|
181
|
-
return this.variant === void 0 ? !1 : !!this.variant.match(new RegExp(`^${this.variantClassPrefix}`));
|
|
182
|
-
},
|
|
183
|
-
variantClass() {
|
|
184
|
-
return this.variant ? !this.variantClassPrefix || this.hasVariantPrefix ? this.variant : `${this.variantClassPrefix}-${this.variant}` : "";
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}, it = b({
|
|
188
|
-
mixins: [
|
|
189
|
-
Y,
|
|
190
|
-
tt
|
|
191
|
-
],
|
|
192
|
-
props: {
|
|
193
|
-
active: Boolean,
|
|
194
|
-
block: Boolean,
|
|
195
|
-
componentPrefix: {
|
|
196
|
-
type: String,
|
|
197
|
-
default: "btn"
|
|
198
|
-
},
|
|
199
|
-
disabled: Boolean,
|
|
200
|
-
label: String,
|
|
201
|
-
outline: Boolean,
|
|
202
|
-
tag: String,
|
|
203
|
-
variant: {
|
|
204
|
-
type: String,
|
|
205
|
-
default: "primary"
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
computed: {
|
|
209
|
-
classes() {
|
|
210
|
-
return [
|
|
211
|
-
"btn",
|
|
212
|
-
this.variantClass,
|
|
213
|
-
this.sizeableClass,
|
|
214
|
-
this.active && "active",
|
|
215
|
-
this.block && "btn-block",
|
|
216
|
-
this.disabled && "disabled"
|
|
217
|
-
];
|
|
218
|
-
},
|
|
219
|
-
component() {
|
|
220
|
-
return this.tag ? this.tag : this.$attrs.href ? "a" : "button";
|
|
221
|
-
},
|
|
222
|
-
variantClassPrefix() {
|
|
223
|
-
return (this.variantPrefix || this.componentPrefix) + (this.outline ? "-outline" : "");
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}), et = (t, i) => {
|
|
227
|
-
const e = t.__vccOpts || t;
|
|
228
|
-
for (const [n, s] of i)
|
|
229
|
-
e[n] = s;
|
|
230
|
-
return e;
|
|
231
|
-
};
|
|
232
|
-
function st(t, i, e, n, s, o) {
|
|
233
|
-
return a(), y(x(t.component), w(t.$attrs, {
|
|
234
|
-
disabled: t.disabled,
|
|
235
|
-
class: t.classes,
|
|
236
|
-
role: "button"
|
|
237
|
-
}), {
|
|
238
|
-
default: A(() => [
|
|
239
|
-
C(t.$slots, "default", {}, () => [
|
|
240
|
-
k(f(t.label), 1)
|
|
241
|
-
])
|
|
242
|
-
]),
|
|
243
|
-
_: 3
|
|
244
|
-
}, 16, ["disabled", "class"]);
|
|
245
|
-
}
|
|
246
|
-
const nt = /* @__PURE__ */ et(it, [["render", st]]), rt = function(t) {
|
|
247
|
-
const i = parseFloat(t || 0), e = t && t.match(/m?s/), n = e ? e[0] : !1;
|
|
1
|
+
import { ActivityIndicator as d } from "@vue-interface/activity-indicator";
|
|
2
|
+
import { Btn as v } from "@vue-interface/btn";
|
|
3
|
+
import { defineComponent as h, resolveComponent as n, openBlock as y, createBlock as p, mergeProps as b, withCtx as m, renderSlot as u, createTextVNode as f, toDisplayString as g, createVNode as A, normalizeProps as $, guardReactiveProps as k } from "vue";
|
|
4
|
+
const w = function(t) {
|
|
5
|
+
const e = parseFloat(t || 0), i = t && t.match(/m?s/), a = i ? i[0] : !1;
|
|
248
6
|
let s;
|
|
249
|
-
switch (
|
|
7
|
+
switch (a) {
|
|
250
8
|
case "s":
|
|
251
|
-
s =
|
|
9
|
+
s = e * 1e3;
|
|
252
10
|
break;
|
|
253
11
|
case "ms":
|
|
254
12
|
default:
|
|
255
|
-
s =
|
|
13
|
+
s = e;
|
|
256
14
|
break;
|
|
257
15
|
}
|
|
258
16
|
return s || 0;
|
|
259
|
-
},
|
|
260
|
-
const
|
|
17
|
+
}, o = function(t, e) {
|
|
18
|
+
const i = (t.ownerDocument || document).defaultView;
|
|
261
19
|
setTimeout(
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
20
|
+
e,
|
|
21
|
+
w(
|
|
22
|
+
i == null ? void 0 : i.getComputedStyle(t).animationDuration
|
|
265
23
|
)
|
|
266
24
|
);
|
|
267
|
-
},
|
|
25
|
+
}, B = h({
|
|
268
26
|
components: {
|
|
269
|
-
ActivityIndicator:
|
|
270
|
-
Btn:
|
|
27
|
+
ActivityIndicator: d,
|
|
28
|
+
Btn: v
|
|
271
29
|
},
|
|
272
30
|
inheritAttrs: !1,
|
|
273
31
|
props: {
|
|
@@ -385,7 +143,7 @@ const nt = /* @__PURE__ */ et(it, [["render", st]]), rt = function(t) {
|
|
|
385
143
|
* Hide the activity indicator inside the button.
|
|
386
144
|
*/
|
|
387
145
|
hideActivity() {
|
|
388
|
-
this.$el.classList.add("btn-hide-activity"),
|
|
146
|
+
this.$el.classList.add("btn-hide-activity"), o(this.$el, () => {
|
|
389
147
|
this.disabled || this.enable(), this.currentActivity = !1, this.$el.classList.remove("btn-activity", "btn-hide-activity"), this.$emit("hide-activity");
|
|
390
148
|
});
|
|
391
149
|
},
|
|
@@ -393,7 +151,7 @@ const nt = /* @__PURE__ */ et(it, [["render", st]]), rt = function(t) {
|
|
|
393
151
|
* Show the activity indicator inside the button.
|
|
394
152
|
*/
|
|
395
153
|
showActivity() {
|
|
396
|
-
this.currentActivity = !0, this.disable(),
|
|
154
|
+
this.currentActivity = !0, this.disable(), o(this.$el, () => {
|
|
397
155
|
this.$el.classList.add("btn-activity"), this.$emit("show-activity");
|
|
398
156
|
});
|
|
399
157
|
},
|
|
@@ -405,15 +163,15 @@ const nt = /* @__PURE__ */ et(it, [["render", st]]), rt = function(t) {
|
|
|
405
163
|
}
|
|
406
164
|
}
|
|
407
165
|
});
|
|
408
|
-
const
|
|
409
|
-
const
|
|
410
|
-
for (const [
|
|
411
|
-
|
|
412
|
-
return
|
|
166
|
+
const S = (t, e) => {
|
|
167
|
+
const i = t.__vccOpts || t;
|
|
168
|
+
for (const [a, s] of e)
|
|
169
|
+
i[a] = s;
|
|
170
|
+
return i;
|
|
413
171
|
};
|
|
414
|
-
function
|
|
415
|
-
const c =
|
|
416
|
-
return
|
|
172
|
+
function P(t, e, i, a, s, C) {
|
|
173
|
+
const c = n("activity-indicator"), r = n("btn");
|
|
174
|
+
return y(), p(r, b({
|
|
417
175
|
active: t.active,
|
|
418
176
|
block: t.block,
|
|
419
177
|
disabled: t.disabled,
|
|
@@ -422,7 +180,7 @@ function ct(t, i, e, n, s, o) {
|
|
|
422
180
|
variant: t.variant,
|
|
423
181
|
class: t.classes
|
|
424
182
|
}, Object.assign({}, t.$attrs, { onClick: void 0 }), {
|
|
425
|
-
onClick:
|
|
183
|
+
onClick: e[0] || (e[0] = (l) => !t.disabled && t.$emit("click", l, {
|
|
426
184
|
disable: t.disable,
|
|
427
185
|
enable: t.enable,
|
|
428
186
|
toggle: t.toggle,
|
|
@@ -430,16 +188,16 @@ function ct(t, i, e, n, s, o) {
|
|
|
430
188
|
hideActivity: t.hideActivity
|
|
431
189
|
}))
|
|
432
190
|
}), {
|
|
433
|
-
default:
|
|
434
|
-
|
|
435
|
-
|
|
191
|
+
default: m(() => [
|
|
192
|
+
u(t.$slots, "default", {}, () => [
|
|
193
|
+
f(g(t.label), 1)
|
|
436
194
|
]),
|
|
437
|
-
|
|
195
|
+
A(c, $(k(t.indicatorProps)), null, 16)
|
|
438
196
|
]),
|
|
439
197
|
_: 3
|
|
440
198
|
}, 16, ["active", "block", "disabled", "size", "tag", "variant", "class"]);
|
|
441
199
|
}
|
|
442
|
-
const
|
|
200
|
+
const O = /* @__PURE__ */ S(B, [["render", P]]);
|
|
443
201
|
export {
|
|
444
|
-
|
|
202
|
+
O as BtnActivity
|
|
445
203
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(n,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@vue-interface/activity-indicator"),require("@vue-interface/btn"),require("vue")):typeof define=="function"&&define.amd?define(["exports","@vue-interface/activity-indicator","@vue-interface/btn","vue"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.BtnActivity={},n.ActivityIndicator,n.Btn,n.Vue))})(this,function(n,o,d,i){"use strict";const l=function(t){const s=parseFloat(t||0),e=t&&t.match(/m?s/),c=e?e[0]:!1;let a;switch(c){case"s":a=s*1e3;break;case"ms":default:a=s;break}return a||0},r=function(t,s){const e=(t.ownerDocument||document).defaultView;setTimeout(s,l(e==null?void 0:e.getComputedStyle(t).animationDuration))},y=i.defineComponent({components:{ActivityIndicator:o.ActivityIndicator,Btn:d.Btn},inheritAttrs:!1,props:{active:Boolean,activity:Boolean,block:Boolean,disabled:Boolean,indicator:{type:[Object,String],default:"spinner"},label:{type:String,default:void 0},orientation:{type:String,default:"right"},size:{type:String,default:"md"},tag:{type:String,default:void 0},variant:{type:String,default:"primary"}},emits:["click","hide-activity","show-activity"],data(){return{currentActivity:this.activity}},computed:{classes(){return{disabled:this.disabled,active:this.active,"btn-activity":this.activity,[`btn-activity-${this.orientation.replace("btn-activity-","")}`]:!!this.orientation,[`btn-activity-indicator-${this.indicatorProps.type.replace("btn-activity-indicator-","")}`]:!!this.indicatorProps.type}},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"),r(this.$el,()=>{this.disabled||this.enable(),this.currentActivity=!1,this.$el.classList.remove("btn-activity","btn-hide-activity"),this.$emit("hide-activity")})},showActivity(){this.currentActivity=!0,this.disable(),r(this.$el,()=>{this.$el.classList.add("btn-activity"),this.$emit("show-activity")})},toggle(){this.currentActivity?this.hideActivity():this.showActivity()}}}),m="",v=(t,s)=>{const e=t.__vccOpts||t;for(const[c,a]of s)e[c]=a;return e};function h(t,s,e,c,a,g){const u=i.resolveComponent("activity-indicator"),b=i.resolveComponent("btn");return i.openBlock(),i.createBlock(b,i.mergeProps({active:t.active,block:t.block,disabled:t.disabled,size:t.size,tag:t.tag,variant:t.variant,class:t.classes},Object.assign({},t.$attrs,{onClick:void 0}),{onClick:s[0]||(s[0]=f=>!t.disabled&&t.$emit("click",f,{disable:t.disable,enable:t.enable,toggle:t.toggle,showActivity:t.showActivity,hideActivity:t.hideActivity}))}),{default:i.withCtx(()=>[i.renderSlot(t.$slots,"default",{},()=>[i.createTextVNode(i.toDisplayString(t.label),1)]),i.createVNode(u,i.normalizeProps(i.guardReactiveProps(t.indicatorProps)),null,16)]),_:3},16,["active","block","disabled","size","tag","variant","class"])}const p=v(y,[["render",h]]);n.BtnActivity=p,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
|