@amaoaaaaa/search-table 0.5.0 → 0.5.1
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/CHANGELOG.md +12 -0
- package/README.md +14 -1
- package/dist/ProTable/index.vue.d.ts +10 -4
- package/dist/ProTable/types.d.ts +7 -0
- package/dist/SearchTable/types.d.ts +6 -1
- package/dist/SearchTable/useTableSort.d.ts +5 -5
- package/dist/index.d.ts +1 -0
- package/dist/search-table.js +187 -183
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循[语义化版本](https://semver.org/lang/zh-CN/)。
|
|
6
6
|
|
|
7
|
+
## [0.5.1] - 2026-10-21
|
|
8
|
+
|
|
9
|
+
### 修复
|
|
10
|
+
|
|
11
|
+
- 修复 `SearchTable` 未将默认排序和排序变化传递给 `el-table` 的问题,默认排序列现在会显示排序箭头,点击列头也会正常触发后端请求。
|
|
12
|
+
|
|
13
|
+
### 变更
|
|
14
|
+
|
|
15
|
+
- `defaultSort` 改为使用 `SortState<T>`,`sort` 会根据行数据类型推导实际字段名,并仅允许字符串字段。
|
|
16
|
+
- 对外导出 `SortState` 类型,调用方可显式标注以获取排序字段自动补全。
|
|
17
|
+
- 补充默认排序与后端排序的配合说明。
|
|
18
|
+
|
|
7
19
|
## [0.5.0] - 2026-10-13
|
|
8
20
|
|
|
9
21
|
### 新增
|
package/README.md
CHANGED
|
@@ -116,10 +116,23 @@ const columns = [{ label: '姓名', prop: 'name' }];
|
|
|
116
116
|
| `showBatchDeleteButton` | `boolean` | `false` | 是否显示批量删除按钮 |
|
|
117
117
|
| `pageSize` | `number` | 自动计算 | 每页条数 |
|
|
118
118
|
| `elPaginationProps` | `SearchTablePaginationProps` | - | 分页组件视觉配置(见下方说明) |
|
|
119
|
-
| `defaultSort` | `SortState` | - |
|
|
119
|
+
| `defaultSort` | `SortState` | - | 默认排序(支持后端排序) |
|
|
120
120
|
| `selectable` | `boolean \| (row, index) => boolean` | - | 是否可勾选 |
|
|
121
121
|
| `searchParamsHandler` | `(params) => params` | - | 搜索参数处理函数 |
|
|
122
122
|
|
|
123
|
+
`defaultSort` 的 `sort`、`order` 会作为请求参数传给 `fetchFn`。使用后端排序时,排序字段对应的列需设置 `sortable: 'custom'`,列 `prop` 与 `sort` 保持一致;排序变化后组件会重新请求后端,由后端返回排序后的分页数据。
|
|
124
|
+
|
|
125
|
+
`SortState<T>` 会根据行数据类型约束排序字段。推荐显式标注,以便获得实际字段的自动补全:
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
import type { SortState } from '@amaoaaaaa/search-table';
|
|
129
|
+
|
|
130
|
+
const defaultSort: SortState<User> = {
|
|
131
|
+
sort: 'createTime',
|
|
132
|
+
order: 'desc',
|
|
133
|
+
};
|
|
134
|
+
```
|
|
135
|
+
|
|
123
136
|
### SearchTable Events
|
|
124
137
|
|
|
125
138
|
| 事件名 | 参数 | 说明 |
|
|
@@ -558,8 +558,7 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
|
558
558
|
e: (element?: string) => string;
|
|
559
559
|
m: (modifier?: string) => string;
|
|
560
560
|
be: (blockSuffix?: string, element?: string) => string;
|
|
561
|
-
em: (element?: string, modifier
|
|
562
|
-
/** @type { [typeof __VLS_components.ElRadioGroup, typeof __VLS_components.elRadioGroup, typeof __VLS_components.ElRadioGroup, typeof __VLS_components.elRadioGroup, ] } */ ? /** @type { [typeof __VLS_components.ElRadioGroup, typeof __VLS_components.elRadioGroup, typeof __VLS_components.ElRadioGroup, typeof __VLS_components.elRadioGroup, ] } */: string) => string;
|
|
561
|
+
em: (element?: string, modifier?: string) => string;
|
|
563
562
|
bm: (blockSuffix?: string, modifier?: string) => string;
|
|
564
563
|
bem: (blockSuffix?: string, element?: string, modifier?: string) => string;
|
|
565
564
|
is: {
|
|
@@ -642,11 +641,19 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
|
642
641
|
applyFilter: (args_0: ApplyFilterPayload) => any;
|
|
643
642
|
selectionChange: (newSelection: import('element-plus/es/components/table/src/table/defaults.mjs').DefaultRow[]) => any;
|
|
644
643
|
"cell-edit": (payload: CellEditPayload) => any;
|
|
644
|
+
sortChange: (payload: {
|
|
645
|
+
prop: string;
|
|
646
|
+
order: "ascending" | "descending" | null;
|
|
647
|
+
}) => any;
|
|
645
648
|
"update:filterData": (value: Record<string, any>) => any;
|
|
646
649
|
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
647
650
|
onApplyFilter?: ((args_0: ApplyFilterPayload) => any) | undefined;
|
|
648
651
|
onSelectionChange?: ((newSelection: import('element-plus/es/components/table/src/table/defaults.mjs').DefaultRow[]) => any) | undefined;
|
|
649
652
|
"onCell-edit"?: ((payload: CellEditPayload) => any) | undefined;
|
|
653
|
+
onSortChange?: ((payload: {
|
|
654
|
+
prop: string;
|
|
655
|
+
order: "ascending" | "descending" | null;
|
|
656
|
+
}) => any) | undefined;
|
|
650
657
|
"onUpdate:filterData"?: ((value: Record<string, any>) => any) | undefined;
|
|
651
658
|
}>, {
|
|
652
659
|
rowKey: string;
|
|
@@ -1207,8 +1214,7 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
|
1207
1214
|
e: (element?: string) => string;
|
|
1208
1215
|
m: (modifier?: string) => string;
|
|
1209
1216
|
be: (blockSuffix?: string, element?: string) => string;
|
|
1210
|
-
em: (element?: string, modifier
|
|
1211
|
-
/** @type { [typeof __VLS_components.ElRadioGroup, typeof __VLS_components.elRadioGroup, typeof __VLS_components.ElRadioGroup, typeof __VLS_components.elRadioGroup, ] } */ ? /** @type { [typeof __VLS_components.ElRadioGroup, typeof __VLS_components.elRadioGroup, typeof __VLS_components.ElRadioGroup, typeof __VLS_components.elRadioGroup, ] } */: string) => string;
|
|
1217
|
+
em: (element?: string, modifier?: string) => string;
|
|
1212
1218
|
bm: (blockSuffix?: string, modifier?: string) => string;
|
|
1213
1219
|
bem: (blockSuffix?: string, element?: string, modifier?: string) => string;
|
|
1214
1220
|
is: {
|
package/dist/ProTable/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
import { Sort } from 'element-plus';
|
|
2
3
|
import { TableColumnProps } from 'element-plus/es/components/table/src/table-column/defaults';
|
|
3
4
|
import { DefaultRow } from 'element-plus/es/components/table/src/table/defaults.mjs';
|
|
4
5
|
export type TableRow = DefaultRow;
|
|
@@ -111,6 +112,12 @@ export type ProTableColumn<T extends TableRow = TableRow> = Partial<Omit<TableCo
|
|
|
111
112
|
export type ProTableProps<T extends TableRow = any> = {
|
|
112
113
|
data: T[];
|
|
113
114
|
columns: ProTableColumn<T>[];
|
|
115
|
+
/**
|
|
116
|
+
* 默认排序
|
|
117
|
+
*
|
|
118
|
+
* @description 使用 Element Plus 的排序格式,`prop` 需与可排序列的 `prop` 一致
|
|
119
|
+
*/
|
|
120
|
+
defaultSort?: Sort;
|
|
114
121
|
/**
|
|
115
122
|
* 行数据的 Key,属性值必须唯一
|
|
116
123
|
*
|
|
@@ -74,8 +74,13 @@ export type SearchTableProps<T extends TableRow = any> = Omit<ProTableProps<T>,
|
|
|
74
74
|
elPaginationProps?: SearchTablePaginationProps;
|
|
75
75
|
/**
|
|
76
76
|
* 默认排序
|
|
77
|
+
*
|
|
78
|
+
* @description
|
|
79
|
+
* 仅用于初始化排序状态,并随首次及后续请求以 `sort`、`order` 参数传给 `fetchFn`。
|
|
80
|
+
* 使用后端排序时,对应表格列需设置 `sortable: 'custom'`,且列的 `prop` 应与
|
|
81
|
+
* `sort` 保持一致;排序变化后组件会重新请求后端,由后端返回排序后的分页数据。
|
|
77
82
|
*/
|
|
78
|
-
defaultSort?: SortState
|
|
83
|
+
defaultSort?: SortState<T>;
|
|
79
84
|
fetchFn: SearchTableFetchFn<T>;
|
|
80
85
|
/**
|
|
81
86
|
* 搜索参数处理函数
|
|
@@ -6,16 +6,16 @@ export interface SortState<T extends Record<string, any> = Record<string, any>>
|
|
|
6
6
|
/**
|
|
7
7
|
* 排序字段
|
|
8
8
|
*/
|
|
9
|
-
sort: keyof T
|
|
9
|
+
sort: Extract<keyof T, string>;
|
|
10
10
|
}
|
|
11
|
-
export interface UseTableSortOption {
|
|
12
|
-
defaultSort?: SortState
|
|
11
|
+
export interface UseTableSortOption<T extends Record<string, any> = Record<string, any>> {
|
|
12
|
+
defaultSort?: SortState<T>;
|
|
13
13
|
fetchFn: () => void;
|
|
14
14
|
onReset?: () => void;
|
|
15
15
|
}
|
|
16
|
-
export declare function useTableSort({ defaultSort, fetchFn, onReset }: UseTableSortOption): {
|
|
16
|
+
export declare function useTableSort<T extends Record<string, any> = Record<string, any>>({ defaultSort, fetchFn, onReset, }: UseTableSortOption<T>): {
|
|
17
17
|
sortState: {
|
|
18
|
-
order: "asc" | "desc";
|
|
18
|
+
order: "asc" | "desc" | "";
|
|
19
19
|
sort: string;
|
|
20
20
|
};
|
|
21
21
|
onSortChange: ({ prop, order, }: {
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { default as SearchTable } from './SearchTable/index.vue';
|
|
|
2
2
|
export { default as SearchTableConfigProvider } from './SearchTable/ConfigProvider.vue';
|
|
3
3
|
export { default as ProTable } from './ProTable/index.vue';
|
|
4
4
|
export type { ProTableInstance } from './ProTable';
|
|
5
|
+
export type { SortState } from './SearchTable/useTableSort';
|
|
5
6
|
export type { SearchTableProps, SearchTablePaginationProps, SearchTableSearchProps, SearchTableFetchFn, PageParams, PageResp, } from './SearchTable/types';
|
|
6
7
|
export type { SearchTableInstance } from './SearchTable';
|
|
7
8
|
export type { SearchTableConfigProviderProps } from './SearchTable/config';
|
package/dist/search-table.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var je = Object.defineProperty;
|
|
2
2
|
var Ie = (e, l, d) => l in e ? je(e, l, { enumerable: !0, configurable: !0, writable: !0, value: d }) : e[l] = d;
|
|
3
3
|
var he = (e, l, d) => Ie(e, typeof l != "symbol" ? l + "" : l, d);
|
|
4
|
-
import { defineComponent as de, computed as z, isVNode as qe, openBlock as s, createBlock as k, resolveDynamicComponent as Ge, createElementBlock as
|
|
4
|
+
import { defineComponent as de, computed as z, isVNode as qe, openBlock as s, createBlock as k, resolveDynamicComponent as Ge, createElementBlock as x, markRaw as Q, createElementVNode as _, useModel as We, useTemplateRef as $e, ref as V, withDirectives as ie, createVNode as C, unref as n, withCtx as y, createCommentVNode as F, createTextVNode as R, toDisplayString as L, Fragment as q, renderList as oe, mergeProps as ge, createSlots as Ye, isRef as Re, normalizeClass as Qe, toValue as Se, withModifiers as pe, withKeys as ye, normalizeStyle as ke, mergeModels as Ce, reactive as xe, nextTick as ue, toRef as Ze, watch as Ve, useSlots as Je, inject as Xe, onMounted as et, onUnmounted as tt, renderSlot as J, provide as lt } from "vue";
|
|
5
5
|
import { ElLoading as at, ElTable as nt, ElTableColumn as ve, ElPopover as rt, ElScrollbar as Te, ElRadioGroup as st, ElRadio as it, ElCheckboxGroup as ot, ElCheckbox as ut, ElDatePicker as dt, ElButton as M, ElInput as Be, ElPopconfirm as ct, ElText as ft, ElTooltip as ht, ElPagination as pt, ElMessage as vt } from "element-plus";
|
|
6
|
-
import { isFunction as I, isBoolean as
|
|
6
|
+
import { isFunction as I, isBoolean as _e, cloneDeep as Y, isString as mt, keys as be, isEqual as gt, pickBy as Fe, sortBy as yt, uniq as bt, countBy as xt } from "lodash-es";
|
|
7
7
|
import { vTextEllipsis as me } from "@amaoaaaaa/v-text-ellipsis";
|
|
8
8
|
import { isCancel as He } from "axios";
|
|
9
|
-
const
|
|
9
|
+
const wt = ["innerHTML"], St = /* @__PURE__ */ de({
|
|
10
10
|
__name: "RenderFormatterResult",
|
|
11
11
|
props: {
|
|
12
12
|
col: {},
|
|
@@ -20,19 +20,19 @@ const St = ["innerHTML"], kt = /* @__PURE__ */ de({
|
|
|
20
20
|
const r = l.col.prop ? l.row[l.col.prop] : void 0;
|
|
21
21
|
return (g = (i = l.col).formatter) == null ? void 0 : g.call(i, l.row, l.column, r, l.index);
|
|
22
22
|
});
|
|
23
|
-
return (r, i) => qe(d.value) ? (s(), k(Ge(d.value), { key: 0 })) : (s(),
|
|
23
|
+
return (r, i) => qe(d.value) ? (s(), k(Ge(d.value), { key: 0 })) : (s(), x("span", {
|
|
24
24
|
key: 1,
|
|
25
25
|
innerHTML: d.value
|
|
26
|
-
}, null, 8,
|
|
26
|
+
}, null, 8, wt));
|
|
27
27
|
}
|
|
28
|
-
}),
|
|
28
|
+
}), kt = {
|
|
29
29
|
viewBox: "0 0 24 24",
|
|
30
30
|
width: "1.2em",
|
|
31
31
|
height: "1.2em"
|
|
32
32
|
};
|
|
33
|
-
function
|
|
34
|
-
return s(),
|
|
35
|
-
|
|
33
|
+
function Ct(e, l) {
|
|
34
|
+
return s(), x("svg", kt, [...l[0] || (l[0] = [
|
|
35
|
+
_("path", {
|
|
36
36
|
fill: "none",
|
|
37
37
|
stroke: "currentColor",
|
|
38
38
|
"stroke-linecap": "round",
|
|
@@ -42,14 +42,14 @@ function Tt(e, l) {
|
|
|
42
42
|
}, null, -1)
|
|
43
43
|
])]);
|
|
44
44
|
}
|
|
45
|
-
const
|
|
45
|
+
const Tt = Q({ name: "tabler-filter", render: Ct }), _t = {
|
|
46
46
|
viewBox: "0 0 24 24",
|
|
47
47
|
width: "1.2em",
|
|
48
48
|
height: "1.2em"
|
|
49
49
|
};
|
|
50
|
-
function
|
|
51
|
-
return s(),
|
|
52
|
-
|
|
50
|
+
function Pt(e, l) {
|
|
51
|
+
return s(), x("svg", _t, [...l[0] || (l[0] = [
|
|
52
|
+
_("path", {
|
|
53
53
|
fill: "none",
|
|
54
54
|
stroke: "currentColor",
|
|
55
55
|
"stroke-linecap": "round",
|
|
@@ -59,14 +59,15 @@ function Et(e, l) {
|
|
|
59
59
|
}, null, -1)
|
|
60
60
|
])]);
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const Et = Q({ name: "tabler-filter-check", render: Pt }), $t = { "element-loading-text": "加载中..." }, Rt = { class: "flex justify-center" }, Vt = { class: "-mx-3 flex w-[150px] items-center justify-evenly" }, Bt = {
|
|
63
63
|
key: 0,
|
|
64
64
|
class: "h-[23px]"
|
|
65
|
-
},
|
|
65
|
+
}, Ft = ["onDblclick"], Ht = { key: 1 }, zt = /* @__PURE__ */ de({
|
|
66
66
|
__name: "index",
|
|
67
|
-
props: /* @__PURE__ */
|
|
67
|
+
props: /* @__PURE__ */ Ce({
|
|
68
68
|
data: {},
|
|
69
69
|
columns: {},
|
|
70
|
+
defaultSort: {},
|
|
70
71
|
rowKey: { default: "id" },
|
|
71
72
|
selectable: { type: [Boolean, Function] },
|
|
72
73
|
showIndex: { type: Boolean, default: !0 },
|
|
@@ -79,45 +80,45 @@ const $t = Y({ name: "tabler-filter-check", render: Et }), Rt = { "element-loadi
|
|
|
79
80
|
},
|
|
80
81
|
filterDataModifiers: {}
|
|
81
82
|
}),
|
|
82
|
-
emits: /* @__PURE__ */
|
|
83
|
+
emits: /* @__PURE__ */ Ce(["applyFilter", "selectionChange", "cell-edit", "sortChange"], ["update:filterData"]),
|
|
83
84
|
setup(e, { expose: l, emit: d }) {
|
|
84
|
-
const r = at.directive, i = e, g = We(e, "filterData"),
|
|
85
|
+
const r = at.directive, i = e, g = We(e, "filterData"), b = d, $ = $e("elTableRef"), w = V({}), H = V({});
|
|
85
86
|
function O(a) {
|
|
86
|
-
w.value[a] =
|
|
87
|
+
w.value[a] = Y(g.value[a]);
|
|
87
88
|
}
|
|
88
89
|
function X(a) {
|
|
89
|
-
w.value[a] =
|
|
90
|
+
w.value[a] = Y(g.value[a]);
|
|
90
91
|
}
|
|
91
|
-
function ee(a,
|
|
92
|
-
w.value[a] = void 0, g.value[a] = void 0, D(a,
|
|
92
|
+
function ee(a, f, t) {
|
|
93
|
+
w.value[a] = void 0, g.value[a] = void 0, D(a, f, t);
|
|
93
94
|
}
|
|
94
|
-
function D(a,
|
|
95
|
-
g.value[a] = w.value[a], H.value[a] = !1,
|
|
95
|
+
function D(a, f, t) {
|
|
96
|
+
g.value[a] = w.value[a], H.value[a] = !1, b("applyFilter", {
|
|
96
97
|
col: t,
|
|
97
98
|
prop: a,
|
|
98
|
-
type:
|
|
99
|
+
type: f,
|
|
99
100
|
value: g.value[a],
|
|
100
101
|
filterData: g.value
|
|
101
102
|
});
|
|
102
103
|
}
|
|
103
|
-
function P(a,
|
|
104
|
-
const t = I(a.actions) ? a.actions(
|
|
105
|
-
return t == null ? void 0 : t.map((
|
|
106
|
-
const v = I(
|
|
107
|
-
return { ...
|
|
108
|
-
}).filter((
|
|
104
|
+
function P(a, f) {
|
|
105
|
+
const t = I(a.actions) ? a.actions(f) : a.actions;
|
|
106
|
+
return t == null ? void 0 : t.map((h) => {
|
|
107
|
+
const v = I(h.visibility) ? h.visibility(f) : h.visibility ?? !0;
|
|
108
|
+
return { ...h, visibility: v };
|
|
109
|
+
}).filter((h) => h.visibility !== !1);
|
|
109
110
|
}
|
|
110
111
|
function S(a) {
|
|
111
112
|
return a.filterFieldName ?? a.prop;
|
|
112
113
|
}
|
|
113
|
-
function te(a,
|
|
114
|
+
function te(a, f) {
|
|
114
115
|
return {
|
|
115
116
|
color: a.text.includes("删除") ? "var(--el-color-danger)" : "",
|
|
116
|
-
visibility:
|
|
117
|
+
visibility: _e(f) ? void 0 : f
|
|
117
118
|
};
|
|
118
119
|
}
|
|
119
120
|
const E = V([]);
|
|
120
|
-
function
|
|
121
|
+
function Z() {
|
|
121
122
|
E.value = Array.from(
|
|
122
123
|
{ length: i.data.length },
|
|
123
124
|
() => Array.from({ length: i.columns.length }, () => ({
|
|
@@ -127,39 +128,41 @@ const $t = Y({ name: "tabler-filter-check", render: Et }), Rt = { "element-loadi
|
|
|
127
128
|
}))
|
|
128
129
|
);
|
|
129
130
|
}
|
|
130
|
-
function G(a,
|
|
131
|
-
return I(a.editable) ? a.editable(
|
|
131
|
+
function G(a, f) {
|
|
132
|
+
return I(a.editable) ? a.editable(f) : a.editable ?? !1;
|
|
132
133
|
}
|
|
133
|
-
function le(a,
|
|
134
|
-
const
|
|
135
|
-
|
|
134
|
+
function le(a, f, t) {
|
|
135
|
+
const h = E.value[a][f];
|
|
136
|
+
h && (h.value = t, h.editing = !0, ue(() => {
|
|
136
137
|
var v;
|
|
137
|
-
(v =
|
|
138
|
+
(v = h.inputRef) == null || v.focus();
|
|
138
139
|
}));
|
|
139
140
|
}
|
|
140
141
|
function U(a) {
|
|
141
|
-
const
|
|
142
|
-
if (!
|
|
143
|
-
|
|
144
|
-
const t = a.newValue,
|
|
145
|
-
t !==
|
|
142
|
+
const f = E.value[a.rowIndex][a.colIndex];
|
|
143
|
+
if (!f) return;
|
|
144
|
+
f.editing = !1;
|
|
145
|
+
const t = a.newValue, h = a.row[a.prop];
|
|
146
|
+
t !== h && (a.row[a.prop] = t, b("cell-edit", a));
|
|
146
147
|
}
|
|
147
|
-
function A(a,
|
|
148
|
-
const t = E.value[a][
|
|
148
|
+
function A(a, f) {
|
|
149
|
+
const t = E.value[a][f];
|
|
149
150
|
t && (t.editing = !1);
|
|
150
151
|
}
|
|
151
152
|
return l({
|
|
152
153
|
tableInstance: $,
|
|
153
|
-
resetCells:
|
|
154
|
-
}), (a,
|
|
155
|
-
|
|
154
|
+
resetCells: Z
|
|
155
|
+
}), (a, f) => ie((s(), x("section", $t, [
|
|
156
|
+
C(n(nt), {
|
|
156
157
|
ref: "elTableRef",
|
|
157
158
|
data: e.data,
|
|
159
|
+
"default-sort": e.defaultSort,
|
|
158
160
|
border: "",
|
|
159
161
|
class: "pro-table",
|
|
160
162
|
height: "100%",
|
|
161
163
|
"row-key": e.rowKey,
|
|
162
|
-
onSelectionChange:
|
|
164
|
+
onSelectionChange: f[1] || (f[1] = (t) => b("selectionChange", t)),
|
|
165
|
+
onSortChange: f[2] || (f[2] = (t) => b("sortChange", { prop: t.prop ?? "", order: t.order }))
|
|
163
166
|
}, {
|
|
164
167
|
default: y(() => [
|
|
165
168
|
e.selectable ? (s(), k(n(ve), {
|
|
@@ -180,14 +183,14 @@ const $t = Y({ name: "tabler-filter-check", render: Et }), Rt = { "element-loadi
|
|
|
180
183
|
]),
|
|
181
184
|
_: 1
|
|
182
185
|
}, 8, ["width"])) : F("", !0),
|
|
183
|
-
(s(!0),
|
|
186
|
+
(s(!0), x(q, null, oe(e.columns, (t, h) => (s(), k(n(ve), ge({ key: h }, { ref_for: !0 }, t, {
|
|
184
187
|
align: t.align ?? "center",
|
|
185
188
|
fixed: t.label === "操作" ? "right" : !1
|
|
186
189
|
}), Ye({ _: 2 }, [
|
|
187
190
|
t.filterable ?? (t.filterType || t.filterOptions || Re(t.filterOptions)) ? {
|
|
188
191
|
name: "header",
|
|
189
192
|
fn: y(({ column: v }) => [
|
|
190
|
-
|
|
193
|
+
_("span", {
|
|
191
194
|
class: Qe(["inline-flex items-center", {
|
|
192
195
|
"text-[--el-color-primary]": S(t) && g.value[S(t)] !== void 0
|
|
193
196
|
}])
|
|
@@ -206,13 +209,13 @@ const $t = Y({ name: "tabler-filter-check", render: Et }), Rt = { "element-loadi
|
|
|
206
209
|
onHide: (c) => X(S(t))
|
|
207
210
|
}, {
|
|
208
211
|
reference: y(() => [
|
|
209
|
-
|
|
212
|
+
_("div", {
|
|
210
213
|
class: "inline-flex cursor-pointer items-center gap-x-0.5 duration-100 hover:text-[--el-color-primary]",
|
|
211
|
-
onClick:
|
|
214
|
+
onClick: f[0] || (f[0] = pe(() => {
|
|
212
215
|
}, ["stop"]))
|
|
213
216
|
}, [
|
|
214
217
|
R(L(v.label) + " ", 1),
|
|
215
|
-
g.value[S(t)] !== void 0 ? (s(), k(n(
|
|
218
|
+
g.value[S(t)] !== void 0 ? (s(), k(n(Et), { key: 0 })) : (s(), k(n(Tt), { key: 1 }))
|
|
216
219
|
])
|
|
217
220
|
]),
|
|
218
221
|
default: y(() => [
|
|
@@ -222,12 +225,12 @@ const $t = Y({ name: "tabler-filter-check", render: Et }), Rt = { "element-loadi
|
|
|
222
225
|
"max-height": "34vh"
|
|
223
226
|
}, {
|
|
224
227
|
default: y(() => [
|
|
225
|
-
|
|
228
|
+
C(n(st), {
|
|
226
229
|
modelValue: w.value[S(t)],
|
|
227
230
|
"onUpdate:modelValue": (c) => w.value[S(t)] = c
|
|
228
231
|
}, {
|
|
229
232
|
default: y(() => [
|
|
230
|
-
(s(!0),
|
|
233
|
+
(s(!0), x(q, null, oe(Se(t.filterOptions), (c) => (s(), k(n(it), {
|
|
231
234
|
key: c.value.toString(),
|
|
232
235
|
value: c.value,
|
|
233
236
|
label: c.label,
|
|
@@ -244,12 +247,12 @@ const $t = Y({ name: "tabler-filter-check", render: Et }), Rt = { "element-loadi
|
|
|
244
247
|
"max-height": "34vh"
|
|
245
248
|
}, {
|
|
246
249
|
default: y(() => [
|
|
247
|
-
|
|
250
|
+
C(n(ot), {
|
|
248
251
|
modelValue: w.value[S(t)],
|
|
249
252
|
"onUpdate:modelValue": (c) => w.value[S(t)] = c
|
|
250
253
|
}, {
|
|
251
254
|
default: y(() => [
|
|
252
|
-
(s(!0),
|
|
255
|
+
(s(!0), x(q, null, oe(Se(t.filterOptions), (c) => (s(), k(n(ut), {
|
|
253
256
|
key: c.value.toString(),
|
|
254
257
|
value: c.value,
|
|
255
258
|
label: c.label,
|
|
@@ -271,10 +274,10 @@ const $t = Y({ name: "tabler-filter-check", render: Et }), Rt = { "element-loadi
|
|
|
271
274
|
"value-format": "YYYY-MM-DD HH:mm:ss",
|
|
272
275
|
teleported: !1
|
|
273
276
|
}, null, 8, ["modelValue", "onUpdate:modelValue"])) : F("", !0),
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
277
|
+
f[5] || (f[5] = _("div", { class: "-mx-3 my-3 border-t" }, null, -1)),
|
|
278
|
+
_("div", Rt, [
|
|
279
|
+
_("div", Vt, [
|
|
280
|
+
C(n(M), {
|
|
278
281
|
type: "primary",
|
|
279
282
|
plain: "",
|
|
280
283
|
size: "small",
|
|
@@ -284,12 +287,12 @@ const $t = Y({ name: "tabler-filter-check", render: Et }), Rt = { "element-loadi
|
|
|
284
287
|
t
|
|
285
288
|
)
|
|
286
289
|
}, {
|
|
287
|
-
default: y(() => [...
|
|
290
|
+
default: y(() => [...f[3] || (f[3] = [
|
|
288
291
|
R("重置", -1)
|
|
289
292
|
])]),
|
|
290
293
|
_: 1
|
|
291
294
|
}, 8, ["onClick"]),
|
|
292
|
-
|
|
295
|
+
C(n(M), {
|
|
293
296
|
type: "primary",
|
|
294
297
|
size: "small",
|
|
295
298
|
class: "!m-0",
|
|
@@ -299,7 +302,7 @@ const $t = Y({ name: "tabler-filter-check", render: Et }), Rt = { "element-loadi
|
|
|
299
302
|
t
|
|
300
303
|
)
|
|
301
304
|
}, {
|
|
302
|
-
default: y(() => [...
|
|
305
|
+
default: y(() => [...f[4] || (f[4] = [
|
|
303
306
|
R("确定", -1)
|
|
304
307
|
])]),
|
|
305
308
|
_: 1
|
|
@@ -316,8 +319,8 @@ const $t = Y({ name: "tabler-filter-check", render: Et }), Rt = { "element-loadi
|
|
|
316
319
|
t.formatter ? {
|
|
317
320
|
name: "default",
|
|
318
321
|
fn: y(({ row: v, column: c, $index: N }) => [
|
|
319
|
-
ie((s(),
|
|
320
|
-
|
|
322
|
+
ie((s(), x("div", null, [
|
|
323
|
+
C(St, {
|
|
321
324
|
col: t,
|
|
322
325
|
row: v,
|
|
323
326
|
column: c,
|
|
@@ -333,53 +336,53 @@ const $t = Y({ name: "tabler-filter-check", render: Et }), Rt = { "element-loadi
|
|
|
333
336
|
fn: y(({ row: v, $index: c }) => {
|
|
334
337
|
var N, ae;
|
|
335
338
|
return [
|
|
336
|
-
t.prop ? (s(),
|
|
337
|
-
G(t, v) ? (s(),
|
|
338
|
-
(ae = (N = E.value[c]) == null ? void 0 : N[
|
|
339
|
+
t.prop ? (s(), x("div", Bt, [
|
|
340
|
+
G(t, v) ? (s(), x(q, { key: 0 }, [
|
|
341
|
+
(ae = (N = E.value[c]) == null ? void 0 : N[h]) != null && ae.editing ? (s(), k(n(Be), {
|
|
339
342
|
key: 0,
|
|
340
343
|
ref_for: !0,
|
|
341
|
-
ref: (o) => E.value[c][
|
|
342
|
-
modelValue: E.value[c][
|
|
343
|
-
"onUpdate:modelValue": (o) => E.value[c][
|
|
344
|
+
ref: (o) => E.value[c][h].inputRef = o,
|
|
345
|
+
modelValue: E.value[c][h].value,
|
|
346
|
+
"onUpdate:modelValue": (o) => E.value[c][h].value = o,
|
|
344
347
|
style: { "--el-input-height": "23px" },
|
|
345
348
|
clearable: "",
|
|
346
349
|
size: "small",
|
|
347
350
|
"input-style": "--el-input-inner-height: 20px",
|
|
348
351
|
onBlur: (o) => U({
|
|
349
352
|
rowIndex: c,
|
|
350
|
-
colIndex:
|
|
353
|
+
colIndex: h,
|
|
351
354
|
row: v,
|
|
352
355
|
prop: t.prop,
|
|
353
356
|
oldValue: v[t.prop],
|
|
354
|
-
newValue: E.value[c][
|
|
357
|
+
newValue: E.value[c][h].value
|
|
355
358
|
}),
|
|
356
359
|
onKeydown: [
|
|
357
360
|
ye(pe((o) => U({
|
|
358
361
|
rowIndex: c,
|
|
359
|
-
colIndex:
|
|
362
|
+
colIndex: h,
|
|
360
363
|
row: v,
|
|
361
364
|
prop: t.prop,
|
|
362
365
|
oldValue: v[t.prop],
|
|
363
|
-
newValue: E.value[c][
|
|
366
|
+
newValue: E.value[c][h].value
|
|
364
367
|
}), ["stop", "prevent"]), ["enter"]),
|
|
365
|
-
ye(pe((o) => A(c,
|
|
368
|
+
ye(pe((o) => A(c, h), ["stop", "prevent"]), ["esc"])
|
|
366
369
|
]
|
|
367
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "onBlur", "onKeydown"])) : ie((s(),
|
|
370
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "onBlur", "onKeydown"])) : ie((s(), x("div", {
|
|
368
371
|
key: 1,
|
|
369
372
|
class: "h-[23px] cursor-pointer",
|
|
370
|
-
onDblclick: (o) => le(c,
|
|
373
|
+
onDblclick: (o) => le(c, h, v[t.prop])
|
|
371
374
|
}, [
|
|
372
375
|
R(L(v[t.prop]), 1)
|
|
373
|
-
], 40,
|
|
376
|
+
], 40, Ft)), [
|
|
374
377
|
[n(me), t.truncate ?? !0]
|
|
375
378
|
])
|
|
376
|
-
], 64)) : ie((s(),
|
|
379
|
+
], 64)) : ie((s(), x("div", Ht, [
|
|
377
380
|
R(L(v[t.prop]), 1)
|
|
378
381
|
])), [
|
|
379
382
|
[n(me), t.truncate ?? !0]
|
|
380
383
|
])
|
|
381
384
|
])) : F("", !0),
|
|
382
|
-
(s(!0),
|
|
385
|
+
(s(!0), x(q, null, oe(P(t, v), (o) => (s(), x(q, {
|
|
383
386
|
key: o.text
|
|
384
387
|
}, [
|
|
385
388
|
o.text === "删除" || o.confirmText ? (s(), k(n(ct), {
|
|
@@ -387,11 +390,11 @@ const $t = Y({ name: "tabler-filter-check", render: Et }), Rt = { "element-loadi
|
|
|
387
390
|
placement: "top",
|
|
388
391
|
"hide-after": 0,
|
|
389
392
|
"popper-style": "width: unset; min-width: 150px;",
|
|
390
|
-
title: n(
|
|
393
|
+
title: n(_e)(o.confirmText) ? `是否确认${o.text}?` : n(I)(o.confirmText) ? o.confirmText(v) : o.confirmText ?? `是否确认${o.text}?`,
|
|
391
394
|
onConfirm: (B) => o.visibility === "hidden" ? void 0 : o.handler(v)
|
|
392
395
|
}, {
|
|
393
396
|
reference: y(() => [
|
|
394
|
-
|
|
397
|
+
C(n(M), {
|
|
395
398
|
link: "",
|
|
396
399
|
type: o.type ?? "primary",
|
|
397
400
|
style: ke(te(o, o.visibility)),
|
|
@@ -425,7 +428,7 @@ const $t = Y({ name: "tabler-filter-check", render: Et }), Rt = { "element-loadi
|
|
|
425
428
|
]), 1040, ["align", "fixed"]))), 128))
|
|
426
429
|
]),
|
|
427
430
|
_: 1
|
|
428
|
-
}, 8, ["data", "row-key"])
|
|
431
|
+
}, 8, ["data", "default-sort", "row-key"])
|
|
429
432
|
])), [
|
|
430
433
|
[n(r), e.loading]
|
|
431
434
|
]);
|
|
@@ -435,9 +438,9 @@ const $t = Y({ name: "tabler-filter-check", render: Et }), Rt = { "element-loadi
|
|
|
435
438
|
for (const [r, i] of l)
|
|
436
439
|
d[r] = i;
|
|
437
440
|
return d;
|
|
438
|
-
},
|
|
439
|
-
function
|
|
440
|
-
var l, d, r, i, g,
|
|
441
|
+
}, Dt = /* @__PURE__ */ ze(zt, [["__scopeId", "data-v-455222f2"]]);
|
|
442
|
+
function At(e) {
|
|
443
|
+
var l, d, r, i, g, b, $;
|
|
441
444
|
if (mt(e))
|
|
442
445
|
return e.includes("database") || e.includes("java.sql.") ? "接口异常" : e;
|
|
443
446
|
if (He(e)) return "请求已取消";
|
|
@@ -467,9 +470,9 @@ function Lt(e) {
|
|
|
467
470
|
return `网络异常 (${w})`;
|
|
468
471
|
}
|
|
469
472
|
}
|
|
470
|
-
return e instanceof SyntaxError ? "数据解析异常" : e instanceof TypeError ? "程序运行异常" : e instanceof Object && ((i = (r = e[(d = be(e)) == null ? void 0 : d[0]]) == null ? void 0 : r[0]) != null && i.message) ? ($ = (
|
|
473
|
+
return e instanceof SyntaxError ? "数据解析异常" : e instanceof TypeError ? "程序运行异常" : e instanceof Object && ((i = (r = e[(d = be(e)) == null ? void 0 : d[0]]) == null ? void 0 : r[0]) != null && i.message) ? ($ = (b = e[(g = be(e)) == null ? void 0 : g[0]]) == null ? void 0 : b[0]) == null ? void 0 : $.message : e.message || "未知错误";
|
|
471
474
|
}
|
|
472
|
-
class
|
|
475
|
+
class Lt {
|
|
473
476
|
/**
|
|
474
477
|
* 实例化 SelectionStore
|
|
475
478
|
*
|
|
@@ -539,42 +542,43 @@ class Mt {
|
|
|
539
542
|
});
|
|
540
543
|
}
|
|
541
544
|
}
|
|
542
|
-
function
|
|
545
|
+
function Mt(e, l, d) {
|
|
543
546
|
let r, i;
|
|
544
547
|
Re(e) ? (r = e, i = l) : (r = Ze(e, l), i = 300);
|
|
545
548
|
const g = V(r.value);
|
|
546
|
-
let
|
|
549
|
+
let b = null;
|
|
547
550
|
const $ = () => {
|
|
548
|
-
|
|
551
|
+
b !== null && (clearTimeout(b), b = null);
|
|
549
552
|
};
|
|
550
553
|
return Ve(
|
|
551
554
|
r,
|
|
552
555
|
(w) => {
|
|
553
|
-
w ? ($(),
|
|
556
|
+
w ? ($(), b = setTimeout(() => {
|
|
554
557
|
g.value = !0;
|
|
555
558
|
}, i)) : ($(), g.value = !1);
|
|
556
559
|
},
|
|
557
560
|
{ immediate: !1 }
|
|
558
561
|
), g;
|
|
559
562
|
}
|
|
560
|
-
function
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
563
|
+
function Kt({
|
|
564
|
+
defaultSort: e,
|
|
565
|
+
fetchFn: l,
|
|
566
|
+
onReset: d
|
|
567
|
+
}) {
|
|
568
|
+
const r = e ? Y(e) : {
|
|
569
|
+
order: "",
|
|
570
|
+
sort: ""
|
|
571
|
+
}, i = xe(Y(r));
|
|
572
|
+
let g = Y(i);
|
|
573
|
+
function b({
|
|
570
574
|
prop: $,
|
|
571
575
|
order: w
|
|
572
576
|
}) {
|
|
573
|
-
w ? (i.sort = $ || "", i.order = w === "ascending" ? "asc" : "desc", l()) : (i.sort = r.sort, i.order = r.order,
|
|
577
|
+
w ? (i.sort = $ || "", i.order = w === "ascending" ? "asc" : "desc", l()) : (i.sort = r.sort, i.order = r.order, gt(i, g) && (i.order = i.order === "asc" ? "desc" : "asc"), d ? d() : l()), g = Y(i);
|
|
574
578
|
}
|
|
575
579
|
return {
|
|
576
580
|
sortState: i,
|
|
577
|
-
onSortChange:
|
|
581
|
+
onSortChange: b
|
|
578
582
|
};
|
|
579
583
|
}
|
|
580
584
|
const De = {
|
|
@@ -595,18 +599,18 @@ function Pe(e, l) {
|
|
|
595
599
|
const r = Math.round(d);
|
|
596
600
|
return r > 0 ? r : l;
|
|
597
601
|
}
|
|
598
|
-
function
|
|
602
|
+
function Ot(e, l) {
|
|
599
603
|
return typeof e == "string" && e.trim() ? e : l;
|
|
600
604
|
}
|
|
601
605
|
function Le(...e) {
|
|
602
606
|
return Fe(Object.assign({}, ...e), (l) => l !== void 0);
|
|
603
607
|
}
|
|
604
|
-
function
|
|
608
|
+
function Ut(e) {
|
|
605
609
|
return {
|
|
606
610
|
buttonText: (e == null ? void 0 : e.buttonText) ?? Ae.buttonText
|
|
607
611
|
};
|
|
608
612
|
}
|
|
609
|
-
function
|
|
613
|
+
function Nt(e) {
|
|
610
614
|
const l = Le(
|
|
611
615
|
K.paginationProps,
|
|
612
616
|
e == null ? void 0 : e.paginationProps
|
|
@@ -616,70 +620,70 @@ function jt(e) {
|
|
|
616
620
|
headerHeight: Pe(e == null ? void 0 : e.headerHeight, K.headerHeight),
|
|
617
621
|
paginationProps: {
|
|
618
622
|
...l,
|
|
619
|
-
layout:
|
|
623
|
+
layout: Ot(
|
|
620
624
|
l.layout,
|
|
621
625
|
De.layout
|
|
622
626
|
)
|
|
623
627
|
},
|
|
624
|
-
searchProps:
|
|
628
|
+
searchProps: Ut(e == null ? void 0 : e.searchProps)
|
|
625
629
|
};
|
|
626
630
|
}
|
|
627
|
-
const Me = Symbol("searchTableConfig"),
|
|
631
|
+
const Me = Symbol("searchTableConfig"), jt = {
|
|
628
632
|
viewBox: "0 0 24 24",
|
|
629
633
|
width: "1.2em",
|
|
630
634
|
height: "1.2em"
|
|
631
635
|
};
|
|
632
|
-
function
|
|
633
|
-
return s(),
|
|
634
|
-
|
|
636
|
+
function It(e, l) {
|
|
637
|
+
return s(), x("svg", jt, [...l[0] || (l[0] = [
|
|
638
|
+
_("path", {
|
|
635
639
|
fill: "currentColor",
|
|
636
640
|
d: "m18.031 16.617l4.283 4.282l-1.415 1.415l-4.282-4.283A8.96 8.96 0 0 1 11 20c-4.968 0-9-4.032-9-9s4.032-9 9-9s9 4.032 9 9a8.96 8.96 0 0 1-1.969 5.617m-2.006-.742A6.98 6.98 0 0 0 18 11c0-3.867-3.133-7-7-7s-7 3.133-7 7s3.133 7 7 7a6.98 6.98 0 0 0 4.875-1.975z"
|
|
637
641
|
}, null, -1)
|
|
638
642
|
])]);
|
|
639
643
|
}
|
|
640
|
-
const
|
|
644
|
+
const qt = Q({ name: "ri-search-line", render: It }), Gt = {
|
|
641
645
|
viewBox: "0 0 24 24",
|
|
642
646
|
width: "1.2em",
|
|
643
647
|
height: "1.2em"
|
|
644
648
|
};
|
|
645
|
-
function
|
|
646
|
-
return s(),
|
|
647
|
-
|
|
649
|
+
function Wt(e, l) {
|
|
650
|
+
return s(), x("svg", Gt, [...l[0] || (l[0] = [
|
|
651
|
+
_("path", {
|
|
648
652
|
fill: "currentColor",
|
|
649
653
|
d: "M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"
|
|
650
654
|
}, null, -1)
|
|
651
655
|
])]);
|
|
652
656
|
}
|
|
653
|
-
const
|
|
657
|
+
const Yt = Q({ name: "ri-add-line", render: Wt }), Qt = {
|
|
654
658
|
viewBox: "0 0 24 24",
|
|
655
659
|
width: "1.2em",
|
|
656
660
|
height: "1.2em"
|
|
657
661
|
};
|
|
658
|
-
function
|
|
659
|
-
return s(),
|
|
660
|
-
|
|
662
|
+
function Zt(e, l) {
|
|
663
|
+
return s(), x("svg", Qt, [...l[0] || (l[0] = [
|
|
664
|
+
_("path", {
|
|
661
665
|
fill: "currentColor",
|
|
662
666
|
d: "M17 6h5v2h-2v13a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V8H2V6h5V3a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1zm1 2H6v12h12zm-9 3h2v6H9zm4 0h2v6h-2zM9 4v2h6V4z"
|
|
663
667
|
}, null, -1)
|
|
664
668
|
])]);
|
|
665
669
|
}
|
|
666
|
-
const
|
|
670
|
+
const Jt = Q({ name: "ri-delete-bin-line", render: Zt }), Xt = {
|
|
667
671
|
viewBox: "0 0 24 24",
|
|
668
672
|
width: "1.2em",
|
|
669
673
|
height: "1.2em"
|
|
670
674
|
};
|
|
671
|
-
function
|
|
672
|
-
return s(),
|
|
673
|
-
|
|
675
|
+
function el(e, l) {
|
|
676
|
+
return s(), x("svg", Xt, [...l[0] || (l[0] = [
|
|
677
|
+
_("path", {
|
|
674
678
|
fill: "currentColor",
|
|
675
679
|
d: "M6.535 3h14.464a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H6.535a1 1 0 0 1-.833-.445l-5.333-8a1 1 0 0 1 0-1.11l5.333-8A1 1 0 0 1 6.535 3m.535 2l-4.667 7l4.667 7H20V5zM13 10.586l2.828-2.829l1.414 1.415L14.414 12l2.828 2.828l-1.414 1.415l-2.829-2.829l-2.828 2.829l-1.414-1.415L11.585 12L8.757 9.172l1.414-1.415z"
|
|
676
680
|
}, null, -1)
|
|
677
681
|
])]);
|
|
678
682
|
}
|
|
679
|
-
const
|
|
683
|
+
const tl = Q({ name: "ri-delete-back2-line", render: el }), ll = { class: "search-table flex h-full flex-col" }, al = {
|
|
680
684
|
key: 0,
|
|
681
685
|
class: "search-table__toolbar mb-6 flex flex-shrink-0 items-center justify-between"
|
|
682
|
-
},
|
|
686
|
+
}, nl = { class: "search-table__search flex items-center gap-x-3" }, rl = { class: "search-table__actions" }, sl = { class: "search-table__footer mt-5 flex flex-shrink-0 items-center justify-between" }, il = { class: "search-table__selection flex w-[164px] items-center" }, Ee = 10, ol = /* @__PURE__ */ de({
|
|
683
687
|
__name: "index",
|
|
684
688
|
props: {
|
|
685
689
|
columns: {},
|
|
@@ -703,17 +707,17 @@ const ll = Y({ name: "ri-delete-back2-line", render: tl }), al = { class: "searc
|
|
|
703
707
|
},
|
|
704
708
|
emits: ["add", "batch-delete", "cell-edit"],
|
|
705
709
|
setup(e, { expose: l, emit: d }) {
|
|
706
|
-
const r = e, i = d, g = Je(),
|
|
710
|
+
const r = e, i = d, g = Je(), b = $e("proTableRef"), $ = Xe(Me, K), w = z(
|
|
707
711
|
() => Le($.paginationProps, r.elPaginationProps)
|
|
708
712
|
), H = z(
|
|
709
713
|
() => r.searchButtonText ?? $.searchProps.buttonText
|
|
710
|
-
), { sortState: O, onSortChange: X } =
|
|
714
|
+
), { sortState: O, onSortChange: X } = Kt({
|
|
711
715
|
defaultSort: r.defaultSort,
|
|
712
|
-
fetchFn:
|
|
716
|
+
fetchFn: h,
|
|
713
717
|
onReset() {
|
|
714
718
|
var m, T;
|
|
715
719
|
const p = O.sort, u = O.order === "asc" ? "ascending" : "descending";
|
|
716
|
-
r.columns.some((W) => W.prop === p) ? (T = (m =
|
|
720
|
+
r.columns.some((W) => W.prop === p) ? (T = (m = b.value) == null ? void 0 : m.tableInstance) == null || T.sort(p, u) : h();
|
|
717
721
|
}
|
|
718
722
|
}), ee = z(() => {
|
|
719
723
|
const p = O.order === "asc" ? "ascending" : "descending";
|
|
@@ -725,16 +729,16 @@ const ll = Y({ name: "ri-delete-back2-line", render: tl }), al = { class: "searc
|
|
|
725
729
|
pageSize: D.value,
|
|
726
730
|
currPage: 1,
|
|
727
731
|
total: 0
|
|
728
|
-
}), S = z(() => bt(
|
|
729
|
-
[
|
|
732
|
+
}), S = z(() => yt(bt([D.value, 10, 20, 30, 40, 50, 100]))), te = z(() => (P.value.currPage - 1) * P.value.pageSize), E = V(0), Z = z(() => r.searchField ?? "search"), G = V({
|
|
733
|
+
[Z.value]: ""
|
|
730
734
|
}), le = z({
|
|
731
|
-
get: () => G.value[
|
|
735
|
+
get: () => G.value[Z.value] ?? "",
|
|
732
736
|
set: (p) => {
|
|
733
|
-
G.value[
|
|
737
|
+
G.value[Z.value] = p;
|
|
734
738
|
}
|
|
735
|
-
}), U = xe({}), A = V([]), a = V(!1),
|
|
739
|
+
}), U = xe({}), A = V([]), a = V(!1), f = Mt(a, 100);
|
|
736
740
|
let t = null;
|
|
737
|
-
async function
|
|
741
|
+
async function h() {
|
|
738
742
|
t == null || t.abort(), t = new AbortController(), a.value = !0;
|
|
739
743
|
const p = te.value;
|
|
740
744
|
try {
|
|
@@ -749,16 +753,16 @@ const ll = Y({ name: "ri-delete-back2-line", render: tl }), al = { class: "searc
|
|
|
749
753
|
});
|
|
750
754
|
A.value = T, E.value = p, P.value.total = W, await ue(() => {
|
|
751
755
|
var j, re, se;
|
|
752
|
-
(re = (j =
|
|
756
|
+
(re = (j = b.value) == null ? void 0 : j.tableInstance) == null || re.setScrollTop(0), (se = b.value) == null || se.resetCells();
|
|
753
757
|
}), r.selectable && Ne(T);
|
|
754
758
|
} catch (u) {
|
|
755
759
|
if (He(u)) return;
|
|
756
|
-
console.error("[SearchTable] 获取数据失败", u), vt.error("表格数据加载失败:" +
|
|
760
|
+
console.error("[SearchTable] 获取数据失败", u), vt.error("表格数据加载失败:" + At(u));
|
|
757
761
|
}
|
|
758
762
|
a.value = !1;
|
|
759
763
|
}
|
|
760
764
|
function v() {
|
|
761
|
-
P.value.currPage = 1,
|
|
765
|
+
P.value.currPage = 1, h();
|
|
762
766
|
}
|
|
763
767
|
function c({ type: p, value: u, prop: m, col: T }) {
|
|
764
768
|
if (p === "datetimerange") {
|
|
@@ -772,16 +776,16 @@ const ll = Y({ name: "ri-delete-back2-line", render: tl }), al = { class: "searc
|
|
|
772
776
|
i("cell-edit", p);
|
|
773
777
|
}
|
|
774
778
|
const ae = async () => {
|
|
775
|
-
a.value || (we(), await
|
|
779
|
+
a.value || (we(), await h());
|
|
776
780
|
};
|
|
777
781
|
function o() {
|
|
778
782
|
var j;
|
|
779
|
-
const { rowHeight: p, headerHeight: u } = $, m = (j =
|
|
783
|
+
const { rowHeight: p, headerHeight: u } = $, m = (j = b.value) == null ? void 0 : j.$el;
|
|
780
784
|
if (!m) return 0;
|
|
781
785
|
const T = m.offsetHeight - u;
|
|
782
786
|
return Math.floor(T / p);
|
|
783
787
|
}
|
|
784
|
-
const B = V([]), Ke = z(() => B.value), ne = new
|
|
788
|
+
const B = V([]), Ke = z(() => B.value), ne = new Lt(r.rowKey);
|
|
785
789
|
let ce = !1;
|
|
786
790
|
const fe = (p) => {
|
|
787
791
|
ce || (ne.syncPage(A.value, p), B.value = ne.values);
|
|
@@ -789,16 +793,16 @@ const ll = Y({ name: "ri-delete-back2-line", render: tl }), al = { class: "searc
|
|
|
789
793
|
fe(p);
|
|
790
794
|
}, we = () => {
|
|
791
795
|
var p, u;
|
|
792
|
-
(u = (p =
|
|
796
|
+
(u = (p = b.value) == null ? void 0 : p.tableInstance) == null || u.clearSelection(), B.value = [], ne.clear();
|
|
793
797
|
};
|
|
794
798
|
r.selectable && Ve(A, async () => {
|
|
795
799
|
ce = !0, await ue(), ne.restorePageSelection(A.value, (p, u) => {
|
|
796
800
|
var m, T;
|
|
797
|
-
(T = (m =
|
|
801
|
+
(T = (m = b.value) == null ? void 0 : m.tableInstance) == null || T.toggleRowSelection(p, u);
|
|
798
802
|
}), await ue(), ce = !1;
|
|
799
803
|
});
|
|
800
804
|
function Ne(p) {
|
|
801
|
-
const u = p.map((T) => T[r.rowKey]), m = be(Fe(
|
|
805
|
+
const u = p.map((T) => T[r.rowKey]), m = be(Fe(xt(u), (T) => T > 1));
|
|
802
806
|
m.length && console.error(
|
|
803
807
|
"[SearchTable] 表格数据存在重复的 rowKey,将会导致勾选功能异常!",
|
|
804
808
|
m
|
|
@@ -807,7 +811,7 @@ const ll = Y({ name: "ri-delete-back2-line", render: tl }), al = { class: "searc
|
|
|
807
811
|
return et(() => {
|
|
808
812
|
P.value.pageSize || (g.table ? (console.warn(
|
|
809
813
|
`[SearchTable] 使用 table 插槽替换表格时无法自动计算每页条数,将使用默认值 ${Ee},可通过 pageSize 指定`
|
|
810
|
-
), D.value = Ee) : D.value = o(), P.value.pageSize = D.value),
|
|
814
|
+
), D.value = Ee) : D.value = o(), P.value.pageSize = D.value), h();
|
|
811
815
|
}), tt(() => {
|
|
812
816
|
t == null || t.abort();
|
|
813
817
|
}), l({
|
|
@@ -827,10 +831,10 @@ const ll = Y({ name: "ri-delete-back2-line", render: tl }), al = { class: "searc
|
|
|
827
831
|
* 勾选指定行
|
|
828
832
|
*/
|
|
829
833
|
selectRows: Ue
|
|
830
|
-
}), (p, u) => (s(),
|
|
831
|
-
e.showSearch ? (s(),
|
|
832
|
-
|
|
833
|
-
|
|
834
|
+
}), (p, u) => (s(), x("div", ll, [
|
|
835
|
+
e.showSearch ? (s(), x("section", al, [
|
|
836
|
+
_("div", nl, [
|
|
837
|
+
C(n(Be), {
|
|
834
838
|
modelValue: le.value,
|
|
835
839
|
"onUpdate:modelValue": u[0] || (u[0] = (m) => le.value = m),
|
|
836
840
|
modelModifiers: { trim: !0 },
|
|
@@ -840,24 +844,24 @@ const ll = Y({ name: "ri-delete-back2-line", render: tl }), al = { class: "searc
|
|
|
840
844
|
onKeyup: ye(v, ["enter"]),
|
|
841
845
|
onClear: v
|
|
842
846
|
}, null, 8, ["modelValue", "placeholder"]),
|
|
843
|
-
|
|
847
|
+
J(p.$slots, "search-form", {
|
|
844
848
|
query: G.value,
|
|
845
849
|
search: v
|
|
846
850
|
}, void 0, !0),
|
|
847
|
-
|
|
851
|
+
C(n(M), {
|
|
848
852
|
class: "search-table__search-button",
|
|
849
853
|
type: "primary",
|
|
850
854
|
onClick: v
|
|
851
855
|
}, {
|
|
852
856
|
default: y(() => [
|
|
853
|
-
|
|
857
|
+
C(n(qt)),
|
|
854
858
|
R(" " + L(H.value), 1)
|
|
855
859
|
]),
|
|
856
860
|
_: 1
|
|
857
861
|
})
|
|
858
862
|
]),
|
|
859
|
-
|
|
860
|
-
|
|
863
|
+
J(p.$slots, "top-center", {}, void 0, !0),
|
|
864
|
+
_("div", rl, [
|
|
861
865
|
e.showAddButton ? (s(), k(n(M), {
|
|
862
866
|
key: 0,
|
|
863
867
|
class: "search-table__add-button",
|
|
@@ -865,7 +869,7 @@ const ll = Y({ name: "ri-delete-back2-line", render: tl }), al = { class: "searc
|
|
|
865
869
|
onClick: u[1] || (u[1] = (m) => i("add"))
|
|
866
870
|
}, {
|
|
867
871
|
default: y(() => [
|
|
868
|
-
|
|
872
|
+
C(n(Yt)),
|
|
869
873
|
u[5] || (u[5] = R("新增 ", -1))
|
|
870
874
|
]),
|
|
871
875
|
_: 1
|
|
@@ -878,17 +882,17 @@ const ll = Y({ name: "ri-delete-back2-line", render: tl }), al = { class: "searc
|
|
|
878
882
|
onClick: u[2] || (u[2] = (m) => i("batch-delete", B.value))
|
|
879
883
|
}, {
|
|
880
884
|
default: y(() => [
|
|
881
|
-
|
|
885
|
+
C(n(Jt)),
|
|
882
886
|
u[6] || (u[6] = R("批量删除 ", -1))
|
|
883
887
|
]),
|
|
884
888
|
_: 1
|
|
885
889
|
}, 8, ["disabled"])) : F("", !0),
|
|
886
|
-
|
|
890
|
+
J(p.$slots, "btns", {}, void 0, !0)
|
|
887
891
|
])
|
|
888
892
|
])) : F("", !0),
|
|
889
|
-
|
|
893
|
+
J(p.$slots, "table", {
|
|
890
894
|
data: A.value,
|
|
891
|
-
loading: n(
|
|
895
|
+
loading: n(f),
|
|
892
896
|
columns: r.columns,
|
|
893
897
|
indexOffset: E.value,
|
|
894
898
|
defaultSort: ee.value,
|
|
@@ -897,11 +901,11 @@ const ll = Y({ name: "ri-delete-back2-line", render: tl }), al = { class: "searc
|
|
|
897
901
|
cellEdit: N,
|
|
898
902
|
sortChange: n(X)
|
|
899
903
|
}, () => [
|
|
900
|
-
|
|
904
|
+
C(Dt, ge({ ref: "proTableRef" }, r, {
|
|
901
905
|
class: "search-table__body flex-1 overflow-hidden",
|
|
902
906
|
"index-offset": E.value,
|
|
903
907
|
data: A.value,
|
|
904
|
-
loading: n(
|
|
908
|
+
loading: n(f),
|
|
905
909
|
"default-sort": ee.value,
|
|
906
910
|
onApplyFilter: c,
|
|
907
911
|
onSelectionChange: fe,
|
|
@@ -909,10 +913,10 @@ const ll = Y({ name: "ri-delete-back2-line", render: tl }), al = { class: "searc
|
|
|
909
913
|
onSortChange: n(X)
|
|
910
914
|
}), null, 16, ["index-offset", "data", "loading", "default-sort", "onSortChange"])
|
|
911
915
|
], !0),
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
e.selectable ? (s(),
|
|
915
|
-
|
|
916
|
+
_("section", sl, [
|
|
917
|
+
_("div", il, [
|
|
918
|
+
e.selectable ? (s(), x(q, { key: 0 }, [
|
|
919
|
+
C(n(ft), { type: "info" }, {
|
|
916
920
|
default: y(() => [
|
|
917
921
|
R("已选 " + L(B.value.length) + " 条", 1)
|
|
918
922
|
]),
|
|
@@ -926,14 +930,14 @@ const ll = Y({ name: "ri-delete-back2-line", render: tl }), al = { class: "searc
|
|
|
926
930
|
"hide-after": 0
|
|
927
931
|
}, {
|
|
928
932
|
default: y(() => [
|
|
929
|
-
|
|
933
|
+
C(n(M), {
|
|
930
934
|
type: "danger",
|
|
931
935
|
text: "",
|
|
932
936
|
class: "search-table__clear-selection-button ml-1 !px-2",
|
|
933
937
|
onClick: we
|
|
934
938
|
}, {
|
|
935
939
|
default: y(() => [
|
|
936
|
-
|
|
940
|
+
C(n(tl))
|
|
937
941
|
]),
|
|
938
942
|
_: 1
|
|
939
943
|
})
|
|
@@ -942,7 +946,7 @@ const ll = Y({ name: "ri-delete-back2-line", render: tl }), al = { class: "searc
|
|
|
942
946
|
})) : F("", !0)
|
|
943
947
|
], 64)) : F("", !0)
|
|
944
948
|
]),
|
|
945
|
-
|
|
949
|
+
C(n(pt), ge(w.value, {
|
|
946
950
|
"page-size": P.value.pageSize,
|
|
947
951
|
"onUpdate:pageSize": u[3] || (u[3] = (m) => P.value.pageSize = m),
|
|
948
952
|
"current-page": P.value.currPage,
|
|
@@ -950,14 +954,14 @@ const ll = Y({ name: "ri-delete-back2-line", render: tl }), al = { class: "searc
|
|
|
950
954
|
total: P.value.total,
|
|
951
955
|
"page-sizes": S.value,
|
|
952
956
|
class: "search-table__pagination flex-shrink-0",
|
|
953
|
-
onSizeChange:
|
|
954
|
-
onCurrentChange:
|
|
957
|
+
onSizeChange: h,
|
|
958
|
+
onCurrentChange: h
|
|
955
959
|
}), null, 16, ["page-size", "current-page", "total", "page-sizes"]),
|
|
956
|
-
u[7] || (u[7] =
|
|
960
|
+
u[7] || (u[7] = _("div", { class: "search-table__footer-spacer w-[164px]" }, null, -1))
|
|
957
961
|
])
|
|
958
962
|
]));
|
|
959
963
|
}
|
|
960
|
-
}),
|
|
964
|
+
}), vl = /* @__PURE__ */ ze(ol, [["__scopeId", "data-v-56484700"]]), ml = /* @__PURE__ */ de({
|
|
961
965
|
name: "SearchTableConfigProvider",
|
|
962
966
|
__name: "ConfigProvider",
|
|
963
967
|
props: {
|
|
@@ -967,11 +971,11 @@ const ll = Y({ name: "ri-delete-back2-line", render: tl }), al = { class: "searc
|
|
|
967
971
|
searchProps: { default: () => K.searchProps }
|
|
968
972
|
},
|
|
969
973
|
setup(e) {
|
|
970
|
-
return lt(Me,
|
|
974
|
+
return lt(Me, Nt(e)), (d, r) => J(d.$slots, "default");
|
|
971
975
|
}
|
|
972
976
|
});
|
|
973
977
|
export {
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
978
|
+
Dt as ProTable,
|
|
979
|
+
vl as SearchTable,
|
|
980
|
+
ml as SearchTableConfigProvider
|
|
977
981
|
};
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.fixed{position:fixed}.\!m-0{margin:0!important}.-mx-3{margin-left:-.75rem;margin-right:-.75rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.mb-6{margin-bottom:1.5rem}.ml-1{margin-left:.25rem}.mt-5{margin-top:1.25rem}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.hidden{display:none}.h-\[23px\]{height:23px}.h-full{height:100%}.\!w-\[260px\]{width:260px!important}.w-\[150px\]{width:150px}.w-\[164px\]{width:164px}.w-full{width:100%}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-evenly{justify-content:space-evenly}.gap-x-0{-moz-column-gap:0px;column-gap:0px}.gap-x-0\.5{-moz-column-gap:.125rem;column-gap:.125rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.overflow-hidden{overflow:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rounded{border-radius:.25rem}.border{border-width:1px}.border-t{border-top-width:1px}.\!px-2{padding-left:.5rem!important;padding-right:.5rem!important}.text-\[--el-color-primary\]{color:var(--el-color-primary)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.duration-100{transition-duration:.1s}.hover\:text-\[--el-color-primary\]:hover{color:var(--el-color-primary)}[data-v-
|
|
1
|
+
.fixed{position:fixed}.\!m-0{margin:0!important}.-mx-3{margin-left:-.75rem;margin-right:-.75rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.mb-6{margin-bottom:1.5rem}.ml-1{margin-left:.25rem}.mt-5{margin-top:1.25rem}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.hidden{display:none}.h-\[23px\]{height:23px}.h-full{height:100%}.\!w-\[260px\]{width:260px!important}.w-\[150px\]{width:150px}.w-\[164px\]{width:164px}.w-full{width:100%}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-evenly{justify-content:space-evenly}.gap-x-0{-moz-column-gap:0px;column-gap:0px}.gap-x-0\.5{-moz-column-gap:.125rem;column-gap:.125rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.overflow-hidden{overflow:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rounded{border-radius:.25rem}.border{border-width:1px}.border-t{border-top-width:1px}.\!px-2{padding-left:.5rem!important;padding-right:.5rem!important}.text-\[--el-color-primary\]{color:var(--el-color-primary)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.duration-100{transition-duration:.1s}.hover\:text-\[--el-color-primary\]:hover{color:var(--el-color-primary)}[data-v-455222f2] .pro-table{--el-table-header-bg-color: #f7f8fa;--el-table-header-text-color: var(--el-text-color-regular);--el-table-text-color: var(--el-text-color-primary)}[data-v-455222f2] .pro-table thead th{font-weight:400}[data-v-56484700] .el-table .el-table-column--selection.el-table__cell{display:flex;align-items:center;justify-content:center}[data-v-56484700] .el-button>span{gap:0 4px}.el-pagination[data-v-56484700] .el-pagination__sizes .el-select{width:110px}
|