@mtn-ui/components 1.0.4 → 1.0.6
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 +1 -1
- package/dist/antd-wrapped/action-group/action-group.vue2.js +113 -109
- 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 +232 -224
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { cn as _e, withInstall as
|
|
2
|
-
import { defineComponent as _, createVNode as
|
|
1
|
+
import { cn as _e, withInstall as ve, PERMISSION_CHECKER_KEY as J, defaultPermissionChecker as Q } from "@mtn-ui/shared";
|
|
2
|
+
import { defineComponent as _, createVNode as b, inject as X, ref as w, computed as p, mergeProps as S, Fragment as I, h as Ee, Comment as Ne, Text as $e, useSlots as Oe, createElementBlock as D, openBlock as u, createElementVNode as ae, unref as B, withCtx as m, createBlock as v, createCommentVNode as Le, renderList as L, resolveDynamicComponent as A, createSlots as W, createTextVNode as F, toDisplayString as Y, cloneVNode as le, watch as ue, nextTick as se, onBeforeUnmount as Re, renderSlot as j, isVNode as Ve } from "vue";
|
|
3
3
|
import { cva as je } from "class-variance-authority";
|
|
4
|
-
import { Button as
|
|
4
|
+
import { Button as be, Space as ce, Dropdown as de, Menu as H, Popconfirm as We, message as fe, Modal as Fe, Table as Ge } from "ant-design-vue";
|
|
5
5
|
import { useElementSize as He, useDebounceFn as Ke } from "@vueuse/core";
|
|
6
|
-
import { MoreOutlined as Ue, DeleteOutlined as
|
|
6
|
+
import { MoreOutlined as Ue, DeleteOutlined as pe, ExclamationCircleOutlined as qe } from "@ant-design/icons-vue";
|
|
7
7
|
const Ye = {
|
|
8
8
|
type: {
|
|
9
9
|
type: String,
|
|
@@ -37,14 +37,14 @@ const Ye = {
|
|
|
37
37
|
const {
|
|
38
38
|
type: o
|
|
39
39
|
} = e;
|
|
40
|
-
return
|
|
40
|
+
return b("span", {
|
|
41
41
|
class: _e(Ze({
|
|
42
42
|
type: o
|
|
43
43
|
}), t.class)
|
|
44
44
|
}, [(l = n.default) == null ? void 0 : l.call(n)]);
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
}), Qe =
|
|
47
|
+
}), Qe = ve(Je), ke = {
|
|
48
48
|
// 按钮类型
|
|
49
49
|
type: {
|
|
50
50
|
type: String,
|
|
@@ -105,12 +105,12 @@ const Ye = {
|
|
|
105
105
|
default: "hide"
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
|
-
function
|
|
109
|
-
const { permission: n, permissionAction: t = "hide" } = e, o =
|
|
108
|
+
function he(e) {
|
|
109
|
+
const { permission: n, permissionAction: t = "hide" } = e, o = X(J, w(Q)), l = p(() => n ? o.value(n) : !0), y = p(() => !l.value && t === "hide"), g = p(() => !l.value && t === "disable");
|
|
110
110
|
return {
|
|
111
111
|
hasPermission: l,
|
|
112
|
-
shouldHide:
|
|
113
|
-
shouldDisable:
|
|
112
|
+
shouldHide: y,
|
|
113
|
+
shouldDisable: g
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
116
|
function Xe(e, n) {
|
|
@@ -127,9 +127,9 @@ function Xe(e, n) {
|
|
|
127
127
|
return t;
|
|
128
128
|
}).filter(Boolean);
|
|
129
129
|
}
|
|
130
|
-
const
|
|
130
|
+
const K = /* @__PURE__ */ _({
|
|
131
131
|
name: "MButton",
|
|
132
|
-
props:
|
|
132
|
+
props: ke,
|
|
133
133
|
emits: ["click"],
|
|
134
134
|
setup(e, {
|
|
135
135
|
slots: n,
|
|
@@ -138,18 +138,18 @@ const H = /* @__PURE__ */ _({
|
|
|
138
138
|
}) {
|
|
139
139
|
const {
|
|
140
140
|
shouldHide: l,
|
|
141
|
-
shouldDisable:
|
|
142
|
-
} =
|
|
141
|
+
shouldDisable: y
|
|
142
|
+
} = he({
|
|
143
143
|
permission: e.permission,
|
|
144
144
|
permissionAction: e.permissionAction
|
|
145
|
-
}),
|
|
146
|
-
o("click",
|
|
145
|
+
}), g = (d) => {
|
|
146
|
+
o("click", d);
|
|
147
147
|
};
|
|
148
|
-
return () => l.value ? null :
|
|
148
|
+
return () => l.value ? null : b(be, S({
|
|
149
149
|
type: e.type,
|
|
150
150
|
size: e.size,
|
|
151
151
|
loading: e.loading,
|
|
152
|
-
disabled: e.disabled ||
|
|
152
|
+
disabled: e.disabled || y.value,
|
|
153
153
|
danger: e.danger,
|
|
154
154
|
block: e.block,
|
|
155
155
|
ghost: e.ghost,
|
|
@@ -158,11 +158,15 @@ const H = /* @__PURE__ */ _({
|
|
|
158
158
|
icon: e.icon
|
|
159
159
|
}, t, {
|
|
160
160
|
class: ["mtn-button", t.class],
|
|
161
|
-
onClick:
|
|
161
|
+
onClick: g
|
|
162
162
|
}), {
|
|
163
163
|
default: () => {
|
|
164
|
-
var
|
|
165
|
-
return
|
|
164
|
+
var d;
|
|
165
|
+
return (d = n.default) == null ? void 0 : d.call(n);
|
|
166
|
+
},
|
|
167
|
+
icon: () => {
|
|
168
|
+
var d;
|
|
169
|
+
return (d = n.icon) == null ? void 0 : d.call(n);
|
|
166
170
|
}
|
|
167
171
|
});
|
|
168
172
|
}
|
|
@@ -192,16 +196,16 @@ const H = /* @__PURE__ */ _({
|
|
|
192
196
|
type: Boolean,
|
|
193
197
|
default: !1
|
|
194
198
|
}
|
|
195
|
-
},
|
|
199
|
+
}, Be = /* @__PURE__ */ _({
|
|
196
200
|
name: "MButtonGroup",
|
|
197
201
|
props: et,
|
|
198
202
|
setup(e, {
|
|
199
203
|
slots: n,
|
|
200
204
|
attrs: t
|
|
201
205
|
}) {
|
|
202
|
-
return () =>
|
|
206
|
+
return () => b(I, null, [e.compact ? (
|
|
203
207
|
// 紧凑模式:按钮紧密连接
|
|
204
|
-
|
|
208
|
+
b(ce.Compact, S({
|
|
205
209
|
size: e.size,
|
|
206
210
|
direction: e.vertical ? "vertical" : "horizontal",
|
|
207
211
|
block: e.block
|
|
@@ -215,7 +219,7 @@ const H = /* @__PURE__ */ _({
|
|
|
215
219
|
})
|
|
216
220
|
) : (
|
|
217
221
|
// 普通模式:按钮有间距
|
|
218
|
-
|
|
222
|
+
b(ce, S({
|
|
219
223
|
size: typeof e.gap == "number" ? e.gap : parseInt(e.gap) || 8,
|
|
220
224
|
direction: e.vertical ? "vertical" : "horizontal"
|
|
221
225
|
}, t, {
|
|
@@ -284,7 +288,7 @@ const H = /* @__PURE__ */ _({
|
|
|
284
288
|
type: String,
|
|
285
289
|
default: "hide"
|
|
286
290
|
}
|
|
287
|
-
},
|
|
291
|
+
}, Z = /* @__PURE__ */ _({
|
|
288
292
|
name: "MDropdownButton",
|
|
289
293
|
props: tt,
|
|
290
294
|
emits: ["click"],
|
|
@@ -295,62 +299,62 @@ const H = /* @__PURE__ */ _({
|
|
|
295
299
|
}) {
|
|
296
300
|
const {
|
|
297
301
|
shouldHide: l,
|
|
298
|
-
shouldDisable:
|
|
299
|
-
} =
|
|
302
|
+
shouldDisable: y
|
|
303
|
+
} = he({
|
|
300
304
|
permission: e.permission,
|
|
301
305
|
permissionAction: e.permissionAction
|
|
302
|
-
}),
|
|
303
|
-
o("click",
|
|
306
|
+
}), g = X(J, w(Q)), d = (k) => {
|
|
307
|
+
o("click", k);
|
|
304
308
|
};
|
|
305
309
|
return () => {
|
|
306
310
|
if (l.value)
|
|
307
311
|
return null;
|
|
308
|
-
const
|
|
312
|
+
const k = {};
|
|
309
313
|
if (n.overlay)
|
|
310
|
-
|
|
314
|
+
k.overlay = n.overlay;
|
|
311
315
|
else if (e.menu && e.menu.length > 0) {
|
|
312
|
-
const
|
|
313
|
-
|
|
314
|
-
items:
|
|
316
|
+
const h = Xe(e.menu, g.value);
|
|
317
|
+
k.overlay = () => Ee(H, {
|
|
318
|
+
items: h
|
|
315
319
|
});
|
|
316
320
|
}
|
|
317
|
-
return n.icon && (
|
|
321
|
+
return n.icon && (k.icon = n.icon), !(n.default || e.text) ? b(de, S({
|
|
318
322
|
placement: e.placement,
|
|
319
323
|
trigger: e.trigger
|
|
320
324
|
}, t, {
|
|
321
325
|
class: ["mtn-dropdown-button", t.class]
|
|
322
326
|
}), {
|
|
323
|
-
default: () => [
|
|
327
|
+
default: () => [b(be, {
|
|
324
328
|
type: e.type,
|
|
325
329
|
size: e.size === "middle" ? void 0 : e.size,
|
|
326
|
-
disabled: e.disabled ||
|
|
330
|
+
disabled: e.disabled || y.value,
|
|
327
331
|
loading: e.loading,
|
|
328
332
|
danger: e.danger,
|
|
329
|
-
onClick:
|
|
333
|
+
onClick: d
|
|
330
334
|
}, {
|
|
331
335
|
default: () => {
|
|
332
|
-
var
|
|
333
|
-
return [(
|
|
336
|
+
var h;
|
|
337
|
+
return [(h = n.icon) == null ? void 0 : h.call(n)];
|
|
334
338
|
}
|
|
335
339
|
})],
|
|
336
|
-
...
|
|
337
|
-
}) :
|
|
340
|
+
...k
|
|
341
|
+
}) : b(de.Button, S({
|
|
338
342
|
type: e.type,
|
|
339
343
|
size: e.size === "middle" ? void 0 : e.size,
|
|
340
|
-
disabled: e.disabled ||
|
|
344
|
+
disabled: e.disabled || y.value,
|
|
341
345
|
loading: e.loading,
|
|
342
346
|
danger: e.danger,
|
|
343
347
|
placement: e.placement,
|
|
344
348
|
trigger: e.trigger
|
|
345
349
|
}, t, {
|
|
346
350
|
class: ["mtn-dropdown-button", t.class],
|
|
347
|
-
onClick:
|
|
351
|
+
onClick: d
|
|
348
352
|
}), {
|
|
349
353
|
default: () => {
|
|
350
|
-
var
|
|
351
|
-
return [((
|
|
354
|
+
var h;
|
|
355
|
+
return [((h = n.default) == null ? void 0 : h.call(n)) || e.text];
|
|
352
356
|
},
|
|
353
|
-
...
|
|
357
|
+
...k
|
|
354
358
|
});
|
|
355
359
|
};
|
|
356
360
|
}
|
|
@@ -448,7 +452,7 @@ function ot(e) {
|
|
|
448
452
|
(n) => n.type !== Ne && n.type !== $e && n.type !== Symbol.for("v-fgt")
|
|
449
453
|
) : [];
|
|
450
454
|
}
|
|
451
|
-
function
|
|
455
|
+
function me(e, n) {
|
|
452
456
|
var t, o;
|
|
453
457
|
if (e.key !== null && e.key !== void 0)
|
|
454
458
|
return typeof e.key == "symbol" ? e.key.toString() : e.key;
|
|
@@ -458,200 +462,204 @@ function pe(e, n) {
|
|
|
458
462
|
}
|
|
459
463
|
return `button-${n}`;
|
|
460
464
|
}
|
|
461
|
-
const
|
|
465
|
+
const ye = "link", ge = "small", it = /* @__PURE__ */ _({
|
|
462
466
|
name: "MActionGroup",
|
|
463
467
|
inheritAttrs: !1,
|
|
464
468
|
__name: "action-group",
|
|
465
469
|
props: nt,
|
|
466
470
|
emits: ["action-click"],
|
|
467
471
|
setup(e, { emit: n }) {
|
|
468
|
-
const t = e, o = n, l = Oe(),
|
|
469
|
-
() =>
|
|
470
|
-
), a =
|
|
471
|
-
() =>
|
|
472
|
-
), s =
|
|
473
|
-
() =>
|
|
474
|
-
), P =
|
|
472
|
+
const t = e, o = n, l = Oe(), y = w(), g = w(), d = w(), { width: k } = He(y), G = X(J, w(Q)), h = p(() => t.mode === "table"), M = p(
|
|
473
|
+
() => h.value ? "small" : t.size
|
|
474
|
+
), a = p(
|
|
475
|
+
() => h.value ? "link" : "default"
|
|
476
|
+
), s = p(
|
|
477
|
+
() => h.value ? "" : t.moreText
|
|
478
|
+
), P = p(() => t.moreIcon || Ue);
|
|
475
479
|
function z(i) {
|
|
476
|
-
return i ?
|
|
480
|
+
return i ? G.value(i) : !0;
|
|
477
481
|
}
|
|
478
|
-
const E =
|
|
482
|
+
const E = p(() => {
|
|
479
483
|
var i;
|
|
480
484
|
return ot((i = l.default) == null ? void 0 : i.call(l));
|
|
481
|
-
}), N =
|
|
485
|
+
}), N = p(() => t.actions ? t.actions.filter((i) => z(i.permission)) : []), $ = p(() => {
|
|
482
486
|
if (t.disableCollapse)
|
|
483
487
|
return t.actions ? N.value.length : E.value.length;
|
|
484
488
|
const i = t.actions ? N.value.length : E.value.length;
|
|
485
|
-
return i <= 1 ? i :
|
|
489
|
+
return i <= 1 ? i : g.value && d.value && k.value ? Te() : Math.min(t.maxItems, i);
|
|
486
490
|
});
|
|
487
|
-
function
|
|
488
|
-
if (!
|
|
491
|
+
function Te() {
|
|
492
|
+
if (!g.value || !d.value || !k.value)
|
|
489
493
|
return t.maxItems;
|
|
490
|
-
const i =
|
|
491
|
-
|
|
494
|
+
const i = d.value.offsetWidth, c = Array.from(
|
|
495
|
+
g.value.querySelectorAll(".measure-item")
|
|
492
496
|
);
|
|
493
|
-
if (
|
|
494
|
-
let r = i,
|
|
495
|
-
for (let C = 0; C <
|
|
496
|
-
const x =
|
|
497
|
-
if (r + x <=
|
|
498
|
-
r += x,
|
|
497
|
+
if (c.length === 0) return t.maxItems;
|
|
498
|
+
let r = i, f = 0;
|
|
499
|
+
for (let C = 0; C < c.length - 1; C++) {
|
|
500
|
+
const x = c[C].offsetWidth + t.gap;
|
|
501
|
+
if (r + x <= k.value)
|
|
502
|
+
r += x, f++;
|
|
499
503
|
else
|
|
500
504
|
break;
|
|
501
505
|
}
|
|
502
506
|
const T = t.actions ? N.value.length : E.value.length;
|
|
503
|
-
return Math.max(0, Math.min(
|
|
507
|
+
return Math.max(0, Math.min(f, t.maxItems, T));
|
|
504
508
|
}
|
|
505
|
-
const
|
|
509
|
+
const Ce = p(() => t.actions ? N.value.slice(0, $.value) : []), ee = p(() => t.actions ? N.value.slice($.value) : []), ze = p(() => {
|
|
506
510
|
if (t.actions) return [];
|
|
507
511
|
const i = E.value;
|
|
508
512
|
return $.value >= i.length ? i : i.slice(0, $.value);
|
|
509
|
-
}),
|
|
513
|
+
}), te = p(() => {
|
|
510
514
|
if (t.actions) return [];
|
|
511
515
|
const i = E.value;
|
|
512
516
|
return $.value >= i.length ? [] : i.slice($.value);
|
|
513
|
-
}),
|
|
514
|
-
const
|
|
515
|
-
return
|
|
516
|
-
})),
|
|
517
|
-
function
|
|
518
|
-
return i.component ||
|
|
517
|
+
}), Ae = p(() => t.actions ? ee.value.filter((i) => z(i.permission)) : []), Pe = p(() => t.actions ? [] : te.value.filter((i) => {
|
|
518
|
+
const c = i.props || {};
|
|
519
|
+
return c.permission && c.permissionAction === "hide" ? z(c.permission) : !0;
|
|
520
|
+
})), xe = p(() => t.disableCollapse ? !1 : (t.actions ? ee.value.length : te.value.length) > 0);
|
|
521
|
+
function U(i) {
|
|
522
|
+
return i.component || K;
|
|
519
523
|
}
|
|
520
|
-
function
|
|
521
|
-
return i.key || i.label || `action-${
|
|
524
|
+
function ne(i, c) {
|
|
525
|
+
return i.key || i.label || `action-${c}`;
|
|
522
526
|
}
|
|
523
|
-
function
|
|
527
|
+
function oe(i) {
|
|
524
528
|
const {
|
|
525
|
-
label:
|
|
529
|
+
label: c,
|
|
526
530
|
key: r,
|
|
527
|
-
onClick:
|
|
531
|
+
onClick: f,
|
|
528
532
|
permission: T,
|
|
529
533
|
permissionAction: C,
|
|
530
|
-
icon:
|
|
534
|
+
icon: R,
|
|
531
535
|
component: x,
|
|
532
|
-
componentProps:
|
|
533
|
-
slot:
|
|
534
|
-
type:
|
|
535
|
-
size:
|
|
536
|
+
componentProps: V,
|
|
537
|
+
slot: q,
|
|
538
|
+
type: O,
|
|
539
|
+
size: we,
|
|
536
540
|
disabled: Me,
|
|
537
541
|
...Ie
|
|
538
542
|
} = i;
|
|
539
543
|
return {
|
|
540
544
|
component: x,
|
|
541
|
-
componentProps:
|
|
542
|
-
type:
|
|
543
|
-
size:
|
|
545
|
+
componentProps: V,
|
|
546
|
+
type: O,
|
|
547
|
+
size: we,
|
|
544
548
|
rest: Ie,
|
|
545
549
|
permission: T,
|
|
546
550
|
permissionAction: C,
|
|
547
551
|
disabled: Me
|
|
548
552
|
};
|
|
549
553
|
}
|
|
550
|
-
function
|
|
551
|
-
const { component:
|
|
552
|
-
type:
|
|
554
|
+
function ie(i) {
|
|
555
|
+
const { component: c, componentProps: r, type: f, rest: T, permission: C, permissionAction: R, disabled: x } = oe(i), V = {
|
|
556
|
+
type: f || a.value,
|
|
553
557
|
size: M.value,
|
|
554
|
-
disabled: x || !z(C) &&
|
|
558
|
+
disabled: x || !z(C) && R === "disable",
|
|
555
559
|
...T
|
|
556
560
|
};
|
|
557
|
-
|
|
561
|
+
if (c && r) {
|
|
562
|
+
const q = (c == null ? void 0 : c.name) === "MDeleteButton" || (c == null ? void 0 : c.__name) === "MDeleteButton", O = { ...V };
|
|
563
|
+
return !r.type && !f && q && delete O.type, { ...O, ...r };
|
|
564
|
+
}
|
|
565
|
+
return V;
|
|
558
566
|
}
|
|
559
|
-
function
|
|
560
|
-
const { component:
|
|
561
|
-
type:
|
|
562
|
-
size:
|
|
563
|
-
disabled:
|
|
564
|
-
...
|
|
567
|
+
function De(i) {
|
|
568
|
+
const { component: c, componentProps: r, rest: f, permission: T, permissionAction: C, disabled: R } = oe(i), x = {
|
|
569
|
+
type: ye,
|
|
570
|
+
size: ge,
|
|
571
|
+
disabled: R || !z(T) && C === "disable",
|
|
572
|
+
...f
|
|
565
573
|
};
|
|
566
|
-
if (
|
|
567
|
-
const { type:
|
|
568
|
-
return { ...x, ...
|
|
574
|
+
if (c && r) {
|
|
575
|
+
const { type: V, size: q, ...O } = r;
|
|
576
|
+
return { ...x, ...O };
|
|
569
577
|
}
|
|
570
578
|
return x;
|
|
571
579
|
}
|
|
572
|
-
function
|
|
580
|
+
function re(i) {
|
|
573
581
|
i.onClick && i.onClick(i), o("action-click", i);
|
|
574
582
|
}
|
|
575
|
-
return (i,
|
|
583
|
+
return (i, c) => (u(), D("div", {
|
|
576
584
|
ref_key: "containerRef",
|
|
577
|
-
ref:
|
|
585
|
+
ref: y,
|
|
578
586
|
class: "mtn-action-group"
|
|
579
587
|
}, [
|
|
580
|
-
|
|
588
|
+
b(B(Be), S({
|
|
581
589
|
size: M.value,
|
|
582
590
|
compact: i.compact,
|
|
583
591
|
vertical: i.vertical,
|
|
584
592
|
block: i.block
|
|
585
593
|
}, i.$attrs), {
|
|
586
|
-
default:
|
|
587
|
-
t.actions ? (u(!0),
|
|
588
|
-
key:
|
|
589
|
-
}, { ref_for: !0 },
|
|
590
|
-
onClick: (T) =>
|
|
591
|
-
}),
|
|
592
|
-
default:
|
|
593
|
-
|
|
594
|
+
default: m(() => [
|
|
595
|
+
t.actions ? (u(!0), D(I, { key: 0 }, L(Ce.value, (r, f) => (u(), v(A(U(r)), S({
|
|
596
|
+
key: ne(r, f)
|
|
597
|
+
}, { ref_for: !0 }, ie(r), {
|
|
598
|
+
onClick: (T) => re(r)
|
|
599
|
+
}), W({
|
|
600
|
+
default: m(() => [
|
|
601
|
+
F(" " + Y(r.label), 1)
|
|
594
602
|
]),
|
|
595
603
|
_: 2
|
|
596
604
|
}, [
|
|
597
|
-
r.icon
|
|
605
|
+
r.icon ? {
|
|
598
606
|
name: "icon",
|
|
599
|
-
fn:
|
|
600
|
-
(u(),
|
|
607
|
+
fn: m(() => [
|
|
608
|
+
(u(), v(A(r.icon)))
|
|
601
609
|
]),
|
|
602
610
|
key: "0"
|
|
603
611
|
} : void 0
|
|
604
|
-
]), 1040, ["onClick"]))), 128)) : (u(!0),
|
|
612
|
+
]), 1040, ["onClick"]))), 128)) : (u(!0), D(I, { key: 1 }, L(ze.value, (r, f) => {
|
|
605
613
|
var T, C;
|
|
606
|
-
return u(),
|
|
607
|
-
type: ((T = r.props) == null ? void 0 : T.type) ?? (
|
|
614
|
+
return u(), v(A(le(r, {
|
|
615
|
+
type: ((T = r.props) == null ? void 0 : T.type) ?? (h.value ? a.value : void 0),
|
|
608
616
|
size: ((C = r.props) == null ? void 0 : C.size) ?? M.value
|
|
609
617
|
})), {
|
|
610
|
-
key: B(
|
|
618
|
+
key: B(me)(r, f)
|
|
611
619
|
});
|
|
612
620
|
}), 128)),
|
|
613
|
-
|
|
621
|
+
xe.value ? (u(), v(B(Z), S({
|
|
614
622
|
key: 2,
|
|
615
623
|
text: s.value,
|
|
616
624
|
size: M.value,
|
|
617
625
|
type: a.value
|
|
618
626
|
}, t.moreProps), {
|
|
619
|
-
icon:
|
|
620
|
-
(u(),
|
|
627
|
+
icon: m(() => [
|
|
628
|
+
(u(), v(A(P.value)))
|
|
621
629
|
]),
|
|
622
|
-
overlay:
|
|
623
|
-
|
|
624
|
-
default:
|
|
625
|
-
t.actions ? (u(!0),
|
|
626
|
-
key:
|
|
630
|
+
overlay: m(() => [
|
|
631
|
+
b(B(H), null, {
|
|
632
|
+
default: m(() => [
|
|
633
|
+
t.actions ? (u(!0), D(I, { key: 0 }, L(Ae.value, (r, f) => (u(), v(B(H).Item, {
|
|
634
|
+
key: ne(r, f)
|
|
627
635
|
}, {
|
|
628
|
-
default:
|
|
629
|
-
(u(),
|
|
630
|
-
onClick: (T) =>
|
|
631
|
-
}),
|
|
632
|
-
default:
|
|
633
|
-
|
|
636
|
+
default: m(() => [
|
|
637
|
+
(u(), v(A(U(r)), S({ ref_for: !0 }, De(r), {
|
|
638
|
+
onClick: (T) => re(r)
|
|
639
|
+
}), W({
|
|
640
|
+
default: m(() => [
|
|
641
|
+
F(" " + Y(r.label), 1)
|
|
634
642
|
]),
|
|
635
643
|
_: 2
|
|
636
644
|
}, [
|
|
637
|
-
r.icon
|
|
645
|
+
r.icon ? {
|
|
638
646
|
name: "icon",
|
|
639
|
-
fn:
|
|
640
|
-
(u(),
|
|
647
|
+
fn: m(() => [
|
|
648
|
+
(u(), v(A(r.icon)))
|
|
641
649
|
]),
|
|
642
650
|
key: "0"
|
|
643
651
|
} : void 0
|
|
644
652
|
]), 1040, ["onClick"]))
|
|
645
653
|
]),
|
|
646
654
|
_: 2
|
|
647
|
-
}, 1024))), 128)) : (u(!0),
|
|
648
|
-
key: B(
|
|
655
|
+
}, 1024))), 128)) : (u(!0), D(I, { key: 1 }, L(Pe.value, (r, f) => (u(), v(B(H).Item, {
|
|
656
|
+
key: B(me)(r, f)
|
|
649
657
|
}, {
|
|
650
|
-
default:
|
|
651
|
-
(u(),
|
|
658
|
+
default: m(() => [
|
|
659
|
+
(u(), v(A(le(r, {
|
|
652
660
|
...r.props,
|
|
653
|
-
type:
|
|
654
|
-
size:
|
|
661
|
+
type: ye,
|
|
662
|
+
size: ge
|
|
655
663
|
}))))
|
|
656
664
|
]),
|
|
657
665
|
_: 2
|
|
@@ -665,47 +673,47 @@ const me = "link", ye = "small", it = /* @__PURE__ */ _({
|
|
|
665
673
|
]),
|
|
666
674
|
_: 1
|
|
667
675
|
}, 16, ["size", "compact", "vertical", "block"]),
|
|
668
|
-
|
|
676
|
+
ae("div", {
|
|
669
677
|
ref_key: "measureRef",
|
|
670
|
-
ref:
|
|
678
|
+
ref: g,
|
|
671
679
|
class: "mtn-action-group-measure"
|
|
672
680
|
}, [
|
|
673
|
-
t.actions ? (u(!0),
|
|
674
|
-
key:
|
|
681
|
+
t.actions ? (u(!0), D(I, { key: 0 }, L(N.value, (r, f) => (u(), D("span", {
|
|
682
|
+
key: f,
|
|
675
683
|
class: "measure-item"
|
|
676
684
|
}, [
|
|
677
|
-
(u(),
|
|
678
|
-
default:
|
|
679
|
-
|
|
685
|
+
(u(), v(A(U(r)), S({ ref_for: !0 }, ie(r)), W({
|
|
686
|
+
default: m(() => [
|
|
687
|
+
F(" " + Y(r.label), 1)
|
|
680
688
|
]),
|
|
681
689
|
_: 2
|
|
682
690
|
}, [
|
|
683
|
-
r.icon
|
|
691
|
+
r.icon ? {
|
|
684
692
|
name: "icon",
|
|
685
|
-
fn:
|
|
686
|
-
(u(),
|
|
693
|
+
fn: m(() => [
|
|
694
|
+
(u(), v(A(r.icon)))
|
|
687
695
|
]),
|
|
688
696
|
key: "0"
|
|
689
697
|
} : void 0
|
|
690
698
|
]), 1040))
|
|
691
|
-
]))), 128)) : (u(!0),
|
|
692
|
-
key:
|
|
699
|
+
]))), 128)) : (u(!0), D(I, { key: 1 }, L(E.value, (r, f) => (u(), D("span", {
|
|
700
|
+
key: f,
|
|
693
701
|
class: "measure-item"
|
|
694
702
|
}, [
|
|
695
|
-
(u(),
|
|
703
|
+
(u(), v(A(r)))
|
|
696
704
|
]))), 128)),
|
|
697
|
-
|
|
705
|
+
ae("span", {
|
|
698
706
|
ref_key: "moreTriggerRef",
|
|
699
|
-
ref:
|
|
707
|
+
ref: d,
|
|
700
708
|
class: "measure-item"
|
|
701
709
|
}, [
|
|
702
|
-
|
|
710
|
+
b(B(Z), {
|
|
703
711
|
text: s.value,
|
|
704
712
|
size: M.value,
|
|
705
713
|
type: a.value
|
|
706
714
|
}, {
|
|
707
|
-
icon:
|
|
708
|
-
(u(),
|
|
715
|
+
icon: m(() => [
|
|
716
|
+
(u(), v(A(P.value)))
|
|
709
717
|
]),
|
|
710
718
|
_: 1
|
|
711
719
|
}, 8, ["text", "size", "type"])
|
|
@@ -713,14 +721,14 @@ const me = "link", ye = "small", it = /* @__PURE__ */ _({
|
|
|
713
721
|
], 512)
|
|
714
722
|
], 512));
|
|
715
723
|
}
|
|
716
|
-
}),
|
|
724
|
+
}), Se = (e, n) => {
|
|
717
725
|
const t = e.__vccOpts || e;
|
|
718
726
|
for (const [o, l] of n)
|
|
719
727
|
t[o] = l;
|
|
720
728
|
return t;
|
|
721
|
-
}, rt = /* @__PURE__ */
|
|
729
|
+
}, rt = /* @__PURE__ */ Se(it, [["__scopeId", "data-v-6b35de38"]]), at = {
|
|
722
730
|
// 继承 Button 的所有 props
|
|
723
|
-
...
|
|
731
|
+
...ke,
|
|
724
732
|
// 覆盖 loading prop,使其默认值为 undefined,以便自动 loading 功能正常工作
|
|
725
733
|
loading: {
|
|
726
734
|
type: Boolean,
|
|
@@ -803,18 +811,18 @@ const me = "link", ye = "small", it = /* @__PURE__ */ _({
|
|
|
803
811
|
props: at,
|
|
804
812
|
emits: ["delete", "success", "error"],
|
|
805
813
|
setup(e, { emit: n }) {
|
|
806
|
-
const t = n, o = e, l =
|
|
807
|
-
|
|
808
|
-
|
|
814
|
+
const t = n, o = e, l = w(!1), y = w(null), g = p(() => o.loading !== void 0 ? o.loading : o.autoLoading ? l.value : !1), d = p(() => typeof o.confirm == "function" ? o.confirm(o.count) : o.confirm);
|
|
815
|
+
ue(g, (a) => {
|
|
816
|
+
y.value && se(() => {
|
|
809
817
|
var s;
|
|
810
|
-
(s =
|
|
818
|
+
(s = y.value) == null || s.update({
|
|
811
819
|
okButtonProps: { loading: a }
|
|
812
820
|
});
|
|
813
821
|
});
|
|
814
822
|
}, { flush: "post" }), Re(() => {
|
|
815
|
-
|
|
823
|
+
y.value && (y.value.destroy(), y.value = null);
|
|
816
824
|
});
|
|
817
|
-
const
|
|
825
|
+
const k = async () => {
|
|
818
826
|
try {
|
|
819
827
|
if (o.beforeDelete && await o.beforeDelete() === !1)
|
|
820
828
|
return;
|
|
@@ -828,7 +836,7 @@ const me = "link", ye = "small", it = /* @__PURE__ */ _({
|
|
|
828
836
|
if (P && typeof P.then == "function")
|
|
829
837
|
try {
|
|
830
838
|
const z = await P;
|
|
831
|
-
a || s(),
|
|
839
|
+
a || s(), G(z);
|
|
832
840
|
} catch (z) {
|
|
833
841
|
throw a || s(), z;
|
|
834
842
|
}
|
|
@@ -839,32 +847,32 @@ const me = "link", ye = "small", it = /* @__PURE__ */ _({
|
|
|
839
847
|
} catch (a) {
|
|
840
848
|
o.autoLoading && o.loading === void 0 && (l.value = !1);
|
|
841
849
|
const s = a instanceof Error ? a : new Error(String(a));
|
|
842
|
-
t("error", s), o.showError &&
|
|
850
|
+
t("error", s), o.showError && fe.error(s.message || "删除失败,请重试");
|
|
843
851
|
}
|
|
844
|
-
},
|
|
845
|
-
o.showSuccess &&
|
|
846
|
-
},
|
|
847
|
-
if (!
|
|
848
|
-
|
|
852
|
+
}, G = (a) => {
|
|
853
|
+
o.showSuccess && fe.success(o.successText || "删除成功"), t("success", a);
|
|
854
|
+
}, h = o.debounce > 0 ? Ke(k, o.debounce) : k, M = () => {
|
|
855
|
+
if (!d.value) {
|
|
856
|
+
h();
|
|
849
857
|
return;
|
|
850
858
|
}
|
|
851
859
|
if (o.confirmType === "popconfirm") return;
|
|
852
|
-
|
|
853
|
-
|
|
860
|
+
se(() => {
|
|
861
|
+
y.value = Fe.confirm({
|
|
854
862
|
title: o.confirmTitle,
|
|
855
|
-
content:
|
|
863
|
+
content: d.value,
|
|
856
864
|
okText: o.okText,
|
|
857
865
|
cancelText: o.cancelText,
|
|
858
866
|
okType: "danger",
|
|
859
|
-
okButtonProps: { loading:
|
|
867
|
+
okButtonProps: { loading: g.value },
|
|
860
868
|
onOk: async () => {
|
|
861
869
|
try {
|
|
862
|
-
return await
|
|
863
|
-
if (!
|
|
870
|
+
return await k(), new Promise((s) => {
|
|
871
|
+
if (!g.value) {
|
|
864
872
|
s();
|
|
865
873
|
return;
|
|
866
874
|
}
|
|
867
|
-
const P =
|
|
875
|
+
const P = ue(g, (z) => {
|
|
868
876
|
z || (P(), s());
|
|
869
877
|
});
|
|
870
878
|
});
|
|
@@ -873,50 +881,50 @@ const me = "link", ye = "small", it = /* @__PURE__ */ _({
|
|
|
873
881
|
}
|
|
874
882
|
},
|
|
875
883
|
onCancel: () => {
|
|
876
|
-
|
|
884
|
+
y.value = null;
|
|
877
885
|
},
|
|
878
886
|
afterClose: () => {
|
|
879
|
-
|
|
887
|
+
y.value = null;
|
|
880
888
|
}
|
|
881
889
|
});
|
|
882
890
|
});
|
|
883
891
|
};
|
|
884
|
-
return (a, s) =>
|
|
892
|
+
return (a, s) => d.value && a.confirmType === "popconfirm" ? (u(), v(B(We), {
|
|
885
893
|
key: 0,
|
|
886
|
-
title:
|
|
894
|
+
title: d.value,
|
|
887
895
|
"ok-text": a.okText,
|
|
888
896
|
"cancel-text": a.cancelText,
|
|
889
|
-
"ok-button-props": { loading:
|
|
890
|
-
onConfirm: B(
|
|
897
|
+
"ok-button-props": { loading: g.value, danger: !0 },
|
|
898
|
+
onConfirm: B(h)
|
|
891
899
|
}, {
|
|
892
|
-
icon:
|
|
893
|
-
|
|
894
|
-
|
|
900
|
+
icon: m(() => [
|
|
901
|
+
j(a.$slots, "popconfirmIcon", {}, () => [
|
|
902
|
+
b(B(qe), { class: "text-[--color-ant-error]" })
|
|
895
903
|
], !0)
|
|
896
904
|
]),
|
|
897
|
-
default:
|
|
898
|
-
|
|
905
|
+
default: m(() => [
|
|
906
|
+
b(B(K), S(a.$attrs, {
|
|
899
907
|
type: a.type,
|
|
900
908
|
size: a.size,
|
|
901
909
|
danger: !0,
|
|
902
|
-
loading:
|
|
910
|
+
loading: g.value,
|
|
903
911
|
disabled: a.disabled,
|
|
904
912
|
permission: a.permission,
|
|
905
913
|
"permission-action": a.permissionAction,
|
|
906
914
|
class: "group"
|
|
907
|
-
}),
|
|
908
|
-
default:
|
|
909
|
-
|
|
910
|
-
s[0] || (s[0] =
|
|
915
|
+
}), W({
|
|
916
|
+
default: m(() => [
|
|
917
|
+
j(a.$slots, "default", {}, () => [
|
|
918
|
+
s[0] || (s[0] = F("删除", -1))
|
|
911
919
|
], !0)
|
|
912
920
|
]),
|
|
913
921
|
_: 2
|
|
914
922
|
}, [
|
|
915
923
|
a.hideIcon ? void 0 : {
|
|
916
924
|
name: "icon",
|
|
917
|
-
fn:
|
|
918
|
-
|
|
919
|
-
|
|
925
|
+
fn: m(() => [
|
|
926
|
+
j(a.$slots, "icon", {}, () => [
|
|
927
|
+
b(B(pe))
|
|
920
928
|
], !0)
|
|
921
929
|
]),
|
|
922
930
|
key: "0"
|
|
@@ -924,35 +932,35 @@ const me = "link", ye = "small", it = /* @__PURE__ */ _({
|
|
|
924
932
|
]), 1040, ["type", "size", "loading", "disabled", "permission", "permission-action"])
|
|
925
933
|
]),
|
|
926
934
|
_: 3
|
|
927
|
-
}, 8, ["title", "ok-text", "cancel-text", "ok-button-props", "onConfirm"])) : (u(),
|
|
935
|
+
}, 8, ["title", "ok-text", "cancel-text", "ok-button-props", "onConfirm"])) : (u(), v(B(K), S({ key: 1 }, a.$attrs, {
|
|
928
936
|
type: a.type,
|
|
929
937
|
size: a.size,
|
|
930
938
|
danger: !0,
|
|
931
|
-
loading:
|
|
939
|
+
loading: g.value,
|
|
932
940
|
disabled: a.disabled,
|
|
933
941
|
permission: a.permission,
|
|
934
942
|
"permission-action": a.permissionAction,
|
|
935
943
|
onClick: M
|
|
936
|
-
}),
|
|
937
|
-
default:
|
|
938
|
-
|
|
939
|
-
s[1] || (s[1] =
|
|
944
|
+
}), W({
|
|
945
|
+
default: m(() => [
|
|
946
|
+
j(a.$slots, "default", {}, () => [
|
|
947
|
+
s[1] || (s[1] = F("删除", -1))
|
|
940
948
|
], !0)
|
|
941
949
|
]),
|
|
942
950
|
_: 2
|
|
943
951
|
}, [
|
|
944
952
|
a.hideIcon ? void 0 : {
|
|
945
953
|
name: "icon",
|
|
946
|
-
fn:
|
|
947
|
-
|
|
948
|
-
|
|
954
|
+
fn: m(() => [
|
|
955
|
+
j(a.$slots, "icon", {}, () => [
|
|
956
|
+
b(B(pe))
|
|
949
957
|
], !0)
|
|
950
958
|
]),
|
|
951
959
|
key: "0"
|
|
952
960
|
}
|
|
953
961
|
]), 1040, ["type", "size", "loading", "disabled", "permission", "permission-action"]));
|
|
954
962
|
}
|
|
955
|
-
}), ut = /* @__PURE__ */
|
|
963
|
+
}), ut = /* @__PURE__ */ Se(lt, [["__scopeId", "data-v-a943bc19"]]), st = {
|
|
956
964
|
// 继承 antd 的所有 props
|
|
957
965
|
columns: {
|
|
958
966
|
type: Array,
|
|
@@ -994,13 +1002,13 @@ const dt = /* @__PURE__ */ _({
|
|
|
994
1002
|
slots: n,
|
|
995
1003
|
attrs: t
|
|
996
1004
|
}) {
|
|
997
|
-
return () =>
|
|
1005
|
+
return () => b(Ge, S(e, t, {
|
|
998
1006
|
class: "mtn-table"
|
|
999
1007
|
}), ct(n) ? n : {
|
|
1000
1008
|
default: () => [n]
|
|
1001
1009
|
});
|
|
1002
1010
|
}
|
|
1003
|
-
}), ft =
|
|
1011
|
+
}), ft = ve(dt), pt = [K, Be, Z, rt, ut, Qe, ft], ht = {
|
|
1004
1012
|
install(e) {
|
|
1005
1013
|
pt.forEach((n) => {
|
|
1006
1014
|
e.component(n.name || "", n);
|
|
@@ -1009,10 +1017,10 @@ const dt = /* @__PURE__ */ _({
|
|
|
1009
1017
|
};
|
|
1010
1018
|
export {
|
|
1011
1019
|
rt as ActionGroup,
|
|
1012
|
-
|
|
1013
|
-
|
|
1020
|
+
K as Button,
|
|
1021
|
+
Be as ButtonGroup,
|
|
1014
1022
|
ut as DeleteButton,
|
|
1015
|
-
|
|
1023
|
+
Z as DropdownButton,
|
|
1016
1024
|
ft as Table,
|
|
1017
1025
|
Qe as Tag,
|
|
1018
1026
|
et as buttonGroupProps,
|