vlite3 1.2.8 → 1.2.10
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/components/Button.vue.d.ts +5 -1
- package/components/Button.vue.js +164 -72
- package/components/CategoryManager/CategoryManager.vue.js +1 -1
- package/components/ColorPicker/ColorIro.vue3.js +2 -2
- package/components/ColorPicker/ColorPicker.vue.js +2 -2
- package/components/Dropdown/Dropdown.vue.d.ts +3 -3
- package/components/Dropdown/Dropdown.vue.js +14 -14
- package/components/Dropdown/DropdownGroupedLayout.vue.js +12 -12
- package/components/Dropdown/DropdownMenu.vue.d.ts +1 -1
- package/components/Dropdown/DropdownMenu.vue.js +2 -2
- package/components/Dropdown/DropdownMenu.vue2.js +1 -1
- package/components/Form/FormFields.vue.js +1 -1
- package/components/Form/FormFields.vue2.js +29 -25
- package/components/ImportData/ImportStep2.vue.js +0 -1
- package/components/Input.vue.js +6 -5
- package/components/Label.vue.d.ts +5 -2
- package/components/Label.vue.js +18 -11
- package/components/MultiSelect/MultiSelect.vue.d.ts +1 -1
- package/components/Screen/ScreenFilter.vue.js +1 -1
- package/components/Splitter/Splitter.vue.d.ts +1 -1
- package/components/Tabes/Tabes.vue.js +2 -2
- package/components/Tabes/Tabes.vue2.js +53 -51
- package/components/Workbook/Sheet.vue.js +61 -57
- package/components/Workbook/Workbook.vue.js +2 -2
- package/components/Workbook/Workbook.vue2.js +25 -25
- package/components/Workbook/WorkbookAddButton.vue.js +9 -8
- package/directives/vRipple.d.ts +3 -1
- package/directives/vRipple.js +11 -11
- package/package.json +1 -1
- package/style.css +22 -3
- package/types/button.d.ts +2 -0
- /package/components/ColorPicker/{ColorIro.vue2.js → ColorIro.vue.js} +0 -0
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { defineComponent as N, ref as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as N, ref as y, computed as f, openBlock as a, createElementBlock as d, normalizeClass as D, createElementVNode as c, withModifiers as v, createBlock as g, withCtx as p, createVNode as u, createCommentVNode as w, withDirectives as O, vModelText as j, toDisplayString as C, unref as z, createTextVNode as M, nextTick as R } from "vue";
|
|
2
|
+
import h from "../Icon.vue.js";
|
|
3
3
|
import A from "../Dropdown/Dropdown.vue.js";
|
|
4
4
|
import { $t as s } from "../../utils/i18n.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
/* empty css */
|
|
7
|
-
import K from "../
|
|
8
|
-
|
|
7
|
+
import K from "../Button.vue.js";
|
|
8
|
+
import U from "../IconPicker.vue.js";
|
|
9
|
+
const q = {
|
|
9
10
|
type: "button",
|
|
10
11
|
class: "flex items-center justify-center rounded hover:bg-accent transition-colors p-0.5 outline-none focus-visible:ring-2 focus-visible:ring-primary/20 mt-1"
|
|
11
|
-
},
|
|
12
|
+
}, F = {
|
|
12
13
|
key: 1,
|
|
13
14
|
class: "flex items-center justify-center p-0.5"
|
|
14
|
-
},
|
|
15
|
+
}, G = { class: "flex-1 min-w-0 pr-1" }, H = {
|
|
15
16
|
key: 1,
|
|
16
17
|
class: "block truncate text-sm font-medium leading-normal"
|
|
17
|
-
},
|
|
18
|
+
}, J = {
|
|
18
19
|
class: /* @__PURE__ */ D(["flex items-center"])
|
|
19
|
-
},
|
|
20
|
+
}, ee = /* @__PURE__ */ N({
|
|
20
21
|
__name: "Sheet",
|
|
21
22
|
props: {
|
|
22
23
|
sheet: {},
|
|
@@ -31,20 +32,22 @@ const U = {
|
|
|
31
32
|
inactiveItemClass: { default: "" }
|
|
32
33
|
},
|
|
33
34
|
emits: ["select", "update:title", "update:icon", "edit-start", "edit-end", "duplicate", "delete"],
|
|
34
|
-
setup(
|
|
35
|
-
const e =
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
setup(n, { emit: E }) {
|
|
36
|
+
const e = n, o = E, m = y(null), r = y(e.sheet.title), T = f(
|
|
37
|
+
() => e.sheet.titleI18n ? s(e.sheet.titleI18n) : e.sheet.title
|
|
38
|
+
), k = () => {
|
|
39
|
+
r.value = e.sheet.title, o("edit-start", e.sheet.id), R(() => {
|
|
40
|
+
m.value?.focus(), m.value?.select();
|
|
38
41
|
});
|
|
39
|
-
},
|
|
42
|
+
}, x = () => {
|
|
40
43
|
if (!e.isEditing) return;
|
|
41
44
|
const t = r.value.trim();
|
|
42
|
-
t ?
|
|
45
|
+
t ? o("update:title", e.sheet.id, t) : r.value = e.sheet.title, o("edit-end", e.sheet.id);
|
|
43
46
|
}, B = () => {
|
|
44
|
-
r.value = e.sheet.title,
|
|
47
|
+
r.value = e.sheet.title, o("edit-end", e.sheet.id);
|
|
45
48
|
}, I = (t) => {
|
|
46
|
-
t.key === "Enter" &&
|
|
47
|
-
}, $ =
|
|
49
|
+
t.key === "Enter" && x(), t.key === "Escape" && B();
|
|
50
|
+
}, $ = f(() => [
|
|
48
51
|
{
|
|
49
52
|
label: s("vlite.workbook.rename") !== "vlite.workbook.rename" ? s("vlite.workbook.rename") : "Rename",
|
|
50
53
|
value: "rename",
|
|
@@ -68,18 +71,18 @@ const U = {
|
|
|
68
71
|
cancelText: e.confirmDeleteTexts?.cancel,
|
|
69
72
|
variant: "danger",
|
|
70
73
|
onConfirm: () => {
|
|
71
|
-
e.canDelete &&
|
|
74
|
+
e.canDelete && o("delete", e.sheet.id);
|
|
72
75
|
}
|
|
73
76
|
} : void 0
|
|
74
77
|
}
|
|
75
78
|
]), S = (t) => {
|
|
76
|
-
if (t.value === "rename" && k(), t.value === "duplicate" &&
|
|
79
|
+
if (t.value === "rename" && k(), t.value === "duplicate" && o("duplicate", e.sheet.id), t.value === "delete") {
|
|
77
80
|
if (!e.canDelete || e.confirmDelete) return;
|
|
78
|
-
|
|
81
|
+
o("delete", e.sheet.id);
|
|
79
82
|
}
|
|
80
|
-
},
|
|
81
|
-
t && t.value && t.value !== "delete" || e.canDelete &&
|
|
82
|
-
}, V =
|
|
83
|
+
}, b = (t) => {
|
|
84
|
+
t && t.value && t.value !== "delete" || e.canDelete && o("delete", e.sheet.id);
|
|
85
|
+
}, V = f(() => [
|
|
83
86
|
"group relative flex items-center min-w-[120px] max-w-[240px] h-9 px-3 border-r border-border select-none cursor-pointer transition-all duration-200 ease-out",
|
|
84
87
|
e.itemClass,
|
|
85
88
|
e.isActive ? `bg-muted text-foreground ring-1 ring-border ring-b-0 z-10 ${e.activeItemClass}` : `text-muted-foreground hover:bg-accent/50 ${e.inactiveItemClass}`,
|
|
@@ -87,82 +90,83 @@ const U = {
|
|
|
87
90
|
].filter(Boolean).join(" "));
|
|
88
91
|
return (t, i) => (a(), d("div", {
|
|
89
92
|
class: D(V.value),
|
|
90
|
-
onClick: i[5] || (i[5] = (l) =>
|
|
93
|
+
onClick: i[5] || (i[5] = (l) => o("select", n.sheet.id)),
|
|
91
94
|
onDblclick: k
|
|
92
95
|
}, [
|
|
93
96
|
c("div", {
|
|
94
|
-
onClick: i[1] || (i[1] =
|
|
97
|
+
onClick: i[1] || (i[1] = v(() => {
|
|
95
98
|
}, ["stop"])),
|
|
96
99
|
class: "mr-2 flex items-center shrink-0"
|
|
97
100
|
}, [
|
|
98
|
-
(
|
|
101
|
+
(n.sheet.icon || n.isEditing) && n.allowIconChange ? (a(), g(U, {
|
|
99
102
|
key: 0,
|
|
100
|
-
value:
|
|
103
|
+
value: n.sheet.icon || "lucide:file",
|
|
101
104
|
position: "bottom-start",
|
|
102
|
-
onOnSelect: i[0] || (i[0] = (l) =>
|
|
105
|
+
onOnSelect: i[0] || (i[0] = (l) => o("update:icon", n.sheet.id, l))
|
|
103
106
|
}, {
|
|
104
|
-
default:
|
|
105
|
-
c("button",
|
|
106
|
-
u(
|
|
107
|
-
icon:
|
|
107
|
+
default: p(() => [
|
|
108
|
+
c("button", q, [
|
|
109
|
+
u(h, {
|
|
110
|
+
icon: n.sheet.icon || "lucide:file",
|
|
108
111
|
class: "w-4 h-4 opacity-70 hover:opacity-100 transition-opacity"
|
|
109
112
|
}, null, 8, ["icon"])
|
|
110
113
|
])
|
|
111
114
|
]),
|
|
112
115
|
_: 1
|
|
113
|
-
}, 8, ["value"])) :
|
|
114
|
-
u(
|
|
115
|
-
icon:
|
|
116
|
+
}, 8, ["value"])) : n.sheet.icon ? (a(), d("div", F, [
|
|
117
|
+
u(h, {
|
|
118
|
+
icon: n.sheet.icon,
|
|
116
119
|
class: "w-4 h-4 opacity-70"
|
|
117
120
|
}, null, 8, ["icon"])
|
|
118
121
|
])) : w("", !0)
|
|
119
122
|
]),
|
|
120
|
-
c("div",
|
|
121
|
-
|
|
123
|
+
c("div", G, [
|
|
124
|
+
n.isEditing ? O((a(), d("input", {
|
|
122
125
|
key: 0,
|
|
123
126
|
ref_key: "inputRef",
|
|
124
|
-
ref:
|
|
127
|
+
ref: m,
|
|
125
128
|
"onUpdate:modelValue": i[2] || (i[2] = (l) => r.value = l),
|
|
126
129
|
type: "text",
|
|
127
130
|
class: "w-full bg-transparent border-none outline-none p-0 text-sm font-medium text-foreground placeholder-muted-foreground focus:ring-0",
|
|
128
|
-
onBlur:
|
|
131
|
+
onBlur: x,
|
|
129
132
|
onKeydown: I,
|
|
130
|
-
onClick: i[3] || (i[3] =
|
|
133
|
+
onClick: i[3] || (i[3] = v(() => {
|
|
131
134
|
}, ["stop"]))
|
|
132
135
|
}, null, 544)), [
|
|
133
136
|
[j, r.value]
|
|
134
|
-
]) : (a(), d("span",
|
|
137
|
+
]) : (a(), d("span", H, C(T.value), 1))
|
|
135
138
|
]),
|
|
136
139
|
c("div", {
|
|
137
|
-
class: "opacity-0 group-hover:opacity-100 transition-opacity ml-auto pl-1 flex items-center
|
|
138
|
-
onClick: i[4] || (i[4] =
|
|
140
|
+
class: "opacity-0 group-hover:opacity-100 transition-opacity ml-auto pl-1 -mr-2 flex items-center",
|
|
141
|
+
onClick: i[4] || (i[4] = v(() => {
|
|
139
142
|
}, ["stop"]))
|
|
140
143
|
}, [
|
|
141
|
-
u(
|
|
144
|
+
u(z(A), {
|
|
142
145
|
options: $.value,
|
|
143
146
|
position: "bottom-end",
|
|
144
147
|
width: "140px",
|
|
145
148
|
teleport: !0,
|
|
146
149
|
onOnSelect: S,
|
|
147
|
-
onOnConfirm:
|
|
148
|
-
onConfirm:
|
|
150
|
+
onOnConfirm: b,
|
|
151
|
+
onConfirm: b
|
|
149
152
|
}, {
|
|
150
|
-
trigger:
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
153
|
+
trigger: p(() => [
|
|
154
|
+
u(K, {
|
|
155
|
+
icon: "lucide:more-vertical",
|
|
156
|
+
asIcon: "",
|
|
157
|
+
size: "xs",
|
|
158
|
+
rounded: "full",
|
|
159
|
+
variant: "ghost"
|
|
160
|
+
})
|
|
157
161
|
]),
|
|
158
|
-
item:
|
|
162
|
+
item: p(({ option: l }) => [
|
|
159
163
|
c("div", J, [
|
|
160
|
-
l?.icon ? (a(),
|
|
164
|
+
l?.icon ? (a(), g(h, {
|
|
161
165
|
key: 0,
|
|
162
166
|
icon: l?.icon,
|
|
163
167
|
class: "w-3.5 h-3.5 mr-2 opacity-70"
|
|
164
168
|
}, null, 8, ["icon"])) : w("", !0),
|
|
165
|
-
|
|
169
|
+
M(" " + C(l?.label), 1)
|
|
166
170
|
])
|
|
167
171
|
]),
|
|
168
172
|
_: 1
|
|
@@ -172,5 +176,5 @@ const U = {
|
|
|
172
176
|
}
|
|
173
177
|
});
|
|
174
178
|
export {
|
|
175
|
-
|
|
179
|
+
ee as default
|
|
176
180
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./Workbook.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import r from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const _ = /* @__PURE__ */ r(o, [["__scopeId", "data-v-8d484d8e"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
_ as default
|
|
7
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as N, ref as
|
|
1
|
+
import { defineComponent as N, ref as C, shallowRef as P, watch as z, computed as A, openBlock as o, createElementBlock as c, createElementVNode as r, renderSlot as v, createCommentVNode as m, createVNode as g, unref as M, withCtx as W, Fragment as Y, renderList as j, isMemoSame as F, createBlock as R } from "vue";
|
|
2
2
|
import { VueDraggable as q } from "vue-draggable-plus";
|
|
3
3
|
import G from "./Sheet.vue.js";
|
|
4
4
|
import p from "./WorkbookAddButton.vue.js";
|
|
@@ -7,7 +7,7 @@ const H = { class: "flex flex-col w-full font-sans" }, J = { class: "flex items-
|
|
|
7
7
|
class: "flex items-center"
|
|
8
8
|
}, O = {
|
|
9
9
|
key: 0,
|
|
10
|
-
class: "shrink-0
|
|
10
|
+
class: "shrink-0 sticky right-0 z-10 bg-white flex items-center justify-center h-full"
|
|
11
11
|
}, Q = { class: "flex items-center mb-0.5 z-20 sticky right-0 ml-auto box-decoration-clone" }, X = { key: 0 }, Z = { key: 1 }, _ = { class: "flex-1 relative bg-white w-full" }, ne = /* @__PURE__ */ N({
|
|
12
12
|
__name: "Workbook",
|
|
13
13
|
props: {
|
|
@@ -29,63 +29,63 @@ const H = { class: "flex flex-col w-full font-sans" }, J = { class: "flex items-
|
|
|
29
29
|
},
|
|
30
30
|
emits: ["update:modelValue", "update:sheets", "change", "add", "delete", "duplicate", "edit-start", "edit-end"],
|
|
31
31
|
setup(a, { emit: I }) {
|
|
32
|
-
const i = a,
|
|
33
|
-
|
|
32
|
+
const i = a, s = I, h = C(null), u = C(null), d = P([...i.sheets]);
|
|
33
|
+
z(
|
|
34
34
|
() => i.sheets,
|
|
35
35
|
(e) => {
|
|
36
36
|
let n = !1;
|
|
37
|
-
if (e.length !==
|
|
37
|
+
if (e.length !== d.value.length)
|
|
38
38
|
n = !0;
|
|
39
39
|
else
|
|
40
40
|
for (let t = 0; t < e.length; t++)
|
|
41
|
-
if (e[t] !==
|
|
41
|
+
if (e[t] !== d.value[t] || e[t].id !== d.value[t].id) {
|
|
42
42
|
n = !0;
|
|
43
43
|
break;
|
|
44
44
|
}
|
|
45
|
-
n && (
|
|
45
|
+
n && (d.value = [...e]);
|
|
46
46
|
},
|
|
47
47
|
{ deep: !0 }
|
|
48
48
|
// Must be true so parent mutating the array via .push() correctly triggers the watcher
|
|
49
49
|
);
|
|
50
50
|
const D = (e) => {
|
|
51
|
-
|
|
51
|
+
d.value = e, s("update:sheets", e);
|
|
52
52
|
}, V = (e) => {
|
|
53
|
-
|
|
53
|
+
s("update:modelValue", e), s("change", e);
|
|
54
54
|
}, x = () => {
|
|
55
|
-
i.sheets.length >= i.maxSheets ||
|
|
55
|
+
i.sheets.length >= i.maxSheets || s("add");
|
|
56
56
|
}, B = (e, n) => {
|
|
57
57
|
const t = i.sheets.findIndex((l) => l.id === e);
|
|
58
58
|
if (t !== -1) {
|
|
59
59
|
const l = [...i.sheets];
|
|
60
|
-
l[t] = { ...l[t], title: n },
|
|
60
|
+
l[t] = { ...l[t], title: n }, s("update:sheets", l);
|
|
61
61
|
}
|
|
62
62
|
}, S = (e, n) => {
|
|
63
63
|
const t = i.sheets.findIndex((l) => l.id === e);
|
|
64
64
|
if (t !== -1) {
|
|
65
65
|
const l = [...i.sheets];
|
|
66
|
-
l[t] = { ...l[t], icon: n },
|
|
66
|
+
l[t] = { ...l[t], icon: n }, s("update:sheets", l);
|
|
67
67
|
}
|
|
68
68
|
}, E = (e) => {
|
|
69
|
-
u.value = e,
|
|
69
|
+
u.value = e, s("edit-start", e);
|
|
70
70
|
}, U = (e) => {
|
|
71
|
-
u.value = null,
|
|
71
|
+
u.value = null, s("edit-end", e);
|
|
72
72
|
}, $ = (e) => {
|
|
73
|
-
|
|
73
|
+
s("duplicate", e);
|
|
74
74
|
}, T = (e) => {
|
|
75
75
|
const n = i.sheets.findIndex((l) => l.id === e);
|
|
76
76
|
if (n === -1) return;
|
|
77
77
|
const t = [...i.sheets];
|
|
78
|
-
if (t.splice(n, 1),
|
|
78
|
+
if (t.splice(n, 1), s("update:sheets", t), s("delete", e), i.modelValue === e) {
|
|
79
79
|
let l = "";
|
|
80
80
|
if (t.length > 0) {
|
|
81
81
|
const k = Math.min(n, t.length - 1);
|
|
82
82
|
l = t[k].id;
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
s("update:modelValue", l), s("change", l);
|
|
85
85
|
}
|
|
86
86
|
}, L = (e) => {
|
|
87
87
|
h.value && e.deltaY !== 0 && (h.value.scrollLeft += e.deltaY, e.preventDefault());
|
|
88
|
-
}, b =
|
|
88
|
+
}, b = A(() => i.sheets.length > 1);
|
|
89
89
|
return (e, n) => (o(), c("div", H, [
|
|
90
90
|
r("div", J, [
|
|
91
91
|
e.$slots["left-addons"] ? (o(), c("div", K, [
|
|
@@ -98,15 +98,15 @@ const H = { class: "flex flex-col w-full font-sans" }, J = { class: "flex items-
|
|
|
98
98
|
style: { "scrollbar-width": "none", "-ms-overflow-style": "none" },
|
|
99
99
|
onWheel: L
|
|
100
100
|
}, [
|
|
101
|
-
g(
|
|
102
|
-
"model-value":
|
|
101
|
+
g(M(q), {
|
|
102
|
+
"model-value": d.value,
|
|
103
103
|
"onUpdate:modelValue": D,
|
|
104
104
|
disabled: !i.draggable || !!u.value,
|
|
105
105
|
animation: 150,
|
|
106
106
|
class: "flex items-end min-w-max"
|
|
107
107
|
}, {
|
|
108
|
-
default:
|
|
109
|
-
(o(!0), c(
|
|
108
|
+
default: W(() => [
|
|
109
|
+
(o(!0), c(Y, null, j(d.value, (t, l, k, f) => {
|
|
110
110
|
const w = [
|
|
111
111
|
t.id,
|
|
112
112
|
t.title,
|
|
@@ -117,8 +117,8 @@ const H = { class: "flex flex-col w-full font-sans" }, J = { class: "flex items-
|
|
|
117
117
|
a.confirmDelete,
|
|
118
118
|
a.allowIconChange
|
|
119
119
|
];
|
|
120
|
-
if (f && f.key === t.id &&
|
|
121
|
-
const
|
|
120
|
+
if (f && f.key === t.id && F(f, w)) return f;
|
|
121
|
+
const y = (o(), R(G, {
|
|
122
122
|
key: t.id,
|
|
123
123
|
sheet: t,
|
|
124
124
|
"is-active": a.modelValue === t.id,
|
|
@@ -138,7 +138,7 @@ const H = { class: "flex flex-col w-full font-sans" }, J = { class: "flex items-
|
|
|
138
138
|
onDuplicate: $,
|
|
139
139
|
onDelete: T
|
|
140
140
|
}, null, 8, ["sheet", "is-active", "is-editing", "can-delete", "confirm-delete", "confirm-delete-texts", "allow-icon-change", "item-class", "active-item-class", "inactive-item-class"]));
|
|
141
|
-
return
|
|
141
|
+
return y.memo = w, y;
|
|
142
142
|
}, n, 0), 128))
|
|
143
143
|
]),
|
|
144
144
|
_: 1
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as l, computed as c, openBlock as s, createBlock as d } from "vue";
|
|
2
|
+
import m from "../Button.vue.js";
|
|
3
3
|
import { $t as u } from "../../utils/i18n.js";
|
|
4
|
-
const
|
|
4
|
+
const _ = /* @__PURE__ */ l({
|
|
5
5
|
__name: "WorkbookAddButton",
|
|
6
6
|
emits: ["click"],
|
|
7
|
-
setup(
|
|
8
|
-
const n = o, i =
|
|
7
|
+
setup(a, { emit: o }) {
|
|
8
|
+
const n = o, i = c(() => {
|
|
9
9
|
const t = u("vlite.workbook.addSheet");
|
|
10
10
|
return t !== "vlite.workbook.addSheet" ? t : "Add New Sheet";
|
|
11
11
|
});
|
|
12
|
-
return (t, e) => (
|
|
12
|
+
return (t, e) => (s(), d(m, {
|
|
13
13
|
variant: "ghost",
|
|
14
|
-
size: "
|
|
14
|
+
size: "md",
|
|
15
15
|
icon: "lucide:plus",
|
|
16
16
|
title: i.value,
|
|
17
17
|
rounded: "none",
|
|
18
|
+
class: "h-full!",
|
|
18
19
|
onClick: e[0] || (e[0] = (r) => n("click", r))
|
|
19
20
|
}, null, 8, ["title"]));
|
|
20
21
|
}
|
|
21
22
|
});
|
|
22
23
|
export {
|
|
23
|
-
|
|
24
|
+
_ as default
|
|
24
25
|
};
|
package/directives/vRipple.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ interface RippleElement extends HTMLElement {
|
|
|
2
2
|
_rippleHandler?: (ev: MouseEvent) => void;
|
|
3
3
|
}
|
|
4
4
|
export declare const vRipple: {
|
|
5
|
-
mounted(el: RippleElement
|
|
5
|
+
mounted(el: RippleElement, binding: {
|
|
6
|
+
value?: boolean;
|
|
7
|
+
}): void;
|
|
6
8
|
unmounted(el: RippleElement): void;
|
|
7
9
|
};
|
|
8
10
|
export {};
|
package/directives/vRipple.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const f = (e, t) => {
|
|
2
|
+
const o = t.getBoundingClientRect(), p = e.clientX - o.left, d = e.clientY - o.top, s = Math.max(o.width, o.height), c = s / 2;
|
|
3
3
|
t.querySelectorAll(".ripple").forEach((r) => r.remove());
|
|
4
|
-
const
|
|
5
|
-
|
|
4
|
+
const n = document.createElement("span");
|
|
5
|
+
n.style.cssText = `
|
|
6
6
|
width: ${s}px;
|
|
7
7
|
height: ${s}px;
|
|
8
8
|
left: ${p - c}px;
|
|
@@ -14,22 +14,22 @@ const y = (e, t) => {
|
|
|
14
14
|
opacity: 0;
|
|
15
15
|
will-change: transform, opacity;
|
|
16
16
|
background-color: rgba(255, 255, 255, 1);
|
|
17
|
-
`,
|
|
17
|
+
`, n.classList.add("ripple"), t.appendChild(n);
|
|
18
18
|
let a = null;
|
|
19
19
|
const m = 400, l = (r) => {
|
|
20
20
|
a || (a = r);
|
|
21
|
-
const
|
|
22
|
-
|
|
21
|
+
const i = Math.min((r - a) / m, 1), u = (1 - Math.pow(1 - i, 3)) * 2.5, h = i < 0.4 ? i * 0.2 : 0.08 * (1 - (i - 0.4) / 0.6);
|
|
22
|
+
n.style.transform = `scale(${u})`, n.style.opacity = `${h}`, i < 1 ? requestAnimationFrame(l) : n.remove();
|
|
23
23
|
};
|
|
24
24
|
requestAnimationFrame(l);
|
|
25
|
-
},
|
|
26
|
-
mounted(e) {
|
|
27
|
-
window.getComputedStyle(e).position === "static" && (e.style.position = "relative"), e.style.overflow = "hidden", e._rippleHandler = (
|
|
25
|
+
}, v = {
|
|
26
|
+
mounted(e, t) {
|
|
27
|
+
t.value !== !1 && (window.getComputedStyle(e).position === "static" && (e.style.position = "relative"), e.style.overflow = "hidden", e._rippleHandler = (o) => f(o, e), e.addEventListener("click", e._rippleHandler));
|
|
28
28
|
},
|
|
29
29
|
unmounted(e) {
|
|
30
30
|
e._rippleHandler && e.removeEventListener("click", e._rippleHandler), e.querySelectorAll(".ripple").forEach((t) => t.remove());
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
export {
|
|
34
|
-
|
|
34
|
+
v as vRipple
|
|
35
35
|
};
|