@vrojs/element-plus 0.0.20 → 0.0.21
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Maybe } from '@vrojs/base';
|
|
1
2
|
import { ButtonProps } from 'element-plus';
|
|
2
3
|
import { ExtractPropTypes, PropType } from 'vue';
|
|
3
4
|
import { VroElTableColumnScope } from '../vro-el-table-column/types';
|
|
@@ -27,7 +28,13 @@ export interface VroElTableActionsColumnAction<T = any> {
|
|
|
27
28
|
*/
|
|
28
29
|
buttonProps?: VroElTableActionsColumnButtonProps;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
+
/**
|
|
32
|
+
* 操作项配置,支持三种写法:
|
|
33
|
+
* - 直接传操作项数组;
|
|
34
|
+
* - 数组中每项是返回单个操作项的工厂函数,入参为 (row, index),可省略,适合复用操作定义、延迟创建;
|
|
35
|
+
* - 传函数,按行返回操作项数组,适合按行数据决定展示哪些操作。
|
|
36
|
+
*/
|
|
37
|
+
export type VroElTableActionsColumnActions<T = any> = Maybe<VroElTableActionsColumnAction<T>>[] | ((row: T, index: number) => Maybe<VroElTableActionsColumnAction<T>>)[] | ((row: T, index: number) => Maybe<VroElTableActionsColumnAction<T>>[]);
|
|
31
38
|
export declare const vroElTableActionsColumnProps: {
|
|
32
39
|
/**
|
|
33
40
|
* 列标题。
|
|
@@ -1,71 +1,69 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { pick as
|
|
3
|
-
import { ElTableColumn as G, ElButton as
|
|
1
|
+
import { defineComponent as z, computed as k, reactive as F, createBlock as c, openBlock as a, unref as s, mergeProps as d, withCtx as l, renderSlot as p, normalizeProps as v, guardReactiveProps as w, createElementBlock as h, createCommentVNode as K, Fragment as T, renderList as E, withModifiers as L, createTextVNode as b, toDisplayString as g, createVNode as _, normalizeClass as S } from "vue";
|
|
2
|
+
import { pick as j, typedKeys as R, isFunction as q, isPromiseLike as B } from "@daysnap/utils";
|
|
3
|
+
import { ElTableColumn as G, ElButton as N, ElDropdown as H, ElDropdownMenu as J, ElDropdownItem as O } from "element-plus";
|
|
4
4
|
import { useLocale as Q } from "../locale/useLocale.js";
|
|
5
5
|
import { elTableColumnProps as U } from "../utils/elTableColumnProps.js";
|
|
6
6
|
import "@vrojs/base";
|
|
7
7
|
import { vroElTableActionsColumnProps as W } from "./types.js";
|
|
8
|
-
const to = /* @__PURE__ */
|
|
8
|
+
const to = /* @__PURE__ */ z({
|
|
9
9
|
name: "VroElTableActionsColumn",
|
|
10
10
|
__name: "vro-el-table-actions-column",
|
|
11
11
|
props: W,
|
|
12
|
-
setup(
|
|
13
|
-
const
|
|
14
|
-
const o =
|
|
12
|
+
setup(V) {
|
|
13
|
+
const f = V, { t: $ } = Q(), D = k(() => {
|
|
14
|
+
const o = j(f, R(U));
|
|
15
15
|
return {
|
|
16
16
|
...o,
|
|
17
|
-
label:
|
|
17
|
+
label: f.label ?? $("tableActionsColumn.label"),
|
|
18
18
|
className: ["vro-el-table-actions-column-cell", o.className].filter(Boolean).join(" ")
|
|
19
19
|
};
|
|
20
|
-
}),
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
const n = o.onAction?.(r, e);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
y(o, e, t, !1);
|
|
30
|
-
}
|
|
20
|
+
}), M = k(() => f.moreText ?? $("tableActionsColumn.moreText")), y = F(/* @__PURE__ */ new Map()), m = (o, r, e) => (typeof o == "function" ? o(r, e) : o).map((n) => typeof n == "function" ? n(r, e) : n).filter((n) => n ? !(q(n.hidden) ? n.hidden(r, e) : n.hidden) : !1), i = (o, r) => o.key ?? `${r}-${o.label}`, C = (o, r, e) => !!y.get(`${r}-${i(o, e)}`), A = (o, r, e, t) => {
|
|
21
|
+
y.set(`${r}-${i(o, e)}`, t);
|
|
22
|
+
}, P = async (o, r, e, t) => {
|
|
23
|
+
const n = o.onAction?.(r, e), u = o.buttonProps?.icon && B(n);
|
|
24
|
+
u && A(o, e, t, !0);
|
|
25
|
+
try {
|
|
26
|
+
B(n) && await n;
|
|
27
|
+
} finally {
|
|
28
|
+
u && A(o, e, t, !1);
|
|
31
29
|
}
|
|
32
30
|
};
|
|
33
|
-
return (o, r) => (a(),
|
|
31
|
+
return (o, r) => (a(), c(s(G), d(D.value, { class: "vro-el-table-actions-column" }), {
|
|
34
32
|
default: l((e) => [
|
|
35
|
-
|
|
36
|
-
(a(!0),
|
|
33
|
+
p(o.$slots, "default", v(w(e)), () => [
|
|
34
|
+
(a(!0), h(T, null, E(m(o.actions, e.row, e.$index), (t, n) => (a(), c(s(N), d({
|
|
37
35
|
key: i(t, n)
|
|
38
36
|
}, { ref_for: !0 }, t.buttonProps, {
|
|
39
37
|
loading: C(t, e.$index, n),
|
|
40
|
-
onClick:
|
|
38
|
+
onClick: L((u) => P(t, e.row, e.$index, n), ["stop"])
|
|
41
39
|
}), {
|
|
42
40
|
default: l(() => [
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
p(o.$slots, "action", d({ ref_for: !0 }, { ...e, action: t }), () => [
|
|
42
|
+
b(g(t.label), 1)
|
|
45
43
|
])
|
|
46
44
|
]),
|
|
47
45
|
_: 2
|
|
48
46
|
}, 1040, ["loading", "onClick"]))), 128)),
|
|
49
|
-
m(o.moreActions, e.row, e.$index).length ? (a(),
|
|
47
|
+
m(o.moreActions, e.row, e.$index).length ? (a(), c(s(H), {
|
|
50
48
|
key: 0,
|
|
51
49
|
trigger: o.moreTrigger
|
|
52
50
|
}, {
|
|
53
51
|
dropdown: l(() => [
|
|
54
|
-
|
|
52
|
+
_(s(J), null, {
|
|
55
53
|
default: l(() => [
|
|
56
|
-
(a(!0),
|
|
54
|
+
(a(!0), h(T, null, E(m(o.moreActions, e.row, e.$index), (t, n) => (a(), c(s(O), {
|
|
57
55
|
key: i(t, n),
|
|
58
|
-
class:
|
|
56
|
+
class: S([
|
|
59
57
|
"vro-el-table-actions-column-dropdown-action",
|
|
60
58
|
t.buttonProps?.type && `is-${t.buttonProps.type}`
|
|
61
59
|
]),
|
|
62
60
|
icon: t.buttonProps?.icon,
|
|
63
61
|
disabled: t.buttonProps?.disabled || C(t, e.$index, n),
|
|
64
|
-
onClick:
|
|
62
|
+
onClick: L((u) => P(t, e.row, e.$index, n), ["stop"])
|
|
65
63
|
}, {
|
|
66
64
|
default: l(() => [
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
p(o.$slots, "more-action", d({ ref_for: !0 }, { ...e, action: t }), () => [
|
|
66
|
+
b(g(t.label), 1)
|
|
69
67
|
])
|
|
70
68
|
]),
|
|
71
69
|
_: 2
|
|
@@ -75,15 +73,15 @@ const to = /* @__PURE__ */ M({
|
|
|
75
73
|
}, 1024)
|
|
76
74
|
]),
|
|
77
75
|
default: l(() => [
|
|
78
|
-
|
|
76
|
+
_(s(N), v(w(o.moreButtonProps)), {
|
|
79
77
|
default: l(() => [
|
|
80
|
-
|
|
78
|
+
b(g(M.value), 1)
|
|
81
79
|
]),
|
|
82
80
|
_: 1
|
|
83
81
|
}, 16)
|
|
84
82
|
]),
|
|
85
83
|
_: 2
|
|
86
|
-
}, 1032, ["trigger"])) :
|
|
84
|
+
}, 1032, ["trigger"])) : K("", !0)
|
|
87
85
|
])
|
|
88
86
|
]),
|
|
89
87
|
_: 3
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vrojs/element-plus",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"description": "vrojs ui",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"vite": "^7.1.12",
|
|
54
54
|
"vite-plugin-dts": "^4.5.4",
|
|
55
55
|
"vue": "^3.5.22",
|
|
56
|
-
"@vrojs/
|
|
57
|
-
"@vrojs/
|
|
56
|
+
"@vrojs/base": "0.0.12",
|
|
57
|
+
"@vrojs/use": "0.0.5"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "npm run clean && vite build",
|