@zl-ui-kit/components 0.20.0 → 0.20.2
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/README.md +7 -0
- package/dist/components/ZlAction/List.vue.mjs +2 -2
- package/dist/components/ZlCardPage/index.vue.d.ts +1 -1
- package/dist/components/ZlCardPage/index.vue.mjs +62 -64
- package/dist/components/ZlCardPage/resolvePagination.d.ts +20 -0
- package/dist/components/ZlCardPage/resolvePagination.mjs +24 -0
- package/dist/components/ZlSearchTable/index.vue.mjs +52 -50
- package/dist/components/ZlTable/useTablePagination.d.ts +1 -0
- package/dist/components/ZlTable/useTablePagination.mjs +37 -23
- package/package.json +11 -9
package/README.md
CHANGED
|
@@ -960,6 +960,10 @@ const cardRequest = usePageableRequest(getPageApi, { manual: true, initialData:
|
|
|
960
960
|
|
|
961
961
|
内部用 `usePageableRequest` 驱动分页与查询;`columns` 为 `TableColumn[]`,`queryItems` 为 `SearchItem[]`。
|
|
962
962
|
|
|
963
|
+
> **查询 / 重置回到第 1 页**:点击「查询」「重置」或外部调用 `search()` 时,请求参数与分页器**同步**回到第 1 页;
|
|
964
|
+
> `ref.refresh()` 则是原地重查、保持当前页码。翻页时组件会把 `{ pageNum, pageSize }` 合并进请求参数,
|
|
965
|
+
> 不需要页面自己维护页码;即使接口不回传 `pageNum`,分页器也会跟随本次请求的目标页码。
|
|
966
|
+
|
|
963
967
|
`queryItems` 与 `ZlForm` 的 `items` 是同一套 schema:基础查询项直接 `component` + `props` 配置(不用写模板),
|
|
964
968
|
选项类控件用 EP 的 `options`,字段不是 `label`/`value` 时用 `props` 别名重映射,联动项用 `slot:true` + `#<model>` 接管:
|
|
965
969
|
|
|
@@ -1024,6 +1028,9 @@ const queryItems: SearchItem[] = [
|
|
|
1024
1028
|
内部组合 `usePageableRequest + ZlSearch + ZlPagination + ZlEmpty`。
|
|
1025
1029
|
搜索栏直接由 `queryItems: SearchItem[]` 驱动,写法与上面的 `ZlSearchTable` 完全一致(`component` + `props` 配置,选项类用 EP 的 `options`)。
|
|
1026
1030
|
|
|
1031
|
+
> **分页状态与查询动作同步**:与 `ZlSearchTable` 一致,点「查询」「重置」时请求参数与分页器同步回到第 1 页;
|
|
1032
|
+
> 即使接口只返回行数组、不回传 `pageNum`,分页器也会跟随本次请求的目标页码。`cardPageRef.value?.refresh()` 是原地重查、保持当前页码。
|
|
1033
|
+
|
|
1027
1034
|
**条件查询 / 页签切换怎么重查**:把变化源放进 `request.options.refreshDeps`(ref / getter 数组),
|
|
1028
1035
|
依赖变化会自动重查**并回到第 1 页**——卡片页的请求是 `manual` 的(首屏由 `ZlSearch` 触发),
|
|
1029
1036
|
组件内部已把 `refreshDeps` 接到自己的 `search()` 上,不需要自己写 `watch`:
|
|
@@ -68,7 +68,7 @@ const G = { class: "zl-action-list" }, H = {
|
|
|
68
68
|
key: 1,
|
|
69
69
|
class: "zl-action-list__action",
|
|
70
70
|
type: "primary",
|
|
71
|
-
underline:
|
|
71
|
+
underline: "never",
|
|
72
72
|
disabled: e.disabled,
|
|
73
73
|
onClick: _((Z) => p(e), ["stop"])
|
|
74
74
|
}, {
|
|
@@ -119,7 +119,7 @@ const G = { class: "zl-action-list" }, H = {
|
|
|
119
119
|
key: 1,
|
|
120
120
|
class: "zl-action-list__more-icon",
|
|
121
121
|
type: "primary",
|
|
122
|
-
underline:
|
|
122
|
+
underline: "never",
|
|
123
123
|
onClick: l[0] || (l[0] = _(() => {
|
|
124
124
|
}, ["stop"]))
|
|
125
125
|
}, {
|
|
@@ -421,8 +421,8 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {
|
|
|
421
421
|
}>, {
|
|
422
422
|
immediate: boolean;
|
|
423
423
|
hideEmptyLabel: boolean;
|
|
424
|
-
queryItems: SearchItem[];
|
|
425
424
|
pagination: Record<string, any> | boolean;
|
|
425
|
+
queryItems: SearchItem[];
|
|
426
426
|
itemKey: string;
|
|
427
427
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
428
428
|
searchRef: ({
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as M, useSlots as V, ref as P, computed as o, watch as x, resolveDirective as F, withDirectives as G, openBlock as l, createElementBlock as b, normalizeStyle as H, createBlock as h, createSlots as J, withCtx as k, renderSlot as g, renderList as z, normalizeProps as Q, guardReactiveProps as T, createCommentVNode as q, createElementVNode as $, Fragment as U, mergeProps as D, unref as v } from "vue";
|
|
2
2
|
import { usePageableRequest as X } from "@zl-ui-kit/composables";
|
|
3
|
-
import { isArray as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
3
|
+
import { isArray as Y } from "@zl-ui-kit/utils";
|
|
4
|
+
import _ from "../ZlEmpty/index.vue.mjs";
|
|
5
|
+
import ee from "../ZlPagination/index.vue.mjs";
|
|
6
|
+
import te from "../ZlSearch/index.vue.mjs";
|
|
7
7
|
import '../ZlSearch/index.css';/* empty css */
|
|
8
|
-
import { usePagination as
|
|
9
|
-
|
|
8
|
+
import { usePagination as ae } from "../ZlPagination/usePagination.mjs";
|
|
9
|
+
import { resolveCardPagePagination as se } from "./resolvePagination.mjs";
|
|
10
|
+
const re = { class: "zl-card-page__content" }, ie = { class: "zl-card-page__list" }, B = "search-", he = /* @__PURE__ */ M({
|
|
10
11
|
name: "ZlCardPage",
|
|
11
12
|
__name: "index",
|
|
12
13
|
props: {
|
|
@@ -19,9 +20,9 @@ const ae = { class: "zl-card-page__content" }, se = { class: "zl-card-page__list
|
|
|
19
20
|
cardMinWidth: {}
|
|
20
21
|
},
|
|
21
22
|
emits: ["search-reset"],
|
|
22
|
-
setup(s, { expose:
|
|
23
|
-
const
|
|
24
|
-
const e =
|
|
23
|
+
setup(s, { expose: C, emit: E }) {
|
|
24
|
+
const c = s, N = E, R = V(), w = P(null), p = o(() => {
|
|
25
|
+
const e = c.request;
|
|
25
26
|
if (e && typeof e == "object" && "run" in e && "data" in e && !("service" in e))
|
|
26
27
|
return {
|
|
27
28
|
instance: e,
|
|
@@ -31,113 +32,110 @@ const ae = { class: "zl-card-page__content" }, se = { class: "zl-card-page__list
|
|
|
31
32
|
const t = { manual: !0, initialData: [] };
|
|
32
33
|
if (typeof e == "function")
|
|
33
34
|
return { instance: null, service: e, options: t };
|
|
34
|
-
const { refreshDeps:
|
|
35
|
+
const { refreshDeps: d, refreshDepsAction: a, ...n } = e.options ?? {};
|
|
35
36
|
return {
|
|
36
37
|
instance: null,
|
|
37
38
|
service: e.service,
|
|
38
39
|
options: {
|
|
39
|
-
...
|
|
40
|
+
...n,
|
|
40
41
|
...t,
|
|
41
|
-
...
|
|
42
|
+
...d ? { refreshDeps: d, refreshDepsAction: a ?? (() => i()) } : {}
|
|
42
43
|
}
|
|
43
44
|
};
|
|
44
|
-
}),
|
|
45
|
-
loading:
|
|
46
|
-
data:
|
|
47
|
-
run:
|
|
48
|
-
params:
|
|
49
|
-
refresh:
|
|
50
|
-
}, { loading: O, data:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
total: e.total ?? 0
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
}), d = te(() => W.value ?? !1), S = u(
|
|
63
|
-
() => D(i.value) ? i.value : i.value?.rows ?? []
|
|
64
|
-
), Z = u(() => {
|
|
45
|
+
}), r = X(p.value.service, p.value.options), I = p.value.instance ?? {
|
|
46
|
+
loading: r.loading,
|
|
47
|
+
data: r.data,
|
|
48
|
+
run: r.run,
|
|
49
|
+
params: r.params,
|
|
50
|
+
refresh: r.refresh
|
|
51
|
+
}, { loading: O, data: m, run: j, params: A, refresh: L } = I, W = o(() => A.value?.[0]), y = P({ pageNum: 1 }), Z = o(
|
|
52
|
+
() => se({
|
|
53
|
+
data: m.value,
|
|
54
|
+
pagination: c.pagination,
|
|
55
|
+
pageState: y.value
|
|
56
|
+
})
|
|
57
|
+
), u = ae(() => Z.value ?? !1), S = o(
|
|
58
|
+
() => Y(m.value) ? m.value : m.value?.rows ?? []
|
|
59
|
+
), K = o(() => {
|
|
65
60
|
const e = [];
|
|
66
|
-
return Object.keys(
|
|
61
|
+
return Object.keys(R).forEach((t) => {
|
|
67
62
|
t.startsWith(B) && t !== "search-actions" && e.push(t.slice(B.length));
|
|
68
63
|
}), e;
|
|
69
64
|
});
|
|
70
65
|
let f;
|
|
71
|
-
function
|
|
66
|
+
function i(e, t = {
|
|
72
67
|
pageNum: 1,
|
|
73
|
-
pageSize:
|
|
68
|
+
pageSize: u.value !== !1 ? u.value.pageSize : 30
|
|
74
69
|
}) {
|
|
75
70
|
f = {
|
|
76
71
|
...f,
|
|
77
72
|
...e,
|
|
78
73
|
...t
|
|
74
|
+
}, y.value = {
|
|
75
|
+
pageNum: t?.pageNum ?? 1,
|
|
76
|
+
pageSize: t?.pageSize
|
|
79
77
|
}, j(f);
|
|
80
78
|
}
|
|
81
79
|
return x(
|
|
82
|
-
() =>
|
|
80
|
+
() => c.immediate,
|
|
83
81
|
(e) => {
|
|
84
|
-
e && !
|
|
82
|
+
e && !c.queryItems.length && i();
|
|
85
83
|
},
|
|
86
84
|
{ immediate: !0, once: !0 }
|
|
87
|
-
),
|
|
85
|
+
), C({
|
|
88
86
|
/** 原地重查:用最近一次入参重新请求,保持当前页码(区别于 `search()` 会回到第 1 页) */
|
|
89
87
|
refresh: L,
|
|
90
88
|
/** 最近一次请求的入参(`{ pageNum, pageSize, ...查询表单 }`),未请求过时为 `undefined` */
|
|
91
|
-
params:
|
|
89
|
+
params: W,
|
|
92
90
|
/** 重新查询并回到第 1 页;消费方可在 useRequest 的 refreshDepsAction 里调用 */
|
|
93
|
-
search:
|
|
91
|
+
search: i
|
|
94
92
|
}), (e, t) => {
|
|
95
|
-
const
|
|
96
|
-
return G((
|
|
93
|
+
const d = F("loading");
|
|
94
|
+
return G((l(), b("div", {
|
|
97
95
|
class: "zl-card-page",
|
|
98
96
|
style: H({ "--card-min-width": s.cardMinWidth })
|
|
99
97
|
}, [
|
|
100
|
-
s.queryItems.length || e.$slots["search-actions"] ? (
|
|
98
|
+
s.queryItems.length || e.$slots["search-actions"] ? (l(), h(te, {
|
|
101
99
|
key: 0,
|
|
102
100
|
ref_key: "searchRef",
|
|
103
|
-
ref:
|
|
101
|
+
ref: w,
|
|
104
102
|
items: s.queryItems,
|
|
105
103
|
immediate: s.immediate,
|
|
106
104
|
"hide-empty-label": s.hideEmptyLabel,
|
|
107
|
-
onSearch:
|
|
108
|
-
onReset: t[0] || (t[0] = (a) =>
|
|
105
|
+
onSearch: i,
|
|
106
|
+
onReset: t[0] || (t[0] = (a) => N("search-reset"))
|
|
109
107
|
}, J({ _: 2 }, [
|
|
110
108
|
e.$slots["search-actions"] ? {
|
|
111
109
|
name: "actions",
|
|
112
|
-
fn:
|
|
113
|
-
|
|
110
|
+
fn: k(() => [
|
|
111
|
+
g(e.$slots, "search-actions")
|
|
114
112
|
]),
|
|
115
113
|
key: "0"
|
|
116
114
|
} : void 0,
|
|
117
|
-
|
|
115
|
+
z(K.value, (a) => ({
|
|
118
116
|
name: a,
|
|
119
|
-
fn:
|
|
120
|
-
|
|
117
|
+
fn: k((n) => [
|
|
118
|
+
g(e.$slots, `search-${a}`, Q(T(n)))
|
|
121
119
|
])
|
|
122
120
|
}))
|
|
123
|
-
]), 1032, ["items", "immediate", "hide-empty-label"])) :
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
S.value.length ? (
|
|
127
|
-
key: a[s.itemKey] ||
|
|
128
|
-
}, { ref_for: !0 }, { data: a }))), 128)) : (
|
|
121
|
+
]), 1032, ["items", "immediate", "hide-empty-label"])) : q("", !0),
|
|
122
|
+
$("div", re, [
|
|
123
|
+
$("div", ie, [
|
|
124
|
+
S.value.length ? (l(!0), b(U, { key: 0 }, z(S.value, (a, n) => g(e.$slots, "default", D({
|
|
125
|
+
key: a[s.itemKey] || n
|
|
126
|
+
}, { ref_for: !0 }, { data: a }))), 128)) : (l(), h(_, { key: 1 }))
|
|
129
127
|
])
|
|
130
128
|
]),
|
|
131
|
-
s.pagination && v(
|
|
132
|
-
onChange: t[1] || (t[1] = (a) =>
|
|
133
|
-
}), null, 16)) :
|
|
129
|
+
s.pagination && v(u) !== !1 ? (l(), h(ee, D({ key: 1 }, v(u), {
|
|
130
|
+
onChange: t[1] || (t[1] = (a) => i(void 0, a))
|
|
131
|
+
}), null, 16)) : q("", !0)
|
|
134
132
|
], 4)), [
|
|
135
|
-
[
|
|
133
|
+
[d, v(O)]
|
|
136
134
|
]);
|
|
137
135
|
};
|
|
138
136
|
}
|
|
139
137
|
});
|
|
140
138
|
export {
|
|
141
|
-
|
|
139
|
+
he as default
|
|
142
140
|
};
|
|
143
141
|
//# sourceMappingURL=index.vue.mjs.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ZlCardPage 的分页数据源解析(纯函数,便于回归测试)。
|
|
3
|
+
*
|
|
4
|
+
* 无论接口返回行数组还是分页对象,结果里都必须带上「本次请求的目标页码」:
|
|
5
|
+
* 下发的 `currentPage` 只有会随查询 / 重置变化,ZlPagination 的监听才会触发。
|
|
6
|
+
* 否则数组响应(或接口不回传 pageNum)时 currentPage 恒为 1,在第 N 页点重置
|
|
7
|
+
* 就会出现「数据已回第 1 页、分页器仍停在第 N 页」。
|
|
8
|
+
*/
|
|
9
|
+
export interface CardPageState {
|
|
10
|
+
/** 本次请求的目标页码,由 `search()` 写入;`refresh()` 不改(原地重查保持页码) */
|
|
11
|
+
pageNum: number;
|
|
12
|
+
/** 本次请求的目标页容量 */
|
|
13
|
+
pageSize?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function resolveCardPagePagination(options: {
|
|
16
|
+
data: any;
|
|
17
|
+
pagination: Record<string, any> | boolean | undefined;
|
|
18
|
+
pageState: CardPageState;
|
|
19
|
+
}): Record<string, any> | false;
|
|
20
|
+
//# sourceMappingURL=resolvePagination.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { isArray as p } from "@zl-ui-kit/utils";
|
|
2
|
+
function f(o) {
|
|
3
|
+
const { data: a, pagination: t, pageState: g } = o;
|
|
4
|
+
if (t === !1) return !1;
|
|
5
|
+
const e = (t === !0 ? {} : t) ?? {}, { pageNum: i, pageSize: r } = g;
|
|
6
|
+
if (p(a))
|
|
7
|
+
return {
|
|
8
|
+
...e,
|
|
9
|
+
pageNum: i,
|
|
10
|
+
pageSize: r ?? e.pageSize ?? 30,
|
|
11
|
+
total: a.length
|
|
12
|
+
};
|
|
13
|
+
const n = a ?? {};
|
|
14
|
+
return {
|
|
15
|
+
...e,
|
|
16
|
+
pageNum: i,
|
|
17
|
+
pageSize: r ?? n.pageSize ?? e.pageSize ?? 30,
|
|
18
|
+
total: n.total ?? 0
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
f as resolveCardPagePagination
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=resolvePagination.mjs.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { usePageableRequest as
|
|
3
|
-
import
|
|
1
|
+
import { defineComponent as K, useSlots as T, useAttrs as V, computed as m, ref as b, toRef as W, watch as Z, openBlock as y, createElementBlock as _, createBlock as x, createSlots as P, withCtx as f, renderSlot as d, renderList as q, normalizeProps as S, guardReactiveProps as $, createCommentVNode as F, createVNode as G, mergeProps as H, unref as h } from "vue";
|
|
2
|
+
import { usePageableRequest as J } from "@zl-ui-kit/composables";
|
|
3
|
+
import M from "../ZlSearch/index.vue.mjs";
|
|
4
4
|
import '../ZlTable/index.css';import '../ZlSearch/index.css';/* empty css */
|
|
5
|
-
import
|
|
5
|
+
import Q from "../ZlTable/index.vue.mjs";
|
|
6
6
|
/* empty css */
|
|
7
|
-
import { useTablePagination as
|
|
8
|
-
const
|
|
7
|
+
import { useTablePagination as U } from "../ZlTable/useTablePagination.mjs";
|
|
8
|
+
const X = { class: "zl-search-table" }, R = "search-", oe = /* @__PURE__ */ K({
|
|
9
9
|
name: "ZlSearchTable",
|
|
10
10
|
inheritAttrs: !1,
|
|
11
11
|
__name: "index",
|
|
@@ -19,62 +19,64 @@ const U = { class: "zl-search-table" }, R = "search-", ne = /* @__PURE__ */ D({
|
|
|
19
19
|
},
|
|
20
20
|
emits: ["search-reset"],
|
|
21
21
|
setup(r, { expose: B, emit: w }) {
|
|
22
|
-
const s = r, z = w,
|
|
22
|
+
const s = r, z = w, C = T(), p = V(), g = m(() => {
|
|
23
23
|
const e = [], t = [];
|
|
24
|
-
return Object.keys(
|
|
24
|
+
return Object.keys(C).forEach((a) => {
|
|
25
25
|
if (a.startsWith(R)) {
|
|
26
26
|
if (a === "search-actions") return;
|
|
27
27
|
t.push({ slot: a, subSlot: a.slice(R.length) });
|
|
28
28
|
} else
|
|
29
29
|
e.push(a);
|
|
30
30
|
}), { table: e, search: t };
|
|
31
|
-
}),
|
|
31
|
+
}), i = b(null), u = b(null), v = m(() => {
|
|
32
32
|
const e = { manual: !0, initialData: [] };
|
|
33
33
|
return typeof s.request == "function" ? { service: s.request, options: e } : {
|
|
34
34
|
...s.request,
|
|
35
35
|
options: Object.assign({ initialData: [] }, s.request.options, { manual: !0 })
|
|
36
36
|
};
|
|
37
37
|
}), {
|
|
38
|
-
loading:
|
|
39
|
-
data:
|
|
40
|
-
run:
|
|
41
|
-
params:
|
|
42
|
-
refresh:
|
|
43
|
-
} =
|
|
44
|
-
data:
|
|
45
|
-
pagination:
|
|
46
|
-
dataKey:
|
|
38
|
+
loading: N,
|
|
39
|
+
data: k,
|
|
40
|
+
run: A,
|
|
41
|
+
params: E,
|
|
42
|
+
refresh: I
|
|
43
|
+
} = J(v.value.service, v.value.options), j = m(() => E.value?.[0]), L = p.dataKey ?? p["data-key"] ?? "rows", { data: O, pagination: n, setCurrentPage: D } = U({
|
|
44
|
+
data: k,
|
|
45
|
+
pagination: W(s, "pagination"),
|
|
46
|
+
dataKey: L,
|
|
47
47
|
// 分页事件由 ZlTable 内部处理,这里无需重复派发
|
|
48
48
|
emit: {}
|
|
49
49
|
});
|
|
50
|
-
let
|
|
51
|
-
function
|
|
52
|
-
|
|
53
|
-
...
|
|
50
|
+
let c;
|
|
51
|
+
function l(e, t = n.value !== !1 ? { pageNum: 1, pageSize: n.value.pageSize } : void 0) {
|
|
52
|
+
c = {
|
|
53
|
+
...c,
|
|
54
54
|
...e,
|
|
55
55
|
...t
|
|
56
|
-
}
|
|
56
|
+
};
|
|
57
|
+
const a = t?.pageNum, o = n.value === !1 ? void 0 : n.value.currentPage;
|
|
58
|
+
a != null && a !== o && D(a), A(c);
|
|
57
59
|
}
|
|
58
|
-
return
|
|
60
|
+
return Z(
|
|
59
61
|
() => s.immediate,
|
|
60
62
|
(e) => {
|
|
61
|
-
e && !s.queryItems.length &&
|
|
63
|
+
e && !s.queryItems.length && l();
|
|
62
64
|
},
|
|
63
65
|
{ immediate: !0, once: !0 }
|
|
64
66
|
), B({
|
|
65
67
|
/** 原地重查:用最近一次入参重新请求,保持当前页码(区别于 `search()` 会回到第 1 页) */
|
|
66
|
-
refresh:
|
|
68
|
+
refresh: I,
|
|
67
69
|
/** 最近一次请求的入参(`{ pageNum, pageSize, ...查询表单 }`) */
|
|
68
|
-
params:
|
|
70
|
+
params: j,
|
|
69
71
|
/** 内部 ZlSearch 实例,`params` / `search()` / `reset()` 等可直接调用 */
|
|
70
72
|
search: new Proxy(
|
|
71
73
|
{},
|
|
72
74
|
{
|
|
73
75
|
get(e, t) {
|
|
74
|
-
return !
|
|
76
|
+
return !i.value && t === "search" ? l : i.value?.[t];
|
|
75
77
|
},
|
|
76
78
|
has(e, t) {
|
|
77
|
-
return t in (
|
|
79
|
+
return t in (i.value ?? {});
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
),
|
|
@@ -83,24 +85,24 @@ const U = { class: "zl-search-table" }, R = "search-", ne = /* @__PURE__ */ D({
|
|
|
83
85
|
{},
|
|
84
86
|
{
|
|
85
87
|
get(e, t) {
|
|
86
|
-
return
|
|
88
|
+
return u.value?.[t];
|
|
87
89
|
},
|
|
88
90
|
has(e, t) {
|
|
89
|
-
return t in (
|
|
91
|
+
return t in (u.value ?? {});
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
94
|
)
|
|
93
|
-
}), (e, t) => (y(),
|
|
94
|
-
r.queryItems.length || e.$slots.searchActions || e.$slots["search-actions"] ? (y(),
|
|
95
|
+
}), (e, t) => (y(), _("div", X, [
|
|
96
|
+
r.queryItems.length || e.$slots.searchActions || e.$slots["search-actions"] ? (y(), x(M, {
|
|
95
97
|
key: 0,
|
|
96
98
|
ref_key: "searchRef",
|
|
97
|
-
ref:
|
|
99
|
+
ref: i,
|
|
98
100
|
items: r.queryItems,
|
|
99
101
|
immediate: r.immediate,
|
|
100
102
|
"hide-empty-label": r.hideEmptyLabel,
|
|
101
|
-
onSearch:
|
|
103
|
+
onSearch: l,
|
|
102
104
|
onReset: t[0] || (t[0] = (a) => z("search-reset"))
|
|
103
|
-
},
|
|
105
|
+
}, P({ _: 2 }, [
|
|
104
106
|
e.$slots.searchActions || e.$slots["search-actions"] ? {
|
|
105
107
|
name: "actions",
|
|
106
108
|
fn: f(() => [
|
|
@@ -108,28 +110,28 @@ const U = { class: "zl-search-table" }, R = "search-", ne = /* @__PURE__ */ D({
|
|
|
108
110
|
]),
|
|
109
111
|
key: "0"
|
|
110
112
|
} : void 0,
|
|
111
|
-
|
|
113
|
+
q(g.value.search, (a) => ({
|
|
112
114
|
name: a.subSlot,
|
|
113
|
-
fn: f((
|
|
114
|
-
d(e.$slots, a.slot, $(
|
|
115
|
+
fn: f((o) => [
|
|
116
|
+
d(e.$slots, a.slot, S($(o)))
|
|
115
117
|
])
|
|
116
118
|
}))
|
|
117
|
-
]), 1032, ["items", "immediate", "hide-empty-label"])) :
|
|
118
|
-
|
|
119
|
+
]), 1032, ["items", "immediate", "hide-empty-label"])) : F("", !0),
|
|
120
|
+
G(Q, H({
|
|
119
121
|
ref_key: "tableRef",
|
|
120
|
-
ref:
|
|
122
|
+
ref: u,
|
|
121
123
|
class: "zl-search-table__table",
|
|
122
124
|
columns: r.columns,
|
|
123
125
|
data: h(O),
|
|
124
|
-
pagination: h(
|
|
125
|
-
loading: h(
|
|
126
|
+
pagination: h(n),
|
|
127
|
+
loading: h(N)
|
|
126
128
|
}, e.$attrs, {
|
|
127
|
-
onPaginationChange: t[1] || (t[1] = (a) =>
|
|
128
|
-
}),
|
|
129
|
-
|
|
129
|
+
onPaginationChange: t[1] || (t[1] = (a) => l(void 0, a))
|
|
130
|
+
}), P({ _: 2 }, [
|
|
131
|
+
q(g.value.table, (a) => ({
|
|
130
132
|
name: a,
|
|
131
|
-
fn: f((
|
|
132
|
-
d(e.$slots, a, $(
|
|
133
|
+
fn: f((o) => [
|
|
134
|
+
d(e.$slots, a, S($(o)))
|
|
133
135
|
])
|
|
134
136
|
}))
|
|
135
137
|
]), 1040, ["columns", "data", "pagination", "loading"])
|
|
@@ -137,6 +139,6 @@ const U = { class: "zl-search-table" }, R = "search-", ne = /* @__PURE__ */ D({
|
|
|
137
139
|
}
|
|
138
140
|
});
|
|
139
141
|
export {
|
|
140
|
-
|
|
142
|
+
oe as default
|
|
141
143
|
};
|
|
142
144
|
//# sourceMappingURL=index.vue.mjs.map
|
|
@@ -25,5 +25,6 @@ export declare function useTablePagination(options: {
|
|
|
25
25
|
data: Ref<any[], any[]>;
|
|
26
26
|
onPageSizeChange: (pageSize: number) => void;
|
|
27
27
|
onPageChange: (pageNum: number) => void;
|
|
28
|
+
setCurrentPage: (pageNum: number) => void;
|
|
28
29
|
};
|
|
29
30
|
//# sourceMappingURL=useTablePagination.d.ts.map
|
|
@@ -1,35 +1,49 @@
|
|
|
1
|
-
import { isArray as
|
|
2
|
-
import { ref as
|
|
3
|
-
import { usePagination as
|
|
4
|
-
function
|
|
5
|
-
const { data:
|
|
6
|
-
() =>
|
|
7
|
-
),
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { isArray as z, isPlainObject as b } from "@zl-ui-kit/utils";
|
|
2
|
+
import { ref as c, computed as S, watch as g } from "vue";
|
|
3
|
+
import { usePagination as j } from "../ZlPagination/usePagination.mjs";
|
|
4
|
+
function _(s) {
|
|
5
|
+
const { data: f, pagination: l, dataKey: p, emit: t } = s, a = j(
|
|
6
|
+
() => l.value === void 0 ? {} : l.value
|
|
7
|
+
), o = c([]), n = c({}), u = S(() => a.value ? Object.assign({}, a.value, n.value) : !1);
|
|
8
|
+
g(
|
|
9
|
+
f,
|
|
10
10
|
(e) => {
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
else if (
|
|
14
|
-
|
|
15
|
-
const { pageNum:
|
|
16
|
-
|
|
17
|
-
Object.entries({ currentPage:
|
|
11
|
+
if (z(e))
|
|
12
|
+
o.value = e;
|
|
13
|
+
else if (b(e)) {
|
|
14
|
+
o.value = e[p] ?? [];
|
|
15
|
+
const { pageNum: r, pageSize: P, total: d } = e;
|
|
16
|
+
n.value = Object.fromEntries(
|
|
17
|
+
Object.entries({ currentPage: r, pageSize: P, total: d }).filter(([, h]) => h != null)
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
{ immediate: !0 }
|
|
22
22
|
);
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
n("pagination-change", { pageNum: e, pageSize: o }), n("page-change", e), a.value.currentPage = e;
|
|
23
|
+
function i(e) {
|
|
24
|
+
n.value.currentPage = e;
|
|
26
25
|
}
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
g(
|
|
27
|
+
() => a.value === !1 ? void 0 : a.value.currentPage,
|
|
28
|
+
(e) => {
|
|
29
|
+
e != null && i(e);
|
|
30
|
+
}
|
|
31
|
+
), g(
|
|
32
|
+
() => a.value === !1 ? void 0 : a.value.pageSize,
|
|
33
|
+
(e) => {
|
|
34
|
+
e != null && (n.value.pageSize = e);
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
function v(e) {
|
|
38
|
+
const r = (u.value === !1 ? 30 : u.value.pageSize) ?? 30;
|
|
39
|
+
t("pagination-change", { pageNum: e, pageSize: r }), t("page-change", e), i(e);
|
|
40
|
+
}
|
|
41
|
+
function m(e) {
|
|
42
|
+
t("pagination-change", { pageNum: 1, pageSize: e }), t("page-size-change", e), i(1), n.value.pageSize = e;
|
|
29
43
|
}
|
|
30
|
-
return { pagination:
|
|
44
|
+
return { pagination: u, data: o, onPageSizeChange: m, onPageChange: v, setCurrentPage: i };
|
|
31
45
|
}
|
|
32
46
|
export {
|
|
33
|
-
|
|
47
|
+
_ as useTablePagination
|
|
34
48
|
};
|
|
35
49
|
//# sourceMappingURL=useTablePagination.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zl-ui-kit/components",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "ZL UI 业务组件库(Element Plus 体系,Zl 前缀)——首批:Icon/AutoTooltip/Tag/CornerTag/Text/Title/Copy/Empty/Pagination/DictTag",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"file-type": "^20.4.1",
|
|
40
40
|
"dt-sql-parser": "^4.3.1",
|
|
41
41
|
"sql-formatter": "^15.4.2",
|
|
42
|
-
"@zl-ui-kit/composables": "0.20.
|
|
43
|
-
"@zl-ui-kit/icons": "0.20.
|
|
44
|
-
"@zl-ui-kit/utils": "0.20.
|
|
42
|
+
"@zl-ui-kit/composables": "0.20.2",
|
|
43
|
+
"@zl-ui-kit/icons": "0.20.2",
|
|
44
|
+
"@zl-ui-kit/utils": "0.20.2"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@vueuse/core": "^12.3.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",
|
|
48
|
-
"element-plus": "^2.9.
|
|
48
|
+
"element-plus": "^2.9.9",
|
|
49
49
|
"vue": "^3.5.13",
|
|
50
50
|
"monaco-editor": "^0.41.0",
|
|
51
51
|
"@vue-office/docx": "^1.6.3",
|
|
@@ -81,12 +81,13 @@
|
|
|
81
81
|
"@vitejs/plugin-vue": "^5.2.1",
|
|
82
82
|
"@vueuse/core": "^12.3.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",
|
|
83
83
|
"cross-env": "^7.0.3",
|
|
84
|
-
"element-plus": "^2.9.
|
|
84
|
+
"element-plus": "^2.9.9",
|
|
85
85
|
"eslint-plugin-vue": "^9.32.0",
|
|
86
86
|
"typescript": "^5.7.3",
|
|
87
87
|
"vite": "^6.0.7",
|
|
88
88
|
"vite-plugin-dts": "^4.5.0",
|
|
89
89
|
"vite-plugin-lib-inject-css": "^2.2.1",
|
|
90
|
+
"vitest": "^2.1.8",
|
|
90
91
|
"vue": "^3.5.13",
|
|
91
92
|
"vue-tsc": "^2.2.0",
|
|
92
93
|
"monaco-editor": "^0.41.0",
|
|
@@ -98,9 +99,9 @@
|
|
|
98
99
|
"@vue-office/pdf": "^2.0.10",
|
|
99
100
|
"@vue-office/pptx": "1.0.1",
|
|
100
101
|
"echarts": "^5.6.0",
|
|
101
|
-
"@zl-ui-kit/theme": "0.20.0",
|
|
102
|
-
"@jichuang/eslint-config": "1.0.0",
|
|
103
102
|
"@jichuang/vite-config": "1.0.0",
|
|
103
|
+
"@jichuang/eslint-config": "1.0.0",
|
|
104
|
+
"@zl-ui-kit/theme": "0.20.2",
|
|
104
105
|
"@jichuang/tsconfig": "1.0.0"
|
|
105
106
|
},
|
|
106
107
|
"repository": {
|
|
@@ -122,6 +123,7 @@
|
|
|
122
123
|
"build": "vite build",
|
|
123
124
|
"dev": "vite build --watch",
|
|
124
125
|
"typecheck": "vue-tsc --noEmit",
|
|
125
|
-
"lint": "cross-env ESLINT_USE_FLAT_CONFIG=false eslint src --ext .ts"
|
|
126
|
+
"lint": "cross-env ESLINT_USE_FLAT_CONFIG=false eslint src --ext .ts",
|
|
127
|
+
"test:unit": "vitest run"
|
|
126
128
|
}
|
|
127
129
|
}
|