@vrojs/element-plus 0.0.17 → 0.0.19
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/vro-el-table/index.d.ts +9 -3
- package/dist/vro-el-table/types.d.ts +19 -2
- package/dist/vro-el-table/types.js +8 -0
- package/dist/vro-el-table/useVroElTable.d.ts +15 -3
- package/dist/vro-el-table/useVroElTable.js +22 -22
- package/dist/vro-el-table/vro-el-table.vue.d.ts +6 -2
- package/dist/vro-el-table/vro-el-table.vue.js +32 -32
- package/dist/vro-el-table-actions-column/vro-el-table-actions-column.vue.js +32 -35
- package/dist/vro-el-tree/index.d.ts +4 -3198
- package/dist/vro-el-tree/types.d.ts +16 -80
- package/dist/vro-el-tree/types.js +6 -4
- package/dist/vro-el-tree/vro-el-tree.vue.d.ts +4 -6000
- package/dist/vro-el-tree/vro-el-tree.vue.js +26 -25
- package/package.json +3 -3
|
@@ -6,7 +6,8 @@ export declare const VroElTable: import('@vrojs/base').WithInstall<{
|
|
|
6
6
|
type: BooleanConstructor;
|
|
7
7
|
default: boolean;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
schema: import('vue').PropType<import('..').VroElSchemaFormSchema>;
|
|
10
|
+
filterProps: import('vue').PropType<Partial<Pick<import('..').VroElSchemaFilterProps, "schema">>>;
|
|
10
11
|
columns: {
|
|
11
12
|
type: import('vue').PropType<import('..').VroElTableColumnGroupColumn[]>;
|
|
12
13
|
default: () => never[];
|
|
@@ -22,6 +23,7 @@ export declare const VroElTable: import('@vrojs/base').WithInstall<{
|
|
|
22
23
|
default: boolean;
|
|
23
24
|
};
|
|
24
25
|
paginationProps: import('vue').PropType<Partial<import('element-plus').PaginationProps>>;
|
|
26
|
+
pagination: import('vue').PropType<Partial<Pick<import('element-plus').PaginationProps, "currentPage" | "total" | "pageSize">>>;
|
|
25
27
|
showRefresh: {
|
|
26
28
|
type: BooleanConstructor;
|
|
27
29
|
default: boolean;
|
|
@@ -60,7 +62,8 @@ export declare const VroElTable: import('@vrojs/base').WithInstall<{
|
|
|
60
62
|
type: BooleanConstructor;
|
|
61
63
|
default: boolean;
|
|
62
64
|
};
|
|
63
|
-
|
|
65
|
+
schema: import('vue').PropType<import('..').VroElSchemaFormSchema>;
|
|
66
|
+
filterProps: import('vue').PropType<Partial<Pick<import('..').VroElSchemaFilterProps, "schema">>>;
|
|
64
67
|
columns: {
|
|
65
68
|
type: import('vue').PropType<import('..').VroElTableColumnGroupColumn[]>;
|
|
66
69
|
default: () => never[];
|
|
@@ -76,6 +79,7 @@ export declare const VroElTable: import('@vrojs/base').WithInstall<{
|
|
|
76
79
|
default: boolean;
|
|
77
80
|
};
|
|
78
81
|
paginationProps: import('vue').PropType<Partial<import('element-plus').PaginationProps>>;
|
|
82
|
+
pagination: import('vue').PropType<Partial<Pick<import('element-plus').PaginationProps, "currentPage" | "total" | "pageSize">>>;
|
|
79
83
|
showRefresh: {
|
|
80
84
|
type: BooleanConstructor;
|
|
81
85
|
default: boolean;
|
|
@@ -106,7 +110,8 @@ export declare const VroElTable: import('@vrojs/base').WithInstall<{
|
|
|
106
110
|
type: BooleanConstructor;
|
|
107
111
|
default: boolean;
|
|
108
112
|
};
|
|
109
|
-
|
|
113
|
+
schema: import('vue').PropType<import('..').VroElSchemaFormSchema>;
|
|
114
|
+
filterProps: import('vue').PropType<Partial<Pick<import('..').VroElSchemaFilterProps, "schema">>>;
|
|
110
115
|
columns: {
|
|
111
116
|
type: import('vue').PropType<import('..').VroElTableColumnGroupColumn[]>;
|
|
112
117
|
default: () => never[];
|
|
@@ -122,6 +127,7 @@ export declare const VroElTable: import('@vrojs/base').WithInstall<{
|
|
|
122
127
|
default: boolean;
|
|
123
128
|
};
|
|
124
129
|
paginationProps: import('vue').PropType<Partial<import('element-plus').PaginationProps>>;
|
|
130
|
+
pagination: import('vue').PropType<Partial<Pick<import('element-plus').PaginationProps, "currentPage" | "total" | "pageSize">>>;
|
|
125
131
|
showRefresh: {
|
|
126
132
|
type: BooleanConstructor;
|
|
127
133
|
default: boolean;
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import { PaginationProps, TableProps } from 'element-plus';
|
|
2
2
|
import { ExtractPropTypes, PropType } from 'vue';
|
|
3
3
|
import { VroElSchemaFilterProps } from '../vro-el-schema-filter';
|
|
4
|
+
import { VroElSchemaFormSchema } from '../vro-el-schema-form';
|
|
4
5
|
import { VroElTableColumnGroupColumn } from '../vro-el-table-column-group';
|
|
5
6
|
export interface VroElTableRequestPayload {
|
|
6
7
|
currentPage?: number;
|
|
7
8
|
pageSize?: number;
|
|
8
9
|
query?: Record<string, any>;
|
|
9
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* 请求函数的分页参数:[currentPage, pageSize]。
|
|
13
|
+
*/
|
|
14
|
+
export type VroElTableRequestParams = [currentPage: number, pageSize: number];
|
|
15
|
+
/**
|
|
16
|
+
* 请求函数的查询参数。
|
|
17
|
+
*/
|
|
18
|
+
export type VroElTableRequestQuery = Record<string, any>;
|
|
10
19
|
export interface VroElTableRequest<T = any> {
|
|
11
|
-
(state:
|
|
20
|
+
(state: VroElTableRequestParams, query: VroElTableRequestQuery): Promise<[T[], number]>;
|
|
12
21
|
}
|
|
13
22
|
export interface VroElTableEmits {
|
|
14
23
|
request: [payload?: VroElTableRequestPayload];
|
|
@@ -42,10 +51,14 @@ export declare const vroElTableProps: {
|
|
|
42
51
|
type: BooleanConstructor;
|
|
43
52
|
default: boolean;
|
|
44
53
|
};
|
|
54
|
+
/**
|
|
55
|
+
* 表单字段 schema 配置。
|
|
56
|
+
*/
|
|
57
|
+
schema: PropType<VroElSchemaFormSchema>;
|
|
45
58
|
/**
|
|
46
59
|
* 筛选区属性,透传给 VroElSchemaFilter。
|
|
47
60
|
*/
|
|
48
|
-
filterProps: PropType<Partial<VroElSchemaFilterProps
|
|
61
|
+
filterProps: PropType<Partial<Pick<VroElSchemaFilterProps, "schema">>>;
|
|
49
62
|
/**
|
|
50
63
|
* 表格列配置。
|
|
51
64
|
*/
|
|
@@ -79,6 +92,10 @@ export declare const vroElTableProps: {
|
|
|
79
92
|
* 分页属性,透传给 ElPagination。
|
|
80
93
|
*/
|
|
81
94
|
paginationProps: PropType<Partial<PaginationProps>>;
|
|
95
|
+
/**
|
|
96
|
+
* 分页属性,透传给 ElPagination。
|
|
97
|
+
*/
|
|
98
|
+
pagination: PropType<Partial<Pick<PaginationProps, "currentPage" | "total" | "pageSize">>>;
|
|
82
99
|
/**
|
|
83
100
|
* 是否显示刷新按钮。
|
|
84
101
|
*/
|
|
@@ -9,6 +9,10 @@ const t = {
|
|
|
9
9
|
type: Boolean,
|
|
10
10
|
default: !0
|
|
11
11
|
},
|
|
12
|
+
/**
|
|
13
|
+
* 表单字段 schema 配置。
|
|
14
|
+
*/
|
|
15
|
+
schema: Object,
|
|
12
16
|
/**
|
|
13
17
|
* 筛选区属性,透传给 VroElSchemaFilter。
|
|
14
18
|
*/
|
|
@@ -46,6 +50,10 @@ const t = {
|
|
|
46
50
|
* 分页属性,透传给 ElPagination。
|
|
47
51
|
*/
|
|
48
52
|
paginationProps: Object,
|
|
53
|
+
/**
|
|
54
|
+
* 分页属性,透传给 ElPagination。
|
|
55
|
+
*/
|
|
56
|
+
pagination: Object,
|
|
49
57
|
/**
|
|
50
58
|
* 是否显示刷新按钮。
|
|
51
59
|
*/
|
|
@@ -27,15 +27,27 @@ export interface UseVroElTableTableProps<Row extends Record<string, any> = any,
|
|
|
27
27
|
data: Row[];
|
|
28
28
|
pagination: UseVroElTablePagination;
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* 传入了筛选表单时返回 schema 类型,未传入时返回 undefined。
|
|
32
|
+
*/
|
|
33
|
+
export type UseVroElTableSchemaResult<R extends VroElSchemaFormSchema> = [R] extends [never] ? undefined : UseVroElTableSchema<R>;
|
|
30
34
|
export interface UseVroElTableReturn<Row extends Record<string, any> = any, R extends VroElSchemaFormSchema = never> {
|
|
31
35
|
tableProps: ComputedRef<UseVroElTableTableProps<Row, R>>;
|
|
32
36
|
query: Ref<Record<string, any> | undefined>;
|
|
33
|
-
schema:
|
|
37
|
+
schema: UseVroElTableSchemaResult<R>;
|
|
34
38
|
columns: VroElTableColumnGroupColumns<Row>;
|
|
35
39
|
trigger: (params?: UseVroElTableAsyncTaskParams) => Promise<Row[]>;
|
|
36
40
|
data: Ref<Row[]>;
|
|
37
41
|
loading: Ref<boolean>;
|
|
38
42
|
pagination: UseVroElTablePagination;
|
|
39
43
|
}
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
/**
|
|
45
|
+
* 表格请求状态管理。
|
|
46
|
+
*
|
|
47
|
+
* 参数统一按「筛选表单 → 请求函数 → 列配置 → 选项」排列,`request` 始终紧跟筛选表单,
|
|
48
|
+
* 因此 `Row` 在解析列配置之前就能从 `request` 的返回值推断出来,列配置里的 `row` 可以直接拿到具体类型。
|
|
49
|
+
*/
|
|
50
|
+
export declare function useVroElTable<Row extends Record<string, any>, R extends VroElSchemaFormSchema = VroElSchemaFormSchema>(rowSchema: R, request: VroElTableRequest<Row>, rawColumns: VroElTableColumnGroupColumns<Row>, options?: UseVroElTableOptions<Row>): UseVroElTableReturn<Row, R>;
|
|
51
|
+
export declare function useVroElTable<Row extends Record<string, any>>(request: VroElTableRequest<Row>, rawColumns: VroElTableColumnGroupColumns<Row>, options?: UseVroElTableOptions<Row>): UseVroElTableReturn<Row, never>;
|
|
52
|
+
export declare function useVroElTable<Row extends Record<string, any>, R extends VroElSchemaFormSchema = VroElSchemaFormSchema>(rowSchema: R, request: VroElTableRequest<Row>, options?: UseVroElTableOptions<Row>): UseVroElTableReturn<Row, R>;
|
|
53
|
+
export declare function useVroElTable<Row extends Record<string, any>>(request: VroElTableRequest<Row>, options?: UseVroElTableOptions<Row>): UseVroElTableReturn<Row, never>;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { isNumber as
|
|
3
|
-
import { useAsyncTask as
|
|
4
|
-
import { reactive as
|
|
5
|
-
function
|
|
6
|
-
const
|
|
1
|
+
import E from "../node_modules/.pnpm/@ajuanjs_banana@0.0.3/node_modules/@ajuanjs/banana/dist/index.js";
|
|
2
|
+
import { isNumber as T, filterEmptyValue as V } from "@daysnap/utils";
|
|
3
|
+
import { useAsyncTask as h } from "@vrojs/use";
|
|
4
|
+
import { reactive as c, ref as k, computed as j } from "vue";
|
|
5
|
+
function C(e, u, d, m) {
|
|
6
|
+
const i = !Array.isArray(e) && typeof e != "function", s = i ? e : void 0, v = i ? u : e, a = i ? d : u, A = Array.isArray(a) ? a : [], w = (Array.isArray(a) ? m : a) ?? {}, n = s ? c(s) : void 0, l = c(A), { query: P, ...b } = w, o = P ?? k(), t = c({
|
|
7
7
|
currentPage: 1,
|
|
8
8
|
pageSize: 10,
|
|
9
9
|
total: 0
|
|
10
|
-
}), { trigger: S, data:
|
|
11
|
-
async (
|
|
12
|
-
|
|
13
|
-
const { currentPage:
|
|
14
|
-
|
|
15
|
-
const [
|
|
16
|
-
return t.total =
|
|
10
|
+
}), { trigger: S, data: y, loading: g } = h(
|
|
11
|
+
async (r) => {
|
|
12
|
+
T(r) && (r = { currentPage: r });
|
|
13
|
+
const { currentPage: f, pageSize: p } = Object.assign({}, t, r);
|
|
14
|
+
r?.query && (o.value = r.query), o.value || (o.value = n ? V(await E.extract(n), !0) : {}), t.currentPage = f, t.pageSize = p;
|
|
15
|
+
const [x, z] = await v([f, p], o.value);
|
|
16
|
+
return t.total = z, x || [];
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
immediate: !0,
|
|
@@ -23,22 +23,22 @@ function _(i, u, c, p) {
|
|
|
23
23
|
}
|
|
24
24
|
);
|
|
25
25
|
return {
|
|
26
|
-
tableProps:
|
|
27
|
-
schema:
|
|
28
|
-
loading:
|
|
26
|
+
tableProps: j(() => ({
|
|
27
|
+
schema: n,
|
|
28
|
+
loading: g.value,
|
|
29
29
|
columns: l,
|
|
30
|
-
data:
|
|
30
|
+
data: y.value,
|
|
31
31
|
pagination: t
|
|
32
32
|
})),
|
|
33
|
-
query:
|
|
34
|
-
schema:
|
|
33
|
+
query: o,
|
|
34
|
+
schema: n,
|
|
35
35
|
columns: l,
|
|
36
36
|
trigger: S,
|
|
37
|
-
data:
|
|
38
|
-
loading:
|
|
37
|
+
data: y,
|
|
38
|
+
loading: g,
|
|
39
39
|
pagination: t
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
export {
|
|
43
|
-
|
|
43
|
+
C as useVroElTable
|
|
44
44
|
};
|
|
@@ -14,7 +14,8 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
14
14
|
type: BooleanConstructor;
|
|
15
15
|
default: boolean;
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
schema: import('vue').PropType<import('..').VroElSchemaFormSchema>;
|
|
18
|
+
filterProps: import('vue').PropType<Partial<Pick<import('..').VroElSchemaFilterProps, "schema">>>;
|
|
18
19
|
columns: {
|
|
19
20
|
type: import('vue').PropType<import('..').VroElTableColumnGroupColumn[]>;
|
|
20
21
|
default: () => never[];
|
|
@@ -30,6 +31,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
30
31
|
default: boolean;
|
|
31
32
|
};
|
|
32
33
|
paginationProps: import('vue').PropType<Partial<import('element-plus').PaginationProps>>;
|
|
34
|
+
pagination: import('vue').PropType<Partial<Pick<import('element-plus').PaginationProps, "currentPage" | "total" | "pageSize">>>;
|
|
33
35
|
showRefresh: {
|
|
34
36
|
type: BooleanConstructor;
|
|
35
37
|
default: boolean;
|
|
@@ -48,7 +50,8 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
48
50
|
type: BooleanConstructor;
|
|
49
51
|
default: boolean;
|
|
50
52
|
};
|
|
51
|
-
|
|
53
|
+
schema: import('vue').PropType<import('..').VroElSchemaFormSchema>;
|
|
54
|
+
filterProps: import('vue').PropType<Partial<Pick<import('..').VroElSchemaFilterProps, "schema">>>;
|
|
52
55
|
columns: {
|
|
53
56
|
type: import('vue').PropType<import('..').VroElTableColumnGroupColumn[]>;
|
|
54
57
|
default: () => never[];
|
|
@@ -64,6 +67,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
64
67
|
default: boolean;
|
|
65
68
|
};
|
|
66
69
|
paginationProps: import('vue').PropType<Partial<import('element-plus').PaginationProps>>;
|
|
70
|
+
pagination: import('vue').PropType<Partial<Pick<import('element-plus').PaginationProps, "currentPage" | "total" | "pageSize">>>;
|
|
67
71
|
showRefresh: {
|
|
68
72
|
type: BooleanConstructor;
|
|
69
73
|
default: boolean;
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { defineComponent as $,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { VroElTableColumnGroup as j } from "../vro-el-table-column-group/index.js";
|
|
1
|
+
import { defineComponent as $, computed as k, useTemplateRef as y, createElementBlock as i, openBlock as r, createBlock as s, createCommentVNode as a, createElementVNode as p, unref as l, mergeProps as u, withDirectives as P, renderSlot as n, withCtx as g, createTextVNode as T, toDisplayString as V, createVNode as q } from "vue";
|
|
2
|
+
import { RefreshRight as w } from "@element-plus/icons-vue";
|
|
3
|
+
import { ElLoading as C, ElButton as S, ElTable as z, ElPagination as R } from "element-plus";
|
|
4
|
+
import { useLocale as B } from "../locale/useLocale.js";
|
|
5
|
+
import { VroElSchemaFilter as N } from "../vro-el-schema-filter/index.js";
|
|
6
|
+
import { VroElTableColumnGroup as L } from "../vro-el-table-column-group/index.js";
|
|
8
7
|
import { vroElTableProps as D } from "./types.js";
|
|
9
|
-
const U = { class: "vro-el-table" },
|
|
8
|
+
const U = { class: "vro-el-table" }, j = { class: "vro-el-table-inner" }, F = {
|
|
10
9
|
key: 0,
|
|
11
10
|
class: "vro-el-table-header"
|
|
12
|
-
},
|
|
11
|
+
}, G = { class: "vro-el-table-actions" }, H = { class: "vro-el-table-content" }, W = /* @__PURE__ */ $({
|
|
13
12
|
name: "VroElTable",
|
|
14
13
|
__name: "vro-el-table",
|
|
15
14
|
props: D,
|
|
16
15
|
emits: ["request", "selection-change"],
|
|
17
|
-
setup(f, { expose:
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
});
|
|
22
|
-
return
|
|
16
|
+
setup(f, { expose: b }) {
|
|
17
|
+
const m = f, { t: v } = B(), c = k(() => ({
|
|
18
|
+
...m.paginationProps,
|
|
19
|
+
...m.pagination
|
|
20
|
+
})), h = z, E = C.directive, d = y("refElTable");
|
|
21
|
+
return b({
|
|
23
22
|
get elTable() {
|
|
24
|
-
return
|
|
23
|
+
return d.value;
|
|
25
24
|
}
|
|
26
25
|
}), (e, o) => (r(), i("div", U, [
|
|
27
|
-
|
|
26
|
+
e.filterable && e.schema ? (r(), s(l(N), u({ key: 0 }, e.filterProps, {
|
|
27
|
+
schema: e.schema,
|
|
28
28
|
loading: e.loading,
|
|
29
29
|
class: "vro-el-table-filter",
|
|
30
30
|
onQuery: o[0] || (o[0] = (t) => e.$emit("request", { query: t, currentPage: 1 }))
|
|
31
|
-
}), null, 16, ["loading"])) : a("", !0),
|
|
32
|
-
|
|
33
|
-
e.showHeader && (e.$slots.title || e.$slots.actions || e.showRefresh) ? (r(), i("div",
|
|
31
|
+
}), null, 16, ["schema", "loading"])) : a("", !0),
|
|
32
|
+
p("div", j, [
|
|
33
|
+
e.showHeader && (e.$slots.title || e.$slots.actions || e.showRefresh) ? (r(), i("div", F, [
|
|
34
34
|
n(e.$slots, "title"),
|
|
35
|
-
|
|
36
|
-
e.showRefresh ? (r(), s(l(
|
|
35
|
+
p("div", G, [
|
|
36
|
+
e.showRefresh ? (r(), s(l(S), {
|
|
37
37
|
key: 0,
|
|
38
38
|
plain: "",
|
|
39
|
-
icon: l(
|
|
39
|
+
icon: l(w),
|
|
40
40
|
loading: e.loading,
|
|
41
41
|
onClick: o[1] || (o[1] = (t) => e.$emit("request"))
|
|
42
42
|
}, {
|
|
43
|
-
default:
|
|
43
|
+
default: g(() => [
|
|
44
44
|
T(V(l(v)("table.refresh")), 1)
|
|
45
45
|
]),
|
|
46
46
|
_: 1
|
|
@@ -48,19 +48,19 @@ const U = { class: "vro-el-table" }, F = { class: "vro-el-table-inner" }, G = {
|
|
|
48
48
|
n(e.$slots, "actions")
|
|
49
49
|
])
|
|
50
50
|
])) : a("", !0),
|
|
51
|
-
P((r(), i("div",
|
|
52
|
-
q(l(
|
|
51
|
+
P((r(), i("div", H, [
|
|
52
|
+
q(l(h), u({
|
|
53
53
|
ref_key: "refElTable",
|
|
54
|
-
ref:
|
|
54
|
+
ref: d,
|
|
55
55
|
width: "100%",
|
|
56
56
|
"table-layout": "fixed"
|
|
57
57
|
}, e.tableProps, {
|
|
58
58
|
data: e.data,
|
|
59
59
|
onSelectionChange: o[2] || (o[2] = (t) => e.$emit("selection-change", t))
|
|
60
60
|
}), {
|
|
61
|
-
default:
|
|
61
|
+
default: g(() => [
|
|
62
62
|
n(e.$slots, "content-prefix"),
|
|
63
|
-
e.columns.length ? (r(), s(l(
|
|
63
|
+
e.columns.length ? (r(), s(l(L), {
|
|
64
64
|
key: 0,
|
|
65
65
|
columns: e.columns
|
|
66
66
|
}, null, 8, ["columns"])) : a("", !0),
|
|
@@ -69,7 +69,7 @@ const U = { class: "vro-el-table" }, F = { class: "vro-el-table-inner" }, G = {
|
|
|
69
69
|
_: 3
|
|
70
70
|
}, 16, ["data"])
|
|
71
71
|
])), [
|
|
72
|
-
[l(
|
|
72
|
+
[l(E), e.loading]
|
|
73
73
|
]),
|
|
74
74
|
e.pageable ? (r(), s(l(R), u({
|
|
75
75
|
key: 1,
|
|
@@ -78,7 +78,7 @@ const U = { class: "vro-el-table" }, F = { class: "vro-el-table-inner" }, G = {
|
|
|
78
78
|
background: "",
|
|
79
79
|
size: "small",
|
|
80
80
|
"page-sizes": [10, 20, 50, 100]
|
|
81
|
-
},
|
|
81
|
+
}, c.value, {
|
|
82
82
|
"onUpdate:currentPage": o[3] || (o[3] = (t) => e.$emit("request", { currentPage: t })),
|
|
83
83
|
"onUpdate:pageSize": o[4] || (o[4] = (t) => e.$emit("request", { pageSize: t, currentPage: 1 }))
|
|
84
84
|
}), null, 16)) : a("", !0)
|
|
@@ -87,5 +87,5 @@ const U = { class: "vro-el-table" }, F = { class: "vro-el-table-inner" }, G = {
|
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
export {
|
|
90
|
-
|
|
90
|
+
W as default
|
|
91
91
|
};
|
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as M, computed as P, reactive as z, createBlock as u, openBlock as a, unref as s, mergeProps as c, withCtx as l, renderSlot as f, normalizeProps as k, guardReactiveProps as v, createElementBlock as w, createCommentVNode as F, Fragment as T, renderList as h, withModifiers as E, createTextVNode as p, toDisplayString as b, createVNode as L, normalizeClass as K } from "vue";
|
|
2
2
|
import { pick as S, typedKeys as j, isFunction as R, isPromiseLike as q } from "@daysnap/utils";
|
|
3
|
-
import { ElTableColumn as G, ElButton as
|
|
3
|
+
import { ElTableColumn as G, ElButton as _, 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__ */ M({
|
|
9
9
|
name: "VroElTableActionsColumn",
|
|
10
10
|
__name: "vro-el-table-actions-column",
|
|
11
11
|
props: W,
|
|
12
|
-
setup(
|
|
13
|
-
const d =
|
|
12
|
+
setup(B) {
|
|
13
|
+
const d = B, { t: g } = Q(), N = P(() => {
|
|
14
14
|
const o = S(d, j(U));
|
|
15
15
|
return {
|
|
16
16
|
...o,
|
|
17
17
|
label: d.label ?? g("tableActionsColumn.label"),
|
|
18
18
|
className: ["vro-el-table-actions-column-cell", o.className].filter(Boolean).join(" ")
|
|
19
19
|
};
|
|
20
|
-
}),
|
|
21
|
-
$.set(`${
|
|
22
|
-
},
|
|
23
|
-
const
|
|
24
|
-
if (!(!o.buttonProps?.icon || !q(
|
|
25
|
-
|
|
20
|
+
}), V = P(() => d.moreText ?? g("tableActionsColumn.moreText")), $ = z(/* @__PURE__ */ new Map()), m = (o, r, e) => (typeof o == "function" ? o(r, e) : o).filter((n) => !(R(n.hidden) ? n.hidden(r, e) : n.hidden)), i = (o, r) => o.key ?? `${r}-${o.label}`, C = (o, r, e) => !!$.get(`${r}-${i(o, e)}`), y = (o, r, e, t) => {
|
|
21
|
+
$.set(`${r}-${i(o, e)}`, t);
|
|
22
|
+
}, A = async (o, r, e, t) => {
|
|
23
|
+
const n = o.onAction?.(r, e);
|
|
24
|
+
if (!(!o.buttonProps?.icon || !q(n))) {
|
|
25
|
+
y(o, e, t, !0);
|
|
26
26
|
try {
|
|
27
|
-
await
|
|
27
|
+
await n;
|
|
28
28
|
} finally {
|
|
29
|
-
|
|
29
|
+
y(o, e, t, !1);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
-
return (o,
|
|
33
|
+
return (o, r) => (a(), u(s(G), c(N.value, { class: "vro-el-table-actions-column" }), {
|
|
34
34
|
default: l((e) => [
|
|
35
|
-
|
|
36
|
-
(a(!0),
|
|
37
|
-
key:
|
|
38
|
-
}, { ref_for: !0 },
|
|
39
|
-
loading:
|
|
40
|
-
onClick:
|
|
35
|
+
f(o.$slots, "default", k(v(e)), () => [
|
|
36
|
+
(a(!0), w(T, null, h(m(o.actions, e.row, e.$index), (t, n) => (a(), u(s(_), c({
|
|
37
|
+
key: i(t, n)
|
|
38
|
+
}, { ref_for: !0 }, t.buttonProps, {
|
|
39
|
+
loading: C(t, e.$index, n),
|
|
40
|
+
onClick: E((D) => A(t, e.row, e.$index, n), ["stop"])
|
|
41
41
|
}), {
|
|
42
42
|
default: l(() => [
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
f(o.$slots, "action", c({ ref_for: !0 }, { ...e, action: t }), () => [
|
|
44
|
+
p(b(t.label), 1)
|
|
45
45
|
])
|
|
46
46
|
]),
|
|
47
47
|
_: 2
|
|
48
48
|
}, 1040, ["loading", "onClick"]))), 128)),
|
|
49
|
-
m(o.moreActions, e.row, e.$index).length ? (a(),
|
|
49
|
+
m(o.moreActions, e.row, e.$index).length ? (a(), u(s(H), {
|
|
50
50
|
key: 0,
|
|
51
51
|
trigger: o.moreTrigger
|
|
52
52
|
}, {
|
|
53
53
|
dropdown: l(() => [
|
|
54
|
-
|
|
54
|
+
L(s(J), null, {
|
|
55
55
|
default: l(() => [
|
|
56
|
-
(a(!0),
|
|
57
|
-
key:
|
|
56
|
+
(a(!0), w(T, null, h(m(o.moreActions, e.row, e.$index), (t, n) => (a(), u(s(O), {
|
|
57
|
+
key: i(t, n),
|
|
58
58
|
class: K([
|
|
59
59
|
"vro-el-table-actions-column-dropdown-action",
|
|
60
60
|
t.buttonProps?.type && `is-${t.buttonProps.type}`
|
|
61
61
|
]),
|
|
62
62
|
icon: t.buttonProps?.icon,
|
|
63
|
-
disabled: t.buttonProps?.disabled ||
|
|
64
|
-
onClick:
|
|
63
|
+
disabled: t.buttonProps?.disabled || C(t, e.$index, n),
|
|
64
|
+
onClick: E((D) => A(t, e.row, e.$index, n), ["stop"])
|
|
65
65
|
}, {
|
|
66
66
|
default: l(() => [
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
f(o.$slots, "more-action", c({ ref_for: !0 }, { ...e, action: t }), () => [
|
|
68
|
+
p(b(t.label), 1)
|
|
69
69
|
])
|
|
70
70
|
]),
|
|
71
71
|
_: 2
|
|
@@ -75,12 +75,9 @@ const to = /* @__PURE__ */ V({
|
|
|
75
75
|
}, 1024)
|
|
76
76
|
]),
|
|
77
77
|
default: l(() => [
|
|
78
|
-
|
|
79
|
-
type: "primary",
|
|
80
|
-
link: ""
|
|
81
|
-
}, o.moreButtonProps), {
|
|
78
|
+
L(s(_), k(v(o.moreButtonProps)), {
|
|
82
79
|
default: l(() => [
|
|
83
|
-
|
|
80
|
+
p(b(V.value), 1)
|
|
84
81
|
]),
|
|
85
82
|
_: 1
|
|
86
83
|
}, 16)
|