@mtn-ui/components 1.0.7 → 1.0.9
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 +249 -215
- package/dist/antd-wrapped/table/table.js +6 -21
- package/dist/components.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +22 -17
- package/dist/index.mjs +453 -460
- package/dist/types/packages/components/src/antd-wrapped/table/index.d.ts +3 -67
- package/dist/types/packages/components/src/antd-wrapped/table/table.d.ts +128 -67
- package/package.json +1 -1
- package/dist/antd-wrapped/table/index.js +0 -7
- package/dist/antd-wrapped/table/props.js +0 -35
- package/dist/types/packages/components/src/antd-wrapped/table/props.d.ts +0 -37
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { cva as
|
|
4
|
-
import { Button as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { cn as Ue, withInstall as je, PERMISSION_CHECKER_KEY as le, defaultPermissionChecker as se } from "@mtn-ui/shared";
|
|
2
|
+
import { defineComponent as G, createVNode as B, inject as ue, ref as D, computed as p, mergeProps as x, Fragment as R, h as Fe, Comment as He, Text as Ke, useSlots as We, useAttrs as Ye, shallowRef as Xe, watch as ee, cloneVNode as ye, onMounted as qe, nextTick as H, onUnmounted as Ze, createElementBlock as M, openBlock as s, createElementVNode as ge, unref as P, normalizeProps as ve, guardReactiveProps as Je, withCtx as m, createBlock as h, createCommentVNode as Qe, renderList as $, resolveDynamicComponent as A, createSlots as K, createTextVNode as W, toDisplayString as re, normalizeStyle as et, onBeforeUnmount as tt, renderSlot as F } from "vue";
|
|
3
|
+
import { cva as nt } from "class-variance-authority";
|
|
4
|
+
import { Button as ze, Space as be, Dropdown as ke, Menu as Q, Popconfirm as ot, message as he, Modal as rt, Table as at } from "ant-design-vue";
|
|
5
|
+
import { Table as Vt } from "ant-design-vue";
|
|
6
|
+
import { useDebounceFn as Ce } from "@vueuse/core";
|
|
7
|
+
import { MoreOutlined as it, DeleteOutlined as Se, ExclamationCircleOutlined as lt } from "@ant-design/icons-vue";
|
|
8
|
+
const st = {
|
|
8
9
|
type: {
|
|
9
10
|
type: String,
|
|
10
11
|
default: "default"
|
|
@@ -12,7 +13,7 @@ const tt = {
|
|
|
12
13
|
color: {
|
|
13
14
|
type: String
|
|
14
15
|
}
|
|
15
|
-
},
|
|
16
|
+
}, ut = nt("inline-flex items-center px-2 py-0.5 rounded text-xs font-medium border transition-colors", {
|
|
16
17
|
variants: {
|
|
17
18
|
type: {
|
|
18
19
|
default: "bg-gray-100 text-gray-800 border-gray-200",
|
|
@@ -25,26 +26,26 @@ const tt = {
|
|
|
25
26
|
defaultVariants: {
|
|
26
27
|
type: "default"
|
|
27
28
|
}
|
|
28
|
-
}),
|
|
29
|
+
}), ct = /* @__PURE__ */ G({
|
|
29
30
|
name: "MTag",
|
|
30
|
-
props:
|
|
31
|
+
props: st,
|
|
31
32
|
setup(e, {
|
|
32
|
-
slots:
|
|
33
|
-
attrs:
|
|
33
|
+
slots: r,
|
|
34
|
+
attrs: n
|
|
34
35
|
}) {
|
|
35
36
|
return () => {
|
|
36
37
|
var l;
|
|
37
38
|
const {
|
|
38
|
-
type:
|
|
39
|
+
type: o
|
|
39
40
|
} = e;
|
|
40
|
-
return
|
|
41
|
-
class:
|
|
42
|
-
type:
|
|
43
|
-
}),
|
|
44
|
-
}, [(l =
|
|
41
|
+
return B("span", {
|
|
42
|
+
class: Ue(ut({
|
|
43
|
+
type: o
|
|
44
|
+
}), n.class)
|
|
45
|
+
}, [(l = r.default) == null ? void 0 : l.call(r)]);
|
|
45
46
|
};
|
|
46
47
|
}
|
|
47
|
-
}),
|
|
48
|
+
}), dt = je(ct), Pe = {
|
|
48
49
|
// 按钮类型
|
|
49
50
|
type: {
|
|
50
51
|
type: String,
|
|
@@ -105,72 +106,72 @@ const tt = {
|
|
|
105
106
|
default: "hide"
|
|
106
107
|
}
|
|
107
108
|
};
|
|
108
|
-
function
|
|
109
|
-
const { permission:
|
|
109
|
+
function Te(e) {
|
|
110
|
+
const { permission: r, permissionAction: n = "hide" } = e, o = ue(le, D(se)), l = p(() => r ? o.value(r) : !0), y = p(() => !l.value && n === "hide"), d = p(() => !l.value && n === "disable");
|
|
110
111
|
return {
|
|
111
112
|
hasPermission: l,
|
|
112
|
-
shouldHide:
|
|
113
|
-
shouldDisable:
|
|
113
|
+
shouldHide: y,
|
|
114
|
+
shouldDisable: d
|
|
114
115
|
};
|
|
115
116
|
}
|
|
116
|
-
function
|
|
117
|
-
return e.map((
|
|
118
|
-
if (!
|
|
119
|
-
return
|
|
120
|
-
if (!
|
|
121
|
-
const l =
|
|
117
|
+
function ft(e, r) {
|
|
118
|
+
return e.map((n) => {
|
|
119
|
+
if (!n || n.type === "divider" || !n.permission)
|
|
120
|
+
return n;
|
|
121
|
+
if (!r(n.permission)) {
|
|
122
|
+
const l = n.permissionAction || "hide";
|
|
122
123
|
if (l === "hide")
|
|
123
124
|
return null;
|
|
124
125
|
if (l === "disable")
|
|
125
|
-
return { ...
|
|
126
|
+
return { ...n, disabled: !0 };
|
|
126
127
|
}
|
|
127
|
-
return
|
|
128
|
+
return n;
|
|
128
129
|
}).filter(Boolean);
|
|
129
130
|
}
|
|
130
|
-
const
|
|
131
|
+
const te = /* @__PURE__ */ G({
|
|
131
132
|
name: "MButton",
|
|
132
|
-
props:
|
|
133
|
+
props: Pe,
|
|
133
134
|
emits: ["click"],
|
|
134
135
|
setup(e, {
|
|
135
|
-
slots:
|
|
136
|
-
attrs:
|
|
137
|
-
emit:
|
|
136
|
+
slots: r,
|
|
137
|
+
attrs: n,
|
|
138
|
+
emit: o
|
|
138
139
|
}) {
|
|
139
140
|
const {
|
|
140
141
|
shouldHide: l,
|
|
141
|
-
shouldDisable:
|
|
142
|
-
} =
|
|
142
|
+
shouldDisable: y
|
|
143
|
+
} = Te({
|
|
143
144
|
permission: e.permission,
|
|
144
145
|
permissionAction: e.permissionAction
|
|
145
|
-
}),
|
|
146
|
-
|
|
146
|
+
}), d = (f) => {
|
|
147
|
+
o("click", f);
|
|
147
148
|
};
|
|
148
|
-
return () => l.value ? null :
|
|
149
|
+
return () => l.value ? null : B(ze, x({
|
|
149
150
|
type: e.type,
|
|
150
151
|
size: e.size,
|
|
151
152
|
loading: e.loading,
|
|
152
|
-
disabled: e.disabled ||
|
|
153
|
+
disabled: e.disabled || y.value,
|
|
153
154
|
danger: e.danger,
|
|
154
155
|
block: e.block,
|
|
155
156
|
ghost: e.ghost,
|
|
156
157
|
shape: e.shape,
|
|
157
158
|
htmlType: e.htmlType,
|
|
158
159
|
icon: e.icon
|
|
159
|
-
},
|
|
160
|
-
class: ["mtn-button",
|
|
161
|
-
onClick:
|
|
160
|
+
}, n, {
|
|
161
|
+
class: ["mtn-button", n.class],
|
|
162
|
+
onClick: d
|
|
162
163
|
}), {
|
|
163
164
|
default: () => {
|
|
164
165
|
var f;
|
|
165
|
-
return (f =
|
|
166
|
+
return (f = r.default) == null ? void 0 : f.call(r);
|
|
166
167
|
},
|
|
167
168
|
icon: () => {
|
|
168
169
|
var f;
|
|
169
|
-
return (f =
|
|
170
|
+
return (f = r.icon) == null ? void 0 : f.call(r);
|
|
170
171
|
}
|
|
171
172
|
});
|
|
172
173
|
}
|
|
173
|
-
}),
|
|
174
|
+
}), pt = {
|
|
174
175
|
// 按钮组尺寸
|
|
175
176
|
size: {
|
|
176
177
|
type: String,
|
|
@@ -196,43 +197,43 @@ const Q = /* @__PURE__ */ N({
|
|
|
196
197
|
type: Boolean,
|
|
197
198
|
default: !1
|
|
198
199
|
}
|
|
199
|
-
},
|
|
200
|
+
}, Ae = /* @__PURE__ */ G({
|
|
200
201
|
name: "MButtonGroup",
|
|
201
|
-
props:
|
|
202
|
+
props: pt,
|
|
202
203
|
setup(e, {
|
|
203
|
-
slots:
|
|
204
|
-
attrs:
|
|
204
|
+
slots: r,
|
|
205
|
+
attrs: n
|
|
205
206
|
}) {
|
|
206
|
-
return () =>
|
|
207
|
+
return () => B(R, null, [e.compact ? (
|
|
207
208
|
// 紧凑模式:按钮紧密连接
|
|
208
|
-
|
|
209
|
+
B(be.Compact, x({
|
|
209
210
|
size: e.size,
|
|
210
211
|
direction: e.vertical ? "vertical" : "horizontal",
|
|
211
212
|
block: e.block
|
|
212
|
-
},
|
|
213
|
-
class: ["mtn-button-group", "mtn-button-group--compact",
|
|
213
|
+
}, n, {
|
|
214
|
+
class: ["mtn-button-group", "mtn-button-group--compact", n.class]
|
|
214
215
|
}), {
|
|
215
216
|
default: () => {
|
|
216
|
-
var
|
|
217
|
-
return [(
|
|
217
|
+
var o;
|
|
218
|
+
return [(o = r.default) == null ? void 0 : o.call(r)];
|
|
218
219
|
}
|
|
219
220
|
})
|
|
220
221
|
) : (
|
|
221
222
|
// 普通模式:按钮有间距
|
|
222
|
-
|
|
223
|
+
B(be, x({
|
|
223
224
|
size: typeof e.gap == "number" ? e.gap : parseInt(e.gap) || 8,
|
|
224
225
|
direction: e.vertical ? "vertical" : "horizontal"
|
|
225
|
-
},
|
|
226
|
-
class: ["mtn-button-group", "mtn-button-group--normal",
|
|
226
|
+
}, n, {
|
|
227
|
+
class: ["mtn-button-group", "mtn-button-group--normal", n.class]
|
|
227
228
|
}), {
|
|
228
229
|
default: () => {
|
|
229
|
-
var
|
|
230
|
-
return [(
|
|
230
|
+
var o;
|
|
231
|
+
return [(o = r.default) == null ? void 0 : o.call(r)];
|
|
231
232
|
}
|
|
232
233
|
})
|
|
233
234
|
)]);
|
|
234
235
|
}
|
|
235
|
-
}),
|
|
236
|
+
}), mt = {
|
|
236
237
|
// 按钮文字
|
|
237
238
|
text: {
|
|
238
239
|
type: String,
|
|
@@ -288,77 +289,77 @@ const Q = /* @__PURE__ */ N({
|
|
|
288
289
|
type: String,
|
|
289
290
|
default: "hide"
|
|
290
291
|
}
|
|
291
|
-
},
|
|
292
|
+
}, ie = /* @__PURE__ */ G({
|
|
292
293
|
name: "MDropdownButton",
|
|
293
|
-
props:
|
|
294
|
+
props: mt,
|
|
294
295
|
emits: ["click"],
|
|
295
296
|
setup(e, {
|
|
296
|
-
slots:
|
|
297
|
-
attrs:
|
|
298
|
-
emit:
|
|
297
|
+
slots: r,
|
|
298
|
+
attrs: n,
|
|
299
|
+
emit: o
|
|
299
300
|
}) {
|
|
300
301
|
const {
|
|
301
302
|
shouldHide: l,
|
|
302
|
-
shouldDisable:
|
|
303
|
-
} =
|
|
303
|
+
shouldDisable: y
|
|
304
|
+
} = Te({
|
|
304
305
|
permission: e.permission,
|
|
305
306
|
permissionAction: e.permissionAction
|
|
306
|
-
}),
|
|
307
|
-
|
|
307
|
+
}), d = ue(le, D(se)), f = (v) => {
|
|
308
|
+
o("click", v);
|
|
308
309
|
};
|
|
309
310
|
return () => {
|
|
310
311
|
if (l.value)
|
|
311
312
|
return null;
|
|
312
313
|
const v = {};
|
|
313
|
-
if (
|
|
314
|
-
v.overlay =
|
|
314
|
+
if (r.overlay)
|
|
315
|
+
v.overlay = r.overlay;
|
|
315
316
|
else if (e.menu && e.menu.length > 0) {
|
|
316
|
-
const
|
|
317
|
-
v.overlay = () =>
|
|
318
|
-
items:
|
|
317
|
+
const b = ft(e.menu, d.value);
|
|
318
|
+
v.overlay = () => Fe(Q, {
|
|
319
|
+
items: b
|
|
319
320
|
});
|
|
320
321
|
}
|
|
321
|
-
return
|
|
322
|
+
return r.icon && (v.icon = r.icon), !(r.default || e.text) ? B(ke, x({
|
|
322
323
|
placement: e.placement,
|
|
323
324
|
trigger: e.trigger
|
|
324
|
-
},
|
|
325
|
-
class: ["mtn-dropdown-button",
|
|
325
|
+
}, n, {
|
|
326
|
+
class: ["mtn-dropdown-button", n.class]
|
|
326
327
|
}), {
|
|
327
|
-
default: () => [
|
|
328
|
+
default: () => [B(ze, {
|
|
328
329
|
type: e.type,
|
|
329
330
|
size: e.size === "middle" ? void 0 : e.size,
|
|
330
|
-
disabled: e.disabled ||
|
|
331
|
+
disabled: e.disabled || y.value,
|
|
331
332
|
loading: e.loading,
|
|
332
333
|
danger: e.danger,
|
|
333
334
|
onClick: f
|
|
334
335
|
}, {
|
|
335
336
|
default: () => {
|
|
336
|
-
var
|
|
337
|
-
return [(
|
|
337
|
+
var b;
|
|
338
|
+
return [(b = r.icon) == null ? void 0 : b.call(r)];
|
|
338
339
|
}
|
|
339
340
|
})],
|
|
340
341
|
...v
|
|
341
|
-
}) :
|
|
342
|
+
}) : B(ke.Button, x({
|
|
342
343
|
type: e.type,
|
|
343
344
|
size: e.size === "middle" ? void 0 : e.size,
|
|
344
|
-
disabled: e.disabled ||
|
|
345
|
+
disabled: e.disabled || y.value,
|
|
345
346
|
loading: e.loading,
|
|
346
347
|
danger: e.danger,
|
|
347
348
|
placement: e.placement,
|
|
348
349
|
trigger: e.trigger
|
|
349
|
-
},
|
|
350
|
-
class: ["mtn-dropdown-button",
|
|
350
|
+
}, n, {
|
|
351
|
+
class: ["mtn-dropdown-button", n.class],
|
|
351
352
|
onClick: f
|
|
352
353
|
}), {
|
|
353
354
|
default: () => {
|
|
354
|
-
var
|
|
355
|
-
return [((
|
|
355
|
+
var b;
|
|
356
|
+
return [((b = r.default) == null ? void 0 : b.call(r)) || e.text];
|
|
356
357
|
},
|
|
357
358
|
...v
|
|
358
359
|
});
|
|
359
360
|
};
|
|
360
361
|
}
|
|
361
|
-
}),
|
|
362
|
+
}), yt = {
|
|
362
363
|
// ===== 配置化 API =====
|
|
363
364
|
/**
|
|
364
365
|
* 操作项配置列表
|
|
@@ -447,267 +448,300 @@ const Q = /* @__PURE__ */ N({
|
|
|
447
448
|
default: !1
|
|
448
449
|
}
|
|
449
450
|
};
|
|
450
|
-
function
|
|
451
|
+
function gt(e) {
|
|
451
452
|
return e ? e.filter(
|
|
452
|
-
(
|
|
453
|
+
(r) => r.type !== He && r.type !== Ke && r.type !== Symbol.for("v-fgt")
|
|
453
454
|
) : [];
|
|
454
455
|
}
|
|
455
|
-
function
|
|
456
|
-
var
|
|
456
|
+
function vt(e, r) {
|
|
457
|
+
var n, o;
|
|
457
458
|
if (e.key !== null && e.key !== void 0)
|
|
458
459
|
return typeof e.key == "symbol" ? e.key.toString() : e.key;
|
|
459
|
-
if (((
|
|
460
|
+
if (((n = e.props) == null ? void 0 : n.key) !== null && ((o = e.props) == null ? void 0 : o.key) !== void 0) {
|
|
460
461
|
const l = e.props.key;
|
|
461
462
|
return typeof l == "symbol" ? l.toString() : l;
|
|
462
463
|
}
|
|
463
|
-
return `button-${
|
|
464
|
+
return `button-${r}`;
|
|
464
465
|
}
|
|
465
|
-
const
|
|
466
|
+
const ae = "link", Be = "small", bt = 150, kt = /* @__PURE__ */ G({
|
|
466
467
|
name: "MActionGroup",
|
|
467
468
|
inheritAttrs: !1,
|
|
468
469
|
__name: "action-group",
|
|
469
|
-
props:
|
|
470
|
+
props: yt,
|
|
470
471
|
emits: ["action-click"],
|
|
471
|
-
setup(e, { emit:
|
|
472
|
-
const
|
|
473
|
-
function
|
|
474
|
-
|
|
475
|
-
const c = n;
|
|
476
|
-
return c.name || c.__name || c.displayName;
|
|
477
|
-
}
|
|
478
|
-
const D = p(() => t.mode === "table"), a = p(
|
|
479
|
-
() => D.value ? "small" : t.size
|
|
480
|
-
), u = p(
|
|
481
|
-
() => D.value ? "link" : "default"
|
|
482
|
-
), A = p(
|
|
483
|
-
() => D.value ? "" : t.moreText
|
|
484
|
-
), _ = p(() => t.moreIcon || Xe);
|
|
485
|
-
function G(n) {
|
|
486
|
-
return n ? F.value(n) : !0;
|
|
472
|
+
setup(e, { emit: r }) {
|
|
473
|
+
const n = e, o = r, l = We(), y = Ye(), d = D(), f = D(), v = D(), Y = ue(le, D(se)), b = p(() => n.mode === "table"), E = p(() => b.value ? "small" : n.size), i = p(() => b.value ? "link" : "default"), u = p(() => b.value ? "" : n.moreText), I = p(() => n.moreIcon || it);
|
|
474
|
+
function w(t) {
|
|
475
|
+
return t ? Y.value(t) : !0;
|
|
487
476
|
}
|
|
488
|
-
const
|
|
489
|
-
|
|
490
|
-
|
|
477
|
+
const ce = p(() => {
|
|
478
|
+
var t;
|
|
479
|
+
return gt((t = l.default) == null ? void 0 : t.call(l));
|
|
480
|
+
}), O = Xe([]);
|
|
481
|
+
function de(t) {
|
|
482
|
+
var z, k, C;
|
|
483
|
+
const c = t.icon && (t.icon.name || t.icon.__name) || "", a = t.component && (t.component.name || t.component.__name) || "";
|
|
491
484
|
return [
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
Array.isArray(
|
|
497
|
-
|
|
498
|
-
String(
|
|
499
|
-
String(((
|
|
500
|
-
String(((
|
|
501
|
-
String(((
|
|
485
|
+
t.key ?? "",
|
|
486
|
+
t.label ?? "",
|
|
487
|
+
c,
|
|
488
|
+
a,
|
|
489
|
+
Array.isArray(t.permission) ? t.permission.join(",") : t.permission ?? "",
|
|
490
|
+
t.permissionAction ?? "",
|
|
491
|
+
String(t.disabled ?? !1),
|
|
492
|
+
String(((z = t.componentProps) == null ? void 0 : z.confirm) ?? ""),
|
|
493
|
+
String(((k = t.componentProps) == null ? void 0 : k.showSuccess) ?? ""),
|
|
494
|
+
String(((C = t.componentProps) == null ? void 0 : C.danger) ?? "")
|
|
502
495
|
].join("|");
|
|
503
496
|
}
|
|
504
|
-
|
|
505
|
-
() =>
|
|
506
|
-
(
|
|
507
|
-
if (!
|
|
508
|
-
|
|
497
|
+
ee(
|
|
498
|
+
() => n.actions,
|
|
499
|
+
(t) => {
|
|
500
|
+
if (!t) {
|
|
501
|
+
O.value = [];
|
|
509
502
|
return;
|
|
510
503
|
}
|
|
511
|
-
if (
|
|
512
|
-
|
|
504
|
+
if (O.value.length !== t.length) {
|
|
505
|
+
O.value = t;
|
|
513
506
|
return;
|
|
514
507
|
}
|
|
515
|
-
const c =
|
|
516
|
-
c !==
|
|
508
|
+
const c = t.map(de).join("||"), a = O.value.map(de).join("||");
|
|
509
|
+
c !== a && (O.value = t);
|
|
517
510
|
},
|
|
518
511
|
{ immediate: !0, deep: !1 }
|
|
519
512
|
);
|
|
520
|
-
const
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
)
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
513
|
+
const ne = p(() => O.value.length ? O.value.filter((t) => w(t.permission)) : []), T = p(() => n.actions ? ne.value.length : ce.value.length), X = p(() => n.actions ? ne.value.map((t, c) => ({
|
|
514
|
+
key: Le(t, c),
|
|
515
|
+
label: t.label || "",
|
|
516
|
+
icon: t.icon || null,
|
|
517
|
+
component: Oe(t),
|
|
518
|
+
props: Ne(t),
|
|
519
|
+
menuProps: Re(t),
|
|
520
|
+
handler: () => Ve(t)
|
|
521
|
+
})) : ce.value.filter((t) => {
|
|
522
|
+
const c = t.props || {};
|
|
523
|
+
return c.permission && c.permissionAction === "hide" ? w(c.permission) : !0;
|
|
524
|
+
}).map((t, c) => {
|
|
525
|
+
var k, C;
|
|
526
|
+
const a = vt(t, c), g = ye(t, {
|
|
527
|
+
type: ((k = t.props) == null ? void 0 : k.type) ?? (b.value ? i.value : void 0),
|
|
528
|
+
size: ((C = t.props) == null ? void 0 : C.size) ?? E.value
|
|
529
|
+
}), z = ye(t, {
|
|
530
|
+
...t.props,
|
|
531
|
+
type: ae,
|
|
532
|
+
size: Be
|
|
533
|
+
});
|
|
534
|
+
return {
|
|
535
|
+
key: a,
|
|
536
|
+
label: "",
|
|
537
|
+
// 插槽模式没有 label,由组件自身渲染
|
|
538
|
+
icon: null,
|
|
539
|
+
component: g,
|
|
540
|
+
props: {},
|
|
541
|
+
// 插槽模式使用 cloneVNode 已经处理了 props
|
|
542
|
+
menuProps: {},
|
|
543
|
+
// 菜单模式使用 cloneVNode 已经处理了 props
|
|
544
|
+
handler: null,
|
|
545
|
+
// 插槽模式的事件由组件自身处理
|
|
546
|
+
vnode: g,
|
|
547
|
+
// 保存原始 vnode 用于渲染
|
|
548
|
+
menuVnode: z
|
|
549
|
+
// 保存菜单模式的 vnode
|
|
550
|
+
};
|
|
551
|
+
})), fe = p(() => X.value.slice(0, pe.value)), oe = p(() => X.value.slice(pe.value)), we = p(() => ({
|
|
552
|
+
size: E.value,
|
|
553
|
+
compact: n.compact,
|
|
554
|
+
vertical: n.vertical,
|
|
555
|
+
block: n.block,
|
|
556
|
+
...y
|
|
557
|
+
})), Ie = p(() => ({
|
|
558
|
+
text: u.value,
|
|
559
|
+
size: E.value,
|
|
560
|
+
type: i.value,
|
|
561
|
+
...n.moreProps
|
|
562
|
+
})), q = D(n.maxItems);
|
|
563
|
+
function Me() {
|
|
564
|
+
if (!d.value || !f.value || !v.value)
|
|
565
|
+
return Math.min(n.maxItems, T.value);
|
|
566
|
+
const t = d.value.clientWidth, c = f.value.querySelectorAll(".measure-item");
|
|
567
|
+
if (c.length === 0) return Math.min(n.maxItems, T.value);
|
|
568
|
+
const a = T.value, g = [];
|
|
569
|
+
for (let S = 0; S < Math.min(a, c.length); S++)
|
|
570
|
+
g.push(c[S].offsetWidth);
|
|
571
|
+
const z = v.value.offsetWidth ?? 0;
|
|
572
|
+
let k = 0, C = 0;
|
|
573
|
+
for (let S = 0; S < g.length; S++) {
|
|
574
|
+
const _ = g[S], N = k === 0 ? _ : k + n.gap + _, V = g.length - (S + 1) > 0 ? k === 0 ? z : n.gap + z : 0;
|
|
575
|
+
if (N + V <= t) {
|
|
576
|
+
k = N, C++;
|
|
577
|
+
continue;
|
|
578
|
+
}
|
|
579
|
+
break;
|
|
535
580
|
}
|
|
536
|
-
return Math.max(0, Math.min(
|
|
581
|
+
return Math.max(0, Math.min(C, n.maxItems, a));
|
|
537
582
|
}
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
()
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
583
|
+
const Z = () => {
|
|
584
|
+
if (n.disableCollapse) {
|
|
585
|
+
q.value = T.value;
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
if (T.value <= 1) {
|
|
589
|
+
q.value = T.value;
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
q.value = Me();
|
|
593
|
+
}, L = Ce(() => {
|
|
594
|
+
Z();
|
|
595
|
+
}, bt), U = (t = !1) => {
|
|
596
|
+
t ? (typeof L == "function" && "cancel" in L && L.cancel(), Z()) : L();
|
|
597
|
+
};
|
|
598
|
+
U.cancel = () => {
|
|
599
|
+
typeof L == "function" && "cancel" in L && L.cancel();
|
|
600
|
+
};
|
|
601
|
+
let j = null;
|
|
602
|
+
const De = async () => {
|
|
603
|
+
await H(), Z(), d.value && typeof ResizeObserver < "u" && (j = new ResizeObserver((t) => {
|
|
604
|
+
t[0].contentRect.width > 0 && U();
|
|
605
|
+
}), j.observe(d.value));
|
|
606
|
+
}, _e = () => {
|
|
607
|
+
j && d.value && j.unobserve(d.value), j = null, "cancel" in U && U.cancel();
|
|
608
|
+
};
|
|
609
|
+
qe(async () => {
|
|
610
|
+
Z(), await H(), De();
|
|
611
|
+
}), Ze(() => {
|
|
612
|
+
_e();
|
|
613
|
+
}), ee(
|
|
614
|
+
[ne, T, () => n.maxItems, () => n.gap],
|
|
615
|
+
async () => {
|
|
616
|
+
await H(), U(!0);
|
|
553
617
|
},
|
|
554
|
-
{
|
|
618
|
+
{ deep: !1 }
|
|
555
619
|
);
|
|
556
|
-
const
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
return O.value >= n.length ? n : n.slice(0, O.value);
|
|
560
|
-
}), se = p(() => {
|
|
561
|
-
if (t.actions) return [];
|
|
562
|
-
const n = H.value;
|
|
563
|
-
return O.value >= n.length ? [] : n.slice(O.value);
|
|
564
|
-
}), Ee = p(() => t.actions ? [] : se.value.filter((n) => {
|
|
565
|
-
const c = n.props || {};
|
|
566
|
-
return c.permission && c.permissionAction === "hide" ? G(c.permission) : !0;
|
|
567
|
-
})), Ne = p(() => t.disableCollapse ? !1 : (t.actions ? ue.value.length : se.value.length) > 0);
|
|
568
|
-
function X(n) {
|
|
569
|
-
return n.component || Q;
|
|
620
|
+
const pe = p(() => n.disableCollapse || T.value <= 1 ? T.value : f.value && v.value && d.value ? q.value : Math.min(n.maxItems, T.value)), Ee = p(() => n.disableCollapse ? !1 : oe.value.length > 0);
|
|
621
|
+
function Oe(t) {
|
|
622
|
+
return t.component || te;
|
|
570
623
|
}
|
|
571
|
-
function
|
|
572
|
-
return
|
|
624
|
+
function Le(t, c) {
|
|
625
|
+
return t.key || t.label || `action-${c}`;
|
|
573
626
|
}
|
|
574
|
-
function
|
|
627
|
+
function me(t) {
|
|
575
628
|
const {
|
|
576
629
|
label: c,
|
|
577
|
-
key:
|
|
578
|
-
onClick:
|
|
579
|
-
permission:
|
|
580
|
-
permissionAction:
|
|
581
|
-
icon:
|
|
582
|
-
component:
|
|
583
|
-
componentProps:
|
|
584
|
-
slot:
|
|
585
|
-
type:
|
|
586
|
-
size:
|
|
630
|
+
key: a,
|
|
631
|
+
onClick: g,
|
|
632
|
+
permission: z,
|
|
633
|
+
permissionAction: k,
|
|
634
|
+
icon: C,
|
|
635
|
+
component: S,
|
|
636
|
+
componentProps: _,
|
|
637
|
+
slot: N,
|
|
638
|
+
type: J,
|
|
639
|
+
size: V,
|
|
587
640
|
disabled: $e,
|
|
588
|
-
...
|
|
589
|
-
} =
|
|
641
|
+
...Ge
|
|
642
|
+
} = t;
|
|
590
643
|
return {
|
|
591
|
-
component:
|
|
592
|
-
componentProps:
|
|
593
|
-
type:
|
|
594
|
-
size:
|
|
595
|
-
rest:
|
|
596
|
-
permission:
|
|
597
|
-
permissionAction:
|
|
644
|
+
component: S,
|
|
645
|
+
componentProps: _,
|
|
646
|
+
type: J,
|
|
647
|
+
size: V,
|
|
648
|
+
rest: Ge,
|
|
649
|
+
permission: z,
|
|
650
|
+
permissionAction: k,
|
|
598
651
|
disabled: $e
|
|
599
652
|
};
|
|
600
653
|
}
|
|
601
|
-
function
|
|
602
|
-
const { component: c, componentProps:
|
|
603
|
-
type:
|
|
604
|
-
size:
|
|
605
|
-
disabled:
|
|
606
|
-
...
|
|
654
|
+
function Ne(t) {
|
|
655
|
+
const { component: c, componentProps: a, type: g, rest: z, permission: k, permissionAction: C, disabled: S } = me(t), _ = {
|
|
656
|
+
type: g || i.value,
|
|
657
|
+
size: E.value,
|
|
658
|
+
disabled: S || !w(k) && C === "disable",
|
|
659
|
+
...z
|
|
607
660
|
};
|
|
608
|
-
if (c &&
|
|
609
|
-
const
|
|
610
|
-
return
|
|
661
|
+
if (c && a) {
|
|
662
|
+
const N = { ..._, ...a };
|
|
663
|
+
return b.value && (N.type = "link"), N;
|
|
611
664
|
}
|
|
612
|
-
return
|
|
665
|
+
return _;
|
|
613
666
|
}
|
|
614
|
-
function
|
|
615
|
-
const { component: c, componentProps:
|
|
616
|
-
type:
|
|
667
|
+
function Re(t) {
|
|
668
|
+
const { component: c, componentProps: a, rest: g, permission: z, permissionAction: k, disabled: C } = me(t), S = {
|
|
669
|
+
type: ae,
|
|
617
670
|
size: Be,
|
|
618
|
-
disabled:
|
|
619
|
-
...
|
|
671
|
+
disabled: C || !w(z) && k === "disable",
|
|
672
|
+
...g
|
|
620
673
|
};
|
|
621
|
-
if (c &&
|
|
622
|
-
const { type:
|
|
623
|
-
return
|
|
674
|
+
if (c && a) {
|
|
675
|
+
const { type: _, size: N, ...J } = a, V = { ...S, ...J };
|
|
676
|
+
return V.type = ae, V;
|
|
624
677
|
}
|
|
625
|
-
return
|
|
678
|
+
return S;
|
|
626
679
|
}
|
|
627
|
-
function
|
|
628
|
-
|
|
680
|
+
function Ve(t) {
|
|
681
|
+
t.onClick && t.onClick(t), o("action-click", t);
|
|
629
682
|
}
|
|
630
|
-
return (
|
|
683
|
+
return (t, c) => (s(), M("div", {
|
|
631
684
|
ref_key: "containerRef",
|
|
632
|
-
ref:
|
|
685
|
+
ref: d,
|
|
633
686
|
class: "mtn-action-group"
|
|
634
687
|
}, [
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
onClick: (b) => pe(r)
|
|
646
|
-
}), U({
|
|
647
|
-
default: y(() => [
|
|
648
|
-
W(" " + te(r.label), 1)
|
|
688
|
+
B(P(Ae), ve(Je(we.value)), {
|
|
689
|
+
default: m(() => [
|
|
690
|
+
n.actions ? (s(!0), M(R, { key: 0 }, $(fe.value, (a) => (s(), h(A(a.component), x({
|
|
691
|
+
key: a.key,
|
|
692
|
+
ref_for: !0
|
|
693
|
+
}, a.props, {
|
|
694
|
+
onClick: a.handler
|
|
695
|
+
}), K({
|
|
696
|
+
default: m(() => [
|
|
697
|
+
W(" " + re(a.label), 1)
|
|
649
698
|
]),
|
|
650
699
|
_: 2
|
|
651
700
|
}, [
|
|
652
|
-
|
|
701
|
+
a.icon ? {
|
|
653
702
|
name: "icon",
|
|
654
|
-
fn:
|
|
655
|
-
(s(),
|
|
703
|
+
fn: m(() => [
|
|
704
|
+
(s(), h(A(a.icon)))
|
|
656
705
|
]),
|
|
657
706
|
key: "0"
|
|
658
707
|
} : void 0
|
|
659
|
-
]), 1040, ["onClick"]))), 128)) : (s(!0),
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
key: S(Se)(r, d)
|
|
666
|
-
});
|
|
667
|
-
}), 128)),
|
|
668
|
-
Ne.value ? (s(), k(S(oe), C({
|
|
669
|
-
key: 2,
|
|
670
|
-
text: A.value,
|
|
671
|
-
size: a.value,
|
|
672
|
-
type: u.value
|
|
673
|
-
}, t.moreProps), {
|
|
674
|
-
icon: y(() => [
|
|
675
|
-
(s(), k(z(_.value)))
|
|
708
|
+
]), 1040, ["onClick"]))), 128)) : (s(!0), M(R, { key: 1 }, $(fe.value, (a) => (s(), h(A(a.vnode), {
|
|
709
|
+
key: a.key
|
|
710
|
+
}))), 128)),
|
|
711
|
+
Ee.value ? (s(), h(P(ie), ve(x({ key: 2 }, Ie.value)), {
|
|
712
|
+
icon: m(() => [
|
|
713
|
+
(s(), h(A(I.value)))
|
|
676
714
|
]),
|
|
677
|
-
overlay:
|
|
678
|
-
|
|
679
|
-
default:
|
|
680
|
-
|
|
681
|
-
key:
|
|
715
|
+
overlay: m(() => [
|
|
716
|
+
B(P(Q), null, {
|
|
717
|
+
default: m(() => [
|
|
718
|
+
n.actions ? (s(!0), M(R, { key: 0 }, $(oe.value, (a) => (s(), h(P(Q).Item, {
|
|
719
|
+
key: a.key
|
|
682
720
|
}, {
|
|
683
|
-
default:
|
|
684
|
-
(s(),
|
|
685
|
-
onClick:
|
|
686
|
-
}),
|
|
687
|
-
default:
|
|
688
|
-
W(" " +
|
|
721
|
+
default: m(() => [
|
|
722
|
+
(s(), h(A(a.component), x({ ref_for: !0 }, a.menuProps, {
|
|
723
|
+
onClick: a.handler
|
|
724
|
+
}), K({
|
|
725
|
+
default: m(() => [
|
|
726
|
+
W(" " + re(a.label), 1)
|
|
689
727
|
]),
|
|
690
728
|
_: 2
|
|
691
729
|
}, [
|
|
692
|
-
|
|
730
|
+
a.icon ? {
|
|
693
731
|
name: "icon",
|
|
694
|
-
fn:
|
|
695
|
-
(s(),
|
|
732
|
+
fn: m(() => [
|
|
733
|
+
(s(), h(A(a.icon)))
|
|
696
734
|
]),
|
|
697
735
|
key: "0"
|
|
698
736
|
} : void 0
|
|
699
737
|
]), 1040, ["onClick"]))
|
|
700
738
|
]),
|
|
701
739
|
_: 2
|
|
702
|
-
}, 1024))), 128)) : (s(!0),
|
|
703
|
-
key:
|
|
740
|
+
}, 1024))), 128)) : (s(!0), M(R, { key: 1 }, $(oe.value, (a) => (s(), h(P(Q).Item, {
|
|
741
|
+
key: a.key
|
|
704
742
|
}, {
|
|
705
|
-
default:
|
|
706
|
-
(s(),
|
|
707
|
-
...r.props,
|
|
708
|
-
type: ne,
|
|
709
|
-
size: Be
|
|
710
|
-
}))))
|
|
743
|
+
default: m(() => [
|
|
744
|
+
(s(), h(A(a.menuVnode)))
|
|
711
745
|
]),
|
|
712
746
|
_: 2
|
|
713
747
|
}, 1024))), 128))
|
|
@@ -716,66 +750,67 @@ const ne = "link", Be = "small", ct = 150, dt = /* @__PURE__ */ N({
|
|
|
716
750
|
})
|
|
717
751
|
]),
|
|
718
752
|
_: 1
|
|
719
|
-
}, 16
|
|
753
|
+
}, 16)) : Qe("", !0)
|
|
720
754
|
]),
|
|
721
755
|
_: 1
|
|
722
|
-
}, 16
|
|
723
|
-
|
|
756
|
+
}, 16),
|
|
757
|
+
ge("div", {
|
|
724
758
|
ref_key: "measureRef",
|
|
725
|
-
ref:
|
|
726
|
-
class: "mtn-action-group-measure"
|
|
759
|
+
ref: f,
|
|
760
|
+
class: "mtn-action-group-measure",
|
|
761
|
+
style: et({ gap: `${n.gap}px` })
|
|
727
762
|
}, [
|
|
728
|
-
|
|
729
|
-
key:
|
|
763
|
+
n.actions ? (s(!0), M(R, { key: 0 }, $(X.value, (a, g) => (s(), M("span", {
|
|
764
|
+
key: g,
|
|
730
765
|
class: "measure-item"
|
|
731
766
|
}, [
|
|
732
|
-
(s(),
|
|
733
|
-
default:
|
|
734
|
-
W(" " +
|
|
767
|
+
(s(), h(A(a.component), x({ ref_for: !0 }, a.props), K({
|
|
768
|
+
default: m(() => [
|
|
769
|
+
W(" " + re(a.label), 1)
|
|
735
770
|
]),
|
|
736
771
|
_: 2
|
|
737
772
|
}, [
|
|
738
|
-
|
|
773
|
+
a.icon ? {
|
|
739
774
|
name: "icon",
|
|
740
|
-
fn:
|
|
741
|
-
(s(),
|
|
775
|
+
fn: m(() => [
|
|
776
|
+
(s(), h(A(a.icon)))
|
|
742
777
|
]),
|
|
743
778
|
key: "0"
|
|
744
779
|
} : void 0
|
|
745
780
|
]), 1040))
|
|
746
|
-
]))), 128)) : (s(!0),
|
|
747
|
-
key:
|
|
781
|
+
]))), 128)) : (s(!0), M(R, { key: 1 }, $(X.value, (a, g) => (s(), M("span", {
|
|
782
|
+
key: g,
|
|
748
783
|
class: "measure-item"
|
|
749
784
|
}, [
|
|
750
|
-
(s(),
|
|
785
|
+
(s(), h(A(a.vnode)))
|
|
751
786
|
]))), 128)),
|
|
752
|
-
|
|
787
|
+
ge("span", {
|
|
753
788
|
ref_key: "moreTriggerRef",
|
|
754
|
-
ref:
|
|
789
|
+
ref: v,
|
|
755
790
|
class: "measure-item"
|
|
756
791
|
}, [
|
|
757
|
-
|
|
758
|
-
text:
|
|
759
|
-
size:
|
|
760
|
-
type:
|
|
792
|
+
B(P(ie), {
|
|
793
|
+
text: u.value,
|
|
794
|
+
size: E.value,
|
|
795
|
+
type: i.value
|
|
761
796
|
}, {
|
|
762
|
-
icon:
|
|
763
|
-
(s(),
|
|
797
|
+
icon: m(() => [
|
|
798
|
+
(s(), h(A(I.value)))
|
|
764
799
|
]),
|
|
765
800
|
_: 1
|
|
766
801
|
}, 8, ["text", "size", "type"])
|
|
767
802
|
], 512)
|
|
768
|
-
],
|
|
803
|
+
], 4)
|
|
769
804
|
], 512));
|
|
770
805
|
}
|
|
771
|
-
}),
|
|
772
|
-
const
|
|
773
|
-
for (const [
|
|
774
|
-
|
|
775
|
-
return
|
|
776
|
-
},
|
|
806
|
+
}), xe = (e, r) => {
|
|
807
|
+
const n = e.__vccOpts || e;
|
|
808
|
+
for (const [o, l] of r)
|
|
809
|
+
n[o] = l;
|
|
810
|
+
return n;
|
|
811
|
+
}, ht = /* @__PURE__ */ xe(kt, [["__scopeId", "data-v-29d941f4"]]), St = {
|
|
777
812
|
// 继承 Button 的所有 props
|
|
778
|
-
...
|
|
813
|
+
...Pe,
|
|
779
814
|
// 覆盖 loading prop,使其默认值为 undefined,以便自动 loading 功能正常工作
|
|
780
815
|
loading: {
|
|
781
816
|
type: Boolean,
|
|
@@ -851,76 +886,76 @@ const ne = "link", Be = "small", ct = 150, dt = /* @__PURE__ */ N({
|
|
|
851
886
|
type: Function,
|
|
852
887
|
default: void 0
|
|
853
888
|
}
|
|
854
|
-
},
|
|
889
|
+
}, Bt = /* @__PURE__ */ G({
|
|
855
890
|
name: "MDeleteButton",
|
|
856
891
|
inheritAttrs: !1,
|
|
857
892
|
__name: "delete-button",
|
|
858
|
-
props:
|
|
893
|
+
props: St,
|
|
859
894
|
emits: ["delete", "success", "error"],
|
|
860
|
-
setup(e, { emit:
|
|
861
|
-
const
|
|
862
|
-
|
|
863
|
-
|
|
895
|
+
setup(e, { emit: r }) {
|
|
896
|
+
const n = r, o = e, l = D(!1), y = D(null), d = p(() => o.loading !== void 0 ? o.loading : o.autoLoading ? l.value : !1), f = p(() => typeof o.confirm == "function" ? o.confirm(o.count) : o.confirm);
|
|
897
|
+
ee(d, (i) => {
|
|
898
|
+
y.value && H(() => {
|
|
864
899
|
var u;
|
|
865
|
-
(u =
|
|
866
|
-
okButtonProps: { loading:
|
|
900
|
+
(u = y.value) == null || u.update({
|
|
901
|
+
okButtonProps: { loading: i }
|
|
867
902
|
});
|
|
868
903
|
});
|
|
869
|
-
}, { flush: "post" }),
|
|
870
|
-
|
|
904
|
+
}, { flush: "post" }), tt(() => {
|
|
905
|
+
y.value && (y.value.destroy(), y.value = null);
|
|
871
906
|
});
|
|
872
907
|
const v = async () => {
|
|
873
908
|
try {
|
|
874
|
-
if (
|
|
909
|
+
if (o.beforeDelete && await o.beforeDelete() === !1)
|
|
875
910
|
return;
|
|
876
|
-
|
|
877
|
-
let
|
|
911
|
+
o.autoLoading && o.loading === void 0 && (l.value = !0);
|
|
912
|
+
let i = !1;
|
|
878
913
|
const u = () => {
|
|
879
|
-
|
|
914
|
+
i || (i = !0, o.autoLoading && o.loading === void 0 && (l.value = !1));
|
|
880
915
|
};
|
|
881
|
-
if (
|
|
882
|
-
const
|
|
883
|
-
if (
|
|
916
|
+
if (o.onDelete) {
|
|
917
|
+
const I = o.onDelete(u);
|
|
918
|
+
if (I && typeof I.then == "function")
|
|
884
919
|
try {
|
|
885
|
-
const
|
|
886
|
-
|
|
887
|
-
} catch (
|
|
888
|
-
throw
|
|
920
|
+
const w = await I;
|
|
921
|
+
i || u(), Y(w);
|
|
922
|
+
} catch (w) {
|
|
923
|
+
throw i || u(), w;
|
|
889
924
|
}
|
|
890
925
|
} else
|
|
891
|
-
|
|
892
|
-
|
|
926
|
+
n("delete", u), o.autoLoading && o.loading === void 0 && setTimeout(() => {
|
|
927
|
+
i || u();
|
|
893
928
|
}, 5e3);
|
|
894
|
-
} catch (
|
|
895
|
-
|
|
896
|
-
const u =
|
|
897
|
-
|
|
929
|
+
} catch (i) {
|
|
930
|
+
o.autoLoading && o.loading === void 0 && (l.value = !1);
|
|
931
|
+
const u = i instanceof Error ? i : new Error(String(i));
|
|
932
|
+
n("error", u), o.showError && he.error(u.message || "删除失败,请重试");
|
|
898
933
|
}
|
|
899
|
-
},
|
|
900
|
-
|
|
901
|
-
},
|
|
934
|
+
}, Y = (i) => {
|
|
935
|
+
o.showSuccess && he.success(o.successText || "删除成功"), n("success", i);
|
|
936
|
+
}, b = o.debounce > 0 ? Ce(v, o.debounce) : v, E = () => {
|
|
902
937
|
if (!f.value) {
|
|
903
|
-
|
|
938
|
+
b();
|
|
904
939
|
return;
|
|
905
940
|
}
|
|
906
|
-
if (
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
title:
|
|
941
|
+
if (o.confirmType === "popconfirm") return;
|
|
942
|
+
H(() => {
|
|
943
|
+
y.value = rt.confirm({
|
|
944
|
+
title: o.confirmTitle,
|
|
910
945
|
content: f.value,
|
|
911
|
-
okText:
|
|
912
|
-
cancelText:
|
|
946
|
+
okText: o.okText,
|
|
947
|
+
cancelText: o.cancelText,
|
|
913
948
|
okType: "danger",
|
|
914
|
-
okButtonProps: { loading:
|
|
949
|
+
okButtonProps: { loading: d.value },
|
|
915
950
|
onOk: async () => {
|
|
916
951
|
try {
|
|
917
952
|
return await v(), new Promise((u) => {
|
|
918
|
-
if (!
|
|
953
|
+
if (!d.value) {
|
|
919
954
|
u();
|
|
920
955
|
return;
|
|
921
956
|
}
|
|
922
|
-
const
|
|
923
|
-
|
|
957
|
+
const I = ee(d, (w) => {
|
|
958
|
+
w || (I(), u());
|
|
924
959
|
});
|
|
925
960
|
});
|
|
926
961
|
} catch (u) {
|
|
@@ -928,50 +963,50 @@ const ne = "link", Be = "small", ct = 150, dt = /* @__PURE__ */ N({
|
|
|
928
963
|
}
|
|
929
964
|
},
|
|
930
965
|
onCancel: () => {
|
|
931
|
-
|
|
966
|
+
y.value = null;
|
|
932
967
|
},
|
|
933
968
|
afterClose: () => {
|
|
934
|
-
|
|
969
|
+
y.value = null;
|
|
935
970
|
}
|
|
936
971
|
});
|
|
937
972
|
});
|
|
938
973
|
};
|
|
939
|
-
return (
|
|
974
|
+
return (i, u) => f.value && i.confirmType === "popconfirm" ? (s(), h(P(ot), {
|
|
940
975
|
key: 0,
|
|
941
976
|
title: f.value,
|
|
942
|
-
"ok-text":
|
|
943
|
-
"cancel-text":
|
|
944
|
-
"ok-button-props": { loading:
|
|
945
|
-
onConfirm:
|
|
977
|
+
"ok-text": i.okText,
|
|
978
|
+
"cancel-text": i.cancelText,
|
|
979
|
+
"ok-button-props": { loading: d.value, danger: !0 },
|
|
980
|
+
onConfirm: P(b)
|
|
946
981
|
}, {
|
|
947
|
-
icon:
|
|
948
|
-
|
|
949
|
-
|
|
982
|
+
icon: m(() => [
|
|
983
|
+
F(i.$slots, "popconfirmIcon", {}, () => [
|
|
984
|
+
B(P(lt), { class: "text-[--color-ant-error]" })
|
|
950
985
|
], !0)
|
|
951
986
|
]),
|
|
952
|
-
default:
|
|
953
|
-
|
|
954
|
-
type:
|
|
955
|
-
size:
|
|
987
|
+
default: m(() => [
|
|
988
|
+
B(P(te), x(i.$attrs, {
|
|
989
|
+
type: i.type,
|
|
990
|
+
size: i.size,
|
|
956
991
|
danger: !0,
|
|
957
|
-
loading:
|
|
958
|
-
disabled:
|
|
959
|
-
permission:
|
|
960
|
-
"permission-action":
|
|
992
|
+
loading: d.value,
|
|
993
|
+
disabled: i.disabled,
|
|
994
|
+
permission: i.permission,
|
|
995
|
+
"permission-action": i.permissionAction,
|
|
961
996
|
class: "group"
|
|
962
|
-
}),
|
|
963
|
-
default:
|
|
964
|
-
|
|
997
|
+
}), K({
|
|
998
|
+
default: m(() => [
|
|
999
|
+
F(i.$slots, "default", {}, () => [
|
|
965
1000
|
u[0] || (u[0] = W("删除", -1))
|
|
966
1001
|
], !0)
|
|
967
1002
|
]),
|
|
968
1003
|
_: 2
|
|
969
1004
|
}, [
|
|
970
|
-
|
|
1005
|
+
i.hideIcon ? void 0 : {
|
|
971
1006
|
name: "icon",
|
|
972
|
-
fn:
|
|
973
|
-
|
|
974
|
-
|
|
1007
|
+
fn: m(() => [
|
|
1008
|
+
F(i.$slots, "icon", {}, () => [
|
|
1009
|
+
B(P(Se))
|
|
975
1010
|
], !0)
|
|
976
1011
|
]),
|
|
977
1012
|
key: "0"
|
|
@@ -979,99 +1014,57 @@ const ne = "link", Be = "small", ct = 150, dt = /* @__PURE__ */ N({
|
|
|
979
1014
|
]), 1040, ["type", "size", "loading", "disabled", "permission", "permission-action"])
|
|
980
1015
|
]),
|
|
981
1016
|
_: 3
|
|
982
|
-
}, 8, ["title", "ok-text", "cancel-text", "ok-button-props", "onConfirm"])) : (s(),
|
|
983
|
-
type:
|
|
984
|
-
size:
|
|
1017
|
+
}, 8, ["title", "ok-text", "cancel-text", "ok-button-props", "onConfirm"])) : (s(), h(P(te), x({ key: 1 }, i.$attrs, {
|
|
1018
|
+
type: i.type,
|
|
1019
|
+
size: i.size,
|
|
985
1020
|
danger: !0,
|
|
986
|
-
loading:
|
|
987
|
-
disabled:
|
|
988
|
-
permission:
|
|
989
|
-
"permission-action":
|
|
990
|
-
onClick:
|
|
991
|
-
}),
|
|
992
|
-
default:
|
|
993
|
-
|
|
1021
|
+
loading: d.value,
|
|
1022
|
+
disabled: i.disabled,
|
|
1023
|
+
permission: i.permission,
|
|
1024
|
+
"permission-action": i.permissionAction,
|
|
1025
|
+
onClick: E
|
|
1026
|
+
}), K({
|
|
1027
|
+
default: m(() => [
|
|
1028
|
+
F(i.$slots, "default", {}, () => [
|
|
994
1029
|
u[1] || (u[1] = W("删除", -1))
|
|
995
1030
|
], !0)
|
|
996
1031
|
]),
|
|
997
1032
|
_: 2
|
|
998
1033
|
}, [
|
|
999
|
-
|
|
1034
|
+
i.hideIcon ? void 0 : {
|
|
1000
1035
|
name: "icon",
|
|
1001
|
-
fn:
|
|
1002
|
-
|
|
1003
|
-
|
|
1036
|
+
fn: m(() => [
|
|
1037
|
+
F(i.$slots, "icon", {}, () => [
|
|
1038
|
+
B(P(Se))
|
|
1004
1039
|
], !0)
|
|
1005
1040
|
]),
|
|
1006
1041
|
key: "0"
|
|
1007
1042
|
}
|
|
1008
1043
|
]), 1040, ["type", "size", "loading", "disabled", "permission", "permission-action"]));
|
|
1009
1044
|
}
|
|
1010
|
-
}),
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
type: Array,
|
|
1014
|
-
required: !0
|
|
1015
|
-
},
|
|
1016
|
-
dataSource: {
|
|
1017
|
-
type: Array,
|
|
1018
|
-
default: () => []
|
|
1019
|
-
},
|
|
1020
|
-
rowKey: {
|
|
1021
|
-
type: [String, Function],
|
|
1022
|
-
default: "id"
|
|
1023
|
-
},
|
|
1024
|
-
pagination: {
|
|
1025
|
-
type: [Object, Boolean],
|
|
1026
|
-
default: void 0
|
|
1027
|
-
},
|
|
1028
|
-
loading: {
|
|
1029
|
-
type: Boolean,
|
|
1030
|
-
default: !1
|
|
1031
|
-
},
|
|
1032
|
-
bordered: {
|
|
1033
|
-
type: Boolean,
|
|
1034
|
-
default: !1
|
|
1035
|
-
},
|
|
1036
|
-
size: {
|
|
1037
|
-
type: String,
|
|
1038
|
-
default: "middle"
|
|
1039
|
-
}
|
|
1040
|
-
// 可以添加更多自定义 props
|
|
1041
|
-
};
|
|
1042
|
-
function vt(e) {
|
|
1043
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !Ke(e);
|
|
1044
|
-
}
|
|
1045
|
-
const bt = /* @__PURE__ */ N({
|
|
1046
|
-
name: "MTable",
|
|
1047
|
-
props: gt,
|
|
1048
|
-
setup(e, {
|
|
1049
|
-
slots: o,
|
|
1050
|
-
attrs: t
|
|
1051
|
-
}) {
|
|
1052
|
-
return () => h(Je, C(e, t, {
|
|
1053
|
-
class: "mtn-table"
|
|
1054
|
-
}), vt(o) ? o : {
|
|
1055
|
-
default: () => [o]
|
|
1056
|
-
});
|
|
1057
|
-
}
|
|
1058
|
-
}), kt = Ce(bt), ht = [Q, xe, oe, ft, yt, it, kt], Pt = {
|
|
1045
|
+
}), zt = /* @__PURE__ */ xe(Bt, [["__scopeId", "data-v-a943bc19"]]);
|
|
1046
|
+
var Ct = /* @__PURE__ */ ((e) => (e.TEXT = "text", e.TAG = "tag", e.DATE = "date", e.DATETIME = "dateTime", e.SELECT = "select", e.STATUS = "status", e.CUSTOM = "custom", e))(Ct || {}), Pt = /* @__PURE__ */ ((e) => (e.LEFT = "left", e.CENTER = "center", e.RIGHT = "right", e))(Pt || {}), Tt = /* @__PURE__ */ ((e) => (e.SMALL = "small", e.MIDDLE = "middle", e.LARGE = "large", e))(Tt || {}), At = /* @__PURE__ */ ((e) => (e.CHECKBOX = "checkbox", e.RADIO = "radio", e))(At || {}), xt = /* @__PURE__ */ ((e) => (e.LEFT = "left", e.RIGHT = "right", e))(xt || {});
|
|
1047
|
+
const wt = [te, Ae, ie, ht, zt, dt, at], Lt = {
|
|
1059
1048
|
install(e) {
|
|
1060
|
-
|
|
1061
|
-
e.component(
|
|
1049
|
+
wt.forEach((r) => {
|
|
1050
|
+
e.component(r.name || "", r);
|
|
1062
1051
|
});
|
|
1063
1052
|
}
|
|
1064
1053
|
};
|
|
1065
1054
|
export {
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1055
|
+
ht as ActionGroup,
|
|
1056
|
+
te as Button,
|
|
1057
|
+
Ae as ButtonGroup,
|
|
1058
|
+
xt as ButtonPositionEnum,
|
|
1059
|
+
zt as DeleteButton,
|
|
1060
|
+
ie as DropdownButton,
|
|
1061
|
+
Vt as Table,
|
|
1062
|
+
Pt as TableColumnAlignEnum,
|
|
1063
|
+
Ct as TableColumnTypeEnum,
|
|
1064
|
+
At as TableSelectionTypeEnum,
|
|
1065
|
+
Tt as TableSizeEnum,
|
|
1066
|
+
dt as Tag,
|
|
1067
|
+
pt as buttonGroupProps,
|
|
1068
|
+
Lt as default,
|
|
1069
|
+
st as tagProps
|
|
1077
1070
|
};
|