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