vft 0.0.439 → 0.0.441
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/attributes.json +1 -1
- package/dist/index.css +1 -1
- package/es/components/pagination/index.d.ts +3 -1
- package/es/components/pagination/pagination.vue.d.ts +3 -1
- package/es/components/pagination/pagination.vue2.js +47 -44
- package/es/components/table/constants.d.ts +2 -1
- package/es/components/table/constants.js +2 -2
- package/es/components/table/field.d.ts +60 -0
- package/es/components/table/index.d.ts +1271 -544
- package/es/components/table/table.vue.d.ts +291 -124
- package/es/components/table/table.vue2.js +143 -132
- package/es/components/table/types.d.ts +48 -43
- package/es/components/table/use/use-data-source.js +69 -69
- package/es/components/table/use/use-pagination.d.ts +11 -7
- package/es/components/table/use/use-pagination.js +36 -46
- package/es/components/table/utils.d.ts +24 -4
- package/es/index.js +2 -2
- package/es/package.json.d.ts +4 -3
- package/es/package.json.js +1 -1
- package/lib/components/pagination/index.d.ts +3 -1
- package/lib/components/pagination/pagination.vue.d.ts +3 -1
- package/lib/components/pagination/pagination.vue2.cjs +1 -1
- package/lib/components/table/constants.cjs +1 -1
- package/lib/components/table/constants.d.ts +2 -1
- package/lib/components/table/field.d.ts +60 -0
- package/lib/components/table/index.d.ts +1271 -544
- package/lib/components/table/table.vue.d.ts +291 -124
- package/lib/components/table/table.vue2.cjs +1 -1
- package/lib/components/table/types.d.ts +48 -43
- package/lib/components/table/use/use-data-source.cjs +1 -1
- package/lib/components/table/use/use-pagination.cjs +1 -1
- package/lib/components/table/use/use-pagination.d.ts +11 -7
- package/lib/components/table/utils.d.ts +24 -4
- package/lib/package.json.cjs +1 -1
- package/lib/package.json.d.ts +4 -3
- package/package.json +6 -5
- package/tags.json +1 -1
- package/theme-style/index.css +1 -1
- package/theme-style/src/table.scss +6 -1
- package/theme-style/vft-table.css +1 -1
- package/web-types.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import "../../pagination/index.js";
|
|
2
|
-
import { isFunction as
|
|
2
|
+
import { isFunction as D, isBoolean as X, delObjAttrNotExist as Y, isString as $, isEmptyObject as ee, isNullOrUndefined as N, isObject as x, isNumber as te, isPlainObject as ae } from "@vft/utils";
|
|
3
3
|
import { useTimeoutFn as re } from "@vueuse/core";
|
|
4
|
-
import { merge as ie, get as
|
|
5
|
-
import { ref as
|
|
6
|
-
import {
|
|
7
|
-
function he(u, { tableData:
|
|
8
|
-
const a =
|
|
4
|
+
import { merge as ie, get as C } from "lodash-es";
|
|
5
|
+
import { ref as p, watchEffect as ne, unref as r, watch as k, computed as ce, onMounted as le } from "vue";
|
|
6
|
+
import { PageSize as ue } from "../constants.js";
|
|
7
|
+
function he(u, { tableData: I, setLoading: T, getPaginationInfo: O, setPagination: o }, j) {
|
|
8
|
+
const a = p([]), R = p({});
|
|
9
9
|
ne(() => {
|
|
10
|
-
|
|
11
|
-
}),
|
|
10
|
+
I.value = r(a);
|
|
11
|
+
}), k(
|
|
12
12
|
() => r(u).data,
|
|
13
13
|
() => {
|
|
14
14
|
const { data: e, api: t } = r(u);
|
|
@@ -18,10 +18,10 @@ function he(u, { tableData: M, setLoading: O, getPaginationInfo: F, setPaginatio
|
|
|
18
18
|
immediate: !0
|
|
19
19
|
}
|
|
20
20
|
);
|
|
21
|
-
function
|
|
22
|
-
|
|
21
|
+
function M(e) {
|
|
22
|
+
o(e), g({});
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const z = ce(() => {
|
|
25
25
|
const e = r(a);
|
|
26
26
|
return !e || e.length === 0 ? r(a) : r(a);
|
|
27
27
|
});
|
|
@@ -32,14 +32,14 @@ function he(u, { tableData: M, setLoading: O, getPaginationInfo: F, setPaginatio
|
|
|
32
32
|
beforeFetch: n,
|
|
33
33
|
afterFetch: l,
|
|
34
34
|
pagination: d,
|
|
35
|
-
delEmptyParams:
|
|
36
|
-
transformParams:
|
|
35
|
+
delEmptyParams: s,
|
|
36
|
+
transformParams: J,
|
|
37
37
|
extraParams: h
|
|
38
38
|
} = r(u);
|
|
39
|
-
if (!(!t || !
|
|
39
|
+
if (!(!t || !D(t)))
|
|
40
40
|
try {
|
|
41
|
-
|
|
42
|
-
const { pageField: b, sizeField:
|
|
41
|
+
T(!0);
|
|
42
|
+
const { pageField: b, sizeField: K, listField: Q, totalField: W } = Object.assign(
|
|
43
43
|
{},
|
|
44
44
|
{
|
|
45
45
|
pageField: "page",
|
|
@@ -50,57 +50,57 @@ function he(u, { tableData: M, setLoading: O, getPaginationInfo: F, setPaginatio
|
|
|
50
50
|
i
|
|
51
51
|
);
|
|
52
52
|
let w = {}, c = e;
|
|
53
|
-
const { currentPage:
|
|
54
|
-
|
|
53
|
+
const { currentPage: P = 1, pageSize: _ = ue } = r(
|
|
54
|
+
O
|
|
55
55
|
);
|
|
56
|
-
if (
|
|
57
|
-
if (
|
|
56
|
+
if (J) {
|
|
57
|
+
if (X(d) && !d)
|
|
58
58
|
w = {};
|
|
59
59
|
else {
|
|
60
|
-
const m = e && e.page ||
|
|
61
|
-
w[b] = d?.pageIsZero ? m - 1 : m, w[
|
|
60
|
+
const m = e && e.page || P;
|
|
61
|
+
w[b] = d?.pageIsZero ? m - 1 : m, w[K] = _;
|
|
62
62
|
}
|
|
63
|
-
if (c = ie(e, w), n &&
|
|
63
|
+
if (c = ie(e, w), n && D(n)) {
|
|
64
64
|
const m = await n(c);
|
|
65
65
|
c = { ...c, ...m };
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
s && Y(
|
|
68
68
|
c,
|
|
69
|
-
$(
|
|
69
|
+
$(s) ? s === "strict" : !1
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
|
-
c && !ee(c) && !
|
|
73
|
-
const v = await t(c),
|
|
74
|
-
let f =
|
|
75
|
-
const S =
|
|
72
|
+
c && !ee(c) && !N(h) ? x(c) && x(h) && (c = Object.assign({}, c, h)) : N(h) || (c = h);
|
|
73
|
+
const v = await t(c), E = Array.isArray(v);
|
|
74
|
+
let f = E ? v : C(v, Q);
|
|
75
|
+
const S = E ? v.length : C(v, W);
|
|
76
76
|
if (Number(S)) {
|
|
77
|
-
const m = Math.ceil(S /
|
|
78
|
-
if (
|
|
79
|
-
return
|
|
77
|
+
const m = Math.ceil(S / _);
|
|
78
|
+
if (P > m)
|
|
79
|
+
return o({
|
|
80
80
|
currentPage: m
|
|
81
81
|
}), await g(e);
|
|
82
82
|
}
|
|
83
|
-
return l &&
|
|
83
|
+
return l && D(l) && (f = await l(f) || f), a.value = f, R.value = f, o({
|
|
84
84
|
total: S || 0
|
|
85
|
-
}), e && e.page &&
|
|
85
|
+
}), e && e.page && o({
|
|
86
86
|
currentPage: e.page || 1
|
|
87
87
|
}), j("fetch-success", {
|
|
88
88
|
items: r(f),
|
|
89
89
|
total: S
|
|
90
90
|
}), f;
|
|
91
91
|
} catch (b) {
|
|
92
|
-
console.log(b), j("fetch-error", b), a.value = [],
|
|
92
|
+
console.log(b), j("fetch-error", b), a.value = [], o({
|
|
93
93
|
total: 0
|
|
94
94
|
});
|
|
95
95
|
} finally {
|
|
96
|
-
|
|
96
|
+
T(!1);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
return
|
|
99
|
+
function F() {
|
|
100
|
+
return R.value;
|
|
101
101
|
}
|
|
102
102
|
async function q(e) {
|
|
103
|
-
return
|
|
103
|
+
return o({
|
|
104
104
|
currentPage: e?.page || 1
|
|
105
105
|
}), await g(e);
|
|
106
106
|
}
|
|
@@ -109,16 +109,16 @@ function he(u, { tableData: M, setLoading: O, getPaginationInfo: F, setPaginatio
|
|
|
109
109
|
const { rowkey: t } = r(u);
|
|
110
110
|
return ((n) => {
|
|
111
111
|
let l;
|
|
112
|
-
return n.some(function(
|
|
113
|
-
if (Reflect.has(
|
|
114
|
-
return l =
|
|
112
|
+
return n.some(function(s) {
|
|
113
|
+
if (Reflect.has(s, t) && s[t] === e)
|
|
114
|
+
return l = s, !0;
|
|
115
115
|
}), l;
|
|
116
116
|
})(a.value);
|
|
117
117
|
}
|
|
118
|
-
async function
|
|
118
|
+
async function L(e, t, i) {
|
|
119
119
|
return a.value[e] && (a.value[e][t] = i), a.value[e];
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function U(e, t) {
|
|
122
122
|
const i = B(e);
|
|
123
123
|
if (i) {
|
|
124
124
|
for (const n in i)
|
|
@@ -126,61 +126,61 @@ function he(u, { tableData: M, setLoading: O, getPaginationInfo: F, setPaginatio
|
|
|
126
126
|
return i;
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function V(e, t = 0) {
|
|
130
130
|
const i = ae(e) ? [e] : e;
|
|
131
131
|
return a.value.splice(t, 0, ...i), r(a);
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function Z(e, t) {
|
|
134
134
|
if (!a.value || a.value.length === 0) return;
|
|
135
135
|
const { rowkey: i } = r(u), n = a.value.findIndex(
|
|
136
136
|
(d) => d[t || i] === e[t || i]
|
|
137
137
|
);
|
|
138
138
|
a.value.splice(n, 1);
|
|
139
|
-
const { total: l } = r(
|
|
140
|
-
te(l) &&
|
|
139
|
+
const { total: l } = r(O);
|
|
140
|
+
te(l) && o({
|
|
141
141
|
total: l - 1
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function y(e) {
|
|
145
145
|
a.value = e;
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
return
|
|
147
|
+
function G() {
|
|
148
|
+
return z.value;
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function H(e) {
|
|
151
151
|
const t = String(e).trim().toLowerCase();
|
|
152
152
|
if (t) {
|
|
153
|
-
const i =
|
|
153
|
+
const i = F?.()?.filter((n) => {
|
|
154
154
|
for (const l in n)
|
|
155
155
|
if (String(n[l]).trim().toLowerCase()?.includes(t))
|
|
156
156
|
return !0;
|
|
157
157
|
});
|
|
158
|
-
|
|
158
|
+
y(i);
|
|
159
159
|
} else
|
|
160
|
-
|
|
160
|
+
y(F());
|
|
161
161
|
}
|
|
162
|
-
const
|
|
162
|
+
const A = p(!0);
|
|
163
163
|
return le(() => {
|
|
164
164
|
re(() => {
|
|
165
|
-
r(u).immediate && g(),
|
|
165
|
+
r(u).immediate && g(), A.value = !1;
|
|
166
166
|
}, 16);
|
|
167
|
-
}),
|
|
167
|
+
}), k(
|
|
168
168
|
() => r(u).api,
|
|
169
169
|
() => {
|
|
170
|
-
r(u).watchApiFetch && !
|
|
170
|
+
r(u).watchApiFetch && !A.value && r(u).immediate && g();
|
|
171
171
|
}
|
|
172
172
|
), {
|
|
173
|
-
setTableData:
|
|
174
|
-
updateTableData:
|
|
175
|
-
updateTableDataRecord:
|
|
176
|
-
insertTableDataRecord:
|
|
177
|
-
deleteTableDataRecord:
|
|
173
|
+
setTableData: y,
|
|
174
|
+
updateTableData: L,
|
|
175
|
+
updateTableDataRecord: U,
|
|
176
|
+
insertTableDataRecord: V,
|
|
177
|
+
deleteTableDataRecord: Z,
|
|
178
178
|
reload: q,
|
|
179
|
-
handleTableChange:
|
|
180
|
-
getDataSourceRef:
|
|
181
|
-
getDataSource:
|
|
182
|
-
getRawDataSource:
|
|
183
|
-
tableSearch:
|
|
179
|
+
handleTableChange: M,
|
|
180
|
+
getDataSourceRef: z,
|
|
181
|
+
getDataSource: G,
|
|
182
|
+
getRawDataSource: F,
|
|
183
|
+
tableSearch: H
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
186
|
export {
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { PaginationProps } from 'vft/es/components/pagination';
|
|
2
2
|
import { type ComputedRef } from 'vue';
|
|
3
3
|
import type { TableProps } from '../types';
|
|
4
|
-
export declare function usePagination(
|
|
5
|
-
getPagination: () =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
export declare function usePagination(tableRefProps: ComputedRef<TableProps>): {
|
|
5
|
+
getPagination: () => (Partial<PaginationProps> & {
|
|
6
|
+
pagePlacement?: "bottom-left" | "bottom-right" | "top-left" | "top-right";
|
|
7
|
+
pageIsZero?: boolean;
|
|
8
|
+
}) | undefined;
|
|
9
|
+
getCurrentPage: () => number | undefined;
|
|
10
|
+
getPageSize: () => number | undefined;
|
|
11
|
+
getPaginationInfo: ComputedRef<(Partial<PaginationProps> & {
|
|
12
|
+
pagePlacement?: "bottom-left" | "bottom-right" | "top-left" | "top-right";
|
|
13
|
+
pageIsZero?: boolean;
|
|
14
|
+
}) | undefined>;
|
|
11
15
|
setPagination: (info: Partial<PaginationProps>) => void;
|
|
12
16
|
};
|
|
@@ -1,66 +1,56 @@
|
|
|
1
|
-
import { isBoolean as
|
|
2
|
-
import { ref as
|
|
3
|
-
import {
|
|
4
|
-
function
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
...
|
|
1
|
+
import { isBoolean as p } from "@vft/utils";
|
|
2
|
+
import { ref as P, watch as m, unref as e, computed as l } from "vue";
|
|
3
|
+
import { PageSize as s } from "../constants.js";
|
|
4
|
+
function v(i) {
|
|
5
|
+
const a = P({});
|
|
6
|
+
m(() => e(i).pagination, (t) => {
|
|
7
|
+
t && (a.value = {
|
|
8
|
+
...e(a),
|
|
9
9
|
...t ?? {}
|
|
10
10
|
});
|
|
11
11
|
});
|
|
12
|
-
const
|
|
12
|
+
const n = l(() => {
|
|
13
13
|
const {
|
|
14
14
|
pagination: t,
|
|
15
|
-
total:
|
|
16
|
-
pageSize:
|
|
17
|
-
} =
|
|
18
|
-
return
|
|
15
|
+
total: o,
|
|
16
|
+
pageSize: c
|
|
17
|
+
} = e(i);
|
|
18
|
+
return i.value.showPager ? {
|
|
19
19
|
currentPage: 1,
|
|
20
|
-
pageSize:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
defaultPageSize: v,
|
|
24
|
-
// layout: 'total, jumper, sizes, prev, pager, next',
|
|
20
|
+
pageSize: c,
|
|
21
|
+
total: o,
|
|
22
|
+
defaultPageSize: s,
|
|
25
23
|
layout: "total, prev, pager, next, jumper",
|
|
26
24
|
pagePlacement: "bottom-right",
|
|
27
|
-
|
|
28
|
-
...
|
|
29
|
-
...
|
|
30
|
-
};
|
|
25
|
+
hideOnSinglePage: !0,
|
|
26
|
+
...p(t) ? {} : t,
|
|
27
|
+
...e(a)
|
|
28
|
+
} : {};
|
|
31
29
|
});
|
|
32
|
-
function
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
...
|
|
30
|
+
function r(t) {
|
|
31
|
+
const o = e(n);
|
|
32
|
+
a.value = {
|
|
33
|
+
...o,
|
|
36
34
|
...t
|
|
37
35
|
};
|
|
38
36
|
}
|
|
39
|
-
function
|
|
40
|
-
return n
|
|
41
|
-
}
|
|
42
|
-
function p() {
|
|
43
|
-
return n(e).currentPage;
|
|
37
|
+
function g() {
|
|
38
|
+
return e(n);
|
|
44
39
|
}
|
|
45
|
-
function
|
|
46
|
-
return n
|
|
40
|
+
function u() {
|
|
41
|
+
return e(n).currentPage;
|
|
47
42
|
}
|
|
48
|
-
function
|
|
49
|
-
return n
|
|
50
|
-
}
|
|
51
|
-
async function l(t) {
|
|
52
|
-
r.value = t;
|
|
43
|
+
function f() {
|
|
44
|
+
return e(n).pageSize;
|
|
53
45
|
}
|
|
54
46
|
return {
|
|
55
|
-
getPagination:
|
|
56
|
-
getCurrentPage:
|
|
57
|
-
getPageSize:
|
|
58
|
-
getPaginationInfo:
|
|
59
|
-
|
|
60
|
-
getShowPagination: P,
|
|
61
|
-
setPagination: c
|
|
47
|
+
getPagination: g,
|
|
48
|
+
getCurrentPage: u,
|
|
49
|
+
getPageSize: f,
|
|
50
|
+
getPaginationInfo: n,
|
|
51
|
+
setPagination: r
|
|
62
52
|
};
|
|
63
53
|
}
|
|
64
54
|
export {
|
|
65
|
-
|
|
55
|
+
v as usePagination
|
|
66
56
|
};
|
|
@@ -1,9 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* 添加必填标记
|
|
3
|
+
* @param obj - 需要添加必填标记的对象
|
|
4
|
+
* @returns 添加了 required 属性的新对象
|
|
5
|
+
*/
|
|
6
|
+
export declare const addRequire: <T extends Record<string, any>>(obj: T) => T & {
|
|
7
|
+
required: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* 移除必填标记
|
|
11
|
+
* @param obj - 需要移除必填标记的对象
|
|
12
|
+
* @returns 移除了 required 属性的新对象
|
|
13
|
+
*/
|
|
14
|
+
export declare const removeRequire: <T extends Record<string, any>>(obj: T) => Omit<T, "required">;
|
|
15
|
+
/**
|
|
16
|
+
* 选择器映射函数,用于将值映射为标签显示
|
|
17
|
+
* @param list - 选项列表,包含 value 和 label 属性
|
|
18
|
+
* @returns 格式化配置对象
|
|
19
|
+
*/
|
|
20
|
+
export declare const selectMapping: (list?: Array<{
|
|
21
|
+
value: any;
|
|
22
|
+
label: string;
|
|
23
|
+
}>) => {
|
|
4
24
|
formatter: ({ cellValue }: {
|
|
5
25
|
cellValue: any;
|
|
6
|
-
}) =>
|
|
26
|
+
}) => string;
|
|
7
27
|
} | {
|
|
8
28
|
formatter?: undefined;
|
|
9
29
|
};
|
package/es/index.js
CHANGED
|
@@ -202,8 +202,8 @@ export { defaultProps, segmentedEmits, segmentedProps } from "./components/segme
|
|
|
202
202
|
export { LEFT_CHECK_CHANGE_EVENT, RIGHT_CHECK_CHANGE_EVENT, transferCheckedChangeFn, transferEmits, transferProps } from "./components/transfer/transfer.js";
|
|
203
203
|
export { genFileId, uploadContextKey } from "./components/upload/constants.js";
|
|
204
204
|
export { watermarkProps } from "./components/watermark/watermark.js";
|
|
205
|
-
export {
|
|
206
|
-
export {
|
|
205
|
+
export { vLoading, createLoadingDirective } from "./components/loading/directive.js";
|
|
206
|
+
export { Loading } from "./components/loading/service.js";
|
|
207
207
|
export { messageDefaults, messageTypes } from "./components/message/types.js";
|
|
208
208
|
export { isDatePicker, isInput, isRangePicker } from "./components/super-form/component-map.js";
|
|
209
209
|
|
package/es/package.json.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
"name": "vft",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.441",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.cjs",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -43,8 +43,9 @@ declare const _default: {
|
|
|
43
43
|
"vue-router": ">=4.0.16"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"vxe-table": "4.
|
|
47
|
-
"
|
|
46
|
+
"vxe-table": "4.16.21",
|
|
47
|
+
"vxe-pc-ui": "4.9.44",
|
|
48
|
+
"xe-utils": "3.7.9",
|
|
48
49
|
"@vft/constants": "workspace:*",
|
|
49
50
|
"@vft/router": "workspace:*",
|
|
50
51
|
"@vft/store": "workspace:*",
|
package/es/package.json.js
CHANGED
|
@@ -53,7 +53,9 @@ export declare const VftPagination: import("vft/es/utils").SFCWithInstall<import
|
|
|
53
53
|
hideOnSinglePage: {
|
|
54
54
|
type: import("vue").PropType<boolean>;
|
|
55
55
|
};
|
|
56
|
-
}>, {
|
|
56
|
+
}>, {
|
|
57
|
+
pageCountBridge: import("vue").ComputedRef<number>;
|
|
58
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
57
59
|
"update:current-page": (val: number) => void;
|
|
58
60
|
"update:page-size": (val: number) => void;
|
|
59
61
|
"size-change": (val: number) => void;
|
|
@@ -20,7 +20,9 @@ export interface PaginationProps {
|
|
|
20
20
|
disabled?: boolean;
|
|
21
21
|
hideOnSinglePage?: boolean;
|
|
22
22
|
}
|
|
23
|
-
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<PaginationProps>>, {
|
|
23
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<PaginationProps>>, {
|
|
24
|
+
pageCountBridge: import("vue").ComputedRef<number>;
|
|
25
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
24
26
|
"update:current-page": (val: number) => void;
|
|
25
27
|
"update:page-size": (val: number) => void;
|
|
26
28
|
"size-change": (val: number) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("vue"),a=require("@vft/utils");require("@vueuse/core");require("../config-provider/hooks/use-global-config.cjs");require("lodash-es");require("../form/index.cjs");const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("vue"),a=require("@vft/utils");require("@vueuse/core");require("../config-provider/hooks/use-global-config.cjs");require("lodash-es");require("../form/index.cjs");const B=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const I=require("./components/jumper.vue2.cjs"),M=require("./components/next.vue2.cjs"),U=require("./components/pager.vue2.cjs"),j=require("./components/prev.vue2.cjs"),w=require("./components/sizes.vue2.cjs"),E=require("./components/total.vue2.cjs"),L=require("./usePagination.cjs"),O=u.defineComponent({name:"vft-pagination"}),W=u.defineComponent({...O,props:{total:{},pageSize:{},defaultPageSize:{},currentPage:{},defaultCurrentPage:{},pageCount:{},pagerCount:{default:7},layout:{},pageSizes:{default:()=>[10,20,30,40,50,100]},popperClass:{default:""},prevText:{},prevIcon:{},nextText:{},nextIcon:{},small:{type:Boolean},background:{type:Boolean},disabled:{type:Boolean},hideOnSinglePage:{type:Boolean}},emits:{"update:current-page":e=>a.isNumber(e),"update:page-size":e=>a.isNumber(e),"size-change":e=>a.isNumber(e),"current-change":e=>a.isNumber(e),"prev-click":e=>a.isNumber(e),"next-click":e=>a.isNumber(e)},setup(e,{expose:P,emit:z}){const l=B.useNamespace("pagination"),s=z,S=u.useSlots(),g=u.getCurrentInstance().vnode.props||{},m="onUpdate:currentPage"in g||"onUpdate:current-page"in g||"onCurrentChange"in g,d="onUpdate:pageSize"in g||"onUpdate:page-size"in g||"onSizeChange"in g,N=u.computed(()=>{if(!a.isNumber(e.total)&&!a.isNumber(e.pageCount)||a.isNumber(e.currentPage)&&!m)return!1;if(e.layout.includes("sizes")){if(a.isNumber(e.pageCount)){if(!d)return!1}else if(a.isNumber(e.total)&&a.isNumber(e.pageSize)&&!d)return!1}return!0}),b=u.ref(a.isNumber(e.defaultPageSize)?e.defaultPageSize:10),h=u.ref(a.isNumber(e.defaultCurrentPage)?e.defaultCurrentPage:1),f=u.computed({get(){return a.isNumber(e.pageSize)?e.pageSize:b.value},set(t){a.isNumber(e.pageSize)||(b.value=t),d&&(s("update:page-size",t),s("size-change",t))}}),r=u.computed(()=>{let t=0;return a.isNumber(e.pageCount)?t=e.pageCount:a.isNumber(e.total)&&(t=Math.max(1,Math.ceil(e.total/f.value))),t}),i=u.computed({get(){return a.isNumber(e.currentPage)?e.currentPage:h.value},set(t){let n=t;t<1?n=1:t>r.value&&(n=r.value),a.isNumber(e.currentPage)||(h.value=n),m&&(s("update:current-page",n),s("current-change",n))}});u.watch(r,t=>{i.value>t&&(i.value=t)});function C(t){i.value=t}function x(t){f.value=t;const n=r.value;i.value>n&&(i.value=n)}function q(){e.disabled||(i.value-=1,s("prev-click",i.value))}function y(){e.disabled||(i.value+=1,s("next-click",i.value))}function o(t,n){t&&(t.props||(t.props={}),t.class=[t.class,n].join(" "))}return u.provide(L.vftPaginationKey,{pageCount:r,disabled:u.computed(()=>e.disabled),currentPage:i,changeEvent:C,handleSizeChange:x}),P({pageCountBridge:r}),()=>{if(!N.value||!e.layout||e.hideOnSinglePage&&r.value<=1)return null;const t=[],n=[],k=u.h("div",{class:l.e("rightwrapper")},n),p={prev:u.h(j.default,{disabled:e.disabled,currentPage:i.value,prevText:e.prevText,prevIcon:e.prevIcon,onClick:q}),jumper:u.h(I.default,{size:e.small?"small":"default"}),pager:u.h(U.default,{currentPage:i.value,pageCount:r.value,pagerCount:e.pagerCount,onChange:C,disabled:e.disabled}),next:u.h(M.default,{disabled:e.disabled,currentPage:i.value,pageCount:r.value,nextText:e.nextText,nextIcon:e.nextIcon,onClick:y}),sizes:u.h(w.default,{pageSize:f.value,pageSizes:e.pageSizes,popperClass:e.popperClass,disabled:e.disabled,size:e.small?"small":"default"}),slot:S?.default?.()??null,total:u.h(E.default,{total:a.isNumber(e.total)?e.total:0})},T=e.layout.split(",").map(c=>c.trim());let v=!1;return T.forEach(c=>{if(c==="->"){v=!0;return}v?n.push(p[c]):t.push(p[c])}),o(t[0],l.is("first")),o(t[t.length-1],l.is("last")),v&&n.length>0&&(o(n[0],l.is("first")),o(n[n.length-1],l.is("last")),t.push(k)),u.h("div",{role:"pagination","aria-label":"pagination",class:[l.b(),l.is("background",e.background),{[l.m("small")]:e.small}]},t)}}});exports.default=W;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=15;exports.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=15;exports.PageSize=e;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
/** 默认每页显示条数 */
|
|
2
|
+
export declare const PageSize = 15;
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import type { ColumnItemProps } from './types';
|
|
2
|
+
/** 序号列配置 */
|
|
2
3
|
export declare const SEQ_FIELD: ColumnItemProps;
|
|
4
|
+
/** 复选框列配置 */
|
|
3
5
|
export declare const CHECKED_FIELD: ColumnItemProps;
|
|
6
|
+
/** ID 列配置 */
|
|
4
7
|
export declare const ID_FIELD: ColumnItemProps;
|
|
8
|
+
/** 名称列配置 */
|
|
5
9
|
export declare const NAME_FIELD: ColumnItemProps;
|
|
10
|
+
/**
|
|
11
|
+
* 日期列配置生成器
|
|
12
|
+
* @param format - 日期格式,默认为 'YYYY-MM-DD'
|
|
13
|
+
* @param field - 字段名,默认为 'date'
|
|
14
|
+
* @param title - 列标题,默认为 '时间'
|
|
15
|
+
* @returns 日期列配置对象
|
|
16
|
+
*/
|
|
6
17
|
export declare const DATE_FIELD: ({ format, field, title, }?: {
|
|
7
18
|
format?: string | undefined;
|
|
8
19
|
field?: string | undefined;
|
|
@@ -15,6 +26,13 @@ export declare const DATE_FIELD: ({ format, field, title, }?: {
|
|
|
15
26
|
row: any;
|
|
16
27
|
}) => string;
|
|
17
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* 日期时间列配置生成器
|
|
31
|
+
* @param format - 日期时间格式,默认为 'YYYY-MM-DD HH:mm:ss'
|
|
32
|
+
* @param field - 字段名,默认为 'date'
|
|
33
|
+
* @param title - 列标题,默认为 '时间'
|
|
34
|
+
* @returns 日期时间列配置对象
|
|
35
|
+
*/
|
|
18
36
|
export declare const DATE_TIME_FIELD: ({ format, field, title, }?: {
|
|
19
37
|
format?: string | undefined;
|
|
20
38
|
field?: string | undefined;
|
|
@@ -27,6 +45,13 @@ export declare const DATE_TIME_FIELD: ({ format, field, title, }?: {
|
|
|
27
45
|
row: any;
|
|
28
46
|
}) => string;
|
|
29
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* 创建时间列配置生成器
|
|
50
|
+
* @param format - 日期时间格式,默认为 'YYYY-MM-DD HH:mm:ss'
|
|
51
|
+
* @param field - 字段名,默认为 'createTime'
|
|
52
|
+
* @param title - 列标题,默认为 '创建时间'
|
|
53
|
+
* @returns 创建时间列配置对象
|
|
54
|
+
*/
|
|
30
55
|
export declare const CREATE_TIME_FIELD: ({ format, field, title, }?: {
|
|
31
56
|
format?: string | undefined;
|
|
32
57
|
field?: string | undefined;
|
|
@@ -39,6 +64,13 @@ export declare const CREATE_TIME_FIELD: ({ format, field, title, }?: {
|
|
|
39
64
|
row: any;
|
|
40
65
|
}) => string;
|
|
41
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* 更新时间列配置生成器
|
|
69
|
+
* @param format - 日期时间格式,默认为 'YYYY-MM-DD HH:mm:ss'
|
|
70
|
+
* @param field - 字段名,默认为 'updateTime'
|
|
71
|
+
* @param title - 列标题,默认为 '更新时间'
|
|
72
|
+
* @returns 更新时间列配置对象
|
|
73
|
+
*/
|
|
42
74
|
export declare const UPDATE_TIME_FIELD: ({ format, field, title, }?: {
|
|
43
75
|
format?: string | undefined;
|
|
44
76
|
field?: string | undefined;
|
|
@@ -51,6 +83,15 @@ export declare const UPDATE_TIME_FIELD: ({ format, field, title, }?: {
|
|
|
51
83
|
row: any;
|
|
52
84
|
}) => string;
|
|
53
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* 状态列配置生成器
|
|
88
|
+
* @param field - 字段名,默认为 'status'
|
|
89
|
+
* @param title - 列标题,默认为 '状态'
|
|
90
|
+
* @param normalText - 正常状态显示文本,默认为 '正常'
|
|
91
|
+
* @param disabledText - 禁用状态显示文本,默认为 '禁用'
|
|
92
|
+
* @param strToNumber - 是否将字符串转换为数字进行判断,默认为 true
|
|
93
|
+
* @returns 状态列配置对象
|
|
94
|
+
*/
|
|
54
95
|
export declare const STATUS_FIELD: ({ field, title, normalText, disabledText, strToNumber, }?: {
|
|
55
96
|
field?: string | undefined;
|
|
56
97
|
title?: string | undefined;
|
|
@@ -58,14 +99,33 @@ export declare const STATUS_FIELD: ({ field, title, normalText, disabledText, st
|
|
|
58
99
|
disabledText?: string | undefined;
|
|
59
100
|
strToNumber?: boolean | undefined;
|
|
60
101
|
}) => ColumnItemProps;
|
|
102
|
+
/** 操作列配置参数接口 */
|
|
61
103
|
interface ActionFieldProps {
|
|
104
|
+
/** 确认删除提示文本 */
|
|
62
105
|
confirmText?: string;
|
|
106
|
+
/** 左侧按钮点击回调函数 */
|
|
63
107
|
leftCallback?: (data?: any) => void;
|
|
108
|
+
/** 右侧按钮点击回调函数,支持异步操作 */
|
|
64
109
|
rightCallback?: ((data?: any) => Promise<any>) | ((data?: any) => void);
|
|
110
|
+
/** 左侧按钮文本 */
|
|
65
111
|
leftText?: string;
|
|
112
|
+
/** 右侧按钮文本 */
|
|
66
113
|
rightText?: string;
|
|
114
|
+
/** 是否显示左侧按钮 */
|
|
67
115
|
showLeft?: boolean;
|
|
116
|
+
/** 是否显示右侧按钮 */
|
|
68
117
|
showRight?: boolean;
|
|
69
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* 操作列配置生成器
|
|
121
|
+
* @param confirmText - 确认删除提示文本,默认为 '确认删除?'
|
|
122
|
+
* @param leftCallback - 左侧按钮点击回调
|
|
123
|
+
* @param rightCallback - 右侧按钮点击回调
|
|
124
|
+
* @param leftText - 左侧按钮文本,默认为 '编辑'
|
|
125
|
+
* @param rightText - 右侧按钮文本,默认为 '删除'
|
|
126
|
+
* @param showLeft - 是否显示左侧按钮,默认为 true
|
|
127
|
+
* @param showRight - 是否显示右侧按钮,默认为 true
|
|
128
|
+
* @returns 操作列配置对象
|
|
129
|
+
*/
|
|
70
130
|
export declare const ACTION_FIELD: ({ confirmText, leftCallback, rightCallback, leftText, rightText, showLeft, showRight, }?: ActionFieldProps) => ColumnItemProps;
|
|
71
131
|
export {};
|