@mtn-ui/components 1.0.5 → 1.0.7
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/antd-wrapped/action-group/action-group.vue.js +2 -2
- package/dist/antd-wrapped/action-group/action-group.vue2.js +218 -167
- package/dist/antd-wrapped/button/button.js +15 -11
- package/dist/components.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +389 -334
- package/package.json +50 -50
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./action-group.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const c = /* @__PURE__ */ t(o, [["__scopeId", "data-v-845c43ad"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
c as default
|
|
7
7
|
};
|
|
@@ -1,207 +1,258 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useElementSize as
|
|
3
|
-
import { MoreOutlined as
|
|
1
|
+
import { defineComponent as Ce, useSlots as be, ref as x, inject as Pe, computed as l, shallowRef as ze, watch as ne, createElementBlock as f, openBlock as o, createVNode as U, createElementVNode as oe, unref as v, mergeProps as I, withCtx as a, createBlock as u, createCommentVNode as Ae, Fragment as g, renderList as _, resolveDynamicComponent as m, createSlots as j, createTextVNode as O, toDisplayString as $, cloneVNode as re } from "vue";
|
|
2
|
+
import { useElementSize as Se, useDebounceFn as Me } from "@vueuse/core";
|
|
3
|
+
import { MoreOutlined as xe } from "@ant-design/icons-vue";
|
|
4
4
|
import { Menu as K } from "ant-design-vue";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { actionGroupProps as
|
|
9
|
-
import { PERMISSION_CHECKER_KEY as
|
|
10
|
-
import { filterValidChildren as
|
|
11
|
-
const
|
|
5
|
+
import Ie from "../button/button.js";
|
|
6
|
+
import Be from "../button-group/button-group.js";
|
|
7
|
+
import ie from "../dropdown-button/dropdown-button.js";
|
|
8
|
+
import { actionGroupProps as Ee } from "./props.js";
|
|
9
|
+
import { PERMISSION_CHECKER_KEY as Ne, defaultPermissionChecker as Te } from "@mtn-ui/shared";
|
|
10
|
+
import { filterValidChildren as Re, getButtonKey as se } from "./utils.js";
|
|
11
|
+
const w = "link", le = "small", Ve = 150, Fe = /* @__PURE__ */ Ce({
|
|
12
12
|
name: "MActionGroup",
|
|
13
13
|
inheritAttrs: !1,
|
|
14
14
|
__name: "action-group",
|
|
15
|
-
props:
|
|
15
|
+
props: Ee,
|
|
16
16
|
emits: ["action-click"],
|
|
17
|
-
setup(
|
|
18
|
-
const n =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
() => M.value ? "" : n.moreText
|
|
24
|
-
), w = s(() => n.moreIcon || Ce);
|
|
25
|
-
function _(e) {
|
|
26
|
-
return e ? oe.value(e) : !0;
|
|
17
|
+
setup(ue, { emit: ae }) {
|
|
18
|
+
const n = ue, ce = ae, G = be(), Y = x(), C = x(), b = x(), { width: P } = Se(Y), me = Pe(Ne, x(Te));
|
|
19
|
+
function F(e) {
|
|
20
|
+
if (!e) return;
|
|
21
|
+
const r = e;
|
|
22
|
+
return r.name || r.__name || r.displayName;
|
|
27
23
|
}
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
24
|
+
const z = l(() => n.mode === "table"), A = l(
|
|
25
|
+
() => z.value ? "small" : n.size
|
|
26
|
+
), B = l(
|
|
27
|
+
() => z.value ? "link" : "default"
|
|
28
|
+
), H = l(
|
|
29
|
+
() => z.value ? "" : n.moreText
|
|
30
|
+
), L = l(() => n.moreIcon || xe);
|
|
31
|
+
function E(e) {
|
|
32
|
+
return e ? me.value(e) : !0;
|
|
33
|
+
}
|
|
34
|
+
const N = l(() => Re(G.default ? G.default() : void 0)), d = ze([]);
|
|
35
|
+
function q(e) {
|
|
36
|
+
var t, i, s;
|
|
37
|
+
return [
|
|
38
|
+
e.key ?? "",
|
|
39
|
+
e.label ?? "",
|
|
40
|
+
F(e.icon) ?? "",
|
|
41
|
+
F(e.component) ?? "",
|
|
42
|
+
Array.isArray(e.permission) ? e.permission.join(",") : e.permission ?? "",
|
|
43
|
+
e.permissionAction ?? "",
|
|
44
|
+
String(e.disabled ?? !1),
|
|
45
|
+
String(((t = e.componentProps) == null ? void 0 : t.confirm) ?? ""),
|
|
46
|
+
String(((i = e.componentProps) == null ? void 0 : i.showSuccess) ?? ""),
|
|
47
|
+
String(((s = e.componentProps) == null ? void 0 : s.danger) ?? "")
|
|
48
|
+
].join("|");
|
|
49
|
+
}
|
|
50
|
+
ne(
|
|
51
|
+
() => n.actions,
|
|
52
|
+
(e) => {
|
|
53
|
+
if (!e) {
|
|
54
|
+
d.value = [];
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (d.value.length !== e.length) {
|
|
58
|
+
d.value = e;
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const r = e.map(q).join("||"), t = d.value.map(q).join("||");
|
|
62
|
+
r !== t && (d.value = e);
|
|
63
|
+
},
|
|
64
|
+
{ immediate: !0, deep: !1 }
|
|
65
|
+
);
|
|
66
|
+
const T = l(() => d.value.length ? d.value.filter((e) => E(e.permission)) : []), c = l(() => n.actions ? T.value.length : N.value.length);
|
|
67
|
+
function pe() {
|
|
68
|
+
if (!C.value || !b.value || !P.value)
|
|
69
|
+
return Math.min(n.maxItems, c.value);
|
|
70
|
+
const e = b.value.offsetWidth, r = Array.from(
|
|
71
|
+
C.value.querySelectorAll(".measure-item")
|
|
42
72
|
);
|
|
43
|
-
if (
|
|
44
|
-
let t = e,
|
|
45
|
-
for (let
|
|
46
|
-
const
|
|
47
|
-
if (t +
|
|
48
|
-
t +=
|
|
73
|
+
if (r.length === 0) return Math.min(n.maxItems, c.value);
|
|
74
|
+
let t = e, i = 0;
|
|
75
|
+
for (let s = 0; s < r.length - 1; s++) {
|
|
76
|
+
const y = r[s].offsetWidth + n.gap;
|
|
77
|
+
if (t + y <= P.value)
|
|
78
|
+
t += y, i++;
|
|
49
79
|
else
|
|
50
80
|
break;
|
|
51
81
|
}
|
|
52
|
-
|
|
53
|
-
return Math.max(0, Math.min(r, n.maxItems, a));
|
|
82
|
+
return Math.max(0, Math.min(i, n.maxItems, c.value));
|
|
54
83
|
}
|
|
55
|
-
const
|
|
84
|
+
const S = x(n.maxItems), fe = Me(() => {
|
|
85
|
+
S.value = pe();
|
|
86
|
+
}, Ve);
|
|
87
|
+
ne(
|
|
88
|
+
[P, c, () => n.maxItems, () => n.gap],
|
|
89
|
+
() => {
|
|
90
|
+
if (n.disableCollapse) {
|
|
91
|
+
S.value = c.value;
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (c.value <= 1) {
|
|
95
|
+
S.value = c.value;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
C.value && b.value && P.value ? fe() : S.value = Math.min(n.maxItems, c.value);
|
|
99
|
+
},
|
|
100
|
+
{ immediate: !0 }
|
|
101
|
+
);
|
|
102
|
+
const k = l(() => n.disableCollapse || c.value <= 1 ? c.value : C.value && b.value && P.value ? S.value : Math.min(n.maxItems, c.value)), ve = l(() => n.actions ? T.value.slice(0, k.value) : []), Z = l(() => n.actions ? T.value.slice(k.value) : []), de = l(() => {
|
|
56
103
|
if (n.actions) return [];
|
|
57
|
-
const e =
|
|
58
|
-
return
|
|
59
|
-
}),
|
|
104
|
+
const e = N.value;
|
|
105
|
+
return k.value >= e.length ? e : e.slice(0, k.value);
|
|
106
|
+
}), J = l(() => {
|
|
60
107
|
if (n.actions) return [];
|
|
61
|
-
const e =
|
|
62
|
-
return
|
|
63
|
-
}),
|
|
64
|
-
const
|
|
65
|
-
return
|
|
66
|
-
})),
|
|
67
|
-
function
|
|
68
|
-
return e.component ||
|
|
108
|
+
const e = N.value;
|
|
109
|
+
return k.value >= e.length ? [] : e.slice(k.value);
|
|
110
|
+
}), ye = l(() => n.actions ? [] : J.value.filter((e) => {
|
|
111
|
+
const r = e.props || {};
|
|
112
|
+
return r.permission && r.permissionAction === "hide" ? E(r.permission) : !0;
|
|
113
|
+
})), ke = l(() => n.disableCollapse ? !1 : (n.actions ? Z.value.length : J.value.length) > 0);
|
|
114
|
+
function W(e) {
|
|
115
|
+
return e.component || Ie;
|
|
69
116
|
}
|
|
70
|
-
function
|
|
71
|
-
return e.key || e.label || `action-${
|
|
117
|
+
function Q(e, r) {
|
|
118
|
+
return e.key || e.label || `action-${r}`;
|
|
72
119
|
}
|
|
73
|
-
function
|
|
120
|
+
function X(e) {
|
|
74
121
|
const {
|
|
75
|
-
label:
|
|
122
|
+
label: r,
|
|
76
123
|
key: t,
|
|
77
|
-
onClick:
|
|
78
|
-
permission:
|
|
79
|
-
permissionAction:
|
|
80
|
-
icon:
|
|
81
|
-
component:
|
|
82
|
-
componentProps:
|
|
83
|
-
slot:
|
|
84
|
-
type:
|
|
85
|
-
size:
|
|
86
|
-
disabled:
|
|
87
|
-
...
|
|
124
|
+
onClick: i,
|
|
125
|
+
permission: s,
|
|
126
|
+
permissionAction: p,
|
|
127
|
+
icon: y,
|
|
128
|
+
component: h,
|
|
129
|
+
componentProps: M,
|
|
130
|
+
slot: R,
|
|
131
|
+
type: D,
|
|
132
|
+
size: V,
|
|
133
|
+
disabled: ge,
|
|
134
|
+
..._e
|
|
88
135
|
} = e;
|
|
89
136
|
return {
|
|
90
|
-
component:
|
|
91
|
-
componentProps:
|
|
92
|
-
type:
|
|
93
|
-
size:
|
|
94
|
-
rest:
|
|
95
|
-
permission:
|
|
96
|
-
permissionAction:
|
|
97
|
-
disabled:
|
|
137
|
+
component: h,
|
|
138
|
+
componentProps: M,
|
|
139
|
+
type: D,
|
|
140
|
+
size: V,
|
|
141
|
+
rest: _e,
|
|
142
|
+
permission: s,
|
|
143
|
+
permissionAction: p,
|
|
144
|
+
disabled: ge
|
|
98
145
|
};
|
|
99
146
|
}
|
|
100
|
-
function
|
|
101
|
-
const { component:
|
|
102
|
-
type:
|
|
103
|
-
size:
|
|
104
|
-
disabled:
|
|
105
|
-
...
|
|
147
|
+
function ee(e) {
|
|
148
|
+
const { component: r, componentProps: t, type: i, rest: s, permission: p, permissionAction: y, disabled: h } = X(e), M = {
|
|
149
|
+
type: i || B.value,
|
|
150
|
+
size: A.value,
|
|
151
|
+
disabled: h || !E(p) && y === "disable",
|
|
152
|
+
...s
|
|
106
153
|
};
|
|
107
|
-
|
|
154
|
+
if (r && t) {
|
|
155
|
+
const R = { ...M, ...t };
|
|
156
|
+
return z.value && (R.type = "link"), R;
|
|
157
|
+
}
|
|
158
|
+
return M;
|
|
108
159
|
}
|
|
109
|
-
function
|
|
110
|
-
const { component:
|
|
111
|
-
type:
|
|
112
|
-
size:
|
|
113
|
-
disabled:
|
|
114
|
-
...
|
|
160
|
+
function he(e) {
|
|
161
|
+
const { component: r, componentProps: t, rest: i, permission: s, permissionAction: p, disabled: y } = X(e), h = {
|
|
162
|
+
type: w,
|
|
163
|
+
size: le,
|
|
164
|
+
disabled: y || !E(s) && p === "disable",
|
|
165
|
+
...i
|
|
115
166
|
};
|
|
116
|
-
if (
|
|
117
|
-
const { type:
|
|
118
|
-
return
|
|
167
|
+
if (r && t) {
|
|
168
|
+
const { type: M, size: R, ...D } = t, V = { ...h, ...D };
|
|
169
|
+
return V.type = w, V;
|
|
119
170
|
}
|
|
120
|
-
return
|
|
171
|
+
return h;
|
|
121
172
|
}
|
|
122
|
-
function
|
|
123
|
-
e.onClick && e.onClick(e),
|
|
173
|
+
function te(e) {
|
|
174
|
+
e.onClick && e.onClick(e), ce("action-click", e);
|
|
124
175
|
}
|
|
125
|
-
return (e,
|
|
176
|
+
return (e, r) => (o(), f("div", {
|
|
126
177
|
ref_key: "containerRef",
|
|
127
|
-
ref:
|
|
178
|
+
ref: Y,
|
|
128
179
|
class: "mtn-action-group"
|
|
129
180
|
}, [
|
|
130
|
-
|
|
131
|
-
size:
|
|
181
|
+
U(v(Be), I({
|
|
182
|
+
size: A.value,
|
|
132
183
|
compact: e.compact,
|
|
133
184
|
vertical: e.vertical,
|
|
134
185
|
block: e.block
|
|
135
186
|
}, e.$attrs), {
|
|
136
|
-
default:
|
|
137
|
-
n.actions ? (o(!0), f(
|
|
138
|
-
key:
|
|
139
|
-
}, { ref_for: !0 },
|
|
140
|
-
onClick: (
|
|
141
|
-
}),
|
|
142
|
-
default:
|
|
143
|
-
|
|
187
|
+
default: a(() => [
|
|
188
|
+
n.actions ? (o(!0), f(g, { key: 0 }, _(ve.value, (t, i) => (o(), u(m(W(t)), I({
|
|
189
|
+
key: Q(t, i)
|
|
190
|
+
}, { ref_for: !0 }, ee(t), {
|
|
191
|
+
onClick: (s) => te(t)
|
|
192
|
+
}), j({
|
|
193
|
+
default: a(() => [
|
|
194
|
+
O(" " + $(t.label), 1)
|
|
144
195
|
]),
|
|
145
196
|
_: 2
|
|
146
197
|
}, [
|
|
147
|
-
t.icon
|
|
198
|
+
t.icon ? {
|
|
148
199
|
name: "icon",
|
|
149
|
-
fn:
|
|
150
|
-
(o(),
|
|
200
|
+
fn: a(() => [
|
|
201
|
+
(o(), u(m(t.icon)))
|
|
151
202
|
]),
|
|
152
203
|
key: "0"
|
|
153
204
|
} : void 0
|
|
154
|
-
]), 1040, ["onClick"]))), 128)) : (o(!0), f(
|
|
155
|
-
var
|
|
156
|
-
return o(),
|
|
157
|
-
type: ((
|
|
158
|
-
size: ((
|
|
205
|
+
]), 1040, ["onClick"]))), 128)) : (o(!0), f(g, { key: 1 }, _(de.value, (t, i) => {
|
|
206
|
+
var s, p;
|
|
207
|
+
return o(), u(m(re(t, {
|
|
208
|
+
type: ((s = t.props) == null ? void 0 : s.type) ?? (z.value ? B.value : void 0),
|
|
209
|
+
size: ((p = t.props) == null ? void 0 : p.size) ?? A.value
|
|
159
210
|
})), {
|
|
160
|
-
key:
|
|
211
|
+
key: v(se)(t, i)
|
|
161
212
|
});
|
|
162
213
|
}), 128)),
|
|
163
|
-
|
|
214
|
+
ke.value ? (o(), u(v(ie), I({
|
|
164
215
|
key: 2,
|
|
165
|
-
text:
|
|
166
|
-
size:
|
|
167
|
-
type:
|
|
216
|
+
text: H.value,
|
|
217
|
+
size: A.value,
|
|
218
|
+
type: B.value
|
|
168
219
|
}, n.moreProps), {
|
|
169
|
-
icon:
|
|
170
|
-
(o(),
|
|
220
|
+
icon: a(() => [
|
|
221
|
+
(o(), u(m(L.value)))
|
|
171
222
|
]),
|
|
172
|
-
overlay:
|
|
173
|
-
|
|
174
|
-
default:
|
|
175
|
-
n.actions ? (o(!0), f(
|
|
176
|
-
key:
|
|
223
|
+
overlay: a(() => [
|
|
224
|
+
U(v(K), null, {
|
|
225
|
+
default: a(() => [
|
|
226
|
+
n.actions ? (o(!0), f(g, { key: 0 }, _(Z.value, (t, i) => (o(), u(v(K).Item, {
|
|
227
|
+
key: Q(t, i)
|
|
177
228
|
}, {
|
|
178
|
-
default:
|
|
179
|
-
(o(),
|
|
180
|
-
onClick: (
|
|
181
|
-
}),
|
|
182
|
-
default:
|
|
183
|
-
|
|
229
|
+
default: a(() => [
|
|
230
|
+
(o(), u(m(W(t)), I({ ref_for: !0 }, he(t), {
|
|
231
|
+
onClick: (s) => te(t)
|
|
232
|
+
}), j({
|
|
233
|
+
default: a(() => [
|
|
234
|
+
O(" " + $(t.label), 1)
|
|
184
235
|
]),
|
|
185
236
|
_: 2
|
|
186
237
|
}, [
|
|
187
|
-
t.icon
|
|
238
|
+
t.icon ? {
|
|
188
239
|
name: "icon",
|
|
189
|
-
fn:
|
|
190
|
-
(o(),
|
|
240
|
+
fn: a(() => [
|
|
241
|
+
(o(), u(m(t.icon)))
|
|
191
242
|
]),
|
|
192
243
|
key: "0"
|
|
193
244
|
} : void 0
|
|
194
245
|
]), 1040, ["onClick"]))
|
|
195
246
|
]),
|
|
196
247
|
_: 2
|
|
197
|
-
}, 1024))), 128)) : (o(!0), f(
|
|
198
|
-
key:
|
|
248
|
+
}, 1024))), 128)) : (o(!0), f(g, { key: 1 }, _(ye.value, (t, i) => (o(), u(v(K).Item, {
|
|
249
|
+
key: v(se)(t, i)
|
|
199
250
|
}, {
|
|
200
|
-
default:
|
|
201
|
-
(o(),
|
|
251
|
+
default: a(() => [
|
|
252
|
+
(o(), u(m(re(t, {
|
|
202
253
|
...t.props,
|
|
203
|
-
type:
|
|
204
|
-
size:
|
|
254
|
+
type: w,
|
|
255
|
+
size: le
|
|
205
256
|
}))))
|
|
206
257
|
]),
|
|
207
258
|
_: 2
|
|
@@ -211,51 +262,51 @@ const Q = "link", X = "small", $e = /* @__PURE__ */ ve({
|
|
|
211
262
|
})
|
|
212
263
|
]),
|
|
213
264
|
_: 1
|
|
214
|
-
}, 16, ["text", "size", "type"])) :
|
|
265
|
+
}, 16, ["text", "size", "type"])) : Ae("", !0)
|
|
215
266
|
]),
|
|
216
267
|
_: 1
|
|
217
268
|
}, 16, ["size", "compact", "vertical", "block"]),
|
|
218
|
-
|
|
269
|
+
oe("div", {
|
|
219
270
|
ref_key: "measureRef",
|
|
220
|
-
ref:
|
|
271
|
+
ref: C,
|
|
221
272
|
class: "mtn-action-group-measure"
|
|
222
273
|
}, [
|
|
223
|
-
n.actions ? (o(!0), f(
|
|
224
|
-
key:
|
|
274
|
+
n.actions ? (o(!0), f(g, { key: 0 }, _(T.value, (t, i) => (o(), f("span", {
|
|
275
|
+
key: i,
|
|
225
276
|
class: "measure-item"
|
|
226
277
|
}, [
|
|
227
|
-
(o(),
|
|
228
|
-
default:
|
|
229
|
-
|
|
278
|
+
(o(), u(m(W(t)), I({ ref_for: !0 }, ee(t)), j({
|
|
279
|
+
default: a(() => [
|
|
280
|
+
O(" " + $(t.label), 1)
|
|
230
281
|
]),
|
|
231
282
|
_: 2
|
|
232
283
|
}, [
|
|
233
|
-
t.icon
|
|
284
|
+
t.icon ? {
|
|
234
285
|
name: "icon",
|
|
235
|
-
fn:
|
|
236
|
-
(o(),
|
|
286
|
+
fn: a(() => [
|
|
287
|
+
(o(), u(m(t.icon)))
|
|
237
288
|
]),
|
|
238
289
|
key: "0"
|
|
239
290
|
} : void 0
|
|
240
291
|
]), 1040))
|
|
241
|
-
]))), 128)) : (o(!0), f(
|
|
242
|
-
key:
|
|
292
|
+
]))), 128)) : (o(!0), f(g, { key: 1 }, _(N.value, (t, i) => (o(), f("span", {
|
|
293
|
+
key: i,
|
|
243
294
|
class: "measure-item"
|
|
244
295
|
}, [
|
|
245
|
-
(o(),
|
|
296
|
+
(o(), u(m(t)))
|
|
246
297
|
]))), 128)),
|
|
247
|
-
|
|
298
|
+
oe("span", {
|
|
248
299
|
ref_key: "moreTriggerRef",
|
|
249
|
-
ref:
|
|
300
|
+
ref: b,
|
|
250
301
|
class: "measure-item"
|
|
251
302
|
}, [
|
|
252
|
-
|
|
253
|
-
text:
|
|
254
|
-
size:
|
|
255
|
-
type:
|
|
303
|
+
U(v(ie), {
|
|
304
|
+
text: H.value,
|
|
305
|
+
size: A.value,
|
|
306
|
+
type: B.value
|
|
256
307
|
}, {
|
|
257
|
-
icon:
|
|
258
|
-
(o(),
|
|
308
|
+
icon: a(() => [
|
|
309
|
+
(o(), u(m(L.value)))
|
|
259
310
|
]),
|
|
260
311
|
_: 1
|
|
261
312
|
}, 8, ["text", "size", "type"])
|
|
@@ -265,5 +316,5 @@ const Q = "link", X = "small", $e = /* @__PURE__ */ ve({
|
|
|
265
316
|
}
|
|
266
317
|
});
|
|
267
318
|
export {
|
|
268
|
-
|
|
319
|
+
Fe as default
|
|
269
320
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as u, createVNode as
|
|
2
|
-
import { Button as
|
|
3
|
-
import { buttonProps as
|
|
4
|
-
import { usePermission as
|
|
1
|
+
import { defineComponent as u, createVNode as d, mergeProps as l } from "vue";
|
|
2
|
+
import { Button as r } from "ant-design-vue";
|
|
3
|
+
import { buttonProps as f } from "./props.js";
|
|
4
|
+
import { usePermission as h } from "../../_utils/usePermission.js";
|
|
5
5
|
const y = /* @__PURE__ */ u({
|
|
6
6
|
name: "MButton",
|
|
7
|
-
props:
|
|
7
|
+
props: f,
|
|
8
8
|
emits: ["click"],
|
|
9
9
|
setup(e, {
|
|
10
10
|
slots: n,
|
|
@@ -12,19 +12,19 @@ const y = /* @__PURE__ */ u({
|
|
|
12
12
|
emit: o
|
|
13
13
|
}) {
|
|
14
14
|
const {
|
|
15
|
-
shouldHide:
|
|
16
|
-
shouldDisable:
|
|
17
|
-
} =
|
|
15
|
+
shouldHide: a,
|
|
16
|
+
shouldDisable: c
|
|
17
|
+
} = h({
|
|
18
18
|
permission: e.permission,
|
|
19
19
|
permissionAction: e.permissionAction
|
|
20
20
|
}), m = (i) => {
|
|
21
21
|
o("click", i);
|
|
22
22
|
};
|
|
23
|
-
return () =>
|
|
23
|
+
return () => a.value ? null : d(r, l({
|
|
24
24
|
type: e.type,
|
|
25
25
|
size: e.size,
|
|
26
26
|
loading: e.loading,
|
|
27
|
-
disabled: e.disabled ||
|
|
27
|
+
disabled: e.disabled || c.value,
|
|
28
28
|
danger: e.danger,
|
|
29
29
|
block: e.block,
|
|
30
30
|
ghost: e.ghost,
|
|
@@ -37,7 +37,11 @@ const y = /* @__PURE__ */ u({
|
|
|
37
37
|
}), {
|
|
38
38
|
default: () => {
|
|
39
39
|
var i;
|
|
40
|
-
return
|
|
40
|
+
return (i = n.default) == null ? void 0 : i.call(n);
|
|
41
|
+
},
|
|
42
|
+
icon: () => {
|
|
43
|
+
var i;
|
|
44
|
+
return (i = n.icon) == null ? void 0 : i.call(n);
|
|
41
45
|
}
|
|
42
46
|
});
|
|
43
47
|
}
|
package/dist/components.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.mtn-action-group[data-v-
|
|
1
|
+
.mtn-action-group[data-v-845c43ad]{width:100%;container-type:inline-size}.mtn-action-group-measure[data-v-845c43ad]{position:absolute;display:flex;visibility:hidden;align-items:center;height:0;overflow:hidden;pointer-events:none;white-space:nowrap}.measure-item[data-v-845c43ad]{display:inline-flex}[data-v-a943bc19] .ant-btn-dangerous{transition:transform .1s ease}[data-v-a943bc19] .ant-btn-dangerous:active{transform:scale(.95)}
|